A simple Ethereum Virtual Machine (EVM) simulator built in JavaScript.
This project helps you understand how the EVM executes opcodes, manages stack, memory, storage, and control flow.
- Stack operations:
PUSH,POP,DUP,SWAP - Arithmetic:
ADD,SUB,MUL,DIV - Memory operations:
MSTORE,MLOAD - Storage operations:
SSTORE,SLOAD - Control flow:
JUMP,JUMPI - Logic operations:
EQ,LT,GT,ISZERO
mini-evm/ ├─ src/ │ ├─ evm.js # MiniEVM implementation │ └─ programs.js # Test programs ├─ index.js # Test runner ├─ package.json └─ README.md
bash Copy code
- Install Node.js if not already installed.
- Clone the repository:
git clone https://github.com/MilosMicun/evm-simulator-js.git
cd evm-simulator-js
Run all tests:
bash
Copy code
node index.js
You should see output for all test cases showing the final stack, memory, and storage.
Example Output
yaml
Copy code
===== Running: Simple Addition Test =====
Final stack: [ 5 ]
Memory: {}
Storage: {}
Future Work
Add more EVM opcodes
Simulate gas consumption
Extend for Solidity-like function calls
Author
Milos Micun – learning blockchain & EVM internals with JavaScript