These libraries are used across the stack to write tests, simulate transactions, connect wallets, and interface with the blockchain in both scripting and frontend contexts.
Library
Purpose
Key Features
Ethers.js
Contract interaction, transaction signing, provider management in JS/TS environments
Provides Contract, Provider, Wallet, and Interface abstractions. Deep Hardhat integration. ABI coder, calldata utilities, and ENS support.
Viem
Modular TypeScript-first library for RPC, contract access, encoding, and data formatting
Tree-shakeable. Supports batching, client-side caching, EIP-1559 fees, multicalls, typed reads/writes. Used by Wagmi.
Wagmi
React hooks for wallet connection, chain state, and contract calls in frontend apps
Built on Viem. Includes useAccount, useConnect, useContractRead, and event subscriptions. Enables seamless integration with wallet modals.
Web3.js
Legacy Ethereum contract and RPC library
One of the earliest libraries. Now largely unmaintained. Lacks EIP-1559 support and modern modularity.
RainbowKit
React component library for wallet connection UI and chain management
Pre-built wallet connect buttons, chain switch UI, and custom themes. Integrates with Wagmi for wallet state management and tx handling.
Ethers and Viem serve similar purposes, but Viem is optimized for frontend apps. Wagmi builds on Viem. Web3.js is no longer recommended for new projects.
# Run JSON-RPC compatibility testscd /path/to/cosmos-evmmake test-rpc-compat # Makefile:373# Test specific tool./scripts/tests_compatibility_foundry.sh./scripts/tests_compatibility_hardhat.sh./scripts/tests_compatibility_viem.sh./scripts/tests_compatibility_web3js.sh./scripts/tests_compatibility_foundry_uniswap_v3.sh
const { time, expectRevert } = require('@openzeppelin/test-helpers');// advance clock by one dayawait time.increase(time.duration.days(1));// expect revert with specific reasonawait expectRevert(contract.someFunction(), "Ownable: caller is not the owner");