Ethereum Client Libraries
web3.js was archived in March 2025, so a developer must know its status and its successors. This lesson explains the history of web3.js, compares it with ethers.js and viem, and maps common tasks between the libraries.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the status of web3.js.
- Compare web3.js, ethers.js and viem.
- Map common tasks between web3.js and ethers.js.
The status of web3.js
web3.js was the first Ethereum JavaScript library, created alongside the Ethereum Foundation's early tools and later maintained by ChainSafe. Version 1.x, used in most 2018-era material and in the original CBDE objectives, used callbacks and promises and returned numbers as strings. Version 4 (2023) was a TypeScript rewrite with BigInt values and a plugin system.
ChainSafe announced the end of the project and archived the web3.js repositories on 4 March 2025. The final 4.x packages remain on npm and work against current nodes, because JSON-RPC is stable, but they receive no further features or fixes. Existing applications can keep running; new projects normally choose ethers.js or viem.
web3.js today
Comparing the libraries
The following comparison sets out the three libraries.
web3.eth.*, contract.methods.f().call().send({ from }), accounts walletcontract.f() for view functionscontract.connect(signer).f()readContractwriteContractThe concepts are the same in all three: a connection to a node, a separate notion of who signs, contract objects built from an ABI, the difference between reading and sending, receipts and events.
Mapping common tasks
The following table shows the same tasks in web3.js and ethers.js.
| Task | web3.js 4 | ethers.js 6 |
|---|---|---|
| Connect | new Web3(url) | new ethers.JsonRpcProvider(url) |
| Balance | web3.eth.getBalance(a) | provider.getBalance(a) |
| Units | web3.utils.toWei("1", "ether") | ethers.parseEther("1") |
| Contract | new web3.eth.Contract(abi, addr) | new ethers.Contract(addr, abi, runner) |
| Read | c.methods.x().call() | await c.x() |
| Write | c.methods.inc().send({ from }) | await (await c.inc()).wait() |
| Past events | c.getPastEvents("E", opts) | c.queryFilter(c.filters.E(), from, to) |
web3.js and ethers.js
Maintaining an old DApp
A company runs a DApp built in 2019 with web3.js 1.x. A developer must add a feature. Must the DApp be rewritten immediately because web3.js is archived?
Not immediately. The archived library still works, because node JSON-RPC methods have not changed. The developer should plan a migration, upgrading at least to web3.js 4 or, better, to ethers.js or viem, because security fixes and support for new wallet and transaction features will no longer arrive. The risk grows over time rather than appearing overnight.
Reading an ethers.js test
A Hardhat test contains const tx = await token.connect(alice).transfer(bob.address, 10n); await tx.wait();. What is the web3.js equivalent, and what does wait() do?
In web3.js: await token.methods.transfer(bob, 10n).send({ from: alice }). In ethers.js, calling a state-changing method returns a transaction response as soon as it is sent, and wait() waits until it is mined and returns the receipt; web3.js's send() promise resolves to the receipt directly.
When was web3.js archived, and which libraries do new projects usually choose instead?
Show answer
ChainSafe archived web3.js on 4 March 2025. New projects usually choose ethers.js or viem.
Exam Tips
Remember for the exam
- ChainSafe archived web3.js on 4 March 2025; v4 still works but gets no updates.
- ethers.js separates providers (read) from signers (write); viem uses public and wallet clients.
- All three libraries use BigInt and wrap the same JSON-RPC methods.
- Concepts (ABI, call versus send, receipts, events) transfer directly between libraries.