From d3d657b2672c3c3e7505ab61b0dc20385b2310d7 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 25 Mar 2021 15:36:57 +0000 Subject: [PATCH 01/13] add rpc spec and support outline --- spec/rpc/README.md | 160 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 spec/rpc/README.md diff --git a/spec/rpc/README.md b/spec/rpc/README.md new file mode 100644 index 00000000..7ca6be5d --- /dev/null +++ b/spec/rpc/README.md @@ -0,0 +1,160 @@ +# RPC spec + +This file defines the JSON-RPC spec of Tendermint. This is meant to be implemented by all clients. + +## Support + + | | Tendermint-Go | Tendermint-Rs | + |--------------|:-------------:|:-------------:| + | JSON-RPC 2.0 | ✅ | ✅ | + | HTTP | ✅ | ✅ | + | HTTPS | ✅ | ❌ | + | WS | ✅ | ❌ | + | WSS | ✅ | ❌ | + + | Routes | Tendermint-Go | Tendermint-Rs | + |-------------------------------------------|:-------------:|:-------------:| + | [Health](#health) | ✅ | ✅ | + | [Status](#status) | ✅ | ✅ | + | [NetInfo](#netinfo) | ✅ | ✅ | + | [blockchain](#blockchain) | ✅ | ✅ | + | [block](#block) | ✅ | ✅ | + | [BlockByHash](#blockbyhash) | ✅ | ❌ | + | [BlockResults](#blockresults) | ✅ | ✅ | + | [Commit](#commit) | ✅ | ✅ | + | [Validators](#validators) | ✅ | ✅ | + | [Genesis](#genesis) | ✅ | ✅ | + | [DumpConsensusState](#dumpconsensusstate) | ✅ | ❌ | + | [ConsensusParams](#consensusparams) | ✅ | ❌ | + | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | + | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | + | [TxSearch](#txsearch) | ✅ | ✅ | + | [BlockSearch](#blocksearch) | ✅ | ❌ | + | [Tx](#tx) | ✅ | ❌ | + | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | + | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [BroadCastTxCommit](#broadcasttxcommit) | ✅ | ✅ | + | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | + | [DialSeeds](#dialseeds) | ✅ | ❌ | + | [DialPeers](#dialpeers) | ✅ | ❌ | + +## Info Routes + +### Health + +``` +curl http://127.0.0.1:26657/health +``` + +```json +{ + "jsonrpc": "2.0", + "id": -1, + "result": {} +} +``` + +### Status + +``` +curl http://127.0.0.1:26657/status +``` + +```json +{ + "jsonrpc": "2.0", + "id": -1, + "result": { + "node_info": { + "protocol_version": { + "p2p": "8", + "block": "11", + "app": "0" + }, + "id": "b93270b358a72a2db30089f3856475bb1f918d6d", + "listen_addr": "tcp://0.0.0.0:26656", + "network": "cosmoshub-4", + "version": "v0.34.8", + "channels": "40202122233038606100", + "moniker": "aib-hub-node", + "other": { + "tx_index": "on", + "rpc_address": "tcp://0.0.0.0:26657" + } + }, + "sync_info": { + "latest_block_hash": "50F03C0EAACA8BCA7F9C14189ACE9C05A9A1BBB5268DB63DC6A3C848D1ECFD27", + "latest_app_hash": "2316CFF7644219F4F15BEE456435F280E2B38955EEA6D4617CCB6D7ABF781C22", + "latest_block_height": "5622165", + "latest_block_time": "2021-03-25T14:00:43.356134226Z", + "earliest_block_hash": "1455A0C15AC49BB506992EC85A3CD4D32367E53A087689815E01A524231C3ADF", + "earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "earliest_block_height": "5200791", + "earliest_block_time": "2019-12-11T16:11:34Z", + "catching_up": false + }, + "validator_info": { + "address": "38FB765D0092470989360ECA1C89CD06C2C1583C", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "Z+8kntVegi1sQiWLYwFSVLNWqdAUGEy7lskL78gxLZI=" + }, + "voting_power": "0" + } + } +} +``` + +### NetInfo + +### Blockchain + +### Block + +### BlockByHash + +### BlockResults + +### Commit + +### Validators + +### Genesis + +### DumpConsensusState + +### ConsensusParams + +### UnconfirmedTxs + +### NumUnconfirmedTxs + +### TxSearch + +### BlockSearch + +### Tx + +## Transaction Routes + +### BroadCastTxSync + +### BroadCastTxAsync + +### BroadCastTxCommit + +## ABCI Routes + +### ABCIInfo + +### ABCIQuery + +## Evidence Routes + +### BroadcastEvidence + +## Unsafe Routes + +### DialSeeds + +### DialPeers From 8591afe86a420173de9d14f4def6dcbb40667779 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 25 Mar 2021 18:14:33 +0000 Subject: [PATCH 02/13] add json --- spec/rpc/README.md | 579 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 566 insertions(+), 13 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 7ca6be5d..e6518888 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -8,12 +8,14 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement |--------------|:-------------:|:-------------:| | JSON-RPC 2.0 | ✅ | ✅ | | HTTP | ✅ | ✅ | - | HTTPS | ✅ | ❌ | - | WS | ✅ | ❌ | - | WSS | ✅ | ❌ | + | HTTPS | ✅ | ❌ | + | WS | ✅ | ✅ | | Routes | Tendermint-Go | Tendermint-Rs | |-------------------------------------------|:-------------:|:-------------:| + | [Subscribe](#subscribe) | ✅ | ✅ | + | [Unsubscribe](#unsubscribe) | ✅ | ✅ | + | [UnsubscribeAll](#unsubscribeall) | ✅ | ❌ | | [Health](#health) | ✅ | ✅ | | [Status](#status) | ✅ | ✅ | | [NetInfo](#netinfo) | ✅ | ✅ | @@ -35,14 +37,12 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | | [BroadCastTxCommit](#broadcasttxcommit) | ✅ | ✅ | | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | - | [DialSeeds](#dialseeds) | ✅ | ❌ | - | [DialPeers](#dialpeers) | ✅ | ❌ | ## Info Routes ### Health -``` +```sh curl http://127.0.0.1:26657/health ``` @@ -56,7 +56,7 @@ curl http://127.0.0.1:26657/health ### Status -``` +```sh curl http://127.0.0.1:26657/status ``` @@ -107,18 +107,577 @@ curl http://127.0.0.1:26657/status ### NetInfo +```sh +curl http://127.0.0.1:26657/net_info +``` + +```json + Example Value + Schema + +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "listening": true, + "listeners": [ + "Listener(@)" + ], + "n_peers": "1", + "peers": [ + { + "node_info": { + "protocol_version": { + "p2p": "7", + "block": "10", + "app": "0" + }, + "id": "5576458aef205977e18fd50b274e9b5d9014525a", + "listen_addr": "tcp://0.0.0.0:26656", + "network": "cosmoshub-2", + "version": "0.32.1", + "channels": "4020212223303800", + "moniker": "moniker-node", + "other": { + "tx_index": "on", + "rpc_address": "tcp://0.0.0.0:26657" + } + }, + "is_outbound": true, + "connection_status": { + "Duration": "168901057956119", + "SendMonitor": { + "Active": true, + "Start": "2019-07-31T14:31:28.66Z", + "Duration": "168901060000000", + "Idle": "168901040000000", + "Bytes": "5", + "Samples": "1", + "InstRate": "0", + "CurRate": "0", + "AvgRate": "0", + "PeakRate": "0", + "BytesRem": "0", + "TimeRem": "0", + "Progress": 0 + }, + "RecvMonitor": { + "Active": true, + "Start": "2019-07-31T14:31:28.66Z", + "Duration": "168901060000000", + "Idle": "168901040000000", + "Bytes": "5", + "Samples": "1", + "InstRate": "0", + "CurRate": "0", + "AvgRate": "0", + "PeakRate": "0", + "BytesRem": "0", + "TimeRem": "0", + "Progress": 0 + }, + "Channels": [ + { + "ID": 48, + "SendQueueCapacity": "1", + "SendQueueSize": "0", + "Priority": "5", + "RecentlySent": "0" + } + ] + }, + "remote_ip": "95.179.155.35" + } + ] + } +} +``` + ### Blockchain +```sh +curl http://127.0.0.1:26657/blockchain +``` + +#### Parameters + +- Minimum height `integer` +- Maximum height `integer` + +example: + +```sh +curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 +``` + +```json +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "last_height": "1276718", + "block_metas": [ + { + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "block_size": 1000000, + "header": { + "version": { + "block": "10", + "app": "0" + }, + "chain_id": "cosmoshub-2", + "height": "12", + "time": "2019-04-22T17:01:51.701356223Z", + "last_block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", + "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", + "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", + "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", + "last_results_hash": "", + "evidence_hash": "", + "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" + }, + "num_txs": "54" + } + ] + } +} +``` + ### Block +```sh +curl http://127.0.0.1:26657/block +``` + +#### Parameters + +- Height `integer` + +example: + +```sh +curl http://127.0.0.1:26657/block?height=1 +``` + +```json +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "block": { + "header": { + "version": { + "block": "10", + "app": "0" + }, + "chain_id": "cosmoshub-2", + "height": "12", + "time": "2019-04-22T17:01:51.701356223Z", + "last_block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", + "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", + "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", + "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", + "last_results_hash": "", + "evidence_hash": "", + "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" + }, + "data": [ + "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0=" + ], + "evidence": [ + { + "type": "string", + "height": 0, + "time": 0, + "total_voting_power": 0, + "validator": { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4=" + }, + "voting_power": 0, + "address": "string" + } + } + ], + "last_commit": { + "height": 0, + "round": 0, + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "signatures": [ + { + "type": 2, + "height": "1262085", + "round": 0, + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "timestamp": "2019-08-01T11:39:38.867269833Z", + "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", + "validator_index": 0, + "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg==" + } + ] + } + } + } +} +``` + ### BlockByHash +```sh +curl http://127.0.0.1:26657/block_by_hash +``` + +#### Parameters + +- Block hash `string` + +example: + +```sh +curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED +``` + +```json +{ + "id": 0, + "jsonrpc": "2.0", + "result": { + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "block": { + "header": { + "version": { + "block": "10", + "app": "0" + }, + "chain_id": "cosmoshub-2", + "height": "12", + "time": "2019-04-22T17:01:51.701356223Z", + "last_block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", + "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", + "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", + "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", + "last_results_hash": "", + "evidence_hash": "", + "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" + }, + "data": [ + "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0=" + ], + "evidence": [ + { + "type": "string", + "height": 0, + "time": 0, + "total_voting_power": 0, + "validator": { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4=" + }, + "voting_power": 0, + "address": "string" + } + } + ], + "last_commit": { + "height": 0, + "round": 0, + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "signatures": [ + { + "type": 2, + "height": "1262085", + "round": 0, + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "timestamp": "2019-08-01T11:39:38.867269833Z", + "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", + "validator_index": 0, + "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg==" + } + ] + } + } + } +} +``` + ### BlockResults +```sh +curl http://127.0.0.1:26657/block_results +``` + +### Parameters + +- Block height `integer` + +```sh +curl http://127.0.0.1:26657/block_results?height=1 +``` + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "height": "12", + "txs_results": [ + { + "code": "0", + "data": "", + "log": "not enough gas", + "info": "", + "gas_wanted": "100", + "gas_used": "100", + "events": [ + { + "type": "app", + "attributes": [ + { + "key": "YWN0aW9u", + "value": "c2VuZA==", + "index": false + } + ] + } + ], + "codespace": "ibc" + } + ], + "begin_block_events": [ + { + "type": "app", + "attributes": [ + { + "key": "YWN0aW9u", + "value": "c2VuZA==", + "index": false + } + ] + } + ], + "end_block": [ + { + "type": "app", + "attributes": [ + { + "key": "YWN0aW9u", + "value": "c2VuZA==", + "index": false + } + ] + } + ], + "validator_updates": [ + { + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "9tK9IT+FPdf2qm+5c2qaxi10sWP+3erWTKgftn2PaQM=" + }, + "power": "300" + } + ], + "consensus_params_updates": { + "block": { + "max_bytes": "22020096", + "max_gas": "1000", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age": "100000" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + } + } + } +} +``` + ### Commit +```sh +curl http://127.0.0.1:26657/commit +``` + +#### Parameters + +- Block height `integer` + - If no height is set the latest commit will be returned. + +```sh +curl http://127.0.0.1:26657/commit?height=1 +``` + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "signed_header": { + "header": { + "version": { + "block": "10", + "app": "0" + }, + "chain_id": "cosmoshub-2", + "height": "12", + "time": "2019-04-22T17:01:51.701356223Z", + "last_block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", + "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", + "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", + "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", + "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", + "last_results_hash": "", + "evidence_hash": "", + "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" + }, + "commit": { + "height": "1311801", + "round": 0, + "block_id": { + "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", + "parts": { + "total": 1, + "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" + } + }, + "signatures": [ + { + "block_id_flag": 2, + "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", + "timestamp": "2019-04-22T17:01:58.376629719Z", + "signature": "14jaTQXYRt8kbLKEhdHq7AXycrFImiLuZx50uOjs2+Zv+2i7RTG/jnObD07Jo2ubZ8xd7bNBJMqkgtkd0oQHAw==" + } + ] + } + }, + "canonical": true + } +} +``` + ### Validators +```sh +curl http://127.0.0.1:26657/validators +``` + +#### Parameters + +- `height`: Block height `integer` + - If no height is set the latest commit will be returned. +- `page` +- `per_page` + +```sh +curl http://127.0.0.1:26657/commit?height=1 +``` + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "block_height": "55", + "validators": [ + { + "address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "9tK9IT+FPdf2qm+5c2qaxi10sWP+3erWTKgftn2PaQM=" + }, + "voting_power": "239727", + "proposer_priority": "-11896414" + } + ], + "count": "1", + "total": "25" + } +} +``` + ### Genesis ### DumpConsensusState @@ -152,9 +711,3 @@ curl http://127.0.0.1:26657/status ## Evidence Routes ### BroadcastEvidence - -## Unsafe Routes - -### DialSeeds - -### DialPeers From 1cdcee0a0cbe5f0b8a289b47f4061e775a901b52 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 30 Mar 2021 18:58:45 +0200 Subject: [PATCH 03/13] add more routes remove unneeded ones --- spec/rpc/README.md | 273 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 263 insertions(+), 10 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index e6518888..2a6f6f3b 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -26,12 +26,9 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement | [Commit](#commit) | ✅ | ✅ | | [Validators](#validators) | ✅ | ✅ | | [Genesis](#genesis) | ✅ | ✅ | - | [DumpConsensusState](#dumpconsensusstate) | ✅ | ❌ | | [ConsensusParams](#consensusparams) | ✅ | ❌ | | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | - | [TxSearch](#txsearch) | ✅ | ✅ | - | [BlockSearch](#blocksearch) | ✅ | ❌ | | [Tx](#tx) | ✅ | ❌ | | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | @@ -46,6 +43,8 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement curl http://127.0.0.1:26657/health ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -60,6 +59,8 @@ curl http://127.0.0.1:26657/health curl http://127.0.0.1:26657/status ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -111,10 +112,9 @@ curl http://127.0.0.1:26657/status curl http://127.0.0.1:26657/net_info ``` -```json - Example Value - Schema +#### Response +```json { "id": 0, "jsonrpc": "2.0", @@ -210,6 +210,8 @@ example: curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ``` +#### Response + ```json { "id": 0, @@ -274,6 +276,8 @@ example: curl http://127.0.0.1:26657/block?height=1 ``` +#### Response + ```json { "id": 0, @@ -381,6 +385,8 @@ example: curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED ``` +#### Response + ```json { "id": 0, @@ -486,6 +492,8 @@ curl http://127.0.0.1:26657/block_results curl http://127.0.0.1:26657/block_results?height=1 ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -582,6 +590,8 @@ curl http://127.0.0.1:26657/commit curl http://127.0.0.1:26657/commit?height=1 ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -655,6 +665,8 @@ curl http://127.0.0.1:26657/validators curl http://127.0.0.1:26657/commit?height=1 ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -680,27 +692,268 @@ curl http://127.0.0.1:26657/commit?height=1 ### Genesis -### DumpConsensusState +```sh +curl http://127.0.0.1:26657/genesis +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "genesis": { + "genesis_time": "2019-04-22T17:00:00Z", + "chain_id": "cosmoshub-2", + "initial_height": "2", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "1000", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age": "100000" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + } + }, + "validators": [ + { + "address": "B00A6323737F321EB0B8D59C6FD497A14B60938A", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "cOQZvh/h9ZioSeUMZB/1Vy1Xo5x2sjrVjlE/qHnYifM=" + }, + "power": "9328525", + "name": "Certus One" + } + ], + "app_hash": "", + "app_state": {} + } + } +} +``` ### ConsensusParams +```sh +curl http://127.0.0.1:26657/consensus_params +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "block_height": "1", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "1000", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age": "100000" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + } + } + } +} +``` + ### UnconfirmedTxs +```sh +curl http://127.0.0.1:26657/unconfirmed_txs +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "n_txs": "82", + "total": "82", + "total_bytes": "19974", + "txs": [ + "gAPwYl3uCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUA75/FmYq9WymsOBJ0XSJ8yV8zmQKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhQbrvwbvlNiT+Yjr86G+YQNx7kRVgowjE1xDQoUjJyJG+WaWBwSiGannBRFdrbma+8SFK2m+1oxgILuQLO55n8mWfnbIzyPCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUQNGfkmhTNMis4j+dyMDIWXdIPiYKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhS8sL0D0wwgGCItQwVowak5YB38KRIUCg4KBXVhdG9tEgUxMDA1NBDoxRgaagom61rphyECn8x7emhhKdRCB2io7aS/6Cpuq5NbVqbODmqOT3jWw6kSQKUresk+d+Gw0BhjiggTsu8+1voW+VlDCQ1GRYnMaFOHXhyFv7BCLhFWxLxHSAYT8a5XqoMayosZf9mANKdXArA=" + ] + } +} +``` + ### NumUnconfirmedTxs -### TxSearch +```sh +curl http://127.0.0.1:26657/num_unconfirmed_txs +``` -### BlockSearch +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "n_txs": "31", + "total": "82", + "total_bytes": "19974" + } +} +``` ### Tx +```sh +curl http://127.0.0.1:26657/num_unconfirmed_txs +``` + +#### Parameters + +- `hash (string)`: The hash of the transaction +- `prove (bool)`: If the response should include proof the transaction was included in a block. + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "hash": "D70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED", + "height": "1000", + "index": 0, + "tx_result": { + "log": "[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]", + "gas_wanted": "200000", + "gas_used": "28596", + "tags": [ + { + "key": "YWN0aW9u", + "value": "c2VuZA==", + "index": false + } + ] + }, + "tx": "5wHwYl3uCkaoo2GaChQmSIu8hxpJxLcCuIi8fiHN4TMwrRIU/Af1cEG7Rcs/6LjTl7YjRSymJfYaFAoFdWF0b20SCzE0OTk5OTk1MDAwEhMKDQoFdWF0b20SBDUwMDAQwJoMGmoKJuta6YchAwswBShaB1wkZBctLIhYqBC3JrAI28XGzxP+rVEticGEEkAc+khTkKL9CDE47aDvjEHvUNt+izJfT4KVF2v2JkC+bmlH9K08q3PqHeMI9Z5up+XMusnTqlP985KF+SI5J3ZOIhhNYWRlIGJ5IENpcmNsZSB3aXRoIGxvdmU=" + } +} +``` + ## Transaction Routes ### BroadCastTxSync +Returns with the response from CheckTx. Does not wait for DeliverTx result. + +```sh +curl http://127.0.0.1:26657/broadcast_tx_sync +``` + +#### Parameters + +- `tx (string)`: The transaction encoded + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "code": "0", + "data": "", + "log": "", + "codespace": "ibc", + "hash": "0D33F2F03A5234F38706E43004489E061AC40A2E" + }, + "error": "" +} +``` + ### BroadCastTxAsync -### BroadCastTxCommit +Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results. + +```sh +curl http://127.0.0.1:26657/broadcast_tx_async +``` + +#### Parameters + +- `tx (string)`: The transaction encoded + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "code": "0", + "data": "", + "log": "", + "codespace": "ibc", + "hash": "0D33F2F03A5234F38706E43004489E061AC40A2E" + }, + "error": "" +} +``` + +### CheckTx + +Checks the transaction without executing it. + +```sh +curl http://127.0.0.1:26657/check_tx +``` + +#### Parameters + +- `tx (string)`: String of the encoded transaction + +#### Response + +```json +{ + "error": "", + "result": { + "code": "0", + "data": "", + "log": "", + "info": "", + "gas_wanted": "1", + "gas_used": "0", + "events": [ + { + "type": "app", + "attributes": [ + { + "key": "YWN0aW9u", + "value": "c2VuZA==", + "index": false + } + ] + } + ], + "codespace": "bank" + }, + "id": 0, + "jsonrpc": "2.0" +} +``` ## ABCI Routes From d244d8cba74668f8a48a0e9ff5ad26ed73e971e7 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 31 Mar 2021 13:47:07 +0200 Subject: [PATCH 04/13] add rest of rpc endpoints --- spec/rpc/README.md | 203 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 156 insertions(+), 47 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 2a6f6f3b..cc8d06e3 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -39,6 +39,8 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement ### Health +#### Request + ```sh curl http://127.0.0.1:26657/health ``` @@ -55,6 +57,8 @@ curl http://127.0.0.1:26657/health ### Status +#### Request + ```sh curl http://127.0.0.1:26657/status ``` @@ -108,6 +112,8 @@ curl http://127.0.0.1:26657/status ### NetInfo +#### Request + ```sh curl http://127.0.0.1:26657/net_info ``` @@ -195,18 +201,16 @@ curl http://127.0.0.1:26657/net_info ### Blockchain -```sh -curl http://127.0.0.1:26657/blockchain -``` - #### Parameters - Minimum height `integer` - Maximum height `integer` -example: +#### Request ```sh +curl http://127.0.0.1:26657/blockchain + curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ``` @@ -262,17 +266,15 @@ curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ### Block -```sh -curl http://127.0.0.1:26657/block -``` - #### Parameters - Height `integer` -example: +#### Request ```sh +curl http://127.0.0.1:26657/block + curl http://127.0.0.1:26657/block?height=1 ``` @@ -371,15 +373,15 @@ curl http://127.0.0.1:26657/block?height=1 ### BlockByHash -```sh -curl http://127.0.0.1:26657/block_by_hash -``` - #### Parameters - Block hash `string` -example: +#### Request + +```sh +curl http://127.0.0.1:26657/block_by_hash +``` ```sh curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED @@ -480,15 +482,16 @@ curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806 ### BlockResults -```sh -curl http://127.0.0.1:26657/block_results -``` - ### Parameters - Block height `integer` +#### Request + ```sh +curl http://127.0.0.1:26657/block_results + + curl http://127.0.0.1:26657/block_results?height=1 ``` @@ -577,16 +580,17 @@ curl http://127.0.0.1:26657/block_results?height=1 ### Commit -```sh -curl http://127.0.0.1:26657/commit -``` - #### Parameters - Block height `integer` - If no height is set the latest commit will be returned. +#### Request + ```sh +curl http://127.0.0.1:26657/commit + + curl http://127.0.0.1:26657/commit?height=1 ``` @@ -650,10 +654,6 @@ curl http://127.0.0.1:26657/commit?height=1 ### Validators -```sh -curl http://127.0.0.1:26657/validators -``` - #### Parameters - `height`: Block height `integer` @@ -661,8 +661,10 @@ curl http://127.0.0.1:26657/validators - `page` - `per_page` +#### Request + ```sh -curl http://127.0.0.1:26657/commit?height=1 +curl http://127.0.0.1:26657/validators ``` #### Response @@ -692,6 +694,8 @@ curl http://127.0.0.1:26657/commit?height=1 ### Genesis +#### Request + ```sh curl http://127.0.0.1:26657/genesis ``` @@ -742,6 +746,8 @@ curl http://127.0.0.1:26657/genesis ### ConsensusParams +#### Request + ```sh curl http://127.0.0.1:26657/consensus_params ``` @@ -775,6 +781,8 @@ curl http://127.0.0.1:26657/consensus_params ### UnconfirmedTxs +#### Request + ```sh curl http://127.0.0.1:26657/unconfirmed_txs ``` @@ -798,10 +806,14 @@ curl http://127.0.0.1:26657/unconfirmed_txs ### NumUnconfirmedTxs +#### Request + ```sh curl http://127.0.0.1:26657/num_unconfirmed_txs ``` +#### Response + ```json { "jsonrpc": "2.0", @@ -816,15 +828,17 @@ curl http://127.0.0.1:26657/num_unconfirmed_txs ### Tx -```sh -curl http://127.0.0.1:26657/num_unconfirmed_txs -``` - #### Parameters - `hash (string)`: The hash of the transaction - `prove (bool)`: If the response should include proof the transaction was included in a block. +#### Request + +```sh +curl http://127.0.0.1:26657/num_unconfirmed_txs +``` + #### Response ```json @@ -858,14 +872,16 @@ curl http://127.0.0.1:26657/num_unconfirmed_txs Returns with the response from CheckTx. Does not wait for DeliverTx result. -```sh -curl http://127.0.0.1:26657/broadcast_tx_sync -``` - #### Parameters - `tx (string)`: The transaction encoded +#### Request + +```sh +curl http://127.0.0.1:26657/broadcast_tx_sync +``` + #### Response ```json @@ -887,14 +903,16 @@ curl http://127.0.0.1:26657/broadcast_tx_sync Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results. -```sh -curl http://127.0.0.1:26657/broadcast_tx_async -``` - #### Parameters - `tx (string)`: The transaction encoded +#### Request + +```sh +curl http://127.0.0.1:26657/broadcast_tx_async +``` + #### Response ```json @@ -916,18 +934,22 @@ curl http://127.0.0.1:26657/broadcast_tx_async Checks the transaction without executing it. -```sh -curl http://127.0.0.1:26657/check_tx -``` - #### Parameters - `tx (string)`: String of the encoded transaction +#### Request + +```sh +curl http://127.0.0.1:26657/check_tx +``` + #### Response ```json { + "id": 0, + "jsonrpc": "2.0", "error": "", "result": { "code": "0", @@ -949,9 +971,7 @@ curl http://127.0.0.1:26657/check_tx } ], "codespace": "bank" - }, - "id": 0, - "jsonrpc": "2.0" + } } ``` @@ -959,8 +979,97 @@ curl http://127.0.0.1:26657/check_tx ### ABCIInfo +Get some info about the application. + +#### Parameters + +None + +#### Request + +```sh +curl http://127.0.0.1:26657/abci_info +``` + +#### Response + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "result": { + "response": { + "data": "{\"size\":0}", + "version": "0.16.1", + "app_version": "1314126" + } + } +} +``` + ### ABCIQuery +Query the application for some information. + +#### Parameters + +- `path (string)`: Path to the data. This is defined by the application. +- `data (string)`: The data requested +- `height (integer)`: Height at which the data is being requested for. +- `prove (bool)`: Include proofs of the transactions inclusion in the block + +#### Request + +```sh +curl http://127.0.0.1:26657/abci_query?path="a/b/c"=IHAVENOIDEA&height=1&prove=true +``` + +#### Response + +```json +{ + "error": "", + "result": { + "response": { + "log": "exists", + "height": "0", + "proof": "010114FED0DAD959F36091AD761C922ABA3CBF1D8349990101020103011406AA2262E2F448242DF2C2607C3CDC705313EE3B0001149D16177BC71E445476174622EA559715C293740C", + "value": "61626364", + "key": "61626364", + "index": "-1", + "code": "0" + } + }, + "id": 0, + "jsonrpc": "2.0" +} +``` + ## Evidence Routes ### BroadcastEvidence + +Broadcast evidence of the misbehavior. + +#### Parameters + +- `evidence (string)`: + +#### Request + +```sh +curl http://localhost:26657/broadcast_evidence?evidence=JSON_EVIDENCE_encoded +``` + +#### Response + +```json + Schema + +{ + "error": "", + "result": "", + "id": 0, + "jsonrpc": "2.0" +} +``` From 0de0d1e76f811332a55d36b08589a9d9ab6ad90b Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 31 Mar 2021 14:26:54 +0200 Subject: [PATCH 05/13] add jsonrpc calls --- spec/rpc/README.md | 64 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index cc8d06e3..58c5a728 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -835,10 +835,18 @@ curl http://127.0.0.1:26657/num_unconfirmed_txs #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/num_unconfirmed_txs ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"num_unconfirmed_txs\"}" +``` + #### Response ```json @@ -878,8 +886,16 @@ Returns with the response from CheckTx. Does not wait for DeliverTx result. #### Request +##### HTTP + +```sh +curl http://127.0.0.1:26657/broadcast_tx_sync?tx=encoded_tx +``` + +##### JSONRPC + ```sh -curl http://127.0.0.1:26657/broadcast_tx_sync +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_tx_sync\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}" ``` #### Response @@ -909,8 +925,16 @@ Returns right away, with no response. Does not wait for CheckTx nor DeliverTx re #### Request +##### HTTP + ```sh -curl http://127.0.0.1:26657/broadcast_tx_async +curl http://127.0.0.1:26657/broadcast_tx_async?tx=encoded_tx +``` + +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_tx_async\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}" ``` #### Response @@ -940,8 +964,16 @@ Checks the transaction without executing it. #### Request +##### HTTP + +```sh +curl http://127.0.0.1:26657/check_tx?tx=encoded_tx +``` + +##### JSONRPC + ```sh -curl http://127.0.0.1:26657/check_tx +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"check_tx\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}" ``` #### Response @@ -987,10 +1019,18 @@ None #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/abci_info ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"abci_info\"}" +``` + #### Response ```json @@ -1020,10 +1060,18 @@ Query the application for some information. #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/abci_query?path="a/b/c"=IHAVENOIDEA&height=1&prove=true ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"abci_query\",\"params\":{\"path\":\"a/b/c\", \"height\":\"1\", \"bool\":\"true\"}}" +``` + #### Response ```json @@ -1057,15 +1105,21 @@ Broadcast evidence of the misbehavior. #### Request +##### HTTP + ```sh curl http://localhost:26657/broadcast_evidence?evidence=JSON_EVIDENCE_encoded ``` +#### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_evidence\",\"params\":{\"evidence\":\"JSON_EVIDENCE_encoded\"}}" +``` + #### Response ```json - Schema - { "error": "", "result": "", From a38fb7a45075c9df87a7d8f755e529bef29daba2 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 31 Mar 2021 14:58:02 +0200 Subject: [PATCH 06/13] add more jsonrpc calls --- spec/rpc/README.md | 198 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 164 insertions(+), 34 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 58c5a728..f526b978 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -11,36 +11,44 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement | HTTPS | ✅ | ❌ | | WS | ✅ | ✅ | - | Routes | Tendermint-Go | Tendermint-Rs | - |-------------------------------------------|:-------------:|:-------------:| - | [Subscribe](#subscribe) | ✅ | ✅ | - | [Unsubscribe](#unsubscribe) | ✅ | ✅ | - | [UnsubscribeAll](#unsubscribeall) | ✅ | ❌ | - | [Health](#health) | ✅ | ✅ | - | [Status](#status) | ✅ | ✅ | - | [NetInfo](#netinfo) | ✅ | ✅ | - | [blockchain](#blockchain) | ✅ | ✅ | - | [block](#block) | ✅ | ✅ | - | [BlockByHash](#blockbyhash) | ✅ | ❌ | - | [BlockResults](#blockresults) | ✅ | ✅ | - | [Commit](#commit) | ✅ | ✅ | - | [Validators](#validators) | ✅ | ✅ | - | [Genesis](#genesis) | ✅ | ✅ | - | [ConsensusParams](#consensusparams) | ✅ | ❌ | - | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | - | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | - | [Tx](#tx) | ✅ | ❌ | - | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | - | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | - | [BroadCastTxCommit](#broadcasttxcommit) | ✅ | ✅ | - | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | + | Routes | Tendermint-Go | Tendermint-Rs | + |-----------------------------------------|:-------------:|:-------------:| + | [Subscribe](#subscribe) | ✅ | ✅ | + | [Unsubscribe](#unsubscribe) | ✅ | ✅ | + | [UnsubscribeAll](#unsubscribeall) | ✅ | ❌ | + | [Health](#health) | ✅ | ✅ | + | [Status](#status) | ✅ | ✅ | + | [NetInfo](#netinfo) | ✅ | ✅ | + | [blockchain](#blockchain) | ✅ | ✅ | + | [block](#block) | ✅ | ✅ | + | [BlockByHash](#blockbyhash) | ✅ | ❌ | + | [BlockResults](#blockresults) | ✅ | ✅ | + | [Commit](#commit) | ✅ | ✅ | + | [Validators](#validators) | ✅ | ✅ | + | [Genesis](#genesis) | ✅ | ✅ | + | [ConsensusParams](#consensusparams) | ✅ | ❌ | + | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | + | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | + | [Tx](#tx) | ✅ | ❌ | + | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | + | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [ABCIInfo](#abciinfo) | ✅ | ✅ | + | [ABCIQuery](#abciquery) | ✅ | ✅ | + | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | ## Info Routes ### Health +Node heartbeat + +#### Parameters + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/health ``` @@ -57,12 +65,26 @@ curl http://127.0.0.1:26657/health ### Status +Get Tendermint status including node info, pubkey, latest block hash, app hash, block height and time. + +#### Parameters + +None + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/status ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"status\"}" +``` + #### Response ```json @@ -112,12 +134,26 @@ curl http://127.0.0.1:26657/status ### NetInfo +Network information + +#### Parameters + +None + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/net_info ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"net_info\"}" +``` + #### Response ```json @@ -201,6 +237,8 @@ curl http://127.0.0.1:26657/net_info ### Blockchain +Get block headers (max: 20) for minHeight <= height <= maxHeight. + #### Parameters - Minimum height `integer` @@ -208,12 +246,20 @@ curl http://127.0.0.1:26657/net_info #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/blockchain curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"blockchain\",\"params\":{\"height\":\"1\"}}" +``` + #### Response ```json @@ -266,18 +312,28 @@ curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ### Block +Get block at a specified height. + #### Parameters -- Height `integer` +- `height (integer)`: height of the requested block. If no height is specified the latest block will be used. #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/block curl http://127.0.0.1:26657/block?height=1 ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block\",\"params\":{\"height\":\"1\"}}" +``` + #### Response ```json @@ -375,16 +431,20 @@ curl http://127.0.0.1:26657/block?height=1 #### Parameters -- Block hash `string` +- `hash (string)`: Hash of the block to query for. #### Request +##### HTTP + ```sh -curl http://127.0.0.1:26657/block_by_hash +curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED ``` +##### JSONRPC + ```sh -curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block_by_hash\",\"params\":{\"hash\":\"0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED\"}}" ``` #### Response @@ -484,10 +544,12 @@ curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806 ### Parameters -- Block height `integer` +- `height (integer)`: Height of the block which contains the results. If no height is specified, the latest block height will be used #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/block_results @@ -495,6 +557,12 @@ curl http://127.0.0.1:26657/block_results curl http://127.0.0.1:26657/block_results?height=1 ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block_results\",\"params\":{\"height\":\"1\"}}" +``` + #### Response ```json @@ -582,11 +650,12 @@ curl http://127.0.0.1:26657/block_results?height=1 #### Parameters -- Block height `integer` - - If no height is set the latest commit will be returned. +- `height (integer)`: Height of the block the requested commit pertains to. If no height is set the latest commit will be returned. #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/commit @@ -594,6 +663,12 @@ curl http://127.0.0.1:26657/commit curl http://127.0.0.1:26657/commit?height=1 ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"commit\",\"params\":{\"height\":\"1\"}}" +``` + #### Response ```json @@ -656,17 +731,24 @@ curl http://127.0.0.1:26657/commit?height=1 #### Parameters -- `height`: Block height `integer` - - If no height is set the latest commit will be returned. -- `page` -- `per_page` +- `height (integer)`: Block height at which the validators were present on. If no height is set the latest commit will be returned. +- `page (integer)`: +- `per_page (integer)`: #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/validators ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"validators\",\"params\":{\"height\":\"1\", \"page\":\"1\", \"per_page\":\"20\"}}" +``` + #### Response ```json @@ -694,12 +776,22 @@ curl http://127.0.0.1:26657/validators ### Genesis +Get Genesis of the chain. + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/genesis ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"genesis\"}" +``` + #### Response ```json @@ -746,12 +838,22 @@ curl http://127.0.0.1:26657/genesis ### ConsensusParams +Get the consensus parameters. + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/consensus_params ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"consensus_params\"}" +``` + #### Response ```json @@ -781,12 +883,26 @@ curl http://127.0.0.1:26657/consensus_params ### UnconfirmedTxs +Get a list of unconfirmed transactions. + +#### Parameters + +- `limit (integer)` The amount of txs to respond with. + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/unconfirmed_txs ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"unconfirmed_txs\, \"params\":{\"limit\":\"20\"}"}" +``` + #### Response ```json @@ -806,12 +922,26 @@ curl http://127.0.0.1:26657/unconfirmed_txs ### NumUnconfirmedTxs +Get data about unconfirmed transactions. + +#### Parameters + +None + #### Request +##### HTTP + ```sh curl http://127.0.0.1:26657/num_unconfirmed_txs ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"num_unconfirmed_txs\"}" +``` + #### Response ```json From 4344c83bab32061f7726cfeebafb93208f3304fa Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 31 Mar 2021 15:05:40 +0200 Subject: [PATCH 07/13] fix blockchain --- spec/rpc/README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index f526b978..89f6fc40 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -45,6 +45,8 @@ Node heartbeat #### Parameters +None + #### Request ##### HTTP @@ -53,6 +55,12 @@ Node heartbeat curl http://127.0.0.1:26657/health ``` +##### JSONRPC + +```sh +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"health\"}" +``` + #### Response ```json @@ -241,8 +249,8 @@ Get block headers (max: 20) for minHeight <= height <= maxHeight. #### Parameters -- Minimum height `integer` -- Maximum height `integer` +- `minHeight (integer)`: The lowest block to be returned in the response +- `maxHeight (integer)`: The highest block to be returned in the response #### Request @@ -257,7 +265,7 @@ curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2 ##### JSONRPC ```sh -curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"blockchain\",\"params\":{\"height\":\"1\"}}" +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"blockchain\",\"params\":{\"minHeight\":\"1\", \"maxHeight\":\"2\"}}" ``` #### Response From bd8e07b8991868ef2422eca03a159d8aa3400db4 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 31 Mar 2021 15:42:32 +0200 Subject: [PATCH 08/13] cleanup unused links and add links to repos --- spec/rpc/README.md | 59 ++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 89f6fc40..7eceed25 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -4,38 +4,35 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement ## Support - | | Tendermint-Go | Tendermint-Rs | - |--------------|:-------------:|:-------------:| - | JSON-RPC 2.0 | ✅ | ✅ | - | HTTP | ✅ | ✅ | - | HTTPS | ✅ | ❌ | - | WS | ✅ | ✅ | + | | [Tendermint-Go](https://github.com/tendermint/tendermint/) | [endermint-Rs](https://github.com/informalsystems/tendermint-rs) | + |--------------|:----------------------------------------------------------:|:----------------------------------------------------------------:| + | JSON-RPC 2.0 | ✅ | ✅ | + | HTTP | ✅ | ✅ | + | HTTPS | ✅ | ❌ | + | WS | ✅ | ✅ | - | Routes | Tendermint-Go | Tendermint-Rs | - |-----------------------------------------|:-------------:|:-------------:| - | [Subscribe](#subscribe) | ✅ | ✅ | - | [Unsubscribe](#unsubscribe) | ✅ | ✅ | - | [UnsubscribeAll](#unsubscribeall) | ✅ | ❌ | - | [Health](#health) | ✅ | ✅ | - | [Status](#status) | ✅ | ✅ | - | [NetInfo](#netinfo) | ✅ | ✅ | - | [blockchain](#blockchain) | ✅ | ✅ | - | [block](#block) | ✅ | ✅ | - | [BlockByHash](#blockbyhash) | ✅ | ❌ | - | [BlockResults](#blockresults) | ✅ | ✅ | - | [Commit](#commit) | ✅ | ✅ | - | [Validators](#validators) | ✅ | ✅ | - | [Genesis](#genesis) | ✅ | ✅ | - | [ConsensusParams](#consensusparams) | ✅ | ❌ | - | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | - | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | - | [Tx](#tx) | ✅ | ❌ | - | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | - | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | - | [ABCIInfo](#abciinfo) | ✅ | ✅ | - | [ABCIQuery](#abciquery) | ✅ | ✅ | - | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | - | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | + | Routes | [Tendermint-Go](https://github.com/tendermint/tendermint/) | [Tendermint-Rs](https://github.com/informalsystems/tendermint-rs) | + |-----------------------------------------|:----------------------------------------------------------:|:-----------------------------------------------------------------:| + | [Health](#health) | ✅ | ✅ | + | [Status](#status) | ✅ | ✅ | + | [NetInfo](#netinfo) | ✅ | ✅ | + | [Blockchain](#blockchain) | ✅ | ✅ | + | [Block](#block) | ✅ | ✅ | + | [BlockByHash](#blockbyhash) | ✅ | ❌ | + | [BlockResults](#blockresults) | ✅ | ✅ | + | [Commit](#commit) | ✅ | ✅ | + | [Validators](#validators) | ✅ | ✅ | + | [Genesis](#genesis) | ✅ | ✅ | + | [ConsensusParams](#consensusparams) | ✅ | ❌ | + | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ | + | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ | + | [Tx](#tx) | ✅ | ❌ | + | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ | + | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [ABCIInfo](#abciinfo) | ✅ | ✅ | + | [ABCIQuery](#abciquery) | ✅ | ✅ | + | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | ## Info Routes From 91e676dfe8487d1929079925e5c2207bb3b35017 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 13 Apr 2021 09:56:11 +0000 Subject: [PATCH 09/13] Update spec/rpc/README.md Co-authored-by: Callum Waters --- spec/rpc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 7eceed25..464f6043 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -905,7 +905,7 @@ curl http://127.0.0.1:26657/unconfirmed_txs ##### JSONRPC ```sh -curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"unconfirmed_txs\, \"params\":{\"limit\":\"20\"}"}" +curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"unconfirmed_txs\, \"params\":{\"limit\":\"20\"}}" ``` #### Response From 855aac819a8e628940fd5c649df69b750a740b49 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 13 Apr 2021 12:01:26 +0200 Subject: [PATCH 10/13] add missing param from consensus param --- spec/rpc/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 7eceed25..7571e1f8 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -242,7 +242,7 @@ curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\ ### Blockchain -Get block headers (max: 20) for minHeight <= height <= maxHeight. +Get block headers. #### Parameters @@ -845,6 +845,10 @@ curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\ Get the consensus parameters. +#### Parameters + +- `height (integer)`: Bloch height at which the consensus params would like to be fetched for. + #### Request ##### HTTP From 0cbfb47103e65b06742456ec013d6b456a33e46e Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 27 Apr 2021 09:21:01 +0000 Subject: [PATCH 11/13] Update spec/rpc/README.md Co-authored-by: Callum Waters --- spec/rpc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 49447a06..7019a1a4 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -242,7 +242,7 @@ curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\ ### Blockchain -Get block headers. +Get block headers. Returned in descending order. May be limited in quantity. #### Parameters From 9f4b21a0be23231d037fa4bcd07e47835e10685c Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 27 Apr 2021 09:21:11 +0000 Subject: [PATCH 12/13] Update spec/rpc/README.md Co-authored-by: Callum Waters --- spec/rpc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rpc/README.md b/spec/rpc/README.md index 7019a1a4..a3750066 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -847,7 +847,7 @@ Get the consensus parameters. #### Parameters -- `height (integer)`: Bloch height at which the consensus params would like to be fetched for. +- `height (integer)`: Block height at which the consensus params would like to be fetched for. #### Request From 034f23c9a4313915aa1369bb2bed542ba334c4cf Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 27 Apr 2021 12:23:36 +0300 Subject: [PATCH 13/13] fix cast and add doc to readme --- spec/README.md | 4 ++++ spec/rpc/README.md | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/README.md b/spec/README.md index 31e740c4..e7563175 100644 --- a/spec/README.md +++ b/spec/README.md @@ -42,6 +42,10 @@ please submit them to our [bug bounty](https://tendermint.com/security)! - [Mempool](./p2p/messages/mempool.md): gossip transactions so they get included in blocks - [Evidence](./p2p/messages/evidence.md): sending invalid evidence will stop the peer +### RPC + +- [RPC SPEC](./rpc/README.md): Specification of the Tendermint remote procedure call interface. + ### Software - [ABCI](./abci/README.md): Details about interactions between the diff --git a/spec/rpc/README.md b/spec/rpc/README.md index a3750066..77d8f850 100644 --- a/spec/rpc/README.md +++ b/spec/rpc/README.md @@ -1,3 +1,10 @@ +--- +order: 1 +parent: + title: RPC + order: 6 +--- + # RPC spec This file defines the JSON-RPC spec of Tendermint. This is meant to be implemented by all clients. @@ -31,7 +38,7 @@ This file defines the JSON-RPC spec of Tendermint. This is meant to be implement | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | | [ABCIInfo](#abciinfo) | ✅ | ✅ | | [ABCIQuery](#abciquery) | ✅ | ✅ | - | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ | + | [BroadcastTxAsync](#broadcasttxasync) | ✅ | ✅ | | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ | ## Info Routes @@ -847,7 +854,7 @@ Get the consensus parameters. #### Parameters -- `height (integer)`: Block height at which the consensus params would like to be fetched for. +- `height (integer)`: Block height at which the consensus params would like to be fetched for. #### Request