Tendermint RPC
v1.0.0https://atom-tendermint.nownodes.ioAuthentication
api-keyAuthapiKeyAPI Key: api-key in header
Tendermint
Tendermint
Returns with the response from CheckTx. Does not wait for DeliverTx result.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
This method blocks until CheckTx returns and reports its result, but does not wait for the transaction to be included in a block. To know when the transaction is included in a block, check for the transaction event using JSON-RPC.
Parameters
txstringrequiredqueryThe transaction
Response
Empty
Error
Returns with the response from CheckTx. Does not wait for DeliverTx result.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
This method blocks until CheckTx returns and reports its result, but does not wait for the transaction to be included in a block. To know when the transaction is included in a block, check for the transaction event using JSON-RPC.
Parameters
txstringrequiredqueryThe transaction
Response
Empty
Error
Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
This method submits the transaction and returns immediately without waiting for the transaction to be checked (CheckTx) or committed. Too know when the transaction is included in a block, you can check for the transaction event using JSON-RPC.
Parameters
txstringrequiredqueryThe transaction
Response
empty answer
empty error
Returns with the responses from CheckTx and DeliverTx.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
This method waits for the transaction to be checked (CheckTx) and makes a best effort to wait for it to be committed into a block before returning. It will report an error if the request times out before the transaction commits. If CheckTx or DeliverTx fails, the RPC will succeed and report the failing (non-zero) ABCI result code.
WARNING: Use this only for testing and development. For production use, call broadcast_tx.
To know when a transaction is included in a block, check for the transaction event using JSON-RPC.
Parameters
txstringrequiredqueryThe transaction
Response
empty answer
empty error
Checks the transaction without executing it.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
The transaction won't be added to the mempool.
Please refer to https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting for formatting/encoding rules.
Parameters
txstringrequiredqueryThe transaction
Response
ABCI application's CheckTx response
empty error
Removes a transaction from the mempool.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Parameters
txKeystringrequiredqueryThe transaction key
Response
empty response.
empty error.
Fetch events posted by the consensus node.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Fetch a batch of events posted by the consensus node and matching a specified query string.
The query grammar is defined in pubsub/query/syntax. An empty query matches all events; otherwise a query comprises one or more terms comparing event metadata to target values. For example, to select new block events:
tm.event = 'NewBlock'Multiple terms can be combined with AND, for example to match the transaction event with a given hash, use:
tm.event = 'Tx' AND tx.hash = 'EA7B33F'The comparison operators include =, <, <=, >, >=, and
CONTAINS. Operands may be strings (in single quotes), numbers, dates,
or timestamps. In addition, the EXISTS operator allows you to check
for the presence of an attribute regardless of its value.
Tendermint defines a tm.event attribute for all events. Transactions
are also assigned tx.hash and tx.height attributes. Other attributes
are provided by the application as ABCI Event records. The name of the
event in the query is formed by combining the type and attribute key
with a period. For example, given:
[]abci.Event{{
Type: "reward",
Attributes: []abci.EventAttribute{
{Key: "address", Value: "cosmos1xyz012pdq"},
{Key: "amount", Value: "45.62"},
{Key: "balance", Value: "100.390001"},
},
}}the query may refer to the names"reward.address,"reward.amount, and
reward.balance, as in:
reward.address EXISTS AND reward.balance > 45The node maintains a log of all events within an operator-defined time
window. The /events method returns the most recent items from the log
that match the query. Each item returned includes a cursor that marks
its location in the log. Cursors can be passed via the before and
after parameters to fetch events earlier in the log.
Parameters
filterEventFilterquerymaxItemsintegerqueryafterstringquerybeforestringquerywaitTimeintegerqueryResponse
Reports a batch of matching events
Reports an error
Subscribe for events via WebSocket.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
To tell which events you want, you need to provide a query. query is a string, which has a form: "condition AND condition ..." (no OR at the moment). condition has a form: "key operation operand". key is a string with a restricted set of possible symbols ( \t\n\r\()"'=>< are not allowed). operation can be "=", "<", "<=", ">", ">=", "CONTAINS" AND "EXISTS". operand can be a string (escaped with single quotes), number, date or time.
Examples: tm.event = 'NewBlock' # new blocks tm.event = 'CompleteProposal' # node got a complete proposal tm.event = 'Tx' AND tx.hash = 'XYZ' # single transaction tm.event = 'Tx' AND tx.height = 5 # all txs of the fifth block tx.height = 5 # all txs of the fifth block
Tendermint provides a few predefined keys: tm.event, tx.hash and tx.height. Note for transactions, you can define additional keys by providing events with DeliverTx response.
import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/pubsub/query" )
abci.ResponseDeliverTx{ Events: []abci.Event{ { Type: "rewards.withdraw", Attributes: []abci.EventAttribute{ {Key: "address", Value: "AddrA", Index: true}, {Key: "source", Value: "SrcX", Index: true}, {Key: "amount", Value: "...", Index: true}, {Key: "balance", Value: "...", Index: true}, }, }, { Type: "rewards.withdraw", Attributes: []abci.EventAttribute{ {Key: "address", Value: "AddrB", Index: true}, {Key: "source", Value: "SrcY", Index: true}, {Key: "amount", Value: "...", Index: true}, {Key: "balance", Value: "...", Index: true}, }, }, { Type: "transfer", Attributes: []abci.EventAttribute{ {Key: "sender", Value: "AddrC", Index: true}, {Key: "recipient", Value: "AddrD", Index: true}, {Key: "amount", Value: "...", Index: true}, }, }, }, }
All events are indexed by a composite key of the form {eventType}.{evenAttrKey}. In the above examples, the following keys would be indexed:
- rewards.withdraw.address
- rewards.withdraw.source
- rewards.withdraw.amount
- rewards.withdraw.balance
- transfer.sender
- transfer.recipient
- transfer.amount
Multiple event types with duplicate keys are allowed and are meant to
categorize unique and distinct events. In the above example, all events
indexed under the key rewards.withdraw.address will have the following
values stored and queryable:
- AddrA
- AddrB
To create a query for txs where address AddrA withdrew rewards: query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrA'")
To create a query for txs where address AddrA withdrew rewards from source Y: query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrA' AND rewards.withdraw.source = 'Y'")
To create a query for txs where AddrA transferred funds: query.MustParse("tm.event = 'Tx' AND transfer.sender = 'AddrA'")
The following queries would return no results: query.MustParse("tm.event = 'Tx' AND transfer.sender = 'AddrZ'") query.MustParse("tm.event = 'Tx' AND rewards.withdraw.address = 'AddrZ'") query.MustParse("tm.event = 'Tx' AND rewards.withdraw.source = 'W'")
import rpchttp "github.com/tendermint/rpc/client/http"
import "github.com/tendermint/tendermint/types"
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err = client.Start()
if err != nil {
// handle error
}
defer client.Stop()
ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Second)
defer cancel()
query := "tm.event = 'Tx' AND tx.height = 3"
txs, err := client.Subscribe(ctx, "test-client", query)
if err != nil {
// handle error
}
go func() {
for e := range txs {
fmt.Println("got ", e.Data.(types.EventDataTx))
}
}()NOTE: if you're not reading events fast enough, Tendermint might terminate the subscription.
Parameters
querystringrequiredqueryquery is a string, which has a form: "condition AND condition ..." (no OR at the moment). condition has a form: "key operation operand". key is a string with a restricted set of possible symbols ( \t\n\r\()"'=>< are not allowed). operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a string (escaped with single quotes), number, date or time.
Response
empty answer
empty error
Unsubscribe from event on Websocket
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
client, err := rpchttp.New("tcp://0.0.0.0:26657", "/websocket")
if err != nil {
// handle error
}
err := client.Start()
if err != nil {
// handle error
}
defer client.Stop()
query := "tm.event = 'Tx' AND tx.height = 3"
err = client.Unsubscribe(context.Background(), "test-client", query)
if err != nil {
// handle error
}Parameters
querystringrequiredqueryquery is a string, which has a form: "condition AND condition ..." (no OR at the moment). condition has a form: "key operation operand". key is a string with a restricted set of possible symbols ( \t\n\r\()"'=>< are not allowed). operation can be "=", "<", "<=", ">", ">=", "CONTAINS". operand can be a string (escaped with single quotes), number, date or time.
Response
Answer
Error
Unsubscribe from all events via WebSocket
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Unsubscribe from all events via WebSocket
Response
empty answer
empty error
Node heartbeat
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get node health. Returns empty result (200 OK) on success, no response - in case of an error.
Response
Gets Node Health
empty error
Node Status
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get Tendermint status including node info, pubkey, latest block hash, app hash, block height, current max peer height, and time.
Response
Status of the node
empty error
Network information
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get network info.
Response
empty answer
empty error
Get block headers (max: 20) for minHeight <= height <= maxHeight.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get block headers 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
minHeightintegerqueryMinimum block height to return
maxHeightintegerqueryMaximum block height to return
Response
Block headers, returned in descending order (highest first).
Error
Get the header at a specified height
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Retrieve the block header corresponding to a specified height.
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch the latest height.
Response
Header information.
Error
Get header by hash
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Retrieve the block header corresponding to a block hash.
Parameters
hashstringrequiredqueryheader hash
Response
Header information.
Error
Get block at a specified height
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get Block.
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch the latest block.
Response
Block information.
Error
Get block by hash
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get Block By Hash.
Parameters
hashstringrequiredqueryblock hash
Response
Block information.
Error
Get block results at a specified height
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get block_results.
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch information regarding the latest block.
Response
Block results.
Error
Get commit results at a specified height
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get Commit.
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch commit information regarding the latest block.
Response
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.
Error
Get validator set at a specified height
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get Validators. Validators are sorted first by voting power (descending), then by address (ascending).
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch validator set which corresponds to the latest block.
pageinteger1queryPage number (1-based)
per_pageinteger30queryNumber of entries per page (max: 100)
Response
Commit results.
Error
Get Genesis
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get the genesis document.
Response
Genesis results.
Error
Get Genesis in paginated chunks
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get genesis document in a paginated/chunked format to make it easier to iterate through larger genesis structures.
Parameters
chunkIDinteger0querySequence number of the chunk to download.
Response
Genesis results.
Error
Get consensus state
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get consensus state.
Not safe to call from inside the ABCI application during a block execution.
Response
Complete consensus state.
Error
Get consensus state
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get consensus state.
Not safe to call from inside the ABCI application during a block execution.
Response
consensus state results.
Error
Get consensus parameters
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get consensus parameters.
Parameters
heightinteger0queryheight to return. If no height is provided, it will fetch commit information regarding the latest block.
Response
consensus parameters results.
Error
Get the list of unconfirmed transactions
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get list of unconfirmed transactions
Parameters
pageinteger1queryPage number (1-based)
per_pageinteger30queryNumber of entries per page (max: 100)
Response
List of unconfirmed transactions
Error
Get data about unconfirmed transactions
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get data about unconfirmed transactions
Response
status about unconfirmed transactions
Error
Search for transactions
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Search for transactions w/ their results.
See /subscribe for the query syntax.
Parameters
querystringrequiredqueryQuery
provebooleanfalsequeryInclude proofs of the transactions inclusion in the block
pageinteger1queryPage number (1-based)
per_pageinteger30queryNumber of entries per page (max: 100)
order_bystringdescqueryOrder in which transactions are sorted ("asc" or "desc"), by height & index. If empty, default sorting will be still applied.
Response
List of transactions
Error
Search for blocks by BeginBlock and EndBlock events
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Search for blocks by BeginBlock and EndBlock events.
See /subscribe for the query syntax.
Parameters
querystringrequiredqueryQuery
pageinteger1queryPage number (1-based)
per_pageinteger30queryNumber of entries per page (max: 100)
order_bystringdescqueryOrder in which blocks are sorted ("asc" or "desc"), by height. If empty, default sorting will be still applied.
Response
List of paginated blocks matching the search criteria.
Error
Get transactions by hash
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get a transaction
Parameters
hashstringrequiredquerytransaction Hash to retrive
provebooleanfalsequeryInclude proofs of the transactions inclusion in the block
Response
Get a transaction
Error
Get some info about the application.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Get some info about the application.
Response
Get some info about the application.
Error
Query the application for some information.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Query the application for some information.
Parameters
pathstringrequiredqueryPath to the data ("/a/b/c")
datastringrequiredqueryData
heightinteger0queryHeight (0 means latest)
provebooleanfalsequeryInclude proofs of the transactions inclusion in the block
Response
Response of the submitted query
Error
Broadcast evidence of the misbehavior.
Authorizations
ApiKeyAuthApiKeyAuthapi-key string
NOWNodes API key passed in the api-key header.
Broadcast evidence of the misbehavior.
Parameters
evidencestringrequiredqueryJSON evidence
Response
Broadcast evidence of the misbehavior.
Error