Ethers.js

github
Developer Tools

Ethers.js provides a powerful and flexible JavaScript library for building Ethereum-based applications.

What is Ethers.js?

Ethers.js is a comprehensive and compact JavaScript library designed for interacting with the Ethereum blockchain and its ecosystem. Developed with a focus on security, simplicity, and efficiency, Ethers.js empowers developers to build decentralized applications (dApps), wallets, and other tools that require reading and writing to the Ethereum blockchain.

Key Features of Ethers.js

Secure Key Management

Ethers.js prioritizes security by keeping private keys in the client-side, ensuring they remain safe and sound. It supports importing and exporting JSON wallets (Geth, Parity, and crowdsale) and BIP 39 mnemonic phrases (12-word backup phrases) for HD Wallets.

Contract Interaction

Ethers.js simplifies interacting with smart contracts by creating JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI. This feature streamlines the process of integrating and working with smart contracts in your applications.

Connectivity Options

Ethers.js provides multiple options for connecting to Ethereum nodes, including JSON-RPC, Infura, Etherscan, Alchemy, Cloudflare, or MetaMask. It also supports Ethereum Name Service (ENS) names, allowing you to use them seamlessly alongside Ethereum addresses.

Lightweight and Efficient

Ethers.js is designed to be lightweight (~88kb compressed) while offering complete functionality for all your Ethereum needs. Its compact size and efficient implementation make it suitable for a wide range of applications, from browser-based dApps to server-side scripts.

Extensive Documentation and Testing

Ethers.js comes with extensive documentation, covering all aspects of the library's functionality. Additionally, it includes a large collection of well-maintained test cases, ensuring the library's reliability and robustness.

TypeScript Support

Ethers.js is fully TypeScript-ready, providing type definitions and TypeScript source code. This feature enhances developer productivity and enables better tooling support for TypeScript projects.

How to Use Ethers.js

Step 1: Install Ethers.js Install Ethers.js in your project using npm or yarn.

Step 2: Import Ethers.js Import the necessary components from Ethers.js in your JavaScript or TypeScript files.

Step 3: Connect to an Ethereum Node Create an Ethers.js provider to connect to an Ethereum node, such as a local node, a public node (e.g., Infura, Alchemy), or a node provided by a wallet (e.g., MetaMask).

Step 4: Create a Wallet or Use an Existing One Create an Ethers.js wallet to manage your Ethereum accounts and sign transactions, or use an existing wallet (e.g., MetaMask).

Step 5: Interact with Contracts Use Ethers.js to interact with smart contracts by creating contract instances and calling their functions.

Step 6: Send Transactions Send transactions to the Ethereum network using Ethers.js, such as transferring Ether or interacting with smart contracts.

Supported Chains

polygon-zkevm-mainnet
scroll-mainnet
linea-mainnet
arbitrum-mainnet
klaytn-mainnet
matic-mainnet
taiko-mainnet
flarenetworks-flare-mainnet
telos-mainnet
arbitrum-nova-mainnet
blast-mainnet
gnosis-mainnet
rollux-mainnet
bsc-mainnet
mantle-mainnet
avalanche-mainnet
celo-mainnet
harmony-mainnet
metis-mainnet
xai-mainnet
heco-mainnet
moonbeam-mainnet
horizen-eon-mainnet
solana-mainnet
base-mainnet
eth-mainnet
iotex-mainnet
zksync-mainnet
optimism-mainnet
btc-mainnet
fantom-mainnet
defi-kingdoms-mainnet
boba-mainnet
evmos-mainnet
eth-goerli
eth-holesky
meter-mainnet
moonbeam-moonriver
oasys-mainnet
palm-mainnet
astar-mainnet
cronos-mainnet
aurora-mainnet
avalanche-meld-mainnet
skale-calypso
zetachain-mainnet
eth-sepolia
arbitrum-sepolia
base-sepolia-testnet
boba-bnb-mainnet
boba-bnb-testnet
mode-mainnet
optimism-sepolia
matic-mumbai
avalanche-testnet
bsc-testnet
fantom-testnet
mantle-sepolia-testnet
moonbeam-moonbase-alpha
rsk-mainnet
rsk-testnet
zora-mainnet
zora-sepolia-testnet

Get started with GoldRush

GoldRush is a set of data tools that enable easy web3 development across 200+ blockchains.