cita-vm
Fast EVM implementation for CITA. Tuned for high performance, up to 5x faster than parity. Based entirely on the Ethereum Yellow Paper(Version: 2d0661f 2018-11-08).
[dependencies]
cita_vm = { git = "https://github.com/cryptape/cita-vm" }
Example
Let us begin with the most basic example. First, we initialize a database in memory:
let db = new;
And, wrap this db as a WorldState
let mut state = new.unwrap;
Create some accounts in WorldState
, one of them stores the SimpleStorage code.
let code = "6080604052600436106049576000357c0100000000000000000000000000000\
000000000000000000000000000900463ffffffff16806360fe47b114604e57\
80636d4ce63c146078575b600080fd5b348015605957600080fd5b506076600\
4803603810190808035906020019092919050505060a0565b005b3480156083\
57600080fd5b50608a60aa565b6040518082815260200191505060405180910\
390f35b8060008190555050565b600080549050905600a165627a7a72305820\
99c66a25d59f0aa78f7ebc40748fa1d1fbc335d8d780f284841b30e0365acd9\
60029";
state.new_contract;
state.new_contract;
Send a transaction to call SimpleStorage.set(42)
let block_data_provider: =
new;
let state_data_provider = new;
let context = default;
let config = Config ;
let tx = Transaction ;
let r = exec
.unwrap;
Send a transaction to call SimpleStorage.get()
let tx = Transaction ;
let r = exec
.unwrap;
println!; // 42 is outputed
Full code could be found here.
Performance comparison with parity and geth
In short, cita-vm is the fastest EVM. Below are benchmark results on Intel(R) Xeon(R) CPU E5-26xx v3.
Tests
Licences
Apache License 2.0