Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ethers

ethers-io5.3mMIT6.13.5TypeScript support: included

A complete and compact Ethereum library, for dapps, wallets and any other tools.

ethereum, ethers, ethersjs

readme

The Ethers Project

npm (tag) CI Tests npm bundle size (version) npm (downloads) GitPOAP Badge Twitter Follow


A complete, compact and simple library for Ethereum and ilk, written in TypeScript.

Features

  • Keep your private keys in your client, safe and sound
  • Import and export JSON wallets (Geth, Parity and crowdsale)
  • Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets (English as well as Czech, French, Italian, Japanese, Korean, Simplified Chinese, Spanish, Traditional Chinese)
  • Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI
  • Connect to Ethereum nodes over JSON-RPC, INFURA, Etherscan, Alchemy, Ankr or MetaMask
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Small (~144kb compressed; 460kb uncompressed)
  • Tree-shaking focused; include only what you need during bundling
  • Complete functionality for all your Ethereum desires
  • Extensive documentation
  • Large collection of test cases which are maintained and added to
  • Fully written in TypeScript, with strict types for security and safety
  • MIT License (including ALL dependencies); completely open source to do with as you please

Keep Updated

For advisories and important notices, follow @ethersproject on Twitter (low-traffic, non-marketing, important information only) as well as watch this GitHub project.

For more general news, discussions, and feedback, follow or DM me, @ricmoo on Twitter or on the Ethers Discord.

For the latest changes, see the CHANGELOG.

Summaries

Installing

NodeJS

/home/ricmoo/some_project> npm install ethers

Browser (ESM)

The bundled library is available in the ./dist/ folder in this repo.

<script type="module">
    import { ethers } from "./dist/ethers.min.js";
</script>

Documentation

Browse the documentation online:

Providers

Ethers works closely with an ever-growing list of third-party providers to ensure getting started is quick and easy, by providing default keys to each service.

These built-in keys mean you can use ethers.getDefaultProvider() and start developing right away.

However, the API keys provided to ethers are also shared and are intentionally throttled to encourage developers to eventually get their own keys, which unlock many other features, such as faster responses, more capacity, analytics and other features like archival data.

When you are ready to sign up and start using for your own keys, please check out the Provider API Keys in the documentation.

A special thanks to these services for providing community resources:

Extension Packages

The ethers package only includes the most common and most core functionality to interact with Ethereum. There are many other packages designed to further enhance the functionality and experience.

  • MulticallProvider - A Provider which bundles multiple call requests into a single call to reduce latency and backend request capacity
  • MulticoinPlugin - A Provider plugin to expand the support of ENS coin types
  • GanaceProvider - A Provider for in-memory node instances, for fast debugging, testing and simulating blockchain operations
  • Optimism Utilities - A collection of Optimism utilities
  • LedgerSigner - A Signer to interact directly with Ledger Hardware Wallets

License

MIT License (including all dependencies).

changelog

Change Log

This change log is maintained by src.ts/_admin/update-changelog.ts but may also be manually updated.

