Nano Blocks API

Block creation, processing, signing, and querying operations

OpenAPI Specification

nano-blocks-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Nano RPC Accounts Blocks 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: Blocks
  description: Block creation, processing, signing, and querying operations
paths:
  /block_account:
    post:
      operationId: block_account
      summary: Get account for block
      description: Returns the account that owns the given block hash.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - block_account
                hash:
                  type: string
      responses:
        '200':
          description: Account for the block
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    type: string
  /block_confirm:
    post:
      operationId: block_confirm
      summary: Request block confirmation
      description: Requests active confirmation of a block by the network.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - block_confirm
                hash:
                  type: string
      responses:
        '200':
          description: Confirmation started
          content:
            application/json:
              schema:
                type: object
                properties:
                  started:
                    type: string
  /block_count:
    post:
      operationId: block_count
      summary: Get total block count
      description: Returns the total number of blocks in the ledger.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              properties:
                action:
                  type: string
                  enum:
                  - block_count
                include_cemented:
                  type: boolean
      responses:
        '200':
          description: Block counts
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: string
                  unchecked:
                    type: string
                  cemented:
                    type: string
  /block_create:
    post:
      operationId: block_create
      summary: Create a block
      description: Creates a new state block for the Nano network.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - json_block
              - type
              - balance
              - representative
              - link
              - previous
              properties:
                action:
                  type: string
                  enum:
                  - block_create
                json_block:
                  type: string
                type:
                  type: string
                  enum:
                  - state
                balance:
                  type: string
                key:
                  type: string
                wallet:
                  type: string
                account:
                  type: string
                representative:
                  type: string
                link:
                  type: string
                previous:
                  type: string
                work:
                  type: string
                version:
                  type: string
                difficulty:
                  type: string
      responses:
        '200':
          description: Created block
          content:
            application/json:
              schema:
                type: object
                properties:
                  hash:
                    type: string
                  block:
                    type: object
                  difficulty:
                    type: string
  /block_hash:
    post:
      operationId: block_hash
      summary: Compute block hash
      description: Returns the hash of a given block without publishing it.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - json_block
              - block
              properties:
                action:
                  type: string
                  enum:
                  - block_hash
                json_block:
                  type: string
                block:
                  type: object
      responses:
        '200':
          description: Block hash
          content:
            application/json:
              schema:
                type: object
                properties:
                  hash:
                    type: string
  /block_info:
    post:
      operationId: block_info
      summary: Get block info
      description: Returns detailed information about a specific block hash.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              - json_block
              properties:
                action:
                  type: string
                  enum:
                  - block_info
                hash:
                  type: string
                json_block:
                  type: string
                include_linked_account:
                  type: boolean
      responses:
        '200':
          description: Block information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockInfoResponse'
  /blocks:
    post:
      operationId: blocks
      summary: Get multiple blocks
      description: Returns block contents for a list of block hashes.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hashes
              - json_block
              properties:
                action:
                  type: string
                  enum:
                  - blocks
                hashes:
                  type: array
                  items:
                    type: string
                json_block:
                  type: string
      responses:
        '200':
          description: Block contents
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: object
                    additionalProperties:
                      type: object
  /blocks_info:
    post:
      operationId: blocks_info
      summary: Get detailed info for multiple blocks
      description: Returns detailed information for a list of block hashes.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hashes
              - json_block
              properties:
                action:
                  type: string
                  enum:
                  - blocks_info
                hashes:
                  type: array
                  items:
                    type: string
                json_block:
                  type: string
                pending:
                  type: boolean
                source:
                  type: boolean
                receive_hash:
                  type: boolean
                include_not_found:
                  type: boolean
                include_linked_account:
                  type: boolean
      responses:
        '200':
          description: Block details
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: object
                    additionalProperties:
                      $ref: '#/components/schemas/BlockInfoResponse'
                  blocks_not_found:
                    type: array
                    items:
                      type: string
  /chain:
    post:
      operationId: chain
      summary: Get chain of blocks
      description: Returns a list of block hashes starting from the given block, traversing backwards.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - block
              - count
              properties:
                action:
                  type: string
                  enum:
                  - chain
                block:
                  type: string
                count:
                  type: integer
                offset:
                  type: integer
                reverse:
                  type: boolean
      responses:
        '200':
          description: Chain of block hashes
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: array
                    items:
                      type: string
  /process:
    post:
      operationId: process
      summary: Process a block
      description: Publishes a signed block to the Nano network.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - block
              - json_block
              - subtype
              properties:
                action:
                  type: string
                  enum:
                  - process
                block:
                  oneOf:
                  - type: object
                  - type: string
                json_block:
                  type: string
                subtype:
                  type: string
                  enum:
                  - send
                  - receive
                  - open
                  - change
                  - epoch
                force:
                  type: boolean
                async:
                  type: boolean
      responses:
        '200':
          description: Block hash after processing
          content:
            application/json:
              schema:
                type: object
                properties:
                  hash:
                    type: string
  /republish:
    post:
      operationId: republish
      summary: Republish blocks
      description: Rebroadcasts blocks starting from the given hash to network peers.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - hash
              properties:
                action:
                  type: string
                  enum:
                  - republish
                hash:
                  type: string
                count:
                  type: integer
      responses:
        '200':
          description: Republished block hashes
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: array
                    items:
                      type: string
  /sign:
    post:
      operationId: sign
      summary: Sign a block
      description: Signs a block with a provided private key or wallet.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - json_block
              - block
              properties:
                action:
                  type: string
                  enum:
                  - sign
                json_block:
                  type: string
                block:
                  type: object
                key:
                  type: string
                wallet:
                  type: string
                account:
                  type: string
      responses:
        '200':
          description: Signed block
          content:
            application/json:
              schema:
                type: object
                properties:
                  signature:
                    type: string
                  block:
                    type: object
  /successors:
    post:
      operationId: successors
      summary: Get successor blocks
      description: Returns successive block hashes forward from the given block.
      tags:
      - Blocks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - action
              - block
              - count
              properties:
                action:
                  type: string
                  enum:
                  - successors
                block:
                  type: string
                count:
                  type: integer
      responses:
        '200':
          description: Successor block hashes
          content:
            application/json:
              schema:
                type: object
                properties:
                  blocks:
                    type: array
                    items:
                      type: string
components:
  schemas:
    BlockInfoResponse:
      type: object
      properties:
        block_account:
          type: string
        amount:
          type: string
        balance:
          type: string
        height:
          type: string
        local_timestamp:
          type: string
        confirmed:
          type: string
        contents:
          type: object
          properties:
            type:
              type: string
            account:
              type: string
            previous:
              type: string
            representative:
              type: string
            balance:
              type: string
            link:
              type: string
            link_as_account:
              type: string
            signature:
              type: string
            work:
              type: string
        subtype:
          type: string
          enum:
          - send
          - receive
          - open
          - change
          - epoch
externalDocs:
  description: Nano RPC Protocol Documentation
  url: https://docs.nano.org/commands/rpc-protocol/