Skip to content
Build reliable apps & libraries with lightweight, composable, and type-safe modules that interface with Ethereum
bash
npm i viem
npm i viem
bash
pnpm i viem
pnpm i viem
bash
bun i viem
bun i viem
Modular
Composable modules to build apps & libraries with speed
Lightweight
Tiny bundle size optimized for tree-shaking
See more
Performant
Optimized architecture compared to alternative libraries
Typed APIs
Flexible programmatic APIs with extensive TypeScript typing

Overview


ts
// 1. Import modules.
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

// 2. Set up your client with desired chain & transport.
const client = createPublicClient({
  chain: mainnet,
  transport: http(),
})

// 3. Consume an action!
const blockNumber = await client.getBlockNumber()
// 1. Import modules.
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'

// 2. Set up your client with desired chain & transport.
const client = createPublicClient({
  chain: mainnet,
  transport: http(),
})

// 3. Consume an action!
const blockNumber = await client.getBlockNumber()

Features


viem supports all these features out-of-the-box:

  • Abstractions over the JSON-RPC API to make your life easier
  • First-class APIs for interacting with Smart Contracts
  • Language closely aligned to official Ethereum terminology
  • Import your Browser Extension, WalletConnect or Private Key Wallet
  • Browser native BigInt, instead of large BigNumber libraries
  • Utilities for working with ABIs (encoding/decoding/inspection)
  • TypeScript ready (infer types from ABIs and EIP-712 Typed Data)
  • First-class support for Anvil, Hardhat & Ganache
  • Test suite running against forked Ethereum network

Community


Check out the following places for more wagmi-related content:

Support


Help support future development and make wagmi a sustainable open-source project:

Sponsors


Released under the MIT License.