Tendermint Tx API

Transactions broadcast APIs

OpenAPI Specification

tendermint-tx-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Tendermint RPC ABCI Tx API
  contact:
    name: Tendermint RPC
    url: https://github.com/tendermint/tendermint/issues/new/choose
  description: "Tendermint supports the following RPC protocols:\n\n* URI over HTTP\n* JSONRPC over HTTP\n* JSONRPC over websockets\n\n## Configuration\n\nRPC can be configured by tuning parameters under `[rpc]` table in the\n`$TMHOME/config/config.toml` file or by using the `--rpc.X` command-line\nflags.\n\nDefault rpc listen address is `tcp://0.0.0.0:26657`.\nTo set another address, set the `laddr` config parameter to desired value.\nCORS (Cross-Origin Resource Sharing) can be enabled by setting\n`cors_allowed_origins`, `cors_allowed_methods`, `cors_allowed_headers`\nconfig parameters.\n\n## Arguments\n\nArguments which expect strings or byte arrays may be passed as quoted\nstrings, like `\"abc\"` or as `0x`-prefixed strings, like `0x616263`.\n\n## URI/HTTP\n\nA REST like interface.\n\n    curl localhost:26657/block?height=5\n\n## JSONRPC/HTTP\n\nJSONRPC requests can be POST'd to the root RPC endpoint via HTTP.\n\n    curl --header \"Content-Type: application/json\" --request POST --data '{\"method\": \"block\", \"params\": [\"5\"], \"id\": 1}' localhost:26657\n\n## JSONRPC/websockets\n\nJSONRPC requests can be also made via websocket.\nThe websocket endpoint is at `/websocket`, e.g. `localhost:26657/websocket`.\nAsynchronous RPC functions like event `subscribe` and `unsubscribe` are\nonly available via websockets.\n\nExample using https://github.com/hashrocket/ws:\n\n    ws ws://localhost:26657/websocket\n    > { \"jsonrpc\": \"2.0\", \"method\": \"subscribe\", \"params\": [\"tm.event='NewBlock'\"], \"id\": 1 }\n"
  version: v0.34
  license:
    name: Apache 2.0
    url: https://github.com/tendermint/tendermint/blob/main/LICENSE
servers:
- url: https://rpc.cosmos.network
  description: Cosmos mainnet node to interact with the Tendermint RPC
- url: http://localhost:26657
  description: Interact with the Tendermint RPC locally on your device
tags:
- name: Tx
  description: Transactions broadcast APIs
