curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x6B8E1585035b5B53afcd9791076E43b53D3e1AA4",
"pending"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x6B8E1585035b5B53afcd9791076E43b53D3e1AA4",
"pending"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
address
— the address to check the balance of.
quantity or tag
— the integer of a block encoded as hexadecimal or the string with:
latest
— the most recent block in the blockchain and the current state of the blockchain at the most recent block. A chain reorganization is to be expected.safe
—the block that received justification from the beacon chain. Although this block could be involved in a chain reorganization, it would necessitate either a coordinated attack by the majority of validators or severe propagation latency.finalized
— the block accepted as canonical by more than 2/3 of the validators. A chain reorganization is extremely unlikely, and it would require at least 1/3 of the staked amount to be burned.earliest
— the earliest available or genesis blockpending
— the pending state and transactions block. This is the current state of transactions that have been broadcast to the network but have not yet been included in a block.quantity
— the integer value of the current balance in Weieth_getBalance
code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getBalance(address, block) {
const balance = await web3.eth.getBalance(address, block)
console.log(balance)
}
getBalance("0x8894E0a0c962CB723c1976a4421c95949bE2D4E3", "latest" )
eth_getBalance
is to check the balance of an account for a program that scans the balance periodically and fills up the account when the balance drops below a certain value.The account balance.
The response is of type object
.
Was this page helpful?