github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/reference/rpc-endpoints.md (about) 1 --- 2 id: rpc-endpoints 3 --- 4 5 # Gno RPC Endpoints 6 7 For network configurations, view the [network configuration page](./network-config.md). 8 ## Common Parameters 9 10 #### Response 11 12 | Name | Type | Description | 13 | --------------- | ------ | --------------------------------- | 14 | `jsonrpc` | String | The RPC version. | 15 | `id` | String | The response ID. | 16 | `result` | Object | (upon success) The result object. | 17 | `error` | Object | (upon failure) The error object. | 18 | `error.code` | Number | The error code. | 19 | `error.message` | String | The error message. | 20 | `error.data` | String | The error data. | 21 22 ## Health Check 23 24 Call with the `/health` path when verifying that the node is running. 25 26 #### Response 27 28 | Name | Type | Description | 29 | --------- | ------ | ---------------- | 30 | `jsonrpc` | String | The RPC version. | 31 | `id` | String | The response ID. | 32 | `result` | Object | {} | 33 34 ## Check Node Server Status 35 36 Call with the `/status` path to check the information from a node. 37 38 #### Response 39 40 | Name | Type | Description | 41 | --------- | ---------------- | ------------------------------------- | 42 | `jsonrpc` | String | The RPC version. | 43 | `id` | String | The response ID. | 44 | `result` | \[Status Result] | The result of the node server status. | 45 46 #### Status Result 47 48 | Name | Type | Description | 49 | ---------------- | ------ | ----------------------------------- | 50 | `node_info` | Object | General information about the node. | 51 | `sync_info` | Object | The sync information. | 52 | `validator_info` | Object | The validator information. | 53 54 ## Get Network Information 55 56 Call with the `/net_info` path to check the network information from the node. 57 58 #### Response 59 60 | Name | Type | Description | 61 | --------- | ----------------- | ------------------------ | 62 | `jsonrpc` | String | The RPC version. | 63 | `id` | String | The response ID. | 64 | `result` | \[NetInfo Result] | The network information. | 65 66 #### NetInfo Result 67 68 | Name | Type | Description | 69 | ----------- | ---------- | ------------------ | 70 | `listening` | Boolean | Enables listening. | 71 | `listeners` | String \[] | List of listeners. | 72 | `n_peers` | String | Number of peers. | 73 | `peers` | String \[] | List of peers. | 74 75 ## Get Genesis Block Information 76 77 Call with the `/genesis` path to retrieve information about the Genesis block from the node. 78 79 #### Response 80 81 | name | Type | Description | 82 | --------- | ------ | ------------------------------ | 83 | `jsonrpc` | String | The RPC version. | 84 | `id` | String | The response ID. | 85 | `result` | Object | The Genesis block information. | 86 87 ## Get Consensus Parameters 88 89 Call with the /consensus\_params path to check the consensus algorithm parameters at the specified height. 90 91 #### Parameters 92 93 | Name | Description | 94 | -------- | ----------------- | 95 | `height` | The block height. | 96 97 #### Response 98 99 | Name | Type | Description | 100 | --------- | -------------------------- | ------------------------------------ | 101 | `jsonrpc` | String | The RPC Version. | 102 | `id` | String | The response ID. | 103 | `result` | \[Consensus Params Result] | The consensus parameter information. | 104 105 #### Consensus Params Result 106 107 | Name | Type | Description | 108 | ----------------------------- | ------ | -------------------------- | 109 | `block_height` | String | The block height. | 110 | `consensus_params` | Object | The parameter information. | 111 | `consensus_params.Block` | Object | The block parameters. | 112 | `consensus_params.Validator` | Object | The validator parameters. | 113 114 ## Get Consensus State 115 116 Call with the `/consensus_state` to get the consensus state of the Gnoland blockchain 117 118 #### Response 119 120 | Name | Type | Description | 121 | ------- | --------------------------- | -------------------------------- | 122 | jsonrpc | String | The RPC version. | 123 | id | String | The response ID. | 124 | result | \[Consensus State Response] | The consensus state information. | 125 126 #### Consensus State Response 127 128 | Name | Type | Description | 129 | --------------------------------- | ------ | -------------------------------- | 130 | `round_state` | Object | The consensus state object. | 131 | `round_state.height/round/step` | String | The block height / round / step. | 132 | `round_state.start_time` | String | The round start time. | 133 | `round_state.proposal_block_hash` | String | The proposal block hash. | 134 | `round_state.locked_block_hash` | String | The locked block hash. | 135 | `round_state.valid_block_hash` | String | The valid block hash. | 136 | `round_state.height_vote_set` | Object | - | 137 138 ## Get Commit 139 140 Call with the `/commit` path to retrieve commit information at the specified block height. 141 142 #### Parameters 143 144 | Name | Description | 145 | -------- | ----------------- | 146 | `height` | The block height. | 147 148 #### Response 149 150 | Name | Type | Description | 151 | --------- | ---------------- | ----------------------- | 152 | `jsonrpc` | String | The RPC version. | 153 | `id` | String | The response ID. | 154 | `result` | \[Commit Result] | The commit information. | 155 156 #### Commit Result 157 158 | Name | Type | Description | 159 | -------------- | ------- | ------------------------- | 160 | signed\_header | Object | The signed header object. | 161 | canonical | Boolean | Returns commit state. | 162 163 ## Get Block Information 164 165 Call with the `/block` path to retrieve block information at the specified height. 166 167 #### Parameters 168 169 | Name | Description | 170 | -------- | ----------------- | 171 | `height` | The block height. | 172 173 #### Response 174 175 | Name | Type | Description | 176 | --------- | --------------- | ----------------------- | 177 | `jsonrpc` | String | The RPC version. | 178 | `id` | String | The response ID. | 179 | `result` | \[Block Result] | The commit information. | 180 181 #### Block Result 182 183 | Name | Type | Description | 184 | ------------ | ------ | ---------------------- | 185 | `block_meta` | Object | The block metadata. | 186 | `block` | Object | The block information. | 187 188 ## Get Block Results 189 190 Call with the `/block_results` path to retrieve block processing information at the specified height. 191 192 #### Parameters 193 194 | Name | Description | 195 | -------- | ----------------- | 196 | `height` | The block height. | 197 198 #### Response 199 200 | Name | Type | Description | 201 | --------- | --------------- | ------------------ | 202 | `jsonrpc` | String | The RPC version. | 203 | `id` | String | The response ID. | 204 | `result` | \[Block Result] | The result object. | 205 206 #### Block Result 207 208 | Name | Type | Description | 209 | --------- | ------------------------ | ------------------------------------- | 210 | `height` | Object | The block height. | 211 | `results` | \[Block Result Info] \[] | The list of block processing results. | 212 213 #### Block Result Info 214 215 | Name | Type | Description | 216 | --------------------------- | ---------- | -------------------------------- | 217 | `deliver_tx` | Object \[] | The list of transaction results. | 218 | `deliver_tx[].ResponseBase` | Object | The transaction response object. | 219 | `deliver_tx[].GasWanted` | String | Maximum amount of gas to use. | 220 | `deliver_tx[].GasUsed` | String | Actual gas used. | 221 | `begin_block` | Object | Previous block information. | 222 | `end_block` | Object | Next block information. | 223 224 ## Get Block List 225 226 Call with the `/blockchain` path to retrieve information about blocks within a specified range. 227 228 #### Parameters 229 230 | Name | Description | 231 | ----------- | ------------------------- | 232 | `minHeight` | The minimum block height. | 233 | `maxHeight` | The maximum block height. | 234 235 #### Response 236 237 | Name | Type | Description | 238 | --------- | -------------------- | ------------------ | 239 | `jsonrpc` | String | The RPC version. | 240 | `id` | String | The response ID. | 241 | `result` | \[Blockchain Result] | The result object. | 242 243 #### Blockchain Result 244 245 | Name | Type | Description | 246 | ------------- | ---------- | --------------------------- | 247 | `last_height` | String | The latest block height. | 248 | `block_meta` | Object \[] | The list of block metadata. | 249 250 ## Get a No. of Unconfirmed Transactions 251 252 Call with the `/num_unconfirmed_txs` path to get data about unconfirmed transactions. 253 254 #### Response 255 256 | Name | Type | Description | 257 | --------- | ----------------------------- | ------------------ | 258 | `jsonrpc` | String | The RPC version. | 259 | `id` | String | The response ID. | 260 | `result` | \[Num Unconfirmed Txs Result] | The result object. | 261 262 #### Num Unconfirmed Txs Result 263 264 | Name | Type | Description | 265 | ------------- | ------ | --------------------------- | 266 | `n_txs` | String | The number of transactions. | 267 | `total` | String | The total number. | 268 | `total_bytes` | String | Total bytes. | 269 | `txs` | null | - | 270 271 ## Get a List of Unconfirmed Transactions 272 273 Call with the `/unconfirmed_txs` path to get a list of unconfirmed transactions. 274 275 #### Parameters 276 277 | Name | Description | 278 | ------- | --------------------------------------- | 279 | `limit` | The maximum transaction numbers to get. | 280 281 #### Response 282 283 | Name | Type | Description | 284 | --------- | ------------------------- | ------------------ | 285 | `jsonrpc` | String | The RPC version. | 286 | `id` | String | The response ID. | 287 | `result` | \[Unconfirmed Txs Result] | The result object. | 288 289 #### Unconfirmed Txs Result 290 291 | Name | Type | Description | 292 | ------------- | ---------- | ----------------------------------- | 293 | `n_txs` | String | The number of transactions. | 294 | `total` | String | The total number. | 295 | `total_bytes` | String | Total bytes. | 296 | `txs` | Object \[] | A list of unconfirmed transactions. | 297 298 ## Get a List of Validators 299 300 Call with the `/validators` path to get a list of validators at a specific height. 301 302 #### Parameters 303 304 | Name | Description | 305 | -------- | ----------------------------------------- | 306 | `height` | The block height (default: newest block). | 307 308 #### Response 309 310 | Name | Type | Description | 311 | --------- | -------------------- | ------------------ | 312 | `jsonrpc` | String | The RPC version. | 313 | `id` | String | The response ID. | 314 | `result` | \[Validators Result] | The result object. | 315 316 #### Validators Result 317 318 | Name | Type | Description | 319 | -------------- | ---------------- | ----------------------- | 320 | `block_height` | Object | The block height. | 321 | `validators` | \[Validator] \[] | The list of validators. | 322 323 #### Validator 324 325 | Name | Type | Description | 326 | ------------------- | ---------- | ---------------------------------------- | 327 | `address` | String | The address of the validator. | 328 | `pub_key` | Object \[] | The public key object of the validator. | 329 | `pub_key.@type` | String | The type of validator's public key. | 330 | `pub_key.value` | String | The value of the validator's public key. | 331 | `voting_power` | String | Voting power of the validator. | 332 | `proposer_priority` | String | The priority of the proposer. | 333 334 ## Broadcast a Transaction - Asynchronous 335 336 Call with the `/broadcast_tx_async` path to create and broadcast a transaction without waiting for the transaction response. 337 338 #### Parameters 339 340 | Name | Description | 341 | ---- | ------------------------------------------- | 342 | `tx` | The value of the signed transaction binary. | 343 344 #### Response 345 346 | Name | Type | Description | 347 | --------- | --------------------- | ------------------ | 348 | `jsonrpc` | String | The RPC version. | 349 | `id` | String | The response ID. | 350 | `result` | \[Transaction Result] | The result object. | 351 352 #### Transaction Result 353 354 | Name | Type | Description | 355 | ----- | ------ | ---------------------------- | 356 | hash | String | The transaction hash. | 357 | data | Object | The transaction data object. | 358 | error | Object | The error object. | 359 | log | String | The log information. | 360 361 ## Broadcast a Transaction - Synchronous 362 363 Call with the `/broadcast_tx_sync` path to create and broadcast a transaction, then wait for the transaction response. 364 365 #### Parameters 366 367 | Name | Description | 368 | ---- | ------------------------------------------- | 369 | `tx` | The value of the signed transaction binary. | 370 371 #### Response 372 373 | Name | Type | Description | 374 | --------- | --------------------- | ------------------ | 375 | `jsonrpc` | String | The RPC version. | 376 | `id` | String | The response ID. | 377 | `result` | \[Transaction Result] | The result object. | 378 379 #### Transaction Result 380 381 | Name | Type | Description | 382 | ----- | ------ | ---------------------------- | 383 | hash | String | The transaction hash. | 384 | data | Object | The transaction data object. | 385 | error | Object | The error object. | 386 | log | String | The log information. | 387 388 ## (NOT RECOMMENDED) Broadcast Transaction and Get Commit Information 389 390 Call with the `/broadcast_tx_commit` path to create and broadcast a transaction, then wait for the transaction response and the commit response. 391 392 #### Parameters 393 394 | Name | Description | 395 | ---- | ------------------------------------------- | 396 | `tx` | The value of the signed transaction binary. | 397 398 #### Response 399 400 | Name | Type | Description | 401 | --------- | ---------------------------- | ------------------ | 402 | `jsonrpc` | String | The RPC version. | 403 | `id` | String | The response ID. | 404 | `result` | \[Transaction Commit Result] | The result object. | 405 406 #### Transaction Commit Result 407 408 | Name | Type | Description | 409 | ------------ | ------ | ----------------------------------------------------------- | 410 | `height` | String | The height of the block when the transaction was committed. | 411 | hash | String | The transaction hash. | 412 | `deliver_tx` | Object | The delivered transaction information. | 413 | `check_tx` | Object | The committed transaction information. | 414 415 ## ABCI 416 417 ### Get ABCI Information 418 419 Call with the `/abci_info` path to get the latest information about the ABCI. 420 421 #### Response 422 423 | Name | Type | Description | 424 | --------- | ------------------- | ----------------------- | 425 | `jsonrpc` | String | The RPC version. | 426 | `id` | String | The response ID. | 427 | `result` | \[ABCI Info Result] | The commit information. | 428 429 #### ABCI Info Result 430 431 | Name | Type | Description | 432 | --------------------------- | ---------------- | -------------------------- | 433 | `response` | Object | The metadata of the block. | 434 | `response.ResponseBase` | \[ABCI Response] | The ABCI response data. | 435 | `response.ABCIVersion` | String | The ABCI version. | 436 | `response.AppVersion` | String | The app version. | 437 | `response.LastBlockHeight` | String | The latest block height. | 438 | `response.LastBlockAppHash` | String | The latest block hash. | 439 440 #### ABCI Response 441 442 | Name | Type | Description | 443 | ------ | ---------- | --------------------------------- | 444 | Data | String | The Base64-encoded response data. | 445 | Error | Object | The ABCI response error object. | 446 | Events | Object \[] | The list of event objects. | 447 | Log | String | The ABCI response log. | 448 | Info | String | The ABCI response information. | 449 450 ### Get ABCI Query 451 452 Call with the `/abci_query` to get information via the ABCI Query. 453 454 #### Query 455 456 | Name | Description | 457 | ------------------------- | ------------------------------------------------------------------ | 458 | `auth/accounts/{ADDRESS}` | Returns the account information. | 459 | `bank/balances/{ADDRESS}` | Returns the balance information about the account. | 460 | `vm/qfuncs` | Returns public facing function signatures as JSON. | 461 | `vm/qfile` | Returns the file bytes, or list of files if directory. | 462 | `vm/qrender` | Calls `.Render(<path>)` in readonly mode. | 463 | `vm/qeval` | Evaluates any expression in readonly mode and returns the results. | 464 | `vm/store` | (not yet supported) Fetches items from the store. | 465 | `vm/package` | (not yet supported) Fetches a package's files. | 466 467 #### Parameters 468 469 | Name | Description | 470 | ------------------- | ------------------------------------------------ | 471 | `path` | The query path. | 472 | `data` | The data from the query path. | 473 | (optional) `height` | The block height (default: latest block height). | 474 | (optional) `prove` | The validation status. | 475 476 #### Response 477 478 | Name | Type | Description | 479 | --------- | -------------------- | ----------------------- | 480 | `jsonrpc` | String | The RPC version. | 481 | `id` | String | The response ID. | 482 | `result` | \[ABCI Query Result] | The commit information. | 483 484 #### ABCI Query Result 485 486 | Name | Type | Description | 487 | ----------------------- | ---------------- | -------------------------- | 488 | `response` | Object | The metadata of the block. | 489 | `response.ResponseBase` | \[ABCI Response] | The ABCI response data. | 490 | `response.Key` | String | The key. | 491 | `response.Value` | String | The value. | 492 | `response.Proof` | String | The validation ID. | 493 | `response.Height` | String | The block height. | 494 495 #### ABCI Response 496 497 | Name | Type | Description | 498 | ------ | ---------- | --------------------------------- | 499 | Data | String | The Base64-encoded response data. | 500 | Error | Object | The ABCI response error object. | 501 | Events | Object \[] | The list of event objects. | 502 | Log | String | The ABCI response log. | 503 | Info | String | The ABCI response information. |