ethers-js

Implements Ethereum interactions with ethers.js v6 including providers, signers, contracts, and event handling.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill ethers-js-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ethers-js
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/ethers-js
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill ethers-js-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ethers.

What problem does it solve? LLMs consistently generate outdated ethers.js v5 code with BigNumber, ethers.utils, and ethers.providers patterns that fail against v6. This Skill provides correct v6 patterns for Provider setup, Wallet signing, Contract interaction, ABI encoding, event filtering, and ENS resolution so generated code works on the first attempt. ## Core Features & Use Cases - v5 to v6 Migration Corrections: Complete mapping of breaking changes including native bigint replacing BigNumber, top-level utility exports, BrowserProvider replacing Web3Provider, and null-returning tx.wait() handling. - Provider and Signer Patterns: Covers JsonRpcProvider, WebSocketProvider, BrowserProvider, and FallbackProvider with quorum configuration, plus Wallet creation from private keys, mnemonics, and browser wallets. - Contract Interaction and Error Handling: Read/write Contract usage, ContractFactory deployment, staticCall simulation, Multicall3 batching, and structured isError-based error handling with a full error code reference. - Use Case: A developer asks an agent to write a script that transfers USDC and listens for Transfer events. The Skill ensures the output uses parseUnits, bigint arithmetic, proper receipt null checks, and WebSocketProvider subscriptions instead of deprecated v5 idioms. ## Quick Start Ask the agent to write an ethers.js v6 script that connects to an RPC endpoint, checks an ERC-20 balance, and sends a transfer with proper error handling.

Frequently Asked Questions about ethers-js

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from ethers.js v5 to v6?

Replace BigNumber with native bigint, move ethers.utils functions to top-level imports like parseEther, and swap ethers.providers classes for direct imports like JsonRpcProvider. Also handle tx.wait() returning null and use await contract.getAddress() instead of contract.address.

How do I connect ethers.js v6 to MetaMask in a browser?

Use BrowserProvider to wrap the window.ethereum EIP-1193 object injected by the wallet, then call await provider.getSigner() to request account access. This replaces the v5 Web3Provider pattern.

Why does ethers.js v6 tx.wait() return null?

In v6, wait() returns null when a transaction is dropped or replaced by the network, such as during nonce conflicts or mempool eviction. Always check receipt === null before accessing receipt.status to avoid null reference errors.

Does ethers.js v6 still support BigNumber?

No, v6 removed BigNumber entirely and returns all uint256 values as native JavaScript bigint. Use standard operators like +, *, and / on bigint values, and convert with BigInt() or 123n literals instead of BigNumber.from().

How do I handle contract revert errors in ethers.js v6?

Use the isError(error, "CALL_EXCEPTION") type guard to catch reverts, then read error.reason for the revert string or error.data for custom error payloads. Custom errors can be decoded with Interface.parseError to extract named arguments.

Which provider should I use for real-time event subscriptions?

Use WebSocketProvider for persistent subscriptions like provider.on("block") and contract.on("Transfer"), since JsonRpcProvider only supports polling. Implement reconnection logic because WebSocket connections can drop in production.