Skip to content

Installation

Install Viem via your package manager, a <script> tag, or build from source.

Package Manager

Install the required packages.

pnpm
pnpm add viem

CDN

If you're not using a package manager, you can also use Viem via an ESM-compatible CDN such as esm.sh. Simply add a <script type="module"> tag to the bottom of your HTML file with the following content.

<script type="module">
  import { createClient } from 'https://esm.sh/viem'
</script>

Using Unreleased Commits

If you can't wait for a new release to test the latest features, you can either install from the canary tag (tracks the main branch).

pnpm
pnpm add viem@canary

Or clone the Viem repo to your local machine, build, and link it yourself.

gh repo clone wevm/viem
cd viem
pnpm install
pnpm build
pnpm link --global

Then go to the project where you are using Viem and run pnpm link --global viem (or the package manager that you used to link Viem globally).

Security

Ethereum-related projects are often targeted in attacks to steal users' assets. Make sure you follow security best-practices for your project. Some quick things to get started.