You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1264 lines
32 KiB

  1. ---
  2. order: 1
  3. parent:
  4. title: RPC
  5. order: 6
  6. ---
  7. # RPC spec
  8. This file defines the JSON-RPC spec of Tendermint. This is meant to be implemented by all clients.
  9. ## Support
  10. | | [Tendermint-Go](https://github.com/tendermint/tendermint/) | [Tendermint-Rs](https://github.com/informalsystems/tendermint-rs) |
  11. |--------------|:-----------------------------------------------------------:|:-----------------------------------------------------------------:|
  12. | JSON-RPC 2.0 | ✅ | ✅ |
  13. | HTTP | ✅ | ✅ |
  14. | HTTPS | ✅ | ❌ |
  15. | WS | ✅ | ✅ |
  16. | Routes | [Tendermint-Go](https://github.com/tendermint/tendermint/) | [Tendermint-Rs](https://github.com/informalsystems/tendermint-rs) |
  17. |-----------------------------------------|:----------------------------------------------------------:|:-----------------------------------------------------------------:|
  18. | [Health](#health) | ✅ | ✅ |
  19. | [Status](#status) | ✅ | ✅ |
  20. | [NetInfo](#netinfo) | ✅ | ✅ |
  21. | [Blockchain](#blockchain) | ✅ | ✅ |
  22. | [Block](#block) | ✅ | ✅ |
  23. | [BlockByHash](#blockbyhash) | ✅ | ❌ |
  24. | [BlockResults](#blockresults) | ✅ | ✅ |
  25. | [Commit](#commit) | ✅ | ✅ |
  26. | [Validators](#validators) | ✅ | ✅ |
  27. | [Genesis](#genesis) | ✅ | ✅ |
  28. | [GenesisChunked](#genesischunked) | ✅ | ❌ |
  29. | [ConsensusParams](#consensusparams) | ✅ | ❌ |
  30. | [UnconfirmedTxs](#unconfirmedtxs) | ✅ | ❌ |
  31. | [NumUnconfirmedTxs](#numunconfirmedtxs) | ✅ | ❌ |
  32. | [Tx](#tx) | ✅ | ❌ |
  33. | [BroadCastTxSync](#broadcasttxsync) | ✅ | ✅ |
  34. | [BroadCastTxAsync](#broadcasttxasync) | ✅ | ✅ |
  35. | [ABCIInfo](#abciinfo) | ✅ | ✅ |
  36. | [ABCIQuery](#abciquery) | ✅ | ✅ |
  37. | [BroadcastTxAsync](#broadcasttxasync) | ✅ | ✅ |
  38. | [BroadcastEvidence](#broadcastevidence) | ✅ | ✅ |
  39. ## Timestamps
  40. Timestamps in the RPC layer of Tendermint follows RFC3339Nano. The RFC3339Nano format removes trailing zeros from the seconds field.
  41. This means if a block has a timestamp like: `1985-04-12T23:20:50.5200000Z`, the value returned in the RPC will be `1985-04-12T23:20:50.52Z`.
  42. ## Info Routes
  43. ### Health
  44. Node heartbeat
  45. #### Parameters
  46. None
  47. #### Request
  48. ##### HTTP
  49. ```sh
  50. curl http://127.0.0.1:26657/health
  51. ```
  52. ##### JSONRPC
  53. ```sh
  54. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"health\"}"
  55. ```
  56. #### Response
  57. ```json
  58. {
  59. "jsonrpc": "2.0",
  60. "id": -1,
  61. "result": {}
  62. }
  63. ```
  64. ### Status
  65. Get Tendermint status including node info, pubkey, latest block hash, app hash, block height and time.
  66. #### Parameters
  67. None
  68. #### Request
  69. ##### HTTP
  70. ```sh
  71. curl http://127.0.0.1:26657/status
  72. ```
  73. ##### JSONRPC
  74. ```sh
  75. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"status\"}"
  76. ```
  77. #### Response
  78. ```json
  79. {
  80. "jsonrpc": "2.0",
  81. "id": -1,
  82. "result": {
  83. "node_info": {
  84. "protocol_version": {
  85. "p2p": "8",
  86. "block": "11",
  87. "app": "0"
  88. },
  89. "id": "b93270b358a72a2db30089f3856475bb1f918d6d",
  90. "listen_addr": "tcp://0.0.0.0:26656",
  91. "network": "cosmoshub-4",
  92. "version": "v0.34.8",
  93. "channels": "40202122233038606100",
  94. "moniker": "aib-hub-node",
  95. "other": {
  96. "tx_index": "on",
  97. "rpc_address": "tcp://0.0.0.0:26657"
  98. }
  99. },
  100. "sync_info": {
  101. "latest_block_hash": "50F03C0EAACA8BCA7F9C14189ACE9C05A9A1BBB5268DB63DC6A3C848D1ECFD27",
  102. "latest_app_hash": "2316CFF7644219F4F15BEE456435F280E2B38955EEA6D4617CCB6D7ABF781C22",
  103. "latest_block_height": "5622165",
  104. "latest_block_time": "2021-03-25T14:00:43.356134226Z",
  105. "earliest_block_hash": "1455A0C15AC49BB506992EC85A3CD4D32367E53A087689815E01A524231C3ADF",
  106. "earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
  107. "earliest_block_height": "5200791",
  108. "earliest_block_time": "2019-12-11T16:11:34Z",
  109. "catching_up": false
  110. },
  111. "validator_info": {
  112. "address": "38FB765D0092470989360ECA1C89CD06C2C1583C",
  113. "pub_key": {
  114. "type": "tendermint/PubKeyEd25519",
  115. "value": "Z+8kntVegi1sQiWLYwFSVLNWqdAUGEy7lskL78gxLZI="
  116. },
  117. "voting_power": "0"
  118. }
  119. }
  120. }
  121. ```
  122. ### NetInfo
  123. Network information
  124. #### Parameters
  125. None
  126. #### Request
  127. ##### HTTP
  128. ```sh
  129. curl http://127.0.0.1:26657/net_info
  130. ```
  131. ##### JSONRPC
  132. ```sh
  133. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"net_info\"}"
  134. ```
  135. #### Response
  136. ```json
  137. {
  138. "id": 0,
  139. "jsonrpc": "2.0",
  140. "result": {
  141. "listening": true,
  142. "listeners": [
  143. "Listener(@)"
  144. ],
  145. "n_peers": "1",
  146. "peers": [
  147. {
  148. "node_id": "5576458aef205977e18fd50b274e9b5d9014525a",
  149. "url": "tcp://5576458aef205977e18fd50b274e9b5d9014525a@95.179.155.35:26656"
  150. }
  151. ]
  152. }
  153. }
  154. ```
  155. ### Blockchain
  156. Get block headers. Returned in descending order. May be limited in quantity.
  157. #### Parameters
  158. - `minHeight (integer)`: The lowest block to be returned in the response
  159. - `maxHeight (integer)`: The highest block to be returned in the response
  160. #### Request
  161. ##### HTTP
  162. ```sh
  163. curl http://127.0.0.1:26657/blockchain
  164. curl http://127.0.0.1:26657/blockchain?minHeight=1&maxHeight=2
  165. ```
  166. ##### JSONRPC
  167. ```sh
  168. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"blockchain\",\"params\":{\"minHeight\":\"1\", \"maxHeight\":\"2\"}}"
  169. ```
  170. #### Response
  171. ```json
  172. {
  173. "id": 0,
  174. "jsonrpc": "2.0",
  175. "result": {
  176. "last_height": "1276718",
  177. "block_metas": [
  178. {
  179. "block_id": {
  180. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  181. "parts": {
  182. "total": 1,
  183. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  184. }
  185. },
  186. "block_size": 1000000,
  187. "header": {
  188. "version": {
  189. "block": "10",
  190. "app": "0"
  191. },
  192. "chain_id": "cosmoshub-2",
  193. "height": "12",
  194. "time": "2019-04-22T17:01:51.701356223Z",
  195. "last_block_id": {
  196. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  197. "parts": {
  198. "total": 1,
  199. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  200. }
  201. },
  202. "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
  203. "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
  204. "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  205. "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  206. "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
  207. "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
  208. "last_results_hash": "",
  209. "evidence_hash": "",
  210. "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
  211. },
  212. "num_txs": "54"
  213. }
  214. ]
  215. }
  216. }
  217. ```
  218. ### Block
  219. Get block at a specified height.
  220. #### Parameters
  221. - `height (integer)`: height of the requested block. If no height is specified the latest block will be used.
  222. #### Request
  223. ##### HTTP
  224. ```sh
  225. curl http://127.0.0.1:26657/block
  226. curl http://127.0.0.1:26657/block?height=1
  227. ```
  228. ##### JSONRPC
  229. ```sh
  230. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block\",\"params\":{\"height\":\"1\"}}"
  231. ```
  232. #### Response
  233. ```json
  234. {
  235. "id": 0,
  236. "jsonrpc": "2.0",
  237. "result": {
  238. "block_id": {
  239. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  240. "parts": {
  241. "total": 1,
  242. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  243. }
  244. },
  245. "block": {
  246. "header": {
  247. "version": {
  248. "block": "10",
  249. "app": "0"
  250. },
  251. "chain_id": "cosmoshub-2",
  252. "height": "12",
  253. "time": "2019-04-22T17:01:51.701356223Z",
  254. "last_block_id": {
  255. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  256. "parts": {
  257. "total": 1,
  258. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  259. }
  260. },
  261. "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
  262. "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
  263. "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  264. "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  265. "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
  266. "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
  267. "last_results_hash": "",
  268. "evidence_hash": "",
  269. "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
  270. },
  271. "data": [
  272. "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0="
  273. ],
  274. "evidence": [
  275. {
  276. "type": "string",
  277. "height": 0,
  278. "time": 0,
  279. "total_voting_power": 0,
  280. "validator": {
  281. "pub_key": {
  282. "type": "tendermint/PubKeyEd25519",
  283. "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4="
  284. },
  285. "voting_power": 0,
  286. "address": "string"
  287. }
  288. }
  289. ],
  290. "last_commit": {
  291. "height": 0,
  292. "round": 0,
  293. "block_id": {
  294. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  295. "parts": {
  296. "total": 1,
  297. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  298. }
  299. },
  300. "signatures": [
  301. {
  302. "type": 2,
  303. "height": "1262085",
  304. "round": 0,
  305. "block_id": {
  306. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  307. "parts": {
  308. "total": 1,
  309. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  310. }
  311. },
  312. "timestamp": "2019-08-01T11:39:38.867269833Z",
  313. "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
  314. "validator_index": 0,
  315. "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
  316. }
  317. ]
  318. }
  319. }
  320. }
  321. }
  322. ```
  323. ### BlockByHash
  324. #### Parameters
  325. - `hash (string)`: Hash of the block to query for.
  326. #### Request
  327. ##### HTTP
  328. ```sh
  329. curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED
  330. ```
  331. ##### JSONRPC
  332. ```sh
  333. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block_by_hash\",\"params\":{\"hash\":\"0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED\"}}"
  334. ```
  335. #### Response
  336. ```json
  337. {
  338. "id": 0,
  339. "jsonrpc": "2.0",
  340. "result": {
  341. "block_id": {
  342. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  343. "parts": {
  344. "total": 1,
  345. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  346. }
  347. },
  348. "block": {
  349. "header": {
  350. "version": {
  351. "block": "10",
  352. "app": "0"
  353. },
  354. "chain_id": "cosmoshub-2",
  355. "height": "12",
  356. "time": "2019-04-22T17:01:51.701356223Z",
  357. "last_block_id": {
  358. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  359. "parts": {
  360. "total": 1,
  361. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  362. }
  363. },
  364. "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
  365. "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
  366. "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  367. "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  368. "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
  369. "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
  370. "last_results_hash": "",
  371. "evidence_hash": "",
  372. "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
  373. },
  374. "data": [
  375. "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0="
  376. ],
  377. "evidence": [
  378. {
  379. "type": "string",
  380. "height": 0,
  381. "time": 0,
  382. "total_voting_power": 0,
  383. "validator": {
  384. "pub_key": {
  385. "type": "tendermint/PubKeyEd25519",
  386. "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4="
  387. },
  388. "voting_power": 0,
  389. "address": "string"
  390. }
  391. }
  392. ],
  393. "last_commit": {
  394. "height": 0,
  395. "round": 0,
  396. "block_id": {
  397. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  398. "parts": {
  399. "total": 1,
  400. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  401. }
  402. },
  403. "signatures": [
  404. {
  405. "type": 2,
  406. "height": "1262085",
  407. "round": 0,
  408. "block_id": {
  409. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  410. "parts": {
  411. "total": 1,
  412. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  413. }
  414. },
  415. "timestamp": "2019-08-01T11:39:38.867269833Z",
  416. "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
  417. "validator_index": 0,
  418. "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
  419. }
  420. ]
  421. }
  422. }
  423. }
  424. }
  425. ```
  426. ### BlockResults
  427. ### Parameters
  428. - `height (integer)`: Height of the block which contains the results. If no height is specified, the latest block height will be used
  429. #### Request
  430. ##### HTTP
  431. ```sh
  432. curl http://127.0.0.1:26657/block_results
  433. curl http://127.0.0.1:26657/block_results?height=1
  434. ```
  435. ##### JSONRPC
  436. ```sh
  437. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block_results\",\"params\":{\"height\":\"1\"}}"
  438. ```
  439. #### Response
  440. ```json
  441. {
  442. "jsonrpc": "2.0",
  443. "id": 0,
  444. "result": {
  445. "height": "12",
  446. "total_gas_used": "100",
  447. "txs_results": [
  448. {
  449. "code": "0",
  450. "data": "",
  451. "log": "not enough gas",
  452. "info": "",
  453. "gas_wanted": "100",
  454. "gas_used": "100",
  455. "events": [
  456. {
  457. "type": "app",
  458. "attributes": [
  459. {
  460. "key": "YWN0aW9u",
  461. "value": "c2VuZA==",
  462. "index": false
  463. }
  464. ]
  465. }
  466. ],
  467. "codespace": "ibc"
  468. }
  469. ],
  470. "begin_block_events": [
  471. {
  472. "type": "app",
  473. "attributes": [
  474. {
  475. "key": "YWN0aW9u",
  476. "value": "c2VuZA==",
  477. "index": false
  478. }
  479. ]
  480. }
  481. ],
  482. "end_block": [
  483. {
  484. "type": "app",
  485. "attributes": [
  486. {
  487. "key": "YWN0aW9u",
  488. "value": "c2VuZA==",
  489. "index": false
  490. }
  491. ]
  492. }
  493. ],
  494. "validator_updates": [
  495. {
  496. "pub_key": {
  497. "type": "tendermint/PubKeyEd25519",
  498. "value": "9tK9IT+FPdf2qm+5c2qaxi10sWP+3erWTKgftn2PaQM="
  499. },
  500. "power": "300"
  501. }
  502. ],
  503. "consensus_params_updates": {
  504. "block": {
  505. "max_bytes": "22020096",
  506. "max_gas": "1000",
  507. "time_iota_ms": "1000"
  508. },
  509. "evidence": {
  510. "max_age": "100000"
  511. },
  512. "validator": {
  513. "pub_key_types": [
  514. "ed25519"
  515. ]
  516. }
  517. }
  518. }
  519. }
  520. ```
  521. ### Commit
  522. #### Parameters
  523. - `height (integer)`: Height of the block the requested commit pertains to. If no height is set the latest commit will be returned.
  524. #### Request
  525. ##### HTTP
  526. ```sh
  527. curl http://127.0.0.1:26657/commit
  528. curl http://127.0.0.1:26657/commit?height=1
  529. ```
  530. ##### JSONRPC
  531. ```sh
  532. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"commit\",\"params\":{\"height\":\"1\"}}"
  533. ```
  534. #### Response
  535. ```json
  536. {
  537. "jsonrpc": "2.0",
  538. "id": 0,
  539. "result": {
  540. "signed_header": {
  541. "header": {
  542. "version": {
  543. "block": "10",
  544. "app": "0"
  545. },
  546. "chain_id": "cosmoshub-2",
  547. "height": "12",
  548. "time": "2019-04-22T17:01:51.701356223Z",
  549. "last_block_id": {
  550. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  551. "parts": {
  552. "total": 1,
  553. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  554. }
  555. },
  556. "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812",
  557. "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73",
  558. "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  559. "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0",
  560. "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8",
  561. "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C",
  562. "last_results_hash": "",
  563. "evidence_hash": "",
  564. "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E"
  565. },
  566. "commit": {
  567. "height": "1311801",
  568. "round": 0,
  569. "block_id": {
  570. "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
  571. "parts": {
  572. "total": 1,
  573. "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
  574. }
  575. },
  576. "signatures": [
  577. {
  578. "block_id_flag": 2,
  579. "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
  580. "timestamp": "2019-04-22T17:01:58.376629719Z",
  581. "signature": "14jaTQXYRt8kbLKEhdHq7AXycrFImiLuZx50uOjs2+Zv+2i7RTG/jnObD07Jo2ubZ8xd7bNBJMqkgtkd0oQHAw=="
  582. }
  583. ]
  584. }
  585. },
  586. "canonical": true
  587. }
  588. }
  589. ```
  590. ### Validators
  591. #### Parameters
  592. - `height (integer)`: Block height at which the validators were present on. If no height is set the latest commit will be returned.
  593. - `page (integer)`:
  594. - `per_page (integer)`:
  595. #### Request
  596. ##### HTTP
  597. ```sh
  598. curl http://127.0.0.1:26657/validators
  599. ```
  600. ##### JSONRPC
  601. ```sh
  602. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"validators\",\"params\":{\"height\":\"1\", \"page\":\"1\", \"per_page\":\"20\"}}"
  603. ```
  604. #### Response
  605. ```json
  606. {
  607. "jsonrpc": "2.0",
  608. "id": 0,
  609. "result": {
  610. "block_height": "55",
  611. "validators": [
  612. {
  613. "address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
  614. "pub_key": {
  615. "type": "tendermint/PubKeyEd25519",
  616. "value": "9tK9IT+FPdf2qm+5c2qaxi10sWP+3erWTKgftn2PaQM="
  617. },
  618. "voting_power": "239727",
  619. "proposer_priority": "-11896414"
  620. }
  621. ],
  622. "count": "1",
  623. "total": "25"
  624. }
  625. }
  626. ```
  627. ### Genesis
  628. Get Genesis of the chain. If the response is large, this operation
  629. will return an error: use `genesis_chunked` instead.
  630. #### Request
  631. ##### HTTP
  632. ```sh
  633. curl http://127.0.0.1:26657/genesis
  634. ```
  635. ##### JSONRPC
  636. ```sh
  637. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"genesis\"}"
  638. ```
  639. #### Response
  640. ```json
  641. {
  642. "jsonrpc": "2.0",
  643. "id": 0,
  644. "result": {
  645. "genesis": {
  646. "genesis_time": "2019-04-22T17:00:00Z",
  647. "chain_id": "cosmoshub-2",
  648. "initial_height": "2",
  649. "consensus_params": {
  650. "block": {
  651. "max_bytes": "22020096",
  652. "max_gas": "1000",
  653. "time_iota_ms": "1000"
  654. },
  655. "evidence": {
  656. "max_age": "100000"
  657. },
  658. "validator": {
  659. "pub_key_types": [
  660. "ed25519"
  661. ]
  662. }
  663. },
  664. "validators": [
  665. {
  666. "address": "B00A6323737F321EB0B8D59C6FD497A14B60938A",
  667. "pub_key": {
  668. "type": "tendermint/PubKeyEd25519",
  669. "value": "cOQZvh/h9ZioSeUMZB/1Vy1Xo5x2sjrVjlE/qHnYifM="
  670. },
  671. "power": "9328525",
  672. "name": "Certus One"
  673. }
  674. ],
  675. "app_hash": "",
  676. "app_state": {}
  677. }
  678. }
  679. }
  680. ```
  681. ### GenesisChunked
  682. Get the genesis document in a chunks to support easily transfering larger documents.
  683. #### Parameters
  684. - `chunk` (integer): the index number of the chunk that you wish to
  685. fetch. These IDs are 0 indexed.
  686. #### Request
  687. ##### HTTP
  688. ```sh
  689. curl http://127.0.0.1:26657/genesis_chunked?chunk=0
  690. ```
  691. ##### JSONRPC
  692. ```sh
  693. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"genesis_chunked\",\"params\":{\"chunk\":0}}"
  694. ```
  695. #### Response
  696. ```json
  697. {
  698. "jsonrpc": "2.0",
  699. "id": 0,
  700. "result": {
  701. "chunk": 0,
  702. "total": 10,
  703. "data": "dGVuZGVybWludAo="
  704. }
  705. }
  706. ```
  707. ### ConsensusParams
  708. Get the consensus parameters.
  709. #### Parameters
  710. - `height (integer)`: Block height at which the consensus params would like to be fetched for.
  711. #### Request
  712. ##### HTTP
  713. ```sh
  714. curl http://127.0.0.1:26657/consensus_params
  715. ```
  716. ##### JSONRPC
  717. ```sh
  718. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"consensus_params\"}"
  719. ```
  720. #### Response
  721. ```json
  722. {
  723. "jsonrpc": "2.0",
  724. "id": 0,
  725. "result": {
  726. "block_height": "1",
  727. "consensus_params": {
  728. "block": {
  729. "max_bytes": "22020096",
  730. "max_gas": "1000",
  731. "time_iota_ms": "1000"
  732. },
  733. "evidence": {
  734. "max_age": "100000"
  735. },
  736. "validator": {
  737. "pub_key_types": [
  738. "ed25519"
  739. ]
  740. }
  741. }
  742. }
  743. }
  744. ```
  745. ### UnconfirmedTxs
  746. Get a list of unconfirmed transactions.
  747. #### Parameters
  748. - `limit (integer)` The amount of txs to respond with.
  749. #### Request
  750. ##### HTTP
  751. ```sh
  752. curl http://127.0.0.1:26657/unconfirmed_txs
  753. ```
  754. ##### JSONRPC
  755. ```sh
  756. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"unconfirmed_txs\, \"params\":{\"limit\":\"20\"}}"
  757. ```
  758. #### Response
  759. ```json
  760. {
  761. "jsonrpc": "2.0",
  762. "id": 0,
  763. "result": {
  764. "n_txs": "82",
  765. "total": "82",
  766. "total_bytes": "19974",
  767. "txs": [
  768. "gAPwYl3uCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUA75/FmYq9WymsOBJ0XSJ8yV8zmQKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhQbrvwbvlNiT+Yjr86G+YQNx7kRVgowjE1xDQoUjJyJG+WaWBwSiGannBRFdrbma+8SFK2m+1oxgILuQLO55n8mWfnbIzyPCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUQNGfkmhTNMis4j+dyMDIWXdIPiYKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhS8sL0D0wwgGCItQwVowak5YB38KRIUCg4KBXVhdG9tEgUxMDA1NBDoxRgaagom61rphyECn8x7emhhKdRCB2io7aS/6Cpuq5NbVqbODmqOT3jWw6kSQKUresk+d+Gw0BhjiggTsu8+1voW+VlDCQ1GRYnMaFOHXhyFv7BCLhFWxLxHSAYT8a5XqoMayosZf9mANKdXArA="
  769. ]
  770. }
  771. }
  772. ```
  773. ### NumUnconfirmedTxs
  774. Get data about unconfirmed transactions.
  775. #### Parameters
  776. None
  777. #### Request
  778. ##### HTTP
  779. ```sh
  780. curl http://127.0.0.1:26657/num_unconfirmed_txs
  781. ```
  782. ##### JSONRPC
  783. ```sh
  784. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"num_unconfirmed_txs\"}"
  785. ```
  786. #### Response
  787. ```json
  788. {
  789. "jsonrpc": "2.0",
  790. "id": 0,
  791. "result": {
  792. "n_txs": "31",
  793. "total": "82",
  794. "total_bytes": "19974"
  795. }
  796. }
  797. ```
  798. ### Tx
  799. #### Parameters
  800. - `hash (string)`: The hash of the transaction
  801. - `prove (bool)`: If the response should include proof the transaction was included in a block.
  802. #### Request
  803. ##### HTTP
  804. ```sh
  805. curl http://127.0.0.1:26657/num_unconfirmed_txs
  806. ```
  807. ##### JSONRPC
  808. ```sh
  809. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"num_unconfirmed_txs\"}"
  810. ```
  811. #### Response
  812. ```json
  813. {
  814. "jsonrpc": "2.0",
  815. "id": 0,
  816. "result": {
  817. "hash": "D70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED",
  818. "height": "1000",
  819. "index": 0,
  820. "tx_result": {
  821. "log": "[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]",
  822. "gas_wanted": "200000",
  823. "gas_used": "28596",
  824. "tags": [
  825. {
  826. "key": "YWN0aW9u",
  827. "value": "c2VuZA==",
  828. "index": false
  829. }
  830. ]
  831. },
  832. "tx": "5wHwYl3uCkaoo2GaChQmSIu8hxpJxLcCuIi8fiHN4TMwrRIU/Af1cEG7Rcs/6LjTl7YjRSymJfYaFAoFdWF0b20SCzE0OTk5OTk1MDAwEhMKDQoFdWF0b20SBDUwMDAQwJoMGmoKJuta6YchAwswBShaB1wkZBctLIhYqBC3JrAI28XGzxP+rVEticGEEkAc+khTkKL9CDE47aDvjEHvUNt+izJfT4KVF2v2JkC+bmlH9K08q3PqHeMI9Z5up+XMusnTqlP985KF+SI5J3ZOIhhNYWRlIGJ5IENpcmNsZSB3aXRoIGxvdmU="
  833. }
  834. }
  835. ```
  836. ## Transaction Routes
  837. ### BroadCastTxSync
  838. Returns with the response from CheckTx. Does not wait for DeliverTx result.
  839. #### Parameters
  840. - `tx (string)`: The transaction encoded
  841. #### Request
  842. ##### HTTP
  843. ```sh
  844. curl http://127.0.0.1:26657/broadcast_tx_sync?tx=encoded_tx
  845. ```
  846. ##### JSONRPC
  847. ```sh
  848. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_tx_sync\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}"
  849. ```
  850. #### Response
  851. ```json
  852. {
  853. "jsonrpc": "2.0",
  854. "id": 0,
  855. "result": {
  856. "code": "0",
  857. "data": "",
  858. "log": "",
  859. "codespace": "ibc",
  860. "hash": "0D33F2F03A5234F38706E43004489E061AC40A2E"
  861. },
  862. "error": ""
  863. }
  864. ```
  865. ### BroadCastTxAsync
  866. Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.
  867. #### Parameters
  868. - `tx (string)`: The transaction encoded
  869. #### Request
  870. ##### HTTP
  871. ```sh
  872. curl http://127.0.0.1:26657/broadcast_tx_async?tx=encoded_tx
  873. ```
  874. ##### JSONRPC
  875. ```sh
  876. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_tx_async\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}"
  877. ```
  878. #### Response
  879. ```json
  880. {
  881. "jsonrpc": "2.0",
  882. "id": 0,
  883. "result": {
  884. "code": "0",
  885. "data": "",
  886. "log": "",
  887. "codespace": "ibc",
  888. "hash": "0D33F2F03A5234F38706E43004489E061AC40A2E"
  889. },
  890. "error": ""
  891. }
  892. ```
  893. ### CheckTx
  894. Checks the transaction without executing it.
  895. #### Parameters
  896. - `tx (string)`: String of the encoded transaction
  897. #### Request
  898. ##### HTTP
  899. ```sh
  900. curl http://127.0.0.1:26657/check_tx?tx=encoded_tx
  901. ```
  902. ##### JSONRPC
  903. ```sh
  904. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"check_tx\",\"params\":{\"tx\":\"a/encoded_tx/c\"}}"
  905. ```
  906. #### Response
  907. ```json
  908. {
  909. "id": 0,
  910. "jsonrpc": "2.0",
  911. "error": "",
  912. "result": {
  913. "code": "0",
  914. "data": "",
  915. "log": "",
  916. "info": "",
  917. "gas_wanted": "1",
  918. "gas_used": "0",
  919. "events": [
  920. {
  921. "type": "app",
  922. "attributes": [
  923. {
  924. "key": "YWN0aW9u",
  925. "value": "c2VuZA==",
  926. "index": false
  927. }
  928. ]
  929. }
  930. ],
  931. "codespace": "bank"
  932. }
  933. }
  934. ```
  935. ## ABCI Routes
  936. ### ABCIInfo
  937. Get some info about the application.
  938. #### Parameters
  939. None
  940. #### Request
  941. ##### HTTP
  942. ```sh
  943. curl http://127.0.0.1:26657/abci_info
  944. ```
  945. ##### JSONRPC
  946. ```sh
  947. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"abci_info\"}"
  948. ```
  949. #### Response
  950. ```json
  951. {
  952. "jsonrpc": "2.0",
  953. "id": 0,
  954. "result": {
  955. "response": {
  956. "data": "{\"size\":0}",
  957. "version": "0.16.1",
  958. "app_version": "1314126"
  959. }
  960. }
  961. }
  962. ```
  963. ### ABCIQuery
  964. Query the application for some information.
  965. #### Parameters
  966. - `path (string)`: Path to the data. This is defined by the application.
  967. - `data (string)`: The data requested
  968. - `height (integer)`: Height at which the data is being requested for.
  969. - `prove (bool)`: Include proofs of the transactions inclusion in the block
  970. #### Request
  971. ##### HTTP
  972. ```sh
  973. curl http://127.0.0.1:26657/abci_query?path="a/b/c"=IHAVENOIDEA&height=1&prove=true
  974. ```
  975. ##### JSONRPC
  976. ```sh
  977. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"abci_query\",\"params\":{\"path\":\"a/b/c\", \"height\":\"1\", \"bool\":\"true\"}}"
  978. ```
  979. #### Response
  980. ```json
  981. {
  982. "error": "",
  983. "result": {
  984. "response": {
  985. "log": "exists",
  986. "height": "0",
  987. "proof": "010114FED0DAD959F36091AD761C922ABA3CBF1D8349990101020103011406AA2262E2F448242DF2C2607C3CDC705313EE3B0001149D16177BC71E445476174622EA559715C293740C",
  988. "value": "61626364",
  989. "key": "61626364",
  990. "index": "-1",
  991. "code": "0"
  992. }
  993. },
  994. "id": 0,
  995. "jsonrpc": "2.0"
  996. }
  997. ```
  998. ## Evidence Routes
  999. ### BroadcastEvidence
  1000. Broadcast evidence of the misbehavior.
  1001. #### Parameters
  1002. - `evidence (string)`:
  1003. #### Request
  1004. ##### HTTP
  1005. ```sh
  1006. curl http://localhost:26657/broadcast_evidence?evidence=JSON_EVIDENCE_encoded
  1007. ```
  1008. #### JSONRPC
  1009. ```sh
  1010. curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"broadcast_evidence\",\"params\":{\"evidence\":\"JSON_EVIDENCE_encoded\"}}"
  1011. ```
  1012. #### Response
  1013. ```json
  1014. {
  1015. "error": "",
  1016. "result": "",
  1017. "id": 0,
  1018. "jsonrpc": "2.0"
  1019. }
  1020. ```