Skip to content

Latest commit

 

History

History
73 lines (60 loc) · 1.75 KB

README.md

File metadata and controls

73 lines (60 loc) · 1.75 KB

zenith

CircleCI License

An implementation of the Ethereum virtual machine in pure Zig.

Project status

Scope

For now, this is a just-for-fun experiment to learn more about Zig and Ethereum.

Run VM

Run with maximum performance:

$ echo '60015f526001601ff3' | xxd -r -p | zig build run -Doptimize=ReleaseFast
EVM gas used:    17
execution time:  36.685µs
0x01

Run in debug mode:

$ echo '60015f526001601ff3' | xxd -r -p | zig build run
debug: PUSH1 0x01
debug:   Stack: push 0x01
debug:   Gas consumed: 3
debug: ---
debug: PUSH0
debug:   Stack: push 0x00
debug:   Gas consumed: 5
debug: ---
debug: MSTORE
debug:   Stack: pop 0x00
debug:   Stack: pop 0x01
debug:   Memory: Writing value=0x1 to memory offset=0
debug:   Gas consumed: 11
debug: ---
debug: PUSH1 0x01
debug:   Stack: push 0x01
debug:   Gas consumed: 14
debug: ---
debug: PUSH1 0x1f
debug:   Stack: push 0x1f
debug:   Gas consumed: 17
debug: ---
debug: RETURN
debug:   Stack: pop 0x1f
debug:   Stack: pop 0x01
debug:   Memory: reading size=1 bytes from offset=31
debug:   Return value: 0x01
debug:   Gas consumed: 17
debug: ---
EVM gas used:    17
execution time:  611.780µs
0x01

Run unit tests

zig build test --summary all