Documentation

This documentation is for Ethers v5.

For Ethers v6, see the v6 documentation.

What is Ethers?

The ethers.js library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem. It was originally designed for use with ethers.io and has since expanded into a more general-purpose library.

Features

Developer Documentation

Getting Started
Installing
Importing
Common Terminology
Connecting to Ethereum: MetaMask
Connecting to Ethereum: RPC
Contracts
Signing Messages
Ethereum Basics
Events
Logs and Filtering
Solidity Topics
Gas
Gas Price
Gas Limit
Security
Side-Channel Attacks
Key Derivation Functions
Best Practices
Network Changes
Provider API Keys
Etherscan
INFURA
Alchemy
Pocket Gateway
Ankr
Creating a Default Provider
Application Programming Interface
Providers
Provider
Accounts Methods
Blocks Methods
Ethereum Naming Service (ENS) Methods
EnsResolver
Logs Methods
Network Status Methods
Transactions Methods
Event Emitter Methods
Inspection Methods
BaseProvider
JsonRpcProvider
JsonRpcSigner
JsonRpcUncheckedSigner
StaticJsonRpcProvider
Node-Specific Methods
API Providers
EtherscanProvider
InfuraProvider
AlchemyProvider
CloudflareProvider
PocketProvider
AnkrProvider
Other Providers
FallbackProvider
IpcProvider
JsonRpcBatchProvider
UrlJsonRpcProvider
Web3Provider
WebSocketProvider
Types
BlockTag
Networkish
Network
FeeData
Block
Events and Logs
Transactions
Access Lists
Signers
Signer
Wallet
VoidSigner
ExternallyOwnedAccount
Contract Interaction
Contract
Creating Instances
Properties
Methods
Events
Meta-Class
ContractFactory
Creating Instances
Properties
Methods
Example: ERC-20 Contract
Deploying a Contract
Connecting to a Contract
Properties
Methods
Events
Meta-Class Methods
Meta-Class Filters
Utilities
Application Binary Interface
AbiCoder
Creating Instance
Coding Methods
ABI Formats
Human-Readable ABI
Solidity JSON ABI
Solidity Object ABI
Converting Between Formats
Fragments
Formats
Fragment
ConstructorFragment
ErrorFragment
EventFragment
FunctionFragment
ParamType
Interface
Creating Instances
Properties
Formatting
Fragment Access
Signature and Topic Hashes
Encoding Data
Decoding Data
Parsing
Types
Specifying Fragments
Addresses
Address Formats
Converting and Verifying
Derivation
Contracts Addresses
BigNumber
Types
Creating Instances
Methods
Notes
Byte Manipulation
Types
Inspection
Converting between Arrays and Hexstrings
Array Manipulation
Hexstring Manipulation
Signature Conversion
Random Bytes
Constants
Bytes
Strings
BigNumber
Display Logic and Input
Units
Functions
Encoding Utilities
Base58
Base64
Recursive-Length Prefix
FixedNumber
Creating Instances
Properties
Methods
FixedFormat
Hashing Algorithms
Cryptographic Hash Functions
HMAC
Hashing Helpers
Solidity Hashing Algorithms
HD Wallet
Types
HDNode
Other Functions
Logging
Logger
Errors
Log Levels
Property Utilities
Signing Key
Other Functions
Strings
Bytes32String
UTF-8 Strings
UnicodeNormalizationForm
Custom UTF-8 Error Handling
Transactions
Types
Functions
Web Utilities
Wordlists
Wordlist
Languages
Other Libraries
Assembly
Ethers ASM Dialect
Opcodes
Labels
Literals
Comments
Scopes
Data Segment
Links
Stack Placeholders
Evaluation and Execution
Utilities
Assembler
Disassembler
Opcode
Abstract Syntax Tree
Types
Nodes
Hardware Wallets
LedgerSigner
Experimental
BrainWallet
EIP1193Bridge
NonceManager
Command Line Interfaces
Sandbox Utility
Help
Examples
Assembler
Help
Example Input Files
Assembler Examples
Disassembler Examples
Ethereum Naming Service
Help
Examples
TypeScript
Help
Examples
Making Your Own
CLI
Plugin
ArgParser
Cookbook
React Native (and ilk)
Installing
Security
Transactions
Compute the raw transaction
Migration Guide
Migration: From Web3.js
Providers
Signers
Contracts
Numbers
Utilities
Migration: From Ethers v4
BigNumber
Contracts
Errors
Interface
Wallet
Testing
Supported Platforms
Test Suites
Test Suite API
Schemas
Contributing and Hacking
Building
Documentation
Other Resources
Ethereum Overview
Tutorials
Flatworm Docs
Fragments
Markdown
Code
Tables
Configuration
Extensions
License and Copyright

Legacy Documentation

This section will be kept up to date, linking to documentation of older versions of the library.