Polygon API Documentation
eth_getBalance RPC Method
The eth_getBalance
method returns the balance (in wei) of the specified account address at the latest block.
eth_getBalance
only returns the balance of the native chain currency (ex: Matic for Polygon or ETH for Ethereum or) and does not include any ERC20 token balances.
Parameters
-
address
- 20 bytes. The address of the account to retrieve the balance of. -
blockNumber or tag
- The string "latest", "earliest", "pending", "safe" or "finalized", or an hexadecimal block number. On Polygon you can not use "Safe" and "finalized". They are only availible on Ethereum and Arbitrum One chains. Read block parameter description in Ethereum documentation (opens in a new tab).
Returns
Balance
- The chosen address’ balance in wei as an integer.
Request
POST https://<network>.chainnodes.org/YOUR-API-KEY
Example
💡 Confusing?
Ask our experienced blockchain developers in Telegram
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your CHAINNODES.ORG Dashboard
- You can use a different supported network by replacing
polygon-mainnet
curl https://polygon-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBalance","params": ["0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5", "latest"],"id":1}'
Body
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x19451085df7bc276d"
}
Some use cases:
- Wallet Balance Display: Wallet applications use
eth_getBalance
to display the current balance of a user's account. - Transaction Validation: Before sending a transaction, a user or a wallet can call
eth_getBalance
to check if the account has enough balance to cover the transaction cost. This can prevent failed transactions due to insufficient funds. - Account Monitoring: Services that monitor Ethereum accounts for various purposes (like auditing, alerting, or reporting) use
eth_getBalance
to track the balance of specific accounts over time. - DApp Interaction: Decentralized applications use
eth_getBalance
to check the balance of a user's account before performing actions that require a certain minimum balance.
Need RPC API keys?
Get 12.5M archival requests for free today.
JSON-RPC API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth