eth_getBalance
Returns Ether balance of a given or account or contract
- CURL
curl --request POST \
--url https://evm.confluxrpc.com \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": ["0x1e6309dc46a2a4936abda54b69c91d7a3c75a39e",null],
"method": "eth_getBalance"
}'
Params
address required
Schema
type : string
Pattern :
^0x[0-9,a-f,A-F]{40}$
blockNumber optional
Block Number or Tags
oneOf
- U64
- BlockHash
- BlockNumber
- string
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,15}|0)$
type : object
blockHash string required
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
requireCanonical boolean
type : boolean
type : object
blockNumber string required
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
type : string
Possible values :
earliest
latest
pending
Result
Schema
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,63}|0)$
Examples
- eth_getBalance
- eth_getBalance
- eth_getBalance
- eth_getBalance
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBalance",
"params": [
"0x1e6309dc46a2a4936abda54b69c91d7a3c75a39e"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0x3635c9adc5de5c9bd8"
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBalance",
"params": [
"0x1e6309dc46a2a4936abda54b69c91d7a3c75a39e",
"earliest"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
"code": -32016,
"message": "Error processing request: State for epoch (number=0 hash=0x3fb9d350f95424c3c27fcf248d9a6f633a83c2a75c11ef887ea41540c85e7804) does not exist: out-of-bound StateAvailabilityBoundary { synced_state_height: 0, lower_bound: 71248001, upper_bound: 71252846, optimistic_executed_height: None }"
}
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBalance",
"params": [
"0x1e6309dc46a2a4936abda54b69c91d7a3c75a39e",
"latest"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
"0x3635c9adc5de5c9bd8"
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBalance",
"params": [
"0x1e6309dc46a2a4936abda54b69c91d7a3c75a39e",
"pending"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
"code": -32602,
"message": "Invalid parameters: num",
"data": "\"Latest mined epoch is not executed\""
}