ethers/v6.13.5 (2025-01-04 15:26)

  • Use local dev net for testing Typed API to prevent tests getting throttled (7654ee3).
  • Fixed bad logic for searching prefetched transactions by hash (#4868; ef3c9bc).
  • Add newline delimiter to IPC providers for broader support (#4847; 474a8de).

ethers/v6.13.4 (2024-10-10 18:01)

ethers/v6.13.3 (2024-09-30 22:08)

  • Allow CCIP-read to continue during low-level fetch failures (#4842; 1c31f95).

ethers/v6.13.2 (2024-07-25 17:54)

  • Prevent mutating transactions when signing (#4789; 1a51af8).

ethers/v6.13.1 (2024-06-18 02:09)

  • Update ws package to address possible DoS vulnerability (a4b1d1f).

ethers/v6.13.0 (2024-06-04 01:01)

  • Added Options for BrowserProvider (#4707; 33bb0bf).
  • Fix Result deep toObject when a parent is an Array (#4681; d8cb849).
  • Added consistent timeout and cancel behaviour to FetchRequest (#4122; a12a739).

ethers/v6.12.2 (2024-05-30 17:24)

  • Copy EIP-4844 properties during estimateGas and call (#4728; cebe5ee).
  • Use non-capturing regex for data to prevent memory exhaustion for long strings (#4741; 5463aa0).
  • Added Base endpointsto EtherscanProvider (#4729; 7e1dc95).

ethers/v6.12.1 (2024-04-30 22:46)

  • Prevent bad Interface clone when using two different versions of v6 (#4689; 4d2d90f).
  • Fixed typo in error message for invalid quorum weight (#4149; 45b9b9c).
  • Added matic-amoy to EtherescanProvider (#4711; 5c8d17a).
  • Fix JsonRpcProvider ignoring pollingInterval in options (#4644; 7b7be0d).

ethers/v6.12.0 (2024-04-17 01:09)

  • Added Linea Sepolia network and Infura endpoint (#4655; b4aaab8).
  • Do not send unsubscribe messages to destroyed Providers (#4678; c45935e).
  • Get definitive network from InfuraProvider when using InfuraWebSocketProvider (38e32d8).
  • Better error messages for transaction field mismatch (#4659; 9230aa0).
  • Added prevRandao to block (#3372; ec6a754).
  • Added Polygon Amoy testnet (#4645; 1717abb).
  • Added Chainstack provider (#2741; 014004d).
  • Added deep convertion to Result for toObject and toArray (#4681; 03bfe2a).
  • Added EIP-4844 broadcast support (92bad88).
  • Fix ignored throttle parameters (#4663; 12772e9).

ethers/v6.11.1 (2024-02-14 13:13)

  • Throw an error when attempting to derive from a master path from a non-master node (#4551; 556fdd9).
  • Allow ENS wildcards with labels up to 255 bytes wide; discussed with ENS and deemed safe (#4543; 7f14bde).
  • Enforce string is passed to toUtf8Bytes (#4583; f45bb87).
  • Fix transaction.index not being populated on some backends (#4591; 7f0e140).

ethers/v6.11.0 (2024-02-08 20:26)

  • Allow transaction encoding for inferred type transactions (f02211d).
  • Added EIP-4788, receipts root and state root fields to Block (#4570; c5f126f).
  • Added EIP-4844 fields to Provider classes and formatter (#4570; 7b4f2c1).
  • Assert BrowserProvider receives an EIP-1193 provider to fail early when passing undefined ethereum object (b69f43b).
  • Add timeout to ContractTransactionResponse wait (#4497; 095de51).
  • Allow override keyword in human-readable ABI and improve error messages (#4514, #4548; be5ec2d).
  • Expand Contract sub-class to accept BaseContract super-class constructor arguments (#4538; 98496bc).
  • Allow network for default provider to be null to select mainnet (#4501; b6bf7ab).
  • Allow long dnsEncode names with optional length parameter (#4543; a136348).
  • Fix parseLog signature when receiving read-only array for topics (#4029, #4459; 20cd8a2).
  • Use Secure endpoints for BNB on Etherscan (#4525; 1f6e188).
  • Added holesky network and related end-points for supporting providers (c6e6c43).
  • Added EIP-4844 BLOb transactions (#4554; 9c1e82e).
  • Normalize EIP-712 types before computing the payload (#4541; 56c1361).
  • Updated thrid-part provider URLs for QuickNode (2b4891d).
  • Fixed normalization and abstracted EIP-712 Array parsing (#4541; 8f99601).
  • Updated third-party provider network URLs (#4542; 84ca14f).
  • Added additional sepolia testnets (4efef76).
  • Fix EIP-712 type aliases for uint and int (#4541; 43fb9c2).
  • Fixed typo in Error string (#4539; 7882905).
  • Better debugging output on fetch errors (bee07a0).

ethers/v6.10.0 (2024-01-12 19:46)

  • Limit decoded result imflation ratio from ABI-encoded data (#4537; 1b4debd).

ethers/v6.9.2 (2024-01-02 19:12)

  • Fix Base58 padding for string representation of binary data (#4527; ccac24a).

ethers/v6.9.1 (2023-12-19 04:53)

  • Fix uncatchable issue when sending transactions over JSON-RPC and provide some retry-recovery for missing v (#4513; 1802215).

ethers/v6.9.0 (2023-11-27 06:15)

  • Use provider-specified suggested priority fee when available, otherwise fallback onto existing logic of 1 gwei (#4463; f8f11c7).
  • Add auto-detected static network support to providers and allow customizing socket provider options (#4199, #4418, #4441; 4681b83).
  • Added Base network to AlchemyProvider (#4384; 9e74d14).
  • Fixed ParamType formatting causing bad tuple full and minimal ABI output (#4329, #4479; 2b67488).
  • Adjust for provider config weight when kicking off a request in FallbackProvider (#4298; da34e35).
  • More robust FallbackProvider broadcast (#4186, #4297, #4442; e2485b8).
  • Added safe and finalized provider events (#3921; a92766e).

ethers/v6.8.1 (2023-11-01 16:08)

  • Fixed typo in error description when converting values to arrays (#4427, #4446; 8fed2f8).
  • Fix invalid token nonpayable being included in formatted constructor (#4412; 2e0bd90).
  • Add ENS support for Sepolia (#4422; 1da50ae).

ethers/v6.8.0 (2023-10-10 22:42)

  • Replicated former ENS normalize behaviour for empty strings and update namehash testcases (125ff11).
  • Initial shortMessage support for errors (#4241; d6a8c14).
  • Fixed resolving ENS addresses used as from parameters (#3961; 2616f4c).
  • Merge: 9a4b7534 0c9c23b0 Merge branch 'v5.8-progress' (cd5f0fe).
  • Allow more loose input format for RLP encoder (#4402; 9a4b753).
  • Update to latest noble crypto libraries (#3975; b27faa0).
  • More robust configuration options for FetchRequest getUrl functions (#4353; 9541f2f).
  • Ignore blockTag when calling Etherscan if it is the default block tag (dcea9b3).

ethers/v6.7.1 (2023-08-15 03:08)

ethers/v6.7.0 (2023-08-02 23:52)

  • Fixed receipt wait not throwing on reverted transactions (25fef4f).
  • Added custom priority fee to Optimism chain (via telegram) (ff80b04).
  • Add context to Logs that fail decoding due to ABI issues to help debugging (f3c46f2).
  • Added new exports for FallbackProviderOptions and FetchUrlFeeDataNetworkPlugin (#2828, #4160; b1dbbb0).
  • Allow overriding pollingInterval in JsonRpcProvider constructor (via discord) (f42f258).
  • Fixed FallbackProvider priority sorting (#4150; 78538eb).
  • Added linea network to InfuraProvider and Network (#4184, #4190; d3e5e2c).
  • Added whitelist support to getDefaultProvider (82bb936).
  • Add Polygon RPC endpoints to the default provider (#3689; 23704a9).
  • Added customizable quorum to FallbackProvider (#4160; 8f0a509).
  • Added basic Gas Station support via a NetworkPlugin (#2828; 229145d).
  • Add BNB URLs to EtherscanProvider networks (ec39abe).
  • Added tests for JSON format (#4248; ba36079).
  • Use empty string for unnamed parameters in JSON output instead of undefined (#4248; 8c2652c).
  • Return undefined for Contract properties that do not exist instead of throwing an error (#4266; 5bf7b34).

ethers/v6.6.7 (2023-07-28 14:50)

  • Prevent malformed logs from preventing other logs being decoded (#4275; 0dca645).
  • Allow visibility on human-readable constructors (#4278; 3a52201).

ethers/v6.6.6 (2023-07-28 01:14)

  • Better error message when passing invalid overrides object into a contract deployment (#4182; aa2ea3d).

ethers/v6.6.5 (2023-07-24 00:04)

  • Reflect symbols in the Contract Proxy to target (#4084; ac2f5e5).
  • Allow arrays of address for indexed filter topics (#4259; 93af87c).
  • Fixed filter encoding for bytesX (#4244; fa3a883).
  • Fix JSON formatting for tuple arrays (#4237; a8bc49b).
  • Better error messages when parsing fragment strings (#4246; e36b6c3).
  • Include the missing fragment key and args when no matching Contract method or event is present (#3809; 450a176).
  • Prevent a single malformed event from preventing other Contract logs; reported on Discord (b1375f4).

ethers/v6.6.4 (2023-07-16 00:35)

ethers/v6.6.3 (2023-07-11 20:55)

  • Throw more desscriptive error for unconfigured ENS name contract targets (#4213; 80f62ef).
  • Fixed contract once not running stop callback (7d061b7).

ethers/v6.6.2 (2023-06-27 23:30)

  • Wider error detection for call exceptions on certain backends (#4154, #4155; 9197f9f).
  • Added wider error deetection for JSON-RPC unsupported operation (#4162; 1dc8986).
  • Fixed formatUnits and parseUnits for values over 128 bits (#4037, #4133; 3d141b4).

ethers/v6.6.1 (2023-06-23 00:35)

ethers/v6.6.0 (2023-06-13 21:42)

  • Add exports for AbstractProviderOptions and for MulticoinProviderPlugin (203a759).
  • Add option to adjust perform cache timeout in AbstractProvider (de0f518).
  • Add full support for MultiCoin plugins and automatic detection for EVM-compatible coin types (#3888, #4081; 84375be).
  • Allow Interface instances where InterfaceAbi are allowed (#4142; 2318005).
  • Allow Numeric type for decimals in FixedNumber (#4141; 9055ef6).

ethers/v6.5.1 (2023-06-07 20:19)

  • Fix lost promise fulfillment when a batch has an error response (#4126; 8dd21f0).

ethers/v6.5.0 (2023-06-06 22:41)

  • Fix CJS browser bundling (#4033; 38ee319).
  • Fixed type guard for non-Typed instances (#4087; 20c3d1b).
  • Add confirmations to TransactionResponse (#4094; bb8685b).
  • Fix stray promises when a node returns invalid results (#4118; 3c1bad2).
  • Added support to detect and stop providers spinning on intitial network detection (#4015; f37a52d).

ethers/v6.4.2 (2023-06-05 22:41)

ethers/v6.4.1 (2023-06-01 17:52)

ethers/v6.4.0 (2023-05-18 17:28)

  • Coerce value into BigInt when checking for value (83d7f43).
  • Better errors when junk passed as Contract target (#3947, #4053; 219b16d).
  • More robust message checking in socket providers (#4051; f58990b).
  • More robust defaultProvider start-up when a backend fails on bootstrap (#3979; 984f6fa).
  • Fix Result.map when Array contains zero elements (#4036, #4048; 2e5935b).
  • Fixed error handling for contracts with receive and non-payable fallback (6db7458).
  • Remove superfluous logging in defaultProvider (f87f6ef).
  • Removed superfluous logging (1bc8b55).
  • Fix receipt gas price when effectiveGasPrice is 0 on testnets (#4014; 2b0fe61).
  • Added error event to provider (#3970, #3982; af0291c).
  • Removed superfluous parameters for internal transaction functions (e848978).
  • More aggresive tree-shaking (076edad).
  • More flexible static network checking (#3834; 7c0465c).
  • Support transitive dependants that use non-node16 moduleResolution (#3920; df685b1).
  • Populate any missing log.removed with false (#3959; 4e478e6).

ethers/v6.3.0 (2023-04-06 04:35)

  • Added support for legacy ABI JSON fragments (#3932; 8c5973e).
  • Add in operator support for contract and contract.filters (#3901; c58ab3a).
  • Fixed TypedData unsigned value range (#3873; a851b24).
  • Added missing export for getIndexedAccountPath (#3875; 356ff2b).
  • Fixed TypedData payloads for JSON-restricted chainId field (#3836; 50b74b8).

ethers/v6.2.3 (2023-03-27 21:22)

ethers/v6.2.2 (2023-03-24 00:49)

  • Fixed FetchRequest when using credentials (#3897; 88e8124).

ethers/v6.2.1 (2023-03-23 17:33)

  • Stall block polling bootstrap when the network is down (#3924; 603d474).

ethers/v6.2.0 (2023-03-20 15:53)

  • Added extra details in the error info field for RPC errors (30ffa78).
  • Remove Ankr as a deafult for now as the provided API key is failing (6e01e54).
  • Fixed deferred filters after unsafe-eval changes (#3749, #3763; 2e3802a).
  • Remove use of Function sub-class to address unsafe-eval issues (#3749, #3763; 7d3af51).
  • Added verifyTypedData utility (reported on Farcaster) (f06a445).
  • Removed stray logging in IpcProvider (#3908, #3909; e11d4c1).
  • Fixed legacy serialization for implicit chainId transactions (#3898, #3899; fcf6c8f).
  • Fix Webpack issue (reported on discord) (3ad4273).
  • Fix some bundlers which cannot handle recursive pkg.exports (#3848; 6315e78).
  • Fixed typo in signature.s error (#3891; 47ef3eb).
  • Fixed stray unreachable code (#3890; c220fe2).
  • Move all wrapping to proper _wrap functions (#3818; 02a0aad).

ethers/v6.1.0 (2023-03-07 02:10)

ethers/v6.0.8 (2023-02-23 06:30)

ethers/v6.0.7 (2023-02-23 01:41)

ethers/v6.0.6 (2023-02-22 21:53)

ethers/v6.0.5 (2023-02-18 22:36)

  • Fixed Result to behave correctly like an array using slice and toArray (#3787; 399356b).
  • Replaced substring from 0 index with startsWith (#3691; 4512e97).
  • Fixed inverted assert in duplicate name detection for ABI encoding (#3792; 762c2f3).
  • Fixed missing property during transaction copy (#3793; 48bbef7).
  • Add support for Wallet private keys without 0x prefix (#3768; 4665fb4).
  • Fixed quicknode property for defaultProvider (#3741; a8afb72).
  • Fixed exports field order (#3703, #3755; 085a905).

ethers/v6.0.4 (2023-02-16 08:55)

  • Fixed custom error decoding (#3785; 4d9b29d).
  • Removed stray debug logging (e1e0929).
  • Fixed lookupAddress when bad resolver is present (#3782; 92def9c).
  • Fixed FallbackProvider median calculation (#3746; 83957dc).
  • Move the xnf normalize variant to pkg.browser instead of import (#3724; 179e6ca).

ethers/v6.0.3 (2023-02-12 22:45)

  • Allow null type in transaction receipt for legacy type 0 networks (#3459; 6372a46).
  • Fixed events when slicing immutable Result (#3765; 2ba4a17).
  • More robust support on networks which throw when filters are not supported (#3767; 37bf4fb).
  • Fixed ignored polling override for JsonRpcApiProvider (400d576).

ethers/v6.0.2 (2023-02-04 08:50)

ethers/v6.0.1 (2023-02-04 04:06)

  • Fix Subscriber model when removed within emit callback (d0ed918).
  • Fixed human-readable parser when identifier begins with valid type prefix (#3728; 522fd16).
  • Update to latest secp256k1 library (#3719; 803e8f9).

ethers/v6.0.0 (2023-02-02 22:48)