eth_getBalance
Returns the balance of a given address.

Example

Command Shell
Bash
1
## using block numbers
2
​
3
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
4
-X POST
5
-H "Content-Type: application/json"
6
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\": [\"0x71C7656EC7ab88b098defB751B7401B5f6d8976F\", \"0x6D8185\"],\"id\":1}"
7
​
8
## using pre-defined strings
9
​
10
curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
11
-X POST
12
-H "Content-Type: application/json"
13
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\": [\"0x71C7656EC7ab88b098defB751B7401B5f6d8976F\", \"latest\"],\"id\":1}"
14
​
Copied!
1
## using block numbers
2
​
3
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
4
-H 'Content-Type: application/json' \
5
--data-raw '{"jsonrpc":"2.0","method":"eth_getBalance","params": ["0x71C7656EC7ab88b098defB751B7401B5f6d8976F", "0x6D8185"],"id":1}'
6
​
7
## using pre-defined strings
8
​
9
curl -X POST 'https://bsc-<network>.web3api.com/v1/YOUR-API-KEY' \
10
-H 'Content-Type: application/json' \
11
--data-raw '{"jsonrpc":"2.0","method":"eth_getBalance","params": ["0x71C7656EC7ab88b098defB751B7401B5f6d8976F", "latest"],"id":1}'
12
​
Copied!
Request Parameters
Response
  1. 1.
    ADDRESS - A string representing the address to check for balance.
  2. 2.
    BLOCK PARAMETER - An int block number in the form of hex, appended with 0x such as 0x6D7FE0, or pre-defined strings latest, earliest, pending.
Web3API's Composer accepts int block numbers, which will be auto-converted to a hex representation before being sent to a node.
Result Fields
BALANCE - A hex code of an integer representing the current address balance in wei.
Body
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":"0x12a05f200"
5
}
Copied!
​
Last modified 5mo ago
Copy link