Using cURL for testing
These examples provide a starting point for testing your connection and querying blockchain data using cURL commands.
Before you start:
Create a JSON-RPC endpoint for the Ethereum blockchain from your GetBlock account.
Replace <ACCESS_TOKEN> in the examples below with your actual Access Token.
Fetch the current block number
Run the following command to retrieve the latest block number:
If successful, the response will include the current block number in hexadecimal value:
Get the chain ID
Identify the blockchain network with the eth_chainId
method:
Response example:
In this example, 0x1
indicates the Ethereum Mainnet. The chain ID helps confirm which blockchain network you are interacting with.
Check account balance by address
Retrieve the balance of an Ethereum address using eth_getBalance
. Replace <ACCOUNT_ADDRESS>
with the target wallet address:
Example response:
The result field shows the account balance in wei (1 ether = 10¹⁸ wei).
For a list of supported RPC methods with examples, navigate to API Reference.
Last updated