Block / Chunk
The RPC API enables you to query the network and get details about specific blocks or chunks.
Block details
Queries network and returns block for given height or hash. You can also use
finalityparam to return latest block details.
Note: You may choose to search by a specific block or finality, you can not choose both.
method:
blockparams:
finalityORblock_id
finality example:
JSON
JavaScript
HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "block",
"params": {
"finality": "final"
}
}[block_id]
JSON
JavaScript
HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "block",
"params": {
"block_id": 17821130
}
}[block_hash]
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "block",
"params": {
"block_id": "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d"
}
}const response = await abogida.connection.provider.block( {blockId: "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d"} );http post https://rpc.testnet.abogida.network jsonrpc=2.0 id=dontcare method=block
params:='{ "block_id": "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d" }'What Could Go Wrong??
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}Heads up
The fields
code,data, andmessagein the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by block method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
NOT_SYNCED_YET
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.infofor more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.infofor more details
Changes in Block
Returns changes in block for given block height or hash. You can also use
finalityparam to return latest block details.
Note: You may choose to search by a specific block or finality, you can not choose both.
method:
EXPERIMENTAL_changes_in_blockparams:
finalityORblock_id
finality
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "EXPERIMENTAL_changes_in_block",
"params": {
"finality": "final"
}
}const response = await abogida.connection.provider.block({
finality: "final",
});http post https://rpc.testnet.abogida.network jsonrpc=2.0 id=dontcare method=block \
params:='{
"finality": "final"
}'[block_id]
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "block",
"params": {
"block_id": 17821130
}
}const response = await abogida.connection.provider.block({blockId: 17821130});http post https://rpc.testnet.abogida.network jsonrpc=2.0 id=dontcare method=block \
params:='{
"block_id": 17821130
}'block_hash
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "block",
"params": {
"block_id": "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d"
}
}const response = await abogida.connection.provider.block(
{blockId: "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d"}
);http post https://rpc.testnet.abogida.network jsonrpc=2.0 id=dontcare method=block \
params:='{
"block_id": "7nsuuitwS7xcdGnD9JgrE22cRB2vf2VS4yh1N9S71F4d"
}'What Could Go Wrong??
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}Heads up
The fields
code,data, andmessagein the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by EXPERIMENTAL_changes_in_block method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
NOT_SYNCED_YET
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.infofor more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.infofor more details
Chunk Details
Returns details of a specific chunk. You can run a block details query to get a valid chunk hash.
method:
chunkparams:
chunk_idORblock_id,shard_id
chunk_id example:
JSON
JavaScript
HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "chunk",
"params": {"chunk_id": "EBM2qg5cGr47EjMPtH88uvmXHDHqmWPzKaQadbWhdw22"}
}block_id, shard_id example:
JSON
JavaScript
HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "chunk",
"params": {"block_id": 58934027, "shard_id": 0}
}What Could Go Wrong??
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}Heads up
The fields
code,data, andmessagein the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by chunk method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
UNKNOWN_CHUNK
The requested chunk can't be found in a database
Check that the requested chunk is legit
If the chunk had been produced more than 5 epochs ago, try to send your request to an archival node
INVALID_SHARD_ID
Provided shard_id does not exist
Provide shard_id for an existing shard
NOT_SYNCED_YET
The node is still syncing and the requested chunk is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.infofor more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.infofor more details
Last updated