Skip to content
TypeScript Interface for Ethereum
versioncoverage
Build reliable Ethereum apps & libraries with lightweight, composable, & type-safe modules from viem.
bash
npm i viem
bash
pnpm i viem
bash
yarn add viem
Modular

Composable modules to build apps & libraries with speed.

Lightweight

Tiny 22kB bundle – optimized for tree-shaking.

Performant

Optimized architecture compared to alternate libraries.

Typed APIs

Flexible programmatic APIs with full 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()

Released under the MIT License.