ERC-20 – Solving Connection Issues with Contract Deployed on Ropsten Testnet

erc-20ropstentestrpc-to-ropstenweb3.py

I am having issues with calling functions of contract deployed on the Ropsten Testnet. Previously, I tested this on testrpc and everything was working well. I'm working on transfer of ERC20 Standard tokens.

When I tried calling balanceOf using contract.call().balanceOf() it raised following error

web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?

Then I also tried contract.transact().balanceOf() which threw the following error

raise ValueError(response["error"]) ValueError: {'code': -32000, 'message': 'unknown account'}

Is it because geth hasn't fully synced with the Ropsten chain? If I have to fully sync with the Ropsten Chain now, does that mean when the contract is later deployed into main net, the main net chain has to be synced fully as well?

Best Answer

is contract deployed correctly and chain synced?

That error message is right. You should definitely sync fully, and that will apply to the main net, too. You might be pleasantly surprised how much faster parity syncs.

unknown account

This problem is unrelated to syncing. It also sounds like you are trying to transact from an account that geth doesn't have a key for. web3.eth.accounts needs to show the account you set as the from field in transact().