MultiversX Tracker is Live!

How to retreive token balance for given address using python?

Etherum Reddit

More / Etherum Reddit 205 Views

Hello guys. I'm stuck here. I want to get token balance for a given eth address using web3 or whatever you want. If I search online there are just answer 4/5 years old.

The last code I tried but got error was in a post on this subreddit:

from web3 import Web3, IPCProvider

import json

token_t_abi = json.loads('[{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]')

wallet_w = '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE'

w3 = Web3(IPCProvider())

token = w3.eth.contract(

'0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE',

abi=token_t_abi,

)

print(token.call().balanceOf(wallet_w))

Somebody can help me?

submitted by /u/gkm-chicken
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments