Block / Chunk
The RPC API enables you to query the network and get details about specific blocks or chunks.
Last updated
The RPC API enables you to query the network and get details about specific blocks or chunks.
Last updated
Queries network and returns block for given height or hash. You can also use
finality
param to return latest block details.
Note: You may choose to search by a specific block or finality, you can not choose both.
method: block
params:
finality
OR block_id
finality
example:
JSON
JavaScript
HTTPie
[block_id]
JSON
JavaScript
HTTPie
[block_hash]
Heads up
The fields
code
,data
, andmessage
in 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.info
for 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.info
for more details
Returns changes in block for given block height or hash. You can also use
finality
param 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_block
params:
finality
OR block_id
finality
[block_id]
block_hash
Heads up
The fields
code
,data
, andmessage
in 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.info
for 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.info
for more details
Returns details of a specific chunk. You can run a block details query to get a valid chunk hash.
method: chunk
params:
chunk_id
OR block_id
, shard_id
chunk_id
example:
JSON
JavaScript
HTTPie
block_id
, shard_id
example:
JSON
JavaScript
HTTPie
Heads up
The fields
code
,data
, andmessage
in 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.info
for 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.info
for more details
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 convention for structuring the error response:
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 convention for structuring the error response:
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 convention for structuring the error response: