Skip to content

avichalp/toy-evm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy EVM

The goal of this project is to build the EVM from scratch. This project doesn't aim to be feature complete, performant, or production ready.

The specification in the Ethereum Yellow Paper is extremely rigorous. At the same time, it is a dry read and difficult to understand.

With this project, I want to create a playground to tinker with EVM primitives. The main purpose is to understand the internals and the core concepts underpinning the EVM.

Current status:

  • Implements 21/140 opcodes.
  • Stack operations
  • Memory load, store, and growth
  • Storage operations
  • calldata and returndata
  • Jump Destination validation restricts invalid code jumps.
  • Static gas account: Constant gas cost for opcodes. Gas accounting for memory growth, self destruct, etc. is not yet implemented.

Requirements

Run tests

go test ./...

Examples

go run ./... -code 6001600055 -gas 50 
go run ./... -code 60048060005b8160125760005360016000f35b8201906001900390600556 -gas 1550

About

A playful EVM implementation

Topics

Resources

Stars

Watchers

Forks

Languages