zabi-rs
Zero-Allocation ABI Decoder for Rust.
zabi-rs is a high-performance, #![no_std] compatible library designed for decoding Ethereum Virtual Machine (EVM) ABI encoded data without any heap allocation.
Unlike standard libraries like ethers-rs or alloy-rs which decode data into owned types (Vec, String, BigInt), zabi-rs maps Rust structs directly to the underlying raw byte slice (&'a [u8]) using explicit lifetimes.
Features
- ๐ Zero Allocation: No
malloc, noBox, noVec. All outcomes are references. - โก High Performance: Designed for hot-path decoding, MEV bots, and embedded environments.
- ๐ก๏ธ Safe & Unsafe Encapsulation: Uses pointer arithmetic for speed but provides safe wrappers with bounds checking.
- ๐ง no_std Compatible: Ready for strict embedded or WASM environments.
- ๐ฆ Primitive Support:
address,uint256,bytes(Basic types supported currently).
Performance
| Scenario | zabi-rs | alloy | ethers |
|---|---|---|---|
| HeavyArray | 2.1813 ns | 849.15 ns | 4.8671 ยตs |
| SimpleTuple | 7.7782 ns | 65.779 ns | 117.93 ns |
| Uint256 | 937.77 ps | 20.502 ns | 82.269 ns |
| Uint64 | 4.6626 ns | 22.106 ns | 70.719 ns |
Installation
Add this to your Cargo.toml:
[]
= "0.0.4"
Usage
use ;
Testing
Run the test suite:
License
MIT
Roadmap
See docs/roadmap.md for future plans.