Ethereum Interface
for Humans & Agents
Build software on Ethereum faster with a clear & reliable interface that developers and AI agents can confidently navigate and use.
npm install viem@nextRead v3.viem.sh and help me build my project with Viem. Add https://v3.viem.sh/api/mcp as an MCP server. Refer to https://v3.viem.sh/docs/v2-migration when migrating from Viem v2.Four concepts to build anything.
A connects to a through a . provide the functionality to read state, send transactions, and interact with wallets.
Client
Learn moreCompose a Chain, Transport, Account, and only the Actions your application needs.
import { , , } from 'viem'
import { } from 'viem/chains'
const = .({
: ,
: (),
}).(())
const = await ..({
: '0x55FE002aefF02F77364de339a1292923A15844B8',
: 'usdc',
})
{ amount: 1000000000n, decimals: 6, formatted: '1000' }One prompt to start building.
Point a coding agent at Viem and let it build. Docs served as Markdown, llms.txt indexes, and an MCP server over docs and source keep agents working against current APIs, not stale training data.
Read v3.viem.sh and help me build my project with Viem. Add https://v3.viem.sh/api/mcp as an MCP server. Refer to https://v3.viem.sh/docs/v2-migration when migrating from Viem v2.
Added MCP server viem · viem.sh/api/mcp
search_docs("send a transaction")
read_page("/docs/clients/create")
Wrote viem.config.ts
Wrote src/pay.ts
tsc --noEmit · 0 errors
Actions that read like business logic.
AI agents shouldn't need to waste tokens crawling docs to figure out how to perform actions. Namespaced methods for tokens, transactions, ENS, and wallets say what they do: high-level where it helps, without hiding how Ethereum works.
Learn moreimport { } from './viem.config'
// Viem batches the concurrent reads into a single multicall.
const [, ] = await .([
..({ : 'usdc' }),
..({ : 'treasury.wevm.eth' }),
])
const = await ..({
: .,
,
: 'usdc',
})
{ value: 1250000000n, formatted: '1250', receipt: { status: 'success', ... },}Tokens without the ABI ceremony.
Every app rebuilds the same ERC-20 plumbing: ABI imports, decimals lookups, unit math. Declare tokens once on the Client, reference them by symbol, and balances, transfers, and approvals come back already formatted.
Learn moreimport { , , } from 'viem'
import { } from 'viem/chains'
import { } from 'viem/tokens'
const = .({
: ,
: .,
: (),
}).(())
const = await ..({
: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
: 'usdc',
})
{ amount: 1000000000n, decimals: 6, formatted: '1000' }Native speed for the hot path.
Cloud platforms bill compute by the millisecond, and busy backends burn through them at scale. WASM modules run on average ~6-10× faster than pure JavaScript, with no native addons to compile, bundle, or deploy.
Learn moreimport { } from 'viem/wasm'
await .() // everything below just got faster500+ chains, one interface.
Adding a network shouldn't start with a hunt for RPC URLs, fee formulas, and custom field codecs. Every major chain ships typed, with fees, contracts, and endpoints included, and a custom chain takes a few lines.
Learn moreimport { , } from 'viem'
import { , , , } from 'viem/chains'
const = .({
: ,
: (),
})
const { , } = .
name: 'Tempo Mainnet'blockTime: 200Types that follow your inputs.
A mistyped token symbol should fail in your editor, not on mainnet. Inference narrows every option across tokens, ABIs, chains, and accounts, and gives coding agents a compiler feedback loop that catches bad calls before anything runs.
Learn moreawait ..({
: { : '250' },
: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
: '|- usdc
- usdt
- eurc
- dai
- wbtc
})Rate limits & outages, handled in the transport.
Launch-day traffic finds every limit your providers have. Spread requests across endpoints, keep each within its plan, and reroute around failures: resilience in the transport, not your application code.
Learn moreimport { , , , } from 'viem'
import { } from 'viem/chains'
const = .({
: ,
: ([
(('https://1.rpc.example'), { : 25 }),
(('https://2.rpc.example'), { : 10 }),
]),
})