TokenBalance is an easy to use public API and application that will output your ERC20 Token balance without any troubles. You can run TokenBalance on your local computer or you can use api.tokenbalance.com to easily parse your erc20 token balances. Connects to your local geth IPC and prints out a simple JSON response for ethereum token balances. Runs on port 8080 by default if you wish to run locally.
To fetch information about your balance, token details, and ETH balance use the follow API call in a simple HTTP GET or CURL. The response is in JSON so you can easily parse what you need. Replace TOKEN_ADDRESS with the contract address of the ERC20 token, and replace ETH_ADDRESS with your address.
https://api.tokenbalance.com/token/TOKEN_ADDRESS/ETH_ADDRESS
https://test.tokenbalance.com/token/TOKEN_ADDRESS/ETH_ADDRESS
{
"name": "Kin",
"wallet": "0x393c82c7Ae55B48775f4eCcd2523450d291f2418",
"symbol": "KIN",
"decimals": 18,
"balance": "15788648",
"eth_balance": "0.217960852347180212",
"block": 4274167
}
This API response will only show you the ERC20 token balance in plain text. Perfect for ultra simple parsing.
https://api.tokenbalance.com/balance/TOKEN_ADDRESS/ETH_ADDRESS
1022.503000
- jsFiddle AJAX Example
- Fetch Balance and Token Details for Status Coin
- Fetch Balance and Token Details for Gnosis
- Fetch Balance and Token Details for Storj
- Only Token Balance for Augur
- Only Token Balance for Golem
Feel free to use the TokenBalance API server to fetch ERC20 token balances and details. We do have a header set that will allow you to call the API via AJAX. Access-Control-Allow-Origin "*"
The server may limit your requests if you do more than 60 hits per minute.
TokenBalance isn't just an API, it's an opensource HTTP server that you can run on your own computer or server.
git clone https://github.com/hunterlong/tokenbalance
cd tokenbalance
go get && go build .
tokenbalance start --geth="/ethereum/geth.ipc"
This will create a light weight HTTP server will respond balance information about a ethereum contract token.
tokenbalance start --geth="/ethereum/geth.ipc" --port 8080 --ip 127.0.0.1
CONTRACT=0xa74476443119A942dE498590Fe1f2454d7D4aC0d
ETH_ADDRESS=0xda0aed568d9a2dbdcbafc1576fedc633d28eee9a
curl https://api.tokenbalance.com/token/$CONTRACT/$ETH_ADDRESS
{
"name": "Kin",
"wallet": "0x393c82c7Ae55B48775f4eCcd2523450d291f2418",
"symbol": "KIN",
"decimals": 18,
"balance": "15788648",
"eth_balance": "0.217960852347180212",
"block": 4274167
}