Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

viem

TypeScript interface for Ethereum with type-safe interactions.

Crypto and web3NPM

GitHubWebsite

1. License

License from npm.

github.com/wevm/viem

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What viem does

viem was written by the wagmi authors as a low-level, stateless TypeScript layer for Ethereum. It deliberately mirrors the chain's own shapes, such as positional contract arguments, array return values and separate Wallet and Public clients, even where that costs some convenience.

viem popularity

73 / 100
Gid Score, #277 overall
10.7M
downloads a week, npm
3,632
GitHub stars
47
agent projects use it
viem: downloads per weeknpm, viem 10,749,623
viem: GitHub starswevm/viem 3,632

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How viem is used

  • viem is a dependency in 47 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.0% of the 4,867 JavaScript/TypeScript ones), #1 of 155 in crypto and web3.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,920; those are left out of every share on this page.
  • The most used alternative in our scan is ethers.js (30 projects).
  • Projects that use it most often also use TanStack Query (38.3%), wagmi (36.2%), Zod (59.6%).

By coding agent

24 projects, 1.0%
22 projects, 0.7%
16 projects, 0.5%
9 projects, 2.7%
5 projects, 1.1%

Often used with

In 38.3% of its projects
In 36.2% of its projects
In 59.6% of its projects
In 87.2% of its projects
In 42.6% of its projects
In 59.6% of its projects
In 42.6% of its projects
In 27.7% of its projects

viem in practice

Strengths

Only the modules you import ship

The docs say viem is tree-shakable. They argue that end users should not have to download "a module of over 100kB" just to interact with Ethereum.

Types inferred from your ABI

The site lists utilities for encoding, decoding and inspecting ABIs. It says viem can infer types from ABIs and EIP-712 Typed Data. Amounts use the browser's native <code>BigInt</code> instead of a BigNumber library.

Tests run against a forked chain

The maintainers say stability matters because many organizations depend on wagmi. Their test suite runs against a forked Ethereum node, and they aim for complete test coverage.

Local and remote signing are kept apart

viem does not use a single "Signer". A Local Account signs directly with its private key. A JSON-RPC Account asks a wallet, such as a browser extension or WalletConnect, to sign, and the wallet can refuse that request.

Watch out for

More code per call, by design

The authors admit the APIs can be wordier than in other libraries. They call this a trade-off in favour of flexible building blocks.

Contract args are positional arrays

You pass <code>args</code> as a tuple, not an object, even when every input is named in Solidity. The FAQ says TypeScript doesn't support dynamic named tuples yet. Once it does, viem will add them so parameter names show up in your editor.

Multi-value returns come back as arrays

A function that returns several named values gives you an array of decoded values, not an object. Only explicitly typed tuples, such as structs, map to objects.

Read the latest block number

import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = createPublicClient ({
  chain: mainnet,
  transport: http (),
})

const blockNumber = await client. getBlockNumber ()

More about viem

Funding
  • GitHub Sponsors: https://github.com/wevm
  • Own page: https://drips.network/wevm.eth
  • 16 GitHub sponsors

See all

Packages around it
  • wagmi: React Hooks for Ethereum, same authors
  • @tanstack/react-query: TanStack Query
  • ethers: Alternative; docs have a v5 migration guide
  • @rainbow-me: RainbowKit
  • next: Next.js
More in Crypto and web3

Alternatives

viem This page

MITGid 7310.7M/wk

ethers.js

Complete Ethereum library for building dapps, wallets and blockchain tools.

MITGid 695.1M/wk

Compare viem with another tool

Get started

Install it.

npm install viem

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## viem
- Create a Client with an explicit `chain` (from `viem/chains`) and `transport`, then call Actions on it.
- In production, pass an authenticated RPC URL to `http(...)`. Without a URL, viem uses a public RPC provider.
- Use a Public Client for reads such as `readContract`, `getBalance` and `getBlockNumber`. A Wallet Client does not support public actions.
- Pass contract `args` as a positional array in ABI order, not as an object keyed by parameter name.
- Expect an array when a contract function returns several values. Only explicitly typed tuples (structs) decode to objects.
- Use native `bigint` literals such as `100n` for amounts.
- When signing through a JSON-RPC Account (browser extension, WalletConnect), handle the case where the wallet rejects the request. A signature is not guaranteed.