[email protected] device
The first Revm EVM device on HyperBEAM
About
The @evm1.0
device: an EVM bytecode emulator built on top of Revm (version v22.0.1).
The device not only allows evaluation of bytecode (signed raw transactions) against a given state db, but also supports appchain creation, statefulness, EVM context customization (gas limit, chain id, contract size limit, etc.), and the elimination of the block gas limit by substituting it with a transaction-level gas limit.
This device is experimental, in PoC stage
Live demo at ultraviolet.load.network
Technical Architecture
eval_bytecode()
takes 3 inputs, a signed raw transaction (N.B: chain id matters), a JSON-stringified state db and the output state path (here in this device it's in ./appchains)
#[rustler::nif]
fn eval_bytecode(signed_raw_tx: String, state: String, cout_state_path: String) -> NifResult<String> {
let state_option = if state.is_empty() { None } else { Some(state) };
let evaluated_state: (String, String) = eval(signed_raw_tx, state_option, cout_state_path)?;
Ok(evaluated_state.0)
}
#[rustler::nif]
fn get_appchain_state(chain_id: &str) -> NifResult<String> {
let state = get_state(chain_id);
Ok(state)
}

References
device source code: native/load_revm_nif
hb device interface: dev_evm.erl
nif tests: load_revm_nif_test.erl
ao process example: evm-device.lua
Last updated