Consensus & Validators
Consensus Validators (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 validator set at a specified height
Get Validators. Validators are sorted first by voting power (descending), then by address (ascending).
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 validator set which corresponds to the latest 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) |
Responses
Response samples
- 200
- 500
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "block_height": "55",
- "validators": [
- {
- "address": "000001E443FD237E4B616E2FA69DF4EE3D49A94F",
- "pub_key": {
- "type": "tendermint/PubKeyEd25519",
- "value": "9tK9IT+FPdf2qm+5c2qaxi10sWP+3erWTKgftn2PaQM="
}, - "voting_power": "239727",
- "proposer_priority": "-11896414"
}
], - "count": "1",
- "total": "25"
}
}Get Genesis
Get genesis.
Upon success, the Cache-Control header will be set with the default
maximum age.
Responses
Response samples
- 200
- 500
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "genesis": {
- "genesis_time": "2019-04-22T17:00:00Z",
- "chain_id": "cosmoshub-2",
- "initial_height": "2",
- "consensus_params": {
- "block": {
- "max_bytes": "22020096",
- "max_gas": "1000",
- "time_iota_ms": "1000"
}, - "evidence": {
- "max_age": "100000"
}, - "validator": {
- "pub_key_types": [
- "ed25519"
]
}
}, - "validators": [
- {
- "address": "B00A6323737F321EB0B8D59C6FD497A14B60938A",
- "pub_key": {
- "type": "tendermint/PubKeyEd25519",
- "value": "cOQZvh/h9ZioSeUMZB/1Vy1Xo5x2sjrVjlE/qHnYifM="
}, - "power": "9328525",
- "name": "Certus One"
}
], - "app_hash": "",
- "app_state": { }
}
}
}Get Genesis in multiple chunks
Get genesis document in multiple chunks to make it easier to iterate through larger genesis structures. Each chunk is produced by converting the genesis document to JSON and then splitting the resulting payload into 16MB blocks, and then Base64-encoding each block.
Upon success, the Cache-Control header will be set with the default
maximum age.
query Parameters
| chunk | integer Default: 0 Example: chunk=1 Sequence number of the chunk to download. |
Responses
Response samples
- 200
- 500
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "chunk": 0,
- "total": 1,
- "data": "Z2VuZXNpcwo="
}
}Get consensus state
Get consensus state.
Not safe to call from inside the ABCI application during a block execution.
Responses
Response samples
- 200
- 500
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "round_state": {
- "height/round/step": "1262197/0/8",
- "start_time": "2019-08-01T11:52:38.962730289Z",
- "proposal_block_hash": "634ADAF1F402663BEC2ABC340ECE8B4B45AA906FA603272ACC5F5EED3097E009",
- "locked_block_hash": "634ADAF1F402663BEC2ABC340ECE8B4B45AA906FA603272ACC5F5EED3097E009",
- "valid_block_hash": "634ADAF1F402663BEC2ABC340ECE8B4B45AA906FA603272ACC5F5EED3097E009",
- "height_vote_set": [
- {
- "round": 0,
- "prevotes": [
- "Vote{0:000001E443FD 1262197/00/1(Prevote) 634ADAF1F402 7BB974E1BA40 @ 2019-08-01T11:52:35.513572509Z}",
- "nil-Vote"
], - "prevotes_bit_array": "BA{100:xxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 169753436/170151262 = 1.00",
- "precommits": [
- "Vote{5:18C78D135C9D 1262197/00/2(Precommit) 634ADAF1F402 8B5EFFFEABCD @ 2019-08-01T11:52:36.25600005Z}",
- "nil-Vote"
], - "precommits_bit_array": "BA{100:xxxxxx_xxxxx_xxxx_x_xxx_xx_xx_xx__x_x_x__xxxxxxxxxxxxxx_xxxx_xx_xxxxxx_xxxxxxxx_xxxx_xxx_x_xxxx__xxx} 118726247/170151262 = 0.70"
}
], - "proposer": {
- "address": "D540AB022088612AC74B287D076DBFBC4A377A2E",
- "index": 0
}
}
}
}Get consensus parameters
Get consensus parameters.
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 commit informations regarding the latest block. |
Responses
Response samples
- 200
- 500
{- "jsonrpc": "2.0",
- "id": 0,
- "result": {
- "block_height": "1",
- "consensus_params": {
- "block": {
- "max_bytes": "22020096",
- "max_gas": "1000",
- "time_iota_ms": "1000"
}, - "evidence": {
- "max_age": "100000"
}, - "validator": {
- "pub_key_types": [
- "ed25519"
]
}
}
}
}