3

Does anyone have an example of what EVM bytecode looks like? New to ETH and trying to understand what exactly gets executed by the virtual machine. Is it similar to how JVM bytecode gets executed from Java?

Thanks a bunch!

1

2 Answers 2

2

EVM is quite similar to JVM in terms of execution model. Both are stack machines executing bytecodes. EVM adds a concept of storage and its bytecode instructions are more suited for contract development.

The most comprehensive description of EVM is Ethereum yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf - see point H.2 for instruction set.

Solidity has inline assembly: http://solidity.readthedocs.io/en/develop/assembly.html

The most "close to metal" language to program EVM is probably LLL.

1
  • Note that LLL probably really means "Lovely Little Lisp" compiler ...
    – duanev
    Commented Mar 27, 2018 at 4:43
1

As Michał writes EVM is machine code for a virtual machine and the Yellow Paper not only describes the instructions on the EVM but rather defines them. If you want to learn EVM, I can recommend compiling some smart contracts through solc (the Solidity compiler) and then use an EVM disassembler to read the assembly instructions that have been generated. Start by disassembling the most simple smart contract you are able to define! If you have tried reading assembly code in any other language, it is not too hard to reason about.

The Ethereum client geth comes with a disassembler.

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.