0

I'm trying to tune my geth node to get ERC-20 tokens balances, but y API call always returns

{'jsonrpc': '2.0', 'id': 1, 'result': '0x'}

My geth node version:

instance=Geth/v1.9.13-stable-cbc4ac26/windows-amd64/go1.14.2
modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

I have fully synced node (200Gb size)

I've tried to connect my node from MyCrypto wallet. It works well (main balance), but I can't get token balances via my geth node.

Also i've tried to use python pyetherbalance module.

import pyetherbalance
ethbalance = pyetherbalance.PyEtherBalance(infura_url)
balance_omg = ethbalance.get_token_balance('USDT', ethereum_address)

eth_call retruns always {'jsonrpc': '2.0', 'id': 1, 'result': '0x'} if I connecting to my geth node, but it work well with infura node

eth.blockNumber = 10040830

Command line:

geth - -rpc - -rpcapi "db, txpool, ethash, eth,net,web3,personal" - -rpcaddr = "127.0.0.1" - -rpcport = "8545" - -rpccorsdomain = "*"

Api python code:

address = "0x......"
contract_address = "0xdac17f958d2ee523a2206206994597c13d831ec7" # USDT
abi = '0x70a08231000000000000000000000000' + address[2:]
params = [{"to": contract_address, "data": abi}, "latest"]
response = json_rpc_post('eth_call', params, 1)
  • If you query most recent eth.blockNumber what does it return? What command line do you use to launch geth? What code do you use to query balances? – Ismael May 10 at 20:35
  • eth.blockNumber = 10040830 <br/> geth - -rpc - -rpcapi "db, txpool, ethash, eth,net,web3,personal" - -rpcaddr = "127.0.0.1" - -rpcport = "8545" - -rpccorsdomain = "*" console I've tryed to use my node from MyCrypto wallet with no luck. Get token balances has no result. – alexethn May 10 at 21:21
  • Also i've used python module pyetherbalance wich has such code: address = "0x......" contract_address = "0xdac17f958d2ee523a2206206994597c13d831ec7" # USDT abi = '0x70a08231000000000000000000000000' + address[2:] params = [{"to": contract_address, "data": abi}, "latest"] response = json_rpc_post('eth_call', params, 1) if I use my node, I have response {'jsonrpc': '2.0', 'id': 1, 'result': '0x'} if I use infura node, the result is success and balance is returned – alexethn May 10 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.