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 = 'a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf' // Replace with actual block hash
const blockHeight = 3229836 // Replace with actual block height
const resultByHash = await tatum.rpc.chainGetBlockTransfers({ hash: blockHash })
const resultByHeight = await tatum.rpc.chainGetBlockTransfers({ height: blockHeight })
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": "chain_get_block_transfers",
"params": [
{
"Height": 3229836
}
]
}'
Overview
chain_get_block_transfers
is an RPC method on the Casper blockchain that retrieves the transfer details for a specific block height.
Parameters
The chain_get_block_transfers
method accepts the following parameters:
hash
: The hash of the block to retrieve.
Orheight
Identify and retrieve the Block with its height.
Return Object
The chain_get_block_transfers
method returns an object with the following fields:
api_version
: The API version. Example:"1.5.6"
block_hash
: The hash of the block. Example:"17b4bb24ae874bfbb923d4cf6e1d73dad9aad2d07105085a327103a8fa0958f7"
transfers
: An array of transfer objects containing transfer details.
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"api_version": "1.5.6",
"block_hash": "17b4bb24ae874bfbb923d4cf6e1d73dad9aad2d07105085a327103a8fa0958f7",
"transfers": [
{
"deploy_hash": "8b3a9c0964cb6a74f414c8dc3b6dd1331b7734db5f0c7a03d8dbf179a5a5a92e",
"from": "account-hash-d9fc4ff970d233a49190b779b60158a39c405fc199e7cce6e623d7c88f3a770f",
"to": "account-hash-a7c5e2e75e7c2b1ab3ccbc07276d4d2d59957926721ee95f6ef24c9887a9b2b7",
"source": "uref-9212491c05be3231a254d6870b556e0d989008f4a18171b740d8d7ddeb1fb424-007",
"target": "uref-45cef3856a12fbe43e774ea198c613438bae429a2cf73ee97826c723fee5e3e9-004",
"amount": "499000000000",
"gas": "0",
"id": null
}
]
}
}
Notes
- This method returns the transfer details for a specific block from the network.
- Ensure to replace the block height with the actual block height you intend to query.
For more detailed information, refer to the official Casper documentation.