Ethereum Virtual Machine implementation

Overview

evmodin

Fast EVM implementation with full async support. Port of evmone to Rust.

Usage

use evmodin::{*, host::*, util::*, tracing::*};
use ethereum_types::*;
use hex_literal::hex;

let my_code = Bytecode::new()
    .mstore8_value(0, b'h')
    .mstore8_value(1, b'e')
    .mstore8_value(2, b'l')
    .mstore8_value(3, b'l')
    .mstore8_value(4, b'o')
    .ret(0, 5)
    .build();

let message = Message {
    kind: CallKind::Call,
    is_static: true,
    depth: 0,
    gas: 200,
    destination: Address::zero(),
    sender: Address::zero(),
    input_data: vec![].into(),
    value: U256::zero(),
};

assert_eq!(
    AnalyzedCode::analyze(my_code)
        .execute(&mut DummyHost, &mut NoopTracer, message, Revision::London)
        .await,
    Output {
        status_code: StatusCode::Success,
        gas_left: 146,
        output_data: b"hello".to_vec().into(),
        create_address: None,
    }
)

License: Apache-2.0

You might also like...
LC3 Virtual Machine written in Rust 🦀

LC3 - Emulator LC3-rust is a virtual machine for the Little Computer 3 architecture, written using the Rust programming language. The VM has been writ

little computer 3 (lc3) virtual machine written in Rust

Little Computer 3 (LC3) Virtual Machine (by @lowlevelers) What is Little Computer 3? Little Computer 3, or LC-3, is a type of computer educational pro

RailCar: Rust implementation of the Open Containers Initiative oci-runtime
RailCar: Rust implementation of the Open Containers Initiative oci-runtime

railcar - rust implementation of the oci-runtime spec What is railcar? railcar is a rust implementation of the opencontainers initiative's runtime spe

Rocker is a minimal docker implementation for educational purposes.
Rocker is a minimal docker implementation for educational purposes.

Rocker is a minimal docker implementation for educational purposes inspired by gocker. Rocker uses linux kernel features (namespace, cgroup, chroot etc.) to isolate container processes and limit available resourses.

A toy Cairo VM implementation in Rust

oriac A toy Cairo VM implementation in Rust This is a toy implementation of the Cairo VM I'm building for learning purposes. There's no guarantee on w

Ethereum Virtual Machine implementation

Fast EVM implementation with full async support. Port of evmone to Rust.

DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support.

DeFiCh/octopus DeFiChain octopus is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support . Proposed as a DFI

DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support

DeFiCh/metachain is a codename research & development for DFIP 2111-B: VOC: Ethereum Virtual Machine (EVM) Support . Proposed as a DFIP on Nov 2021; D

A low-level assembly language for the Ethereum Virtual Machine built in blazing-fast pure rust.
A low-level assembly language for the Ethereum Virtual Machine built in blazing-fast pure rust.

huff-rs • huff-rs is a Huff compiler built in rust. What is a Huff? Huff is a low-level programming language designed for developing highly optimized

A Rust implementation of the Lox programming language. Based on clox, the bytecode virtual machine.

A Rust implementation of the Lox programming language. Based on clox, the bytecode virtual machine.

Substreams development kit for Ethereum chains, contains Firehose Block model and helpers as well as utilities for Ethereum ABI encoding/decoding.

Substreams Ethereum Substreams development kit for Ethereum chains, contains Rust Firehose Block model and helpers as well as utilities for Ethereum A

Ethereum (and Ethereum like) indexer using P2P message to fetch blocks and transactions

Ethereum P2P indexer This project is an indexer for Ethereum and Ethereum forks. It takes advantage of the ETH (Ethereum Wire Protocol) to fetch block

Wait, another virtual machine ?

WAVM WAVM, Wait, another virtual machine ?, is a register based 64 bits virtual machine written in Rust. It relies on 32 registers and 31 opcodes that

vore is a virtual machine management tool focused on VFIO set ups.

vore is a virtual machine management tool focused on VFIO set ups. with a minimal TOML file you should be able to get you should be able to create a VFIO-focused VM.

Detect if code is running inside a virtual machine (x86 and x86-64 only).

inside-vm Detect if code is running inside a virtual machine. Only works on x86 and x86-64. How does it work Measure average cpu cycles when calling c

An LC-3 virtual machine written in Rust for learning purposes.

LC-3 written in Rust An LC-3 virtual machine written in Rust for learning purposes.

crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor

crosvm - The Chrome OS Virtual Machine Monitor crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity,

🍄 A disassembler for the UEFI Bytecode Virtual Machine.
🍄 A disassembler for the UEFI Bytecode Virtual Machine.

🍄 A disassembler for the UEFI Bytecode Virtual Machine.

STARK-based virtual machine

Polygon Miden A STARK-based virtual machine. WARNING: This project is in an alpha stage. It has not been audited and may contain bugs and security fla

