Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.28 KB

File metadata and controls

58 lines (44 loc) · 1.28 KB

MiniEVM Simulator (JavaScript)

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.

Features

  • 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

Project Structure

mini-evm/ ├─ src/ │ ├─ evm.js # MiniEVM implementation │ └─ programs.js # Test programs ├─ index.js # Test runner ├─ package.json └─ README.md

bash Copy code

Usage

  1. Install Node.js if not already installed.
  2. 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