Informational JSON-RPC Methods
The following methods return information from a node on a Casper network. The response should be identical, regardless of the node queried, as the information in question is objective and common to all nodes within a network.
chain_get_block
This method returns the JSON representation of a Block from the network.
| Parameter | Type | Description |
|---|---|---|
| block_identifier | Object | The Block hash or the Block height. |
Example chain_get_block request
{
"id": 1,
"jsonrpc": "2.0",
"method": "chain_get_block",
"params": [
{
"Hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb"
}
]
}
chain_get_block_result
The result from chain_get_block depends on block availability from a given node. If chain_get_block returns an error message that the node does not have information on the given block, you may attempt to get the information from a different node.
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| block | Object | The Block, if found. (Not required) |
Example chain_get_block result
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api_version": "1.4.13",
"block": {
"body": {
"deploy_hashes": [],
"proposer": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"transfer_hashes": [
"5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa"
]
},
"hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb",
"header": {
"accumulated_seed": "ac979f51525cfd979b14aa7dc0737c5154eabe0db9280eceaa8dc8d2905b20d5",
"body_hash": "cd502c5393a3c8b66d6979ad7857507c9baf5a8ba16ba99c28378d3a970fff42",
"era_end": {
"era_report": {
"equivocators": [
"013b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29"
],
"inactive_validators": [
"018139770ea87d175f56a35466c34c7ecccb8d8a91b4ee37a25df60f5b8fc9b394"
],
"rewards": [
{
"amount": 1000,
"validator": "018a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c"
}
]
},
"next_era_validator_weights": [
{
"validator": "016e7a1cdd29b0b78fd13af4c5598feff4ef2a97166e3ca6f2e4fbfccd80505bf1",
"weight": "456"
},
{
"validator": "018a875fff1eb38451577acd5afee405456568dd7c89e090863a0557bc7af49f17",
"weight": "789"
},
{
"validator": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"weight": "123"
}
]
},
"era_id": 1,
"height": 10,
"parent_hash": "0707070707070707070707070707070707070707070707070707070707070707",
"protocol_version": "1.0.0",
"random_bit": true,
"state_root_hash": "0808080808080808080808080808080808080808080808080808080808080808",
"timestamp": "2020-11-17T00:39:24.072Z"
},
"proofs": [
{
"public_key": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"signature": "016291a7b2689e2edcc6e79030be50edd02f9bd7d809921ae2654012f808c7b9a0f125bc32d6aa610cbd012395a9832ccfaa9262023339f1db71ca073a13bb9707"
}
]
}
}
}
chain_get_block_transfers
This method returns all successful native transfers within a given Block from a network.
| Parameter | Type | Description |
|---|---|---|
| block_identifier | Object | The Block hash. |
Example chain_get_block_transfers request
{
"id": 1,
"jsonrpc": "2.0",
"method": "chain_get_block_transfers",
"params": [
{
"Hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb"
}
]
}
chain_get_block_transfers_result
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| block_hash | Object | The Block hash, if found. |
| transfers | Array | The Block's successful transfers, if found. |
Example chain_get_block_transfers result
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api_version": "1.4.13",
"block_hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb",
"transfers": [
{
"amount": "0",
"deploy_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"from": "account-hash-0000000000000000000000000000000000000000000000000000000000000000",
"gas": "0",
"id": null,
"source": "uref-0000000000000000000000000000000000000000000000000000000000000000-000",
"target": "uref-0000000000000000000000000000000000000000000000000000000000000000-000",
"to": null
}
]
}
}
chain_get_era_summary
This method returns the era summary at a given Block. If you do not specify a block_identifier, you will receive the era summary at the highest state root hash.
| Parameter | Type | Description |
|---|---|---|
| block_identifier | Object | The Block hash. (Optional) |
Example chain_get_era_summary request
{
"id": 1,
"jsonrpc":"2.0",
"method":"chain_get_era_summary",
"params": [
{
"Hash":"9bfa58709058935882a095ca6adf844b72a2ddf0f49b8575ef1ceda987452fb8"
}
]
}
chain_get_era_summary_result
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| era_summary | Object | The era summary (if found). |
Example chain_get_era_summary result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"api_version": "1.0.0",
"era_summary": {
"block_hash": "9bfa58709058935882a095ca6adf844b72a2ddf0f49b8575ef1ceda987452fb8",
"era_id": 1,
"stored_value": {
"EraInfo": {
"seigniorage_allocations": [
{
"Delegator": {
"delegator_public_key": "01c08939bf1ecd1139448d435989a761c975466d30b96c2dd74e9d23c7b12bc9ff",
"validator_public_key": "01039c258651e04597d786142d9749922245cf44b6cc0c93c58bd6c1783ac3be9b",
"amount": "53472520551166781393617756"
}
},
{
"Validator": {
"validator_public_key": "01039c258651e04597d786142d9749922245cf44b6cc0c93c58bd6c1783ac3be9b",
"amount": "54552773491594393138943367"
}
},
{
"Delegator": {
"delegator_public_key": "01264689a5b4c57dac1088cd0aae8074de105f2269f6041e2c120e80df7a95e6b5",
"validator_public_key": "013e193dec433a73a0b41b924243c62311689648a10b4468f9c609c75674c18726",
"amount": "51312014670568117976319374"
}
},
{
"Validator": {
"validator_public_key": "013e193dec433a73a0b41b924243c62311689648a10b4468f9c609c75674c18726",
"amount": "56713279372733183026458256"
}
},
{
"Delegator": {
"delegator_public_key": "016f571eaf1d3a442e684ecdb31d00a51448dcbaa06d00b340983311f0ba3e76db",
"validator_public_key": "0186d12379939682ae9669b354f7a637ec106369074d567b969cc0e2127c904f12",
"amount": "51852141140784624481333262"
}
},
{
"Validator": {
"validator_public_key": "0186d12379939682ae9669b354f7a637ec106369074d567b969cc0e2127c904f12",
"amount": "56173152902516676521444368"
}
},
{
"Delegator": {
"delegator_public_key": "0161e7ed5c592f16b507b9dd196662b530f9bde6c5b2cfd957fe8d0700ecfbe20b",
"validator_public_key": "01d4cbef55ed9968171102aa136c9564286211ee46c5ab65b6fd68fab5b14d4c4b",
"amount": "52392267611001130986347150"
}
},
{
"Validator": {
"validator_public_key": "01d4cbef55ed9968171102aa136c9564286211ee46c5ab65b6fd68fab5b14d4c4b",
"amount": "55633026432300170016430480"
}
},
{
"Delegator": {
"delegator_public_key": "01b1339a1d114036d84d7b65c804669166d38456114657abbb0e53e67bf1667c60",
"validator_public_key": "01dbce10c8418c21daf16bc1052a486cdb557ba66b09a84605bc1f4b3df364960f",
"amount": "52932394080952975520954950"
}
},
{
"Validator": {
"validator_public_key": "01dbce10c8418c21daf16bc1052a486cdb557ba66b09a84605bc1f4b3df364960f",
"amount": "55092899961808199011606173"
}
}
]
}
},
"state_root_hash": "918abd1973171867e03c1e6e56fd7dd9da35c92461784f9a15c0df23e437d850",
"merkle_proof": "010000000e0000000000000000000000000000000000000000000000000000000000000000070a0000000101c08939bf1ecd1139448d435989a761c975466d30b96c2dd74e9d23c7b12bc9ff01039c258651e04597d786142d9749922245cf44b6cc0c93c58bd6c1783ac3be9b0b5c4316483512c2253f3b2c0001039c258651e04597d786142d9749922245cf44b6cc0c93c58bd6c1783ac3be9b0b87d59268bf17d8c6ff1f2d0101264689a5b4c57dac1088cd0aae8074de105f2269f6041e2c120e80df7a95e6b5013e193dec433a73a0b41b924243c62311689648a10b4468f9c609c75674c187260b8e45261378f096e3bd712a00013e193dec433a73a0b41b924243c62311689648a10b4468f9c609c75674c187260b90eee69bba24050981e92e01016f571eaf1d3a442e684ecdb31d00a51448dcbaa06d00b340983311f0ba3e76db0186d12379939682ae9669b354f7a637ec106369074d567b969cc0e2127c904f120b0ef09fedb1f521341ee42a000186d12379939682ae9669b354f7a637ec106369074d567b969cc0e2127c904f120b10446dc1801f7ab820772e010161e7ed5c592f16b507b9dd196662b530f9bde6c5b2cfd957fe8d0700ecfbe20b01d4cbef55ed9968171102aa136c9564286211ee46c5ab65b6fd68fab5b14d4c4b0b8e9a19c8ebfaac847e562b0001d4cbef55ed9968171102aa136c9564286211ee46c5ab65b6fd68fab5b14d4c4b0b9099f3e6461aef67c0042e0101b1339a1d114036d84d7b65c804669166d38456114657abbb0e53e67bf1667c6001dbce10c8418c21daf16bc1052a486cdb557ba66b09a84605bc1f4b3df364960f0b46fad737700f37d5dec82b0001dbce10c8418c21daf16bc1052a486cdb557ba66b09a84605bc1f4b3df364960f0b9d1ed178841a631760922d01000000000e060000000001fb7043fe388fef916937aa899a0dda9b042168149e600fb068ecb16839d545d60101a0676758b903440b28c8f4a1d46404e9879fcfc0b90dad20962536de493aecc302013584bc9d5c00ac639fe14410b4cfa480b12eddd8f3dce08d7b76ae47977c1c680601664224aca1272e2a5632da4a56399dee6c585318ebbb7bb4040039792d3ad33c07013b48237cd26eb35ec3c864e1ae250ca656d00893de1dfc4c951e0d779adeda1d0a002c722cac61792676eb19d773fd3c41e37a63f54f78bdf7712ca96a5c5e5c4986"
}
}
}
chain_get_state_root_hash
This method returns a state root hash at a given Block. If you do not specify a block_identifier, you will receive the highest state root hash.
| Parameter | Type | Description |
|---|---|---|
| block_identifier | Object | The Block hash. (Optional) |
Example chain_get_state_root_hash request
{
"id": 1,
"jsonrpc": "2.0",
"method": "chain_get_state_root_hash",
"params": [
{
"Height": 10
}
]
}
chain_get_state_root_hash_result
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| state_root_hash | String | Hex-encoded hash of the state root. |
Example chain_get_state_root_hash result
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api_version": "1.4.13",
"state_root_hash": "0808080808080808080808080808080808080808080808080808080808080808"
}
}
info_get_chainspec
This method returns raw bytes for chainspec files.
Example info_get_chainspec request
{
"jsonrpc": "2.0",
"method": "info_get_chainspec",
"id": 5510244237763930243
}
info_get_chainspec_result
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| chainspec_bytes | Object | The raw bytes of the chainspec.toml, genesis accounts.toml, and global_state.toml files. |
Example info_get_chainspec result
Please note that adding a --vv flag will return the full chainspec bytes.
{
"jsonrpc": "2.0",
"result": {
"api_version": "1.5.0",
"chainspec_bytes": {
"chainspec_bytes": "[22040 hex chars]",
"maybe_genesis_accounts_bytes": null,
"maybe_global_state_bytes": null
}
},
"id": 5510244237763930243
}
info_get_deploy
This method retrieves a Deploy from a network. It requires a deploy_hash to query the Deploy.
| Parameter | Type | Description |
|---|---|---|
| deploy_hash | String | The Deploy hash. |
| finalized_approvals | Boolean | Determines whether to return the Deploy with the finalized approvals substituted. (Optional) |
Example info_get_deploy request
{
"id": 1,
"jsonrpc": "2.0",
"method": "info_get_deploy",
"params": [
"5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa",
true
]
}
info_get_deploy_result
The response contains the Deploy and the results of executing the Deploy.
If the execution_results field is empty, it means that the network processed the Deploy, but has yet to execute it. If the network executed the Deploy, it will return the results of the execution. The execution results contain the Block hash which contains the Deploy.
| Parameter | Type | Description |
|---|---|---|
| api_version | String | The RPC API version. |
| deploy | Object | The Deploy. |
| execution_results | Array | An array of execution results with Block hashes. |
Example info_get_deploy result
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"api_version": "1.4.13",
"deploy": {
"approvals": [
{
"signature": "014c1a89f92e29dd74fc648f741137d9caf4edba97c5f9799ce0c9aa6b0c9b58db368c64098603dbecef645774c05dff057cb1f91f2cf390bbacce78aa6f084007",
"signer": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c"
}
],
"hash": "5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa",
"header": {
"account": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"body_hash": "d53cf72d17278fd47d399013ca389c50d589352f1a12593c0b8e01872a641b50",
"chain_name": "casper-example",
"dependencies": [
"0101010101010101010101010101010101010101010101010101010101010101"
],
"gas_price": 1,
"timestamp": "2020-11-17T00:39:24.072Z",
"ttl": "1h"
},
"payment": {
"StoredContractByName": {
"args": [
[
"amount",
{
"bytes": "e8030000",
"cl_type": "I32",
"parsed": 1000
}
]
],
"entry_point": "example-entry-point",
"name": "casper-example"
}
},
"session": {
"Transfer": {
"args": [
[
"amount",
{
"bytes": "e8030000",
"cl_type": "I32",
"parsed": 1000
}
]
]
}
}
},
"execution_results": [
{
"block_hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb",
"result": {
"Success": {
"cost": "123456",
"effect": {
"operations": [
{
"key": "account-hash-2c4a11c062a8a337bfc97e27fd66291caeb2c65865dcb5d3ef3759c4c97efecb",
"kind": "Write"
},
{
"key": "deploy-af684263911154d26fa05be9963171802801a0b6aff8f199b7391eacb8edc9e1",
"kind": "Read"
}
],
"transforms": [
{
"key": "uref-2c4a11c062a8a337bfc97e27fd66291caeb2c65865dcb5d3ef3759c4c97efecb-007",
"transform": {
"AddUInt64": 8
}
},
{
"key": "deploy-af684263911154d26fa05be9963171802801a0b6aff8f199b7391eacb8edc9e1",
"transform": "Identity"
}
]
},
"transfers": [
"transfer-5959595959595959595959595959595959595959595959595959595959595959",
"transfer-8282828282828282828282828282828282828282828282828282828282828282"
]
}
}
}
]
}
}
query_balance
This method allows you to query for the balance of a purse using a PurseIdentifier and StateIdentifier.
| Parameter | Type | Description |
|---|---|---|
| purse_identifier | Object | The identifier to obtain the purse corresponding to the balance query. |
| state_identifier | Object | The state identifier used for the query; if none is passed the tip of the chain will be used. |
Example query_balance request
{
"id": 1,
"jsonrpc": "2.0",
"method": "query_balance",
"params": [
{
"name": "state_identifier",
"value": {
"BlockHash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb"
}
},
{
"name": "purse_identifier",
"value": {
"main_purse_under_account_hash": "account-hash-0909090909090909090909090909090909090909090909090909090909090909"
}
}
]
}