explaingit

ethers-io/ethers.js

8,667TypeScriptAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

A JavaScript library that lets developers connect to the Ethereum blockchain, manage crypto wallets, send transactions, and call smart contracts from a web page or Node.js app.

Mindmap

mindmap
  root((ethers.js))
    What it does
      Ethereum access
      Wallet management
      Smart contract calls
    Tech Stack
      TypeScript
      Node.js
      Browser compatible
    Wallet Features
      Private key management
      BIP39 mnemonics
      JSON keystore
    Providers
      INFURA
      Alchemy
      MetaMask
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a web app that connects to MetaMask and reads the user's Ether balance.

USE CASE 2

Call a smart contract function from JavaScript by supplying its ABI and contract address.

USE CASE 3

Create an Ethereum wallet from a 12-word recovery phrase and send a signed transaction to the network.

Tech stack

TypeScriptJavaScriptNode.js

Getting it running

Difficulty · moderate Time to first run · 30min

Requires an Ethereum provider API key (INFURA or Alchemy) for production, MetaMask works for browser development.

MIT licensed, use freely for any purpose, including commercial, as long as you keep the copyright notice. All dependencies are also MIT.

In plain English

Ethers.js is a JavaScript library for working with the Ethereum blockchain. Ethereum is a decentralized network where people can hold cryptocurrency (Ether) and run programs called smart contracts. This library gives JavaScript developers the tools to connect to that network, read data from it, send transactions, and manage wallets, all from a web page or a Node.js application. On the wallet side, the library can create and manage Ethereum wallets entirely within your own code. Private keys never leave the client, which means you are not handing them to a third-party server. It supports importing and exporting wallets in the JSON format used by Geth and Parity (two Ethereum node programs), and it supports the 12-word recovery phrases (BIP 39 mnemonics) that many wallet apps use. Recovery phrases are supported in over ten languages including English, Japanese, Korean, and several Chinese variants. To interact with the network, you connect through a provider, which is essentially a gateway to an Ethereum node. Ethers.js comes with built-in support for several popular providers: INFURA, Alchemy, Etherscan, Ankr, QuickNode, and MetaMask. A default provider is available for getting started quickly, though for production use the docs recommend getting your own API key from one of these services. For interacting with smart contracts, you give the library the contract's ABI (a description of its functions and data types) and it automatically creates a JavaScript object that mirrors those functions, so you can call them like regular code. ENS names (the human-readable .eth addresses that map to wallet addresses, similar to how domain names map to IP addresses) are treated as first-class citizens and can be used anywhere a raw address can. The library is written in TypeScript, has a small bundle size, supports tree-shaking (so you only include what you use), and is fully MIT licensed including all of its dependencies. Documentation is available at docs.ethers.org.

Copy-paste prompts

Prompt 1
Using ethers.js, write the code to connect to MetaMask in the browser, read the connected wallet's ETH balance, and display it on the page.
Prompt 2
How do I use ethers.js to call a read-only function on a smart contract given its ABI and address on Ethereum mainnet?
Prompt 3
Write an ethers.js script that creates a new wallet from a 12-word mnemonic, signs a transaction, and broadcasts it to the Sepolia testnet.
Prompt 4
Using ethers.js and the INFURA provider, how do I listen for Transfer events emitted by an ERC-20 token contract in real time?
Open on GitHub → Explain another repo

← ethers-io on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.