paths:
  /broadcast_tx_sync:
    get:
      summary: Returns with the response from CheckTx. Does not wait for DeliverTx result.
      tags:
      - Tx
      operationId: broadcast_tx_sync
      description: 'If you want to be sure that the transaction is included in a block, you can

        subscribe for the result using JSONRPC via a websocket. See

        https://docs.tendermint.com/v0.34/app-dev/subscribing-to-events-via-websocket.html

        If you haven''t received anything after a couple of blocks, resend it. If the

        same happens again, send it to some other node. A few reasons why it could

        happen:


        1. malicious node can drop or pretend it had committed your tx

        2. malicious proposer (not necessary the one you''re communicating with) can

        drop transactions, which might become valid in the future

        (https://github.com/tendermint/tendermint/issues/3322)



        Please refer to

        https://docs.tendermint.com/v0.34/tendermint-core/using-tendermint.html#formatting

        for formatting/encoding rules.

        '
      parameters:
      - in: query
        name: tx
        required: true
        schema:
          type: string
        example: '456'
        description: The transaction
      responses:
        '200':
          description: Empty
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastTxResponse'
        '500':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /broadcast_tx_async:
    get:
      summary: Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.
      tags:
      - Tx
      operationId: broadcast_tx_async
      description: 'If you want to be sure that the transaction is included in a block, you can

        subscribe for the result using JSONRPC via a websocket. See

        https://docs.tendermint.com/v0.34/app-dev/subscribing-to-events-via-websocket.html

        If you haven''t received anything after a couple of blocks, resend it. If the

        same happens again, send it to some other node. A few reasons why it could

        happen:


        1. malicious node can drop or pretend it had committed your tx

        2. malicious proposer (not necessary the one you''re communicating with) can

        drop transactions, which might become valid in the future

        (https://github.com/tendermint/tendermint/issues/3322)

        3. node can be offline


        Please refer to

        https://docs.tendermint.com/v0.34/tendermint-core/using-tendermint.html#formatting

        for formatting/encoding rules.

        '
      parameters:
      - in: query
        name: tx
        required: true
        schema:
          type: string
          example: '123'
        description: The transaction
      responses:
        '200':
          description: empty answer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastTxResponse'
        '500':
          description: empty error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /broadcast_tx_commit:
    get:
      summary: Returns with the responses from CheckTx and DeliverTx.
      tags:
      - Tx
      operationId: broadcast_tx_commit
      description: 'IMPORTANT: use only for testing and development. In production, use

        BroadcastTxSync or BroadcastTxAsync. You can subscribe for the transaction

        result using JSONRPC via a websocket. See

        https://docs.tendermint.com/v0.34/app-dev/subscribing-to-events-via-websocket.html


        CONTRACT: only returns error if mempool.CheckTx() errs or if we timeout

        waiting for tx to commit.


        If CheckTx or DeliverTx fail, no error will be returned, but the returned result

        will contain a non-OK ABCI code.


        Please refer to

        https://docs.tendermint.com/v0.34/tendermint-core/using-tendermint.html#formatting

        for formatting/encoding rules.

        '
      parameters:
      - in: query
        name: tx
        required: true
        schema:
          type: string
          example: '785'
        description: The transaction
      responses:
        '200':
          description: empty answer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BroadcastTxCommitResponse'
        '500':
          description: empty error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /check_tx:
    get:
      summary: Checks the transaction without executing it.
      tags:
      - Tx
      operationId: check_tx
      description: 'The transaction won''t be added to the mempool.


        Please refer to

        https://docs.tendermint.com/v0.34/tendermint-core/using-tendermint.html#formatting

        for formatting/encoding rules.


        Upon success, the `Cache-Control` header will be set with the default

        maximum age.

        '
      parameters:
      - in: query
        name: tx
        required: true
        schema:
          type: string
          example: '785'
        description: The transaction
      responses:
        '200':
          description: ABCI application's CheckTx response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckTxResponse'
        '500':
          description: empty error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      description: Error Response
      allOf:
      - $ref: '#/components/schemas/JSONRPC'
      - type: object
        properties:
          error:
            type: string
            example: Description of failure
    BroadcastTxCommitResponse:
      type: object
      required:
      - error
      - result
      - id
      - jsonrpc
      properties:
        error:
          type: string
          example: ''
        result:
          required:
          - height
          - hash
          - deliver_tx
          - check_tx
          properties:
            height:
              type: string
              example: '26682'
            hash:
              type: string
              example: 75CA0F856A4DA078FC4911580360E70CEFB2EBEE
            deliver_tx:
              required:
              - log
              - data
              - code
              properties:
                log:
                  type: string
                  example: ''
                data:
                  type: string
                  example: ''
                code:
                  type: string
                  example: '0'
              type: object
            check_tx:
              required:
              - log
              - data
              - code
              properties:
                log:
                  type: string
                  example: ''
                data:
                  type: string
                  example: ''
                code:
                  type: string
                  example: '0'
              type: object
          type: object
        id:
          type: integer
          example: 0
        jsonrpc:
          type: string
          example: '2.0'
    Event:
      type: object
      properties:
        key:
          type: string
          example: YWN0aW9u
        value:
          type: string
          example: c2VuZA==
        index:
          type: boolean
          example: false
    JSONRPC:
      type: object
      properties:
        id:
          type: integer
          example: 0
        jsonrpc:
          type: string
          example: '2.0'
    CheckTxResponse:
      type: object
      required:
      - error
      - result
      - id
      - jsonrpc
      properties:
        error:
          type: string
          example: ''
        result:
          required:
          - log
          - data
          - code
          properties:
            code:
              type: string
              example: '0'
            data:
              type: string
              example: ''
            log:
              type: string
              example: ''
            info:
              type: string
              example: ''
            gas_wanted:
              type: string
              example: '1'
            gas_used:
              type: string
              example: '0'
            events:
              type: array
              nullable: true
              items:
                type: object
                properties:
                  type:
                    type: string
                    example: app
                  attributes:
                    type: array
                    nullable: false
                    items:
                      $ref: '#/components/schemas/Event'
            codespace:
              type: string
              example: bank
          type: object
        id:
          type: integer
          example: 0
        jsonrpc:
          type: string
          example: '2.0'
    BroadcastTxResponse:
      type: object
      required:
      - jsonrpc
      - id
      - result
      - error
      properties:
        jsonrpc:
          type: string
          example: '2.0'
        id:
          type: integer
          example: 0
        result:
          required:
          - code
          - data
          - log
          - hash
          properties:
            code:
              type: string
              example: '0'
            data:
              type: string
              example: ''
            log:
              type: string
              example: ''
            codespace:
              type: string
              example: ibc
            hash:
              type: string
              example: 0D33F2F03A5234F38706E43004489E061AC40A2E
          type: object
        error:
          type: string
          example: ''