Overview

What viem is, the problems it solves versus class-based Web3 libraries, and where it sits under higher-level frameworks like Wagmi.

Path: overview

Third-party documentation. This is independently authored analysis of the public Viem codebase — not the official docs, and not reviewed or endorsed by the Viem team.

Viem

Viem is a TypeScript library for interacting with Ethereum: reading chain state, encoding and decoding ABI data, sending transactions, and subscribing to events. Its design stance is unusual among Web3 libraries — no classes, no single client object holding global state, no plugin system. Instead it exposes actions: small, pure, tree-shakeable functions that take explicit parameters and return typed results.

Why it exists

Older Ethereum libraries grew around a singleton connection object with mutable configuration, which made them awkward to use in server-side contexts, hard to type precisely, and expensive to bundle. Viem's core bet is that a chain interface can be ordinary functional TypeScript: compose a client from a chain and a transport, call action functions, get decoded values with end-to-end types derived from literal ABIs.

Where it sits in the ecosystem

  • EIP-1193 providers — injected browser wallets are just one transport type; viem wraps them rather than depending on them.
  • Wagmi — the React hooks library built on viem; most React apps consume viem through it, but viem itself has zero framework coupling.
  • Node services and indexers — stateless clients make viem a common choice for backend jobs that talk to many chains concurrently.
  • TypeScript compiler — treated as a first-class runtime dependency: const-asserted ABIs produce precise function-name, argument, and return types.