Comparison
How eth.zig compares to alloy.rs, Zabi, and other Ethereum libraries.
Performance vs alloy.rs (Rust)
alloy.rs is the leading Rust Ethereum library, backed by Paradigm. eth.zig outperforms it on 23 of 26 benchmarks.
| Category | eth.zig | alloy.rs |
|---|---|---|
| Benchmarks won | 23/26 | 1/26 |
| secp256k1 signing | Faster (2.10-4.04x) | -- |
| ABI encoding/decoding | Faster (1.89-8.00x) | -- |
| Hashing (Keccak) | Faster (1.21-1.30x) | -- |
| u256 arithmetic | Faster on all ops (1.10-3.43x) | -- |
| UniswapV4 mulDiv | Faster (1.71x) | -- |
| Hex operations | Faster (1.22x) | Faster on hex parsing (1.36x, SIMD) |
See full benchmark results for details.
Features vs Zabi (Zig)
Zabi is another Zig Ethereum library. Here's how they compare:
| Feature | eth.zig | Zabi |
|---|---|---|
| Dependencies | Vendored C (secp256k1, XKCP) | C binding (secp256k1) |
| Comptime selectors | Yes | No |
| secp256k1 ECDSA | Yes (libsecp256k1 + Zig fallback) | Yes (C binding) |
| ABI encode/decode | Yes | Yes |
| HD wallets (BIP-32/39/44) | Yes | Yes |
| ERC-20/721 wrappers | Yes | No |
| JSON ABI parsing | Yes | Yes |
| WebSocket transport | Yes | Yes |
| ENS resolution | Yes | Yes |
| EIP-712 typed data | Yes | Yes |
| Multicall3 | Yes | No |
Key Differences
Performance: eth.zig beats alloy.rs (Rust) on 23 of 26 benchmarks, including secp256k1 signing (2.10x faster), ABI decoding (8.00x), and u256 mulDiv (1.71x).
Comptime selectors: eth.zig computes function selectors and event topics at compile time. This is unique to eth.zig and eliminates runtime hashing overhead. See Comptime Selectors.
Typed token wrappers: eth.zig provides ERC-20 and ERC-721 structs that wrap the contract address and provider for a clean API (token.balanceOf(addr) instead of raw ABI encoding).
vs ethers.js / viem (JavaScript)
| Aspect | eth.zig | ethers.js / viem |
|---|---|---|
| Language | Zig | JavaScript/TypeScript |
| Performance | Nanoseconds | Microseconds-milliseconds |
| Dependencies | Vendored C (compiled by zig build) | Many (npm packages) |
| Use case | Backend, infra, bots | Frontend, scripts, dApps |
| Binary size | Single static binary | Node.js runtime required |
eth.zig is not a replacement for JavaScript libraries in browser environments. It targets backend infrastructure, MEV bots, indexers, and latency-sensitive applications where performance matters.