You can query the JSON-RPC API of a node on a Casper network. You will need the IP address of a node and the REST endpoint for status and metrics, which is by default 8888 on Mainnet and Testnet. You can find specific node addresses for Testnet or Mainnet.
To list all RPC commands on the node via port 8888:
curl -s http://$NODE_IP:8888/rpc-schema | jq '.methods[].name
Which will return a line-by-line output of the available rpc commands:
"account_put_deploy"
"info_get_deploy"
"state_get_account_info"
"state_get_dictionary_item"
"query_global_state"
"info_get_peers"
"info_get_status"
"info_get_validator_changes"
"chain_get_block"
"chain_get_block_transfers"
"chain_get_state_root_hash"
"state_get_item"
"state_get_balance"
"chain_get_era_info_by_switch_block"
"state_get_auction_info"
You can also run the Casper client list-rpcs
command to get the full list of available JSON-RPC methods. You will need the RPC endpoint for interaction with the casper-client, which is by default 7777 on Mainnet and Testnet.
casper-client list-rpcs --node-address <HOST:7777>
Additionally you can view the Casper JSON RPC API documentation for more information on the various endpoints and examples.
Comments
0 comments
Please sign in to leave a comment.