Well, my question is terse but to the point: Where's the bytecode of smart contract stored? And how to get it executed ? From the image and Ethereum Yellow Paper we can see there is codeHash in WorldState ==> Account which is described as:

The hash of the EVM code of this account—this is the code that gets executed should this address receive a message call; it is immutable and thus, unlike all other fields, cannot be changed after construction. All such code fragments are contained in the state database under their corresponding hashes for later retrieval.

So, it only mentions the codeHash but not the code itself. So, it seems I have to read Ethereum's source code to get how it deals with contract bytecode and that's what I'm doing but you know, it's thousands of lines of Golang code. So did anyone have some ideas about that ?

  • Same LevelDB as before. – Mikko Ohtamaa Dec 5 '18 at 21:56
  • Yeah, everything is stored in LevelDB but do you know how does it store the bytecode? – Shuai Xu Dec 6 '18 at 17:03
  • As bytes, I would assume – Mikko Ohtamaa Dec 7 '18 at 8:13
  • 1
    I would try to use tools like this github.com/hxoht/levelui to explorer the database – Mikko Ohtamaa Dec 7 '18 at 8:14
  • 1
    Well, the tool is COOL ! I think it's helpful. Thanks! – Shuai Xu Dec 7 '18 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.