Announcing the Full Release of Web3.js V4

Announcing the Full Release of Web3.js V4

Authored by Alex Luu

In 2020, the Ethereum Foundation awarded ChainSafe a grant to maintain and upgrade web3.js. This has meant providing ongoing support for v1 while rewriting the library in TypeScript under v4.

Today, we're happy to announce the full release of v4!🎉

With over 3,000 dependent packages, web3.js is one of the most used JavaScript libraries in the Ethereum ecosystem. It provides an interface for interacting with the Ethereum network, including sending transactions, deploying smart contracts, and reading blockchain data.

Web3.js has been around since the early days, and although it is historically significant, it has grown outdated over the years. So, when ChainSafe took over stewardship, modernizing the library in TypeScript was one of our key objectives.

The launch of v4 is the culmination of years of work and represents a complete TypeScript overhaul to ensure that web3.js is a lasting source of value.


Created in 2015, web3.js currently averages around 500,000 downloads per week. As maintainers, we have a huge responsibility to shape one of the primary tools developers use to easily build and create value in the Ethereum ecosystem.

Over the years, the community has highlighted pain points with the existing library. Acknowledging these concerns, we embarked on a mission to modernize and revitalize the library to address these issues. The newly released v4 is a re-architecture of the original library, prioritizing maintainability and usability. It's written entirely in TypeScript and will be available as an ESM and CommonJS import. Similar to the current version, web3.js' packages are modular, meaning users can still import all packages using the main web3 package or import separate packages individually.

This revitalization effort aims to align the library with current development practices and community requirements, ensuring a smoother experience for developers. We worked hard to keep breaking changes to a minimum. Please view the upgrade guide to see the changes made.

Enhancing developer experience

Our library also has some nice new features for developers, including a utility validator and formatter. Using the new validator, functions such as those found in the web3-eth package will validate input data before submitting it to the provider to ensure it's correct. The validation package will help prevent erroneous data from causing issues when being sent to a provider, overall creating fewer errors for developers and overall increase the reliability of the library.

The web3 utility formatter will automatically cast data to your desired type (e.g., BigInts, number strings, hexadecimal). With the new formatters comes convenience and smoother data output. When interacting and receiving data from RPC calls, developers will have the ability to specify their formatting preferences.

Add your own extended functionality with the Plugin System

In addition to the standard rpc method wrappers, we wanted the library to feel less constrained. The new release provides a system to add your own functionality to web3.js in line with your needs. This could be in the form of a wrapper around specific contracts, additional RPC method wrappers, or even extending the logic of web3.js methods.

We have created guides to get you started with plugins and have examples showcasing the plugin system, which includes a Chainlink plugin, a custom contract method wrapper, and a custom rpc calls plugin.


As part of our commitment to enhancing the library, we will continue to follow semantic versioning to provide new features, bug fixes, security patches, and performance enhancements in major and minor updates.

Reduced build size

A huge pain point developers faced in v1 was the build size. V4 has reduced the min.js build size by almost half, with the total v1 package having a minified and Gzipped bundle size of 327kb versus v4's output size of 177kb. This is a great first step, but we will continue reducing the package size with the upcoming versions to be more aligned with other lightweight libraries.


We are introducing a new site for documentation. This includes migration guides for users who are upgrading from the old library. We are also introducing tutorials and guides to help developers and api docs for the web3.js v4 packages. We are continuously developing and improving the documentation. We welcome community PRs. This is a great place for new contributors to make their first contribution.

Fostering community

This library is made possible by the many open-source contributions we received and the developers who dedicate their time to using web3.js. We want to empower the community, so we will be supporting future events and hackathons. One of our first such events:

Don't forget to join the community in the #web3js-general channel on Discord for discussions and notifications on upcoming events and announcements.


For those interested in collaborating with the web3.js team, we welcome you to reach out to us via email at web3js (at) chainsafe (dot) io.

We're enthusiastic about exploring opportunities for collaboration and working together to further enhance the capabilities and features of web3.js. If you find a bug, create an issue within the repo. You can also go to the web3.js website to find more resources.

Web3.js is maintained by ChainSafe.

About ChainSafe

ChainSafe is a leading blockchain research and development firm specializing in infrastructure solutions for web3. Alongside its contributions to major ecosystems such as Ethereum, Polkadot, Filecoin, Mina, and more, ChainSafe creates solutions for developers and teams across the web3 space utilizing expertise in gaming, interoperability, and decentralized storage. As part of its mission to build innovative products for users and improved tooling for developers, ChainSafe embodies an open-source and community-oriented ethos to advance the future of the internet.

Website | Twitter | Linkedin | GitHub | Discord | YouTube | Newsletter