1

I was trying to call the balanceOf function in web3.py and I ran into a problem. I started getting this: "web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?" error when I called the balanceOf method. I called the method like this:

contract.functions.balanceOf("0x174dE9daF56Aa0399870c31AAc5209a8D7E88Ee2").call()

and from what I saw on the internet this seemed okay, but I removed the line and the error stopped occuring, so what is the fix to this problem

1 Answer 1

0

For each of the function defined in the abi there is a defined return type. For the balanceOf method normally a uint256 is expected (at least for most token standards). The error indicates that the value returned cannot be parse into a uint256.

This can happen if the contract at the address does not implement the method or implements it with a different return type or if there is no contract at the specified address.

To provide more info it would be good to know what address your contract instance is linked to.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.