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!
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!
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.
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.