Skip to main content

Comparison

How Tevm’s request builders compare to other Ethereum libraries.
TypeScript-oriented page. In Zig, construct JSON-RPC payloads with std.json and post with std.http.Client; use primitives.AbiEncoding for calldata and result decoding.

vs Raw EIP-1193

FeatureRaw EIP-1193Tevm Request Builders
Method callsrequest({ method, params })Request builder + request()
ParametersPlain strings/objectsBranded primitive types
Type safetyNone (manual typing)Full compile-time checking
ErrorsThrows exceptionsThrows exceptions
AutocompletionNoYes

Example Comparison

// Raw EIP-1193 - no type safety
const balance = await provider.request({
  method: 'eth_getBalance',
  params: ['0x...', 'latest']  // Typos not caught!
});

// Tevm - fully typed
import * as Rpc from '@tevm/voltaire/jsonrpc';
import * as Address from '@tevm/voltaire/Address';

const balance = await provider.request(
  Rpc.Eth.GetBalanceRequest(Address('0x...'), 'latest')
);

vs ethers.js

Featureethers.jsTevm
Method styleAbstracted (getBalance)Direct JSON-RPC (eth_getBalance)
TypesRuntime classesBranded primitives (zero overhead)
Type safetyGoodExcellent (branded types)
Tree-shakingLimitedFull
Tevm provides lower-level JSON-RPC access with maximum type safety and tree-shaking.

vs viem

FeatureviemTevm
API styleActionsRequest builders
Type systemNarrow typesBranded primitives
Tree-shaking✅ Yes✅ Yes
WASM❌ No✅ Yes (optional)
Multi-language❌ No✅ Yes (TS/Zig/Rust/C)
Both provide excellent type safety. Tevm adds multi-language support and optional WASM acceleration.

When to Use Tevm

  • Type safety - Branded primitives catch errors at compile time
  • Tree-shaking - Import only what you need
  • Multi-language - Building for TypeScript + Zig/Rust/C
  • WASM acceleration - Performance-critical crypto operations
  • Direct JSON-RPC - Work directly with JSON-RPC spec