Comments
  • Fixes a compilation error for wasm targets.

    Fixes a compilation error for wasm targets.

    Without this fix, the build fails when targetting wasm. Repro steps:

    $ wasm-pack build --target web
    [INFO]: 🎯  Checking for the Wasm target...
    [INFO]: 🌀  Compiling to Wasm...
       Compiling getrandom v0.2.3
    error: the wasm32-unknown-unknown target is not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
       --> /*******/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:219:9
        |
    219 | /         compile_error!("the wasm32-unknown-unknown target is not supported by \
    220 | |                         default, you may need to enable the \"js\" feature. \
    221 | |                         For more information see: \
    222 | |                         https://docs.rs/getrandom/#webassembly-support");
        | |_________________________________________________________________________^
    
    error[E0433]: failed to resolve: use of undeclared crate or module `imp`
       --> /********/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/lib.rs:246:5
        |
    246 |     imp::getrandom_inner(dest)
        |     ^^^ use of undeclared crate or module `imp`
    
    For more information about this error, try `rustc --explain E0433`.
    error: could not compile `getrandom` due to 2 previous errors
    Error: Compiling your crate to WebAssembly failed
    Caused by: failed to execute `cargo build`: exited with exit status: 101
      full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
    

    After applying this fix the compilation succeeds:

    $ wasm-pack build --target web
    [INFO]: 🎯  Checking for the Wasm target...
    [INFO]: 🌀  Compiling to Wasm...
        Finished release [optimized] target(s) in 0.13s
    [INFO]: ⬇️  Installing wasm-bindgen...
    [INFO]: Optimizing wasm binaries with `wasm-opt`...
    [INFO]: Optional fields missing from Cargo.toml: 'description', 'repository'. These are not necessary, but recommended
    [INFO]: ✨   Done in 0.71s
    [INFO]: 📦   Your wasm pkg is ready to publish at /*****/evmodin/pkg.
    
    opened by karim-agha 4
  • Adding String to Enum conversion for hardfork names.

    Adding String to Enum conversion for hardfork names.

    I needed to translate hardfork names from string to a typed enum multiple times so far when reading config, exposing JS api through N-API, etc. I think that if we keep this here, we can guarantee that this conversion will always be in sync with new hardforks that become supported by evmodin.

    opened by karim-agha 0
  • Adding String to Enum conversion for hardfork names.

    Adding String to Enum conversion for hardfork names.

    I needed to translate hardfork names from string to a typed enum multiple times so far when reading config, exposing JS api through N-API, etc. I think that if we keep this here, we can guarantee that this conversion will always be in sync with new hardforks that become supported by evmodin.

    opened by karim-agha 0
Owner
Artem Vorotnikov
Creator of Akula Ethereum. Ethereum core developer.
Artem Vorotnikov
A Rust implementation of the Lox programming language. Based on clox, the bytecode virtual machine.

A Rust implementation of the Lox programming language. Based on clox, the bytecode virtual machine.

Diego Freijo 23 Dec 26, 2022
vore is a virtual machine management tool focused on VFIO set ups.

vore is a virtual machine management tool focused on VFIO set ups. with a minimal TOML file you should be able to get you should be able to create a VFIO-focused VM.

eater 8 Mar 20, 2022
An LC-3 virtual machine written in Rust for learning purposes.

LC-3 written in Rust An LC-3 virtual machine written in Rust for learning purposes.

Rodrigo Araújo 30 Dec 11, 2022
crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor

crosvm - The Chrome OS Virtual Machine Monitor crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity,

Google 454 Dec 31, 2022
🍄 A disassembler for the UEFI Bytecode Virtual Machine.

?? A disassembler for the UEFI Bytecode Virtual Machine.

Samuel Wilder 51 Dec 6, 2022
STARK-based virtual machine

Polygon Miden A STARK-based virtual machine. WARNING: This project is in an alpha stage. It has not been audited and may contain bugs and security fla

Polygon (previously Matic) 415 Dec 28, 2022
SVM - Spacemesh Virtual Machine

SVM - Spacemesh Virtual Machine Project Goals Self-contained. Should be hosted by the Spacemesh Golang full-node and future Spacemesh Rust full-node B

Spacemesh 83 Sep 15, 2022
Dragonball-sandbox is a collection of Rust crates to help build custom Virtual Machine Monitors and hypervisors

Dragonball-sandbox is a collection of Rust crates to help build custom Virtual Machine Monitors and hypervisors. The crates here are considered to be the downstream of rust-vmm.

OpenAnolis Community 62 Dec 30, 2022
Virtual Machine Language - Yet another stack-based programming language

Virtual Machine Language - Yet another stack-based programming language

null 2 Feb 26, 2022
BM - a basic virtual machine written in rust

A basic virtual machine implementation with it's own binary format and assembly, as a learning experience.

KaviiSuri 1 May 8, 2022