github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/spec/rpc/README.md (about) 1 # RPC spec 2 3 Please ensure you've first read the spec for [CometBFT RPC spec](https://github.com/cometbft/cometbft/blob/v0.34.x/spec/rpc/README.md). Here only defines the difference between CometBFT. 4 5 ## Support 6 7 Ostracon has only a Go implementation. 8 9 ## Info Routes 10 11 ### Block 12 13 Ostracon adds entropy to the [Block](https://github.com/cometbft/cometbft/blob/v0.34.x/spec/rpc/README.md#block) response. 14 15 #### Parameters 16 17 - `height (integer)`: height of the requested block. If no height is specified the latest block will be used. 18 19 #### Request 20 21 ##### HTTP 22 23 ```sh 24 curl http://127.0.0.1:26657/block 25 curl http://127.0.0.1:26657/block?height=1 26 ``` 27 28 ##### JSONRPC 29 30 ```sh 31 curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block\",\"params\":{\"height\":\"1\"}}" 32 ``` 33 34 #### Response 35 36 ```json 37 { 38 "id": 0, 39 "jsonrpc": "2.0", 40 "result": { 41 "block_id": { 42 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 43 "parts": { 44 "total": 1, 45 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 46 } 47 }, 48 "block": { 49 "header": { 50 "version": { 51 "block": "10", 52 "app": "0" 53 }, 54 "chain_id": "cosmoshub-2", 55 "height": "12", 56 "time": "2019-04-22T17:01:51.701356223Z", 57 "last_block_id": { 58 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 59 "parts": { 60 "total": 1, 61 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 62 } 63 }, 64 "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", 65 "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", 66 "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", 67 "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", 68 "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", 69 "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", 70 "last_results_hash": "", 71 "evidence_hash": "", 72 "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" 73 }, 74 "data": [ 75 "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0=" 76 ], 77 "evidence": [ 78 { 79 "type": "string", 80 "height": 0, 81 "time": 0, 82 "total_voting_power": 0, 83 "validator": { 84 "pub_key": { 85 "type": "tendermint/PubKeyEd25519", 86 "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4=" 87 }, 88 "voting_power": 0, 89 "address": "string" 90 } 91 } 92 ], 93 "last_commit": { 94 "height": 0, 95 "round": 0, 96 "block_id": { 97 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 98 "parts": { 99 "total": 1, 100 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 101 } 102 }, 103 "signatures": [ 104 { 105 "type": 2, 106 "height": "1262085", 107 "round": 0, 108 "block_id": { 109 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 110 "parts": { 111 "total": 1, 112 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 113 } 114 }, 115 "timestamp": "2019-08-01T11:39:38.867269833Z", 116 "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", 117 "validator_index": 0, 118 "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg==" 119 } 120 ] 121 }, 122 "entropy": { 123 "round": 0, 124 "proof": "03a9873d2c5fa9240cf987383b6127cc49cff64ec34f749aa71da80ced8584b9e43c866f96c07c83ba58e319572587485800190c79fcca8c0409e80b6af4279e4e9a889abcb4c1e2561499ad523bc4cbb2", 125 } 126 } 127 } 128 } 129 ``` 130 131 ### BlockByHash 132 133 Ostracon adds entropy to the [BlockByHash](https://github.com/cometbft/cometbft/blob/v0.34.x/spec/rpc/README.md#blockbyhash) response. 134 135 #### Parameters 136 137 - `hash (string)`: Hash of the block to query for. 138 139 #### Request 140 141 ##### HTTP 142 143 ```sh 144 curl http://127.0.0.1:26657/block_by_hash?hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED 145 ``` 146 147 ##### JSONRPC 148 149 ```sh 150 curl -X POST https://localhost:26657 -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"block_by_hash\",\"params\":{\"hash\":\"0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED\"}}" 151 ``` 152 153 #### Response 154 155 ```json 156 { 157 "id": 0, 158 "jsonrpc": "2.0", 159 "result": { 160 "block_id": { 161 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 162 "parts": { 163 "total": 1, 164 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 165 } 166 }, 167 "block": { 168 "header": { 169 "version": { 170 "block": "10", 171 "app": "0" 172 }, 173 "chain_id": "cosmoshub-2", 174 "height": "12", 175 "time": "2019-04-22T17:01:51.701356223Z", 176 "last_block_id": { 177 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 178 "parts": { 179 "total": 1, 180 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 181 } 182 }, 183 "last_commit_hash": "21B9BC845AD2CB2C4193CDD17BFC506F1EBE5A7402E84AD96E64171287A34812", 184 "data_hash": "970886F99E77ED0D60DA8FCE0447C2676E59F2F77302B0C4AA10E1D02F18EF73", 185 "validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", 186 "next_validators_hash": "D658BFD100CA8025CFD3BECFE86194322731D387286FBD26E059115FD5F2BCA0", 187 "consensus_hash": "0F2908883A105C793B74495EB7D6DF2EEA479ED7FC9349206A65CB0F9987A0B8", 188 "app_hash": "223BF64D4A01074DC523A80E76B9BBC786C791FB0A1893AC5B14866356FCFD6C", 189 "last_results_hash": "", 190 "evidence_hash": "", 191 "proposer_address": "D540AB022088612AC74B287D076DBFBC4A377A2E" 192 }, 193 "data": [ 194 "yQHwYl3uCkKoo2GaChRnd+THLQ2RM87nEZrE19910Z28ABIUWW/t8AtIMwcyU0sT32RcMDI9GF0aEAoFdWF0b20SBzEwMDAwMDASEwoNCgV1YXRvbRIEMzEwMRCd8gEaagom61rphyEDoJPxlcjRoNDtZ9xMdvs+lRzFaHe2dl2P5R2yVCWrsHISQKkqX5H1zXAIJuC57yw0Yb03Fwy75VRip0ZBtLiYsUqkOsPUoQZAhDNP+6LY+RUwz/nVzedkF0S29NZ32QXdGv0=" 195 ], 196 "evidence": [ 197 { 198 "type": "string", 199 "height": 0, 200 "time": 0, 201 "total_voting_power": 0, 202 "validator": { 203 "pub_key": { 204 "type": "tendermint/PubKeyEd25519", 205 "value": "A6DoBUypNtUAyEHWtQ9bFjfNg8Bo9CrnkUGl6k6OHN4=" 206 }, 207 "voting_power": 0, 208 "address": "string" 209 } 210 } 211 ], 212 "last_commit": { 213 "height": 0, 214 "round": 0, 215 "block_id": { 216 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 217 "parts": { 218 "total": 1, 219 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 220 } 221 }, 222 "signatures": [ 223 { 224 "type": 2, 225 "height": "1262085", 226 "round": 0, 227 "block_id": { 228 "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7", 229 "parts": { 230 "total": 1, 231 "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD" 232 } 233 }, 234 "timestamp": "2019-08-01T11:39:38.867269833Z", 235 "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F", 236 "validator_index": 0, 237 "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg==" 238 } 239 ] 240 }, 241 "entropy": { 242 "round": 0, 243 "proof": "03a9873d2c5fa9240cf987383b6127cc49cff64ec34f749aa71da80ced8584b9e43c866f96c07c83ba58e319572587485800190c79fcca8c0409e80b6af4279e4e9a889abcb4c1e2561499ad523bc4cbb2", 244 } 245 } 246 } 247 } 248 ```