curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x3eb6347f6282E78F778C23c97E8657F5EE5378E0",
"pending"
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x3eb6347f6282E78F778C23c97E8657F5EE5378E0",
"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 ETH 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("0x038D8981cC8fB8421CB96e8EEe8093Fc1F2E63dC", "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.Was this page helpful?