4 releases
0.1.3 | Jan 7, 2025 |
---|---|
0.1.2 | Jan 7, 2025 |
0.1.1 | Jan 7, 2025 |
0.1.0 | Jan 7, 2025 |
#8 in #u256
228 downloads per month
100KB
2.5K
SLoC
xevm
xevm
is a tiny implementation of Ethereum Virtual Machine, written in pure Rust!
Sample usage:
use alloy_primitives::primitives::{Address, U256};
use xevm::context::MiniEthereum;
use xevm::machine::{CallInfo, Machine};
use xevm::opcodes::ExecutionResult;
fn main() {
let code = vec![];
let mut ctx = MiniEthereum::new();
let exec_result = Machine::new(Address::ZERO, code.clone())
.run(
&mut ctx,
&CallInfo {
origin: Address::ZERO,
caller: Address::ZERO,
call_value: U256::ZERO,
calldata: vec![0xd0, 0x9d, 0xe0, 0x8a],
},
)
.unwrap();
match exec_result {
ExecutionResult::Returned(ret) => {
println!("Returned {:?}!", ret);
}
ExecutionResult::Halted => {
println!("Halted!");
}
}
}
Dependencies
~10MB
~175K SLoC