light-evm
is a simple implementation of the EVM (Ethereum Virtual Machine). It's purely an experimental project for my own educational purposes. So don't use any code from this repo for production.
- Clone the repository:
git clone https://github.com/lazyfuhrer/light-evm.git cd light-evm
- Build the project:
cargo build
- Run the project:
cargo run <BYTECODE>
Run: cargo run 600660070260005360016000f3
It should return0x2a
as the output.
"PUSH1" @ pc=0
Stack: [6]
Memory: []
---------
"PUSH1" @ pc=2
Stack: [6, 7]
Memory: []
---------
"MUL" @ pc=4
Stack: [42]
Memory: []
---------
"PUSH1" @ pc=5
Stack: [42, 0]
Memory: []
---------
"MSTORE8" @ pc=7
Stack: []
Memory: [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---------
"PUSH1" @ pc=8
Stack: [1]
Memory: [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---------
"PUSH1" @ pc=10
Stack: [1, 0]
Memory: [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---------
"RETURN" @ pc=12
Stack: []
Memory: [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
---------
Output : 0x2a00000000000000