| Crates.io | zabi-rs |
| lib.rs | zabi-rs |
| version | 0.0.13 |
| created_at | 2025-12-20 01:12:12.758021+00 |
| updated_at | 2026-01-24 05:01:07.507479+00 |
| description | Zero-Allocation ABI Decoder for Rust |
| homepage | |
| repository | https://github.com/smallyunet/zabi-rs |
| max_upload_size | |
| id | 1995840 |
| size | 220,057 |
The fastest, zero-allocation EVM ABI decoder for Rust.
zabi-rs is designed for high-performance applications (MEV bots, indexers, embedded devices) where every microsecond and byte of memory counts. It decodes EVM ABI data by validating and wrapping the raw specific byte slices, avoiding Vec and String allocations entirely.
malloc) during decoding.unsafe pointer arithmetic wrapped in safe APIs.alloy-primitives types (optional).[dependencies]
zabi-rs = "0.0.13"
use zabi_rs::{decode_tuple, ZU256, ZAddress};
fn main() -> Result<(), zabi_rs::ZError> {
let data = [0u8; 64]; // Your ABI encoded data
// Decode (uint256, address) tuple
let (balance, owner) = decode_tuple!(&data, ZU256, ZAddress)?;
println!("Balance: {:?}", balance);
println!("Owner: {:?}", owner);
Ok(())
}
zabi-rs is orders of magnitude faster than traditional decoders because it skips the parsing/allocation phase.
| Benchmark | zabi-rs | alloy-rs | ethers-rs |
|---|---|---|---|
| Uint256 | ~0.9 ns | ~27 ns | ~78 ns |
| Simple Tuple | ~7.8 ns | ~63 ns | ~121 ns |
| Large Array | ~2.5 ns | ~831 ns | ~5,170 ns |
> Benchmarks run on M2 Air. See benches/ for details.
Check out docs/roadmap.md for future plans (Zero-Copy Encoding, WASM).
MIT