2

This question already has an answer here:

I synchronized my ethereum node using the command

geth --syncmode "fast"

Now I wanted to access a smart contract, e.g. the one of OmiseGO. Unfortunately this is not found. I tried web3 and also a WebGUI etherparty/explorer. Both didn't find anything. No contract address at all. However it found the corresponding transaction, that created the smart contract.

For web3 I used the following code:

var code = web3.eth.getCode('0xd26114cd6EE289AccF82350c8d8487fedB8A0C07');

The code was always 0x which represents that the contract is not present.

Is it because of the syncmode fast that these kind of things are not stored?

marked as duplicate by Ismael, Achala Dissanayake, Richard Horrocks, eth Mar 17 '18 at 4:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Does your node finished syncing? What does eth.blockNumber return? What version of geth are you using? – Ismael Mar 14 '18 at 5:34
  • ok, looks like I've been to impatient. It was nearly finished syncing, and the blocks where the smart contract was created were synced long ago. So I assumed everything created in this blocks should be there. Thank you for your clarification! If you add this as an answer I'll accept it – itsme Mar 14 '18 at 19:21
0

If you run geth in syncmode fast, it means it only downloads the transactions, but is not processing them. Therefore, everything, that was created by these transactions will not be available. If you want to have the smart contracts, you have to do a full sync.

geth --syncmode "full"

and to speed up I recommend to increase the cache. I'm running it with

geth --syncmode "fast" --cache=2048

I have 16GB of RAM

  • Fast mode will download the current state (balances and contracts code), only after it has finished syncing. The difference between full and fast is how processing of blocks is done, old version of geth will store all intermediate states, but from v1.8 they will be discarded and only keep the more recent ones. – Ismael Mar 14 '18 at 6:08

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