Nano Work API

Proof-of-work generation, validation, and caching

OpenAPI Specification

nano-work-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Nano RPC Accounts Work API
  description: 'The Nano RPC API is a JSON-RPC HTTP interface for interacting with the Nano network. Nano is a feeless, instant digital currency using a block-lattice architecture where each account maintains its own blockchain. The RPC API supports account queries, block operations, wallet management, node diagnostics, and unit conversions. All requests are POST with a JSON body containing an "action" field identifying the RPC command.

    '
  version: 1.0.0
  contact:
    name: Nano Foundation
    url: https://nano.org/en/developers
    email: integrations@nano.org
  license:
    name: BSD-2-Clause
    url: https://opensource.org/licenses/BSD-2-Clause
  termsOfService: https://nano.org/terms-of-use
servers:
- url: http://localhost:7076
  description: Local Nano node (default RPC port)
tags:
- name: Work
  description: Proof-of-work generation, validation, and caching
paths:
  /work_cancel:
    post:
      operationId: work_cancel
      summary: Cancel work generation
      description: Cancels pending work generation for a given hash.
      tags:
      - Work
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - work_cancel
                hash:
                  type: string
      responses:
        '200':
          description: Cancellation acknowledged
          content:
            application/json:
              schema:
                type: object
  /work_generate:
    post:
      operationId: work_generate
      summary: Generate proof-of-work
      description: Generates proof-of-work for a given block hash.
      tags:
      - Work
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - work_generate
                hash:
                  type: string
                difficulty:
                  type: string
                multiplier:
                  type: string
                account:
                  type: string
      responses:
        '200':
          description: Generated work value
          content:
            application/json:
              schema:
                type: object
                properties:
                  work:
                    type: string
                  difficulty:
                    type: string
                  multiplier:
                    type: string
  /work_validate:
    post:
      operationId: work_validate
      summary: Validate proof-of-work
      description: Validates that a given work value satisfies difficulty for a hash.
      tags:
      - Work
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - work
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - work_validate
                work:
                  type: string
                hash:
                  type: string
                difficulty:
                  type: string
                multiplier:
                  type: string
      responses:
        '200':
          description: Work validation result
          content:
            application/json:
              schema:
                type: object
                properties:
                  valid:
                    type: boolean
                  difficulty:
                    type: string
                  multiplier:
                    type: string
  /work_get:
    post:
      operationId: work_get
      summary: Get cached work for account
      description: Returns the cached proof-of-work value for the account in a wallet.
      tags:
      - Work
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - wallet
              - account
              properties:
                action:
                  type: string
                  enum:
                  - work_get
                wallet:
                  type: string
                account:
                  type: string
      responses:
        '200':
          description: Cached work value
          content:
            application/json:
              schema:
                type: object
                properties:
                  work:
                    type: string
  /work_set:
    post:
      operationId: work_set
      summary: Set cached work for account
      description: Stores a proof-of-work value in cache for an account.
      tags:
      - Work
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - wallet
              - account
              - work
              properties:
                action:
                  type: string
                  enum:
                  - work_set
                wallet:
                  type: string
                account:
                  type: string
                work:
                  type: string
      responses:
        '200':
          description: Work set result
          content:
            application/json:
              schema:
                type: object
externalDocs:
  description: Nano RPC Protocol Documentation
  url: https://docs.nano.org/commands/rpc-protocol/