Skip to main content

Try it Live

Run Blob examples in the interactive playground
Tevm provides WASM builds for blob operations with some limitations. This page covers WASM support, performance, and workarounds.

Current Status

Supported Operations

Unsupported Operations

KZG operations require c-kzg-4844 native library (not available in WASM):

Use Cases

Browser-Based L2 Clients

Use WASM for data encoding/decoding, compute KZG operations server-side:

Backend KZG Service

Build Configuration

WASM Builds

Tevm provides optimized WASM builds:

Output Files

Import in Browser

Performance

Data Operations

WASM performs well for data encoding/decoding:

KZG Operations

For KZG operations, use native builds or backend services:

Workarounds

Hybrid Approach

Use WASM for data operations, native for KZG:

Pre-computed Commitments

For known data, pre-compute commitments:

Testing

WASM-Specific Tests

Run WASM Tests

Future Support

Potential Improvements

  1. WASM KZG Library
    • Port c-kzg-4844 to WASM
    • Maintain compatibility with trusted setup
  2. Progressive Enhancement
    • Detect native KZG availability
    • Fall back to WASM-only operations
  3. Worker Threads
    • Offload KZG operations to workers
    • Parallel commitment computation

Tracking Issue

Follow progress on WASM KZG support:

Limitations

Memory Constraints

WASM has stricter memory limits:

No Trusted Setup Access

WASM builds cannot load trusted setup:

Best Practices

  1. Use Native for KZG - Always compute commitments/proofs in native environment
  2. WASM for Data - Use WASM builds for encoding/decoding/validation
  3. Backend Services - Provide KZG API for browser clients
  4. Pre-compute When Possible - Generate commitments ahead of time
  5. Test Both Environments - Run tests in both native and WASM

Resources

See Also