Block Data
Block Data (v0.38.x)
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:
- URI over HTTP
- JSONRPC over HTTP
- JSONRPC over websockets
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 block headers (max: 20) for minHeight <= height <= maxHeight.
Get block headers for minHeight <= height <= maxHeight.
At most 20 items will be returned.
Upon success, the Cache-Control header will be set with the default
maximum age.
query Parameters
| minHeight | integer Example: minHeight=1 Minimum block height to return |
| maxHeight | integer Example: maxHeight=2 Maximum block height to return |
Responses
Response samples
- 200
- 500
{- "id": 0,
- "jsonrpc": "2.0",
- "result": {
- "last_height": "1276718",
- "block_metas": [
- {
- "block_id": {
- "hash": "112BC173FD838FB68EB43476816CD7B4C6661B6884A9E357B417EE957E1CF8F7",
- "parts": {
- "total": 1,
- "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
}, - "block_size": 1000000,
- "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"
}, - "num_txs": "54"
}
]
}
}Get header at a specified height
Get Header.
If the height field is set to a non-default value, upon success, the
Cache-Control header will be set with the default maximum age.
query Parameters
| height | integer Default: 0 Example: height=1 height to return. If no height is provided, it will fetch the latest header. |
Responses
Response samples
- 200
- 500
{- "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"
}Get header by hash
Get Header By Hash.
Upon success, the Cache-Control header will be set with the default
maximum age.
query Parameters
| hash required | string Example: hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED header hash |
Responses
Response samples
- 200
- 500
{- "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"
}Get block at a specified height
Get Block.
If the height field is set to a non-default value, upon success, the
Cache-Control header will be set with the default maximum age.
query Parameters
| height | integer Default: 0 Example: height=1 height to return. If no height is provided, it will fetch the latest block. |
Responses
Response samples
- 200
- 500
{- "id": 0,
- "jsonrpc": "2.0",
- "result": {
- "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": 1,
- "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
}, - "timestamp": "2019-08-01T11:39:38.867269833Z",
- "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
- "validator_index": 0,
- "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
}
]
}
}
}
}Get block by hash
Get Block By Hash.
Upon success, the Cache-Control header will be set with the default
maximum age.
query Parameters
| hash required | string Example: hash=0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED block hash |
Responses
Response samples
- 200
- 500
{- "id": 0,
- "jsonrpc": "2.0",
- "result": {
- "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": 1,
- "hash": "38D4B26B5B725C4F13571EFE022C030390E4C33C8CF6F88EDD142EA769642DBD"
}
}, - "timestamp": "2019-08-01T11:39:38.867269833Z",
- "validator_address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
- "validator_index": 0,
- "signature": "DBchvucTzAUEJnGYpNvMdqLhBAHG4Px8BsOBB3J3mAFCLGeuG7uJqy+nVngKzZdPhPi8RhmE/xcw/M9DOJjEDg=="
}
]
}
}
}
}