Version: 4.0.0
Python: 3.5
OS: Linux
I have Geth (version 1.7.2) node, which was synced using the "fast" mode. When I use the getCode method on smart contract addresses, it always returns "0x". I have verified this with known smart contract addresses like the Iconomi ERC20 token contract address.
I am wondering why this is happening? Is it possible that nodes synced in "fast" mode cannot return the contract bytecode? Or is it a problem with web3py?
Any help is appreciated.
Likely culprits.
Closed as it is very unlikely this is a web3.py bug. Please continue to post here if you still have issues and we can re-open if it turns out to be a web3.py issue.
The node is definitely not fully synced. I was stumped because all transaction related queries returned fine, however getCode didn't return the correct values. When the node syncs fully, will report back if the problem is resolved.
馃憤 your description fits. Fast sync finishes syncing Blocks/Transactions/Receipts well before the state sync finished and the contract code is part of the state sync.
Most helpful comment
Likely culprits.