Skip to content

Viem

Viem is a TypeScript EVM library with public, wallet and test clients. It infers ABI types and simulates calls; configuration and transaction tracking remain application responsibilities. It can be used in interfaces, SDKs and backend services without requiring React. Applications keep network and account configuration explicit and distinguish simulation from completed execution.

Written by Isaac GonzálezUpdated October 11, 2026

Key takeaways

  • Viem uses TypeScript to type calls and results from a contract’s ABI.
  • It separates read, signing and test clients by responsibility.
  • Simulation and types help detect errors but do not guarantee future execution.

What is Viem?

Viem is a TypeScript library for Ethereum and EVM networks. Its API separates querying, signing and testing capabilities and infers types from contract ABIs. It can be used in frontends, SDKs and backend services without depending on React or a particular interface framework.

Inference helps detect function names or arguments incompatible with the declared ABI. It does not verify that the configured address contains that contract or that external data is correct. Integration quality also depends on deployment configuration, runtime validation and the handling of network responses.

How it works

Public clients query state and simulate calls; wallet clients request signatures or submit authorised operations. Transports connect through HTTP, WebSocket or custom providers. Explicit network and account selection helps prevent preparing an operation for a destination different from the wallet's active network.

Write simulation can detect reverts and prepare a request consistent with queried state. Submission remains a separate step and can fail if balances, permissions or contract conditions change. Applications must track receipts rather than present a successful simulation as a completed on-chain operation.

What Viem offers

A protocol SDK can expose functions incorporating ABI, address and expected units, reducing repeated decisions for consuming teams. Responses retain bigint where appropriate and use explicit conversion rules at transport boundaries. Documentation should explain amounts and errors rather than relying on types alone.

Reads may be grouped when dependencies and environment permit. Critical operations should retain the block or temporal reference used for their inputs. This supports reproducing decisions and detecting whether separate reads describe incompatible states, especially when multiple providers or cached sources are involved.

Limitations and selection criteria

Modularity helps bundlers remove unused code, but final size depends on imports and configuration. There is no universal percentage saving over Ethers. Selection should consider existing clients, typing requirements and team maintenance needs rather than generic bundle comparisons or ecosystem popularity.

Alternative transports help with failures, although providers may return different heights or states. Applications should check network and freshness, limit retries and recover missed events. Types and a well-designed API reduce some mistakes without replacing tests of signing and confirmation journeys.

Also known as

  • viem.sh
  • Viem client
  • Wevm Viem
Development at Metlabs

How we approach a project with Viem

Development capabilities and use cases to assess how Viem fits your product.

What we build with Viem at Metlabs

  • Typed clients

    Public, wallet and test clients with typing inferred from the ABI and the selected chain.

  • Bundle performance

    Tree-shaking that reduces frontend size loading only what's used.

  • ABI-derived types

    We set the ABI as a constant so TypeScript infers parameters and return types, catching integration errors at compile time.

  • Use case

    Typed protocol SDK

    Client library distributed to third parties exposing each contract function with strict types.

  • Use case

    End-to-end typed dApp

    A frontend using ABI types while validating network, address and outcomes at runtime.

Related content

Go deeper on Viem

Other Metlabs pages that expand on this entry.

Building with Viem?

We analyze your case, pick the right stack and ship a production-ready solution.

Tell us about your project

As featured in

CointelegraphInvesting.comEl EspañolEmprendedoresEl ObservadorCriptoNoticias