跨链Cosmos(13) Tendermint RPC

Posted thefist11

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了跨链Cosmos(13) Tendermint RPC相关的知识,希望对你有一定的参考价值。

1. 3 RPC protocols:

  • URI over HTTP *
  • JSONRPC over HTTP *
  • JSONRPC over websockets

eg.

curl localhost:26657/block?height=5
curl --header "Content-Type: application/json" --request POST --data '{"method": "block", "params": ["5"], "id": 1}' localhost:26657
ws ws://localhost:26657/websocket
> { "jsonrpc": "2.0", "method": "subscribe", "params": ["tm.event='NewBlock'"], "id": 1 }

2. API

  • subscribe
GET/subscribe
Subscribe for events via WebSocket.


GET/unsubscribe
Unsubscribe from event on Websocket


GET/unsubscribe_all
Unsubscribe from all events via WebSocket
  • Informations about the node APIs
GET/health
Node heartbeat

GET/status
Node Status

GET/net_info
Network informations

GET/blockchain
Get block headers (max: 20) for minHeight <= height <= maxHeight.

GET/block
Get block at a specified height

GET/block_by_hash
Get block by hash

GET/block_results
Get block results at a specified height

GET/commit
Get commit results at a specified height

GET/validators
Get validator set at a specified height

GET/genesis
Get Genesis

GET/dump_consensus_state
Get consensus state

GET/consensus_state
Get consensus state

GET/consensus_params
Get consensus parameters

GET/unconfirmed_txs
Get the list of unconfirmed transactions

GET/num_unconfirmed_txs
Get data about unconfirmed transactions

GET/tx_search
Search for transactions

GET/block_search
Search for blocks by BeginBlock and EndBlock events

GET/tx
Get transactions by hash

Tx
Transactions broadcast APIs

GET/broadcast_tx_sync
Returns with the response from CheckTx. Does not wait for DeliverTx result.

GET/broadcast_tx_async
Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.

GET/broadcast_tx_commit
Returns with the responses from CheckTx and DeliverTx.

GET/check_tx
Checks the transaction without executing it.
 
  • ABCI APIs
GET/abci_info
Get some info about the application.

GET/abci_query
Query the application for some information.
  • Evidence APIs

GET/broadcast_evidence
Broadcast evidence of the misbehavior.

  • Unsafe APIs
GET/dial_seeds
Dial Seeds (Unsafe)


GET/dial_peers
Add Peers/Persistent Peers (unsafe)

以上是关于跨链Cosmos(13) Tendermint RPC的主要内容,如果未能解决你的问题,请参考以下文章

跨链跨链双雄Cosmos“系统框架”

跨链Cosmos(12) Cosmos插件

深度解析Tendermint,快速融入Cosmos生态

深度知识Tendermint共识算法原理和框架流程

跨链Cosmos普通交易流程

跨链Cosmos之“跨链交互协议IBC”