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