Tendermint-RPC API

Supported methods for Alchemy Crypto.org Tendermint RPC API.

Alchemy Tendermint API

Here you will find a list of all the methods Alchemy supports for Tendermint.

RPC Protocols

There are two RPC protocols that are supported for Alchemy Tendermint.

URI/HTTP

A REST like interface.

curl https://cro-croeseid.alchemyapi.io/your-api-key/tendermint/block?height=5

JSONRPC/HTTP

JSONRPC requests can be POST'd to the root RPC endpoint via HTTP.

curl --header "Content-Type: application/json" --request POST --data '{"method": "block", "params": ["5"], "id": 1}' https://cro-croeseid.alchemyapi.io/your-api-key/tendermint/

API Key

We've created an API key called your-api-key so you can easily copy and paste these sample requests above and below. However, you should replace your-api-key with your own API key when developing.

Arguments

Arguments which expect strings or byte arrays may be passed as quoted strings, like "abc" or as 0x- prefixed strings like 0x616263

Error Codes

Unlike direct Crypto.org nodes, Alchemy will return a 200response for every request served. This means even requests that resulted in an error will get back a 200 response and the corresponding error message. If the request was unable to be served by the nodes at all, users will receive a 500 response error code.

Information

Calls to get information related to the Node API.

health

Get node health.

Parameters

none

Returns

none

Example

Request

Result

Example requests below have not been updated. When making requests please use:

status

Get Tendermint status including node info, pubkey, latest block hash, app hash, block height and time.

Parameters

none

Returns

Status of the node

Example

Request

Result

blockchain

Get block headers (max: 20) for minHeight <= height <= maxHeight. If maxHeight does not yet exist, blocks up to the current height will be returned. If minHeight does not exist (due to pruning), earliest existing height will be used.

At most 20 items will be returned. Block headers are returned in descending order (highest first).

Parameters

  • minHeight - integer, minimum block height to return

  • maxHeight - integer, maximum block height to return

Returns

Block headers, returned in descending order (highest first).

Example

Request

Result

block

Get block at a specified height.

Parameters

  • height - integer, height to return. If no height is provided, it will fetch the latest block. Default value = 0

Returns

Network info.

Example

Request

Result

block_by_hash

Get block by hash.

Parameters

  • hash - string, block hash

Returns

Block information.

Example

Request

Result

block_results

Get block results at a specified height.

Parameters

  • height - integer, height to return. If no height is provided, it will fetch informations regarding the latest block. Default value = 0

Returns

Block results.

Example

Request

Result

commit

Get commit results at a specified height.

Parameters

  • height - integer, height to return. If no height is provided, it will fetch commit information regarding the latest block. Default value = 0

Returns

Commit results. Canonical switches from false to true for block H once block H+1 has been committed, until then it's subjective and only reflects what this node has seen so far

Example

Request

Result

validators

Get validator set at a specified height. Validators are sorted first by voting power (descending), then by address (ascending).

Parameters

  • height - integer, height to return. If no height is provided, it will fetch validator set which corresponds to the latest block. Default value = 0

  • page - integer, page number (1-based). Default value = 1

  • per_page - integer, number of entries per page (max: 100). Default value: 30

Returns

Commit results.

Example

Request

Result

genesis

Get genesis.

Parameters

none

Returns

Genesis results.

Example

Request

Result

unconfirmed_txs

Get the list of unconfirmed transactions.

Parameters

  • limit - integer, Maximum number of unconfirmed transactions to return (max 100). Default value 30

Returns

List of unconfirmed transactions.

Example

Request

Result

num_unconfirmed_txs

Get data about unconfirmed transactions.

Parameters

none

Returns

Status about unconfirmed transactions.

Example

Request

Result

Search for transactions with their results.

Parameters

  • query - string, required query.

  • prove - boolean, include proofs of the transactions inclusion in the block. Default value = false

  • page - integer, page number (1-based). Default value = 1

  • per_page - integer, number of entries per page (max: 100). Default value = 30.

  • order_by - string, Order in which transactions are sorted ("asc" or "desc"), by height & index. If empty, default sorting will be still applied. Default value = asc

Returns

List of unconfirmed transactions.

Example

Request

Result

tx

Get transactions by hash.

Parameters

  • hash - string, required transaction hash to retrieve

  • prove - boolean, include proofs of the transactions inclusion in the block. Default value = false

Returns

Transaction info.

Example

Request

Result

Transactions

Methods for broadcasting transactions.

broadcast_tx_sync

Returns with the response from check_tx, does not wait for DeliverTx result.

WebSocket Subscription

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. However, Alchemy does not currently support WebSocket subscriptions for crypto.org nodes.

You can view how to use websockets on the Tendermint docs. 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

Please refer to this page for formatting/encoding rules.

Parameters

  • tx - string, the transaction

Returns

none

Example

Request

Result

broadcast_tx_async

Returns right away, with no response, does not wait for check_tx nor DeliverTx result.

See hint above in broadcast_tx_sync, the same applies.

Parameters

  • tx - string, the transaction

Returns

none

Example

Request

Result

broadcast_tx_commit

Returns with the responses from CheckTX and DeliverTx.

IMPORTANT: use only for testing and development. In production, use broadcast_tx_sync or broadcast_tx_async.

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 the Tendermint documentation for formatting/encoding rules

Parameters

  • tx - string, required transaction

Returns

none

Example

Request

Result

check_tx

Checks the transaction without executing it. the transaction won't be added to the mempool. Please refer to the Tendermint documentation for formatting/encoding rules.

Parameters

  • tx - string, required transaction

Returns

ABCI application's CheckTx response.

Example

Request

Result

ABCI

abci_info

Get some info about the application.

Parameters

none

Returns

Information about the application.

Example

Request

Result

abci_query

Query the application for some information.

Parameters

  • path - string, required path to the data ("a/b/c"

  • data - string, data

  • height - integer, Hieght. Default value = 0 (latest)

  • prove - boolean, include proofs of the transactions inclusion in the block. Default value = false.

Returns

Response of the submitted query.

Example

Request

Result

Last updated

Was this helpful?