Casper RPC
How to use it
// yarn add @tatumio/tatum
import { TatumSDK, Casper, Network } from '@tatumio/tatum'
const tatum = await TatumSDK.init<Casper>({ network: Network.CASPER })
const blockHash = '13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb'
const accountHash = 'a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf'
const result = await tatum.rpc.stateGetAccountInfo({ Hash: blockHash }, accountHash)
await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
Request Example
curl --location 'https://api.tatum.io/v3/blockchain/node/casper-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "state_get_account_info",
"params": [
{
"Hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb"
},
"a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf"
]
}'
Overview
state_get_account_info
is an RPC method on the Casper blockchain that retrieves information about an account at a given block hash.
Parameters
The state_get_account_info
method accepts the following parameters:
block_identifier
: An object specifying the block identifier, which includes:Hash
: The hash of the block to query. Example:"13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb"
account_hash
: The account hash to query. Example:"a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf"
Return Object
The state_get_account_info
method returns an object with the following fields:
api_version
: The API version. Example:"1.5.6"
account
: An object containing account information.
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"api_version": "1.5.6",
"account": {
"account_hash": "account-hash-1ed5a1c39bea93c105f2d22c965a84b205b36734a377d05dbb103b6bfaa595a7",
...
}
}
}
Notes
- This method returns the information about an account at the specified block hash.
- Ensure to replace the block hash and account hash with the actual values you intend to query.
For more detailed information, refer to the official Casper documentation.