{
 "kind": "tool",
 "slug": "viem",
 "path": "tools/viem/",
 "name": "viem",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Crypto and web3",
   "tools/web3/"
  ]
 ],
 "lead": "TypeScript interface for Ethereum with type-safe interactions.",
 "chips": [
  {
   "label": "Crypto and web3",
   "path": "tools/web3/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install viem"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/wevm/viem"
  },
  {
   "label": "Website",
   "href": "https://viem.sh"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/wevm/viem"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 24, 2026",
   "note": "Latest GitHub release Nov 24, 2026. ",
   "src": "https://github.com/wevm/viem"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "47 projects",
   "status": "info",
   "sub": "#1 of 155 in its category",
   "note": "Dependency in 47 public GitHub projects set up for AI coding agents that we scanned (0.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://viem.sh/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What viem does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "viem popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "73",
       "of": "/ 100",
       "l": "Gid Score, #277 overall"
      },
      {
       "n": "10.7M",
       "l": "downloads a week, npm"
      },
      {
       "n": "3,632",
       "l": "GitHub stars"
      },
      {
       "n": "47",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How viem is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "24 projects, 1.0%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "22 projects, 0.7%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "16 projects, 0.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "9 projects, 2.7%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "5 projects, 1.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 38.3% of its projects",
       "v": "TanStack Query",
       "path": "tools/tanstack-react-query/"
      },
      {
       "l": "In 36.2% of its projects",
       "v": "wagmi",
       "path": "tools/wagmi/"
      },
      {
       "l": "In 59.6% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 87.2% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 42.6% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 59.6% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 42.6% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 27.7% of its projects",
       "v": "React Hook Form",
       "path": "tools/react-hook-form/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "viem in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Only the modules you import ship",
       "v": "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."
      },
      {
       "l": "Types inferred from your ABI",
       "v": "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."
      },
      {
       "l": "Tests run against a forked chain",
       "v": "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."
      },
      {
       "l": "Local and remote signing are kept apart",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "More code per call, by design",
       "v": "The authors admit the APIs can be wordier than in other libraries. They call this a trade-off in favour of flexible building blocks."
      },
      {
       "l": "Contract args are positional arrays",
       "v": "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."
      },
      {
       "l": "Multi-value returns come back as arrays",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Read the latest block number"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Ts",
       "code": "import { createPublicClient, http } from 'viem'\nimport { mainnet } from 'viem/chains'\n\nconst client = createPublicClient ({\n  chain: mainnet,\n  transport: http (),\n})\n\nconst blockNumber = await client. getBlockNumber ()"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about viem",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/wevm",
        "Own page: https://drips.network/wevm.eth",
        "16 GitHub sponsors"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "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"
       ]
      },
      {
       "title": "More in Crypto and web3",
       "path": "tools/web3/",
       "items": [
        {
         "text": "Solana Web3.js",
         "path": "tools/solana-web3-js/"
        },
        {
         "text": "wagmi",
         "path": "tools/wagmi/"
        },
        {
         "text": "TweetNaCl.js",
         "path": "tools/tweetnacl/"
        },
        {
         "text": "Hardhat",
         "path": "tools/hardhat/"
        },
        {
         "text": "OpenZeppelin Contracts",
         "path": "tools/openzeppelin/"
        },
        {
         "text": "Solana SPL Token",
         "path": "tools/solana-spl-token/"
        },
        {
         "text": "Hardhat Toolbox",
         "path": "tools/nomicfoundation-hardhat-toolbox/"
        },
        {
         "text": "Metaplex",
         "path": "tools/metaplex-foundation/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "viem",
       "me": true,
       "facts": [
        "MIT",
        "Gid 73",
        "10.7M/wk"
       ]
      },
      {
       "name": "ethers.js",
       "why": "Complete Ethereum library for building dapps, wallets and blockchain tools.",
       "path": "tools/ethers/",
       "facts": [
        "MIT",
        "Gid 69",
        "5.1M/wk"
       ]
      }
     ],
     "more": "Compare viem with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install viem"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## viem\n- Create a Client with an explicit `chain` (from `viem/chains`) and `transport`, then call Actions on it.\n- In production, pass an authenticated RPC URL to `http(...)`. Without a URL, viem uses a public RPC provider.\n- Use a Public Client for reads such as `readContract`, `getBalance` and `getBlockNumber`. A Wallet Client does not support public actions.\n- Pass contract `args` as a positional array in ABI order, not as an object keyed by parameter name.\n- Expect an array when a contract function returns several values. Only explicitly typed tuples (structs) decode to objects.\n- Use native `bigint` literals such as `100n` for amounts.\n- When signing through a JSON-RPC Account (browser extension, WalletConnect), handle the case where the wallet rejects the request. A signature is not guaranteed.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm viem"
  ],
  [
   "Category",
   "Crypto and web3"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "viem@2.57.4, October 8, 2026"
  ],
  [
   "On GitHub since",
   "July 2022"
  ],
  [
   "Gid Score",
   "72.9"
  ],
  [
   "Rank in category",
   "#1 of 155"
  ],
  [
   "GitHub",
   "wevm/viem"
  ],
  [
   "Last change",
   "Nov 24, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/wevm.png"
}