Download OpenAPI specification:Download
The Node RPC endpoints are intended for working with the blockchain consensus layer directly. These endpoints return information about the blocks, validators, and network layer itself while the API endpoints work at a higher level and are used to return information at the blockchain Application layer.
The RPC service would typically be used by users and applications that wish to retrieve information about raw blocks being produced or monitor for transactions and network activity.
The Node RPC service supports the following communication protocols:
A bearer token is required for all requests.
Exchange client id and client secret for a token:
curl -XPOST https://dev-v6yakh57b7z3ngqo.us.auth0.com/oauth/token \
-H \"content-type: application/json\" \
-d '{\"client_id\":\"<id>\",\"client_secret\":\"<secret>\",\"audience\":\"https://api.provlabs.com\",\"grant_type\":\"client_credentials\"}'
The returned token can then be used to make API calls:
curl -XGET -H \"Authorization: Bearer <token>\" https://pio-mainnet-1-rpc.provlabs.com/block?height=5
Arguments which expect strings or byte arrays may be passed as quoted
strings, like "abc" or as 0x-prefixed strings, like 0x616263.
JSONRPC requests can be POST'd to the root RPC endpoint via HTTP.
curl --header "Content-Type: application/json" --request POST --data '{"method": "block", "params": ["5"], "id": 1}' https://pio-mainnet-1-rpc.provlabs.com
JSONRPC requests can be also made via websocket.
The websocket endpoint is at /websocket, e.g. https://pio-mainnet-1-rpc.provlabs.com/websocket.
Asynchronous RPC functions like event subscribe and unsubscribe are
only available via websockets.
For example using the websocat tool, you can subscribe for 'NewBlock` events with the following command:
echo '{ "jsonrpc": "2.0","method": "subscribe","id": 0,"params": {"query": "tm.event='"'NewBlock'"'"} }' | websocat -n -t wss://pio-mainnet-1-rpc.provlabs.com/websocket
Get list of unconfirmed transactions
| limit | integer Default: 30 Example: limit=1 Maximum number of unconfirmed transactions to return (max 100) |
{- "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="
]
}
}Search for transactions w/ their results.
See /subscribe for the query syntax.
| query required | string Example: query="tx.height=1000" Query |
| prove | boolean Default: false Example: prove=true Include proofs of the transactions inclusion in the block |
| page | integer Default: 1 Example: page=1 Page number (1-based) |
| per_page | integer Default: 30 Example: per_page=30 Number of entries per page (max: 100) |
| order_by | string Default: "asc" Example: order_by=asc Order in which transactions are sorted ("asc" or "desc"), by height & index. If empty, default sorting will be still applied. |
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "txs": [
- {
- "hash": "D70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED",
- "height": "1000",
- "index": 0,
- "tx_result": {
- "log": "[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]",
- "gas_wanted": "200000",
- "gas_used": "28596",
- "tags": {
- "key": "action",
- "value": "send",
- "index": false
}
}, - "tx": "5wHwYl3uCkaoo2GaChQmSIu8hxpJxLcCuIi8fiHN4TMwrRIU/Af1cEG7Rcs/6LjTl7YjRSymJfYaFAoFdWF0b20SCzE0OTk5OTk1MDAwEhMKDQoFdWF0b20SBDUwMDAQwJoMGmoKJuta6YchAwswBShaB1wkZBctLIhYqBC3JrAI28XGzxP+rVEticGEEkAc+khTkKL9CDE47aDvjEHvUNt+izJfT4KVF2v2JkC+bmlH9K08q3PqHeMI9Z5up+XMusnTqlP985KF+SI5J3ZOIhhNYWRlIGJ5IENpcmNsZSB3aXRoIGxvdmU=",
- "proof": {
- "RootHash": "72FE6BF6D4109105357AECE0A82E99D0F6288854D16D8767C5E72C57F876A14D",
- "Data": "5wHwYl3uCkaoo2GaChQmSIu8hxpJxLcCuIi8fiHN4TMwrRIU/Af1cEG7Rcs/6LjTl7YjRSymJfYaFAoFdWF0b20SCzE0OTk5OTk1MDAwEhMKDQoFdWF0b20SBDUwMDAQwJoMGmoKJuta6YchAwswBShaB1wkZBctLIhYqBC3JrAI28XGzxP+rVEticGEEkAc+khTkKL9CDE47aDvjEHvUNt+izJfT4KVF2v2JkC+bmlH9K08q3PqHeMI9Z5up+XMusnTqlP985KF+SI5J3ZOIhhNYWRlIGJ5IENpcmNsZSB3aXRoIGxvdmU=",
- "Proof": {
- "total": "2",
- "index": "0",
- "leaf_hash": "eoJxKCzF3m72Xiwb/Q43vJ37/2Sx8sfNS9JKJohlsYI=",
- "aunts": [
- "eWb+HG/eMmukrQj4vNGyFYb3nKQncAWacq4HF5eFzDY="
]
}
}
}
], - "total_count": "2"
}
}Search for blocks by FinalizeBlock events.
See /subscribe for the query syntax.
| query required | string Example: query="block.height > 1000" Query |
| page | integer Default: 1 Example: page=1 Page number (1-based) |
| per_page | integer Default: 30 Example: per_page=30 Number of entries per page (max: 100) |
| order_by | string Default: "desc" Example: order_by=asc Order in which blocks are sorted ("asc" or "desc"), by height. If empty, default sorting will be still applied. |
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "blocks": [
- {
- "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": null,
- "hash": null
}
}, - "timestamp": "2019-08-01T11:39:38.867269833Z",
- "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
- "validator_index": 0,
- "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
}
]
}
}
}
], - "total_count": 2
}
}Get a transaction
Upon success, the Cache-Control header will be set with the default
maximum age.
| hash required | string Example: hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED hash of transaction to retrieve |
| prove | boolean Default: false Example: prove=true Include proofs of the transaction's inclusion in the block |
{- "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": "action",
- "value": "send",
- "index": false
}
]
}, - "tx": "5wHwYl3uCkaoo2GaChQmSIu8hxpJxLcCuIi8fiHN4TMwrRIU/Af1cEG7Rcs/6LjTl7YjRSymJfYaFAoFdWF0b20SCzE0OTk5OTk1MDAwEhMKDQoFdWF0b20SBDUwMDAQwJoMGmoKJuta6YchAwswBShaB1wkZBctLIhYqBC3JrAI28XGzxP+rVEticGEEkAc+khTkKL9CDE47aDvjEHvUNt+izJfT4KVF2v2JkC+bmlH9K08q3PqHeMI9Z5up+XMusnTqlP985KF+SI5J3ZOIhhNYWRlIGJ5IENpcmNsZSB3aXRoIGxvdmU="
}
}