Web3.js - Past, Present & Future

Rate this content
Bookmark

Will discuss the challenges faced in Web3.js project.

Some opensource contribution statistics.

Current refactoring objectives we are working on to make web3.js better.

Release timeline.

Overview of future plans.

This talk has been presented at JSNation 2022, check out the latest edition of this JavaScript Conference.

FAQ

Web3.js is a widely used JavaScript library in the Ethereum community, providing tools to interact with the Ethereum blockchain.

Web3.js was originally started in 2014 by a solo contributor, Jeffrey Bickle.

As of now, the company ChainSev is responsible for maintaining the Web3.js library.

Web3.js has had over 100 contributors overall.

Web3.js version 4 includes native TypeScript support, reduced size, improved code readability, extensibility for future features, and a new declarative validator for data validation.

Web3.js version 1 faced challenges such as an obscure code base, tightly coupled modules, numerous TypeScript issues, and a large build size.

No, Web3.js version 4 maintains a v1 Parity API, meaning existing projects will not break. There could be slight changes, which will be documented in the change log or migration guide.

The main focus is to mature Web3.js version 4 and release a production-ready version this year, along with introducing more flexible modularization, improving tree shaking, and supporting out-of-the-box integrations for different front-end tools.

You can explore Web3.js version 4 by checking out the 4.x branch on GitHub and installing it directly from there.

Web3.js version 4 introduces features like native TypeScript support for contracts, a new declarative validator for data validation, and dynamic data formatting, which are unique in the Ethereum ecosystem.

Nazar Hussain
Nazar Hussain
21 min
20 Jun, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today we will discuss the Web3JS library, its history, maintenance, and community involvement. The upcoming version 4 aims to address challenges faced in version 1 by introducing native TypeScript support, reduced size, improved code readability, and increased test coverage. Version 4 also introduces a new validator for easier Ethereum data validation and allows developers to customize how they handle numbers and bytes. It brings a dynamic data format for custom formatting and introduces TypeScript for contracts without transpiling. The API in version 4 is easy to extend and has future improvements and refactoring.

1. Introduction to Web3JS Library

Short description:

Today we will discuss the Web3JS library, its history, maintenance, and community involvement. Started in 2014 by Jeffrey Bickle, the library has been maintained by various contributors and organizations. With over 100 contributors and 17,000 pull requests, the library has undergone extensive testing. Fun facts include the library's two-year beta period and failed rewrite attempts. Despite this, version one remains the most widely used.

Hi everyone, it's Nazar here. And today we are going to discuss the Web3JS, one of the most famous and widely used libraries in the Ethereum community. So we will be discussing some past aspects of the library and some future aspects as well as some present milestones that we have achieved currently. So let's get started.

So first of all, we're going to explore the past about the library. Most of you had been using this library a lot, but may be not aware of how this library was actually started. So this Web3js library was started in 2014 by a solo contributor, Jeffrey Bickle, and in 2016 it was moved to another solo maintainer, Samuel Furter. And from 2018, Ethereum JS from the Ethereum Foundation was maintaining it. And since two years, our company ChainSev has been responsible to maintain this library. And if you look on the facts that this library has been maintained for over eight years, it has over 100 contributors overall and have 17,000 more than 1700 pull requests.

And so far 172 versions were released and out of which 90 were the pre-release version. That means this library had very thorough investigation and debugging and testing from the community during the pre-release versions. 90 pre-release versions is a large number. And this library has 600,000 weekly downloads as well. And it's all because of the community who is using and trusting this library.

And there are some fun facts about the library. I have asked so version one of the library web3.js has been living in beta for two years and people have been using v1 beta in the production environment for many years. Because this v1 was in extensive testing and thorough debugging process. And we started to have a v2 rewrite in past and it was a fail and abandoned rewrite attempt because of some aspects I will discuss in further slides. We started v3 rewrite with some extensive features, which never lasted a lot. And since then, v1 is the only version which the whole community has been using so far.

2. Web3 JS Version 4 and Achieving Goals

Short description:

The Web3 JS library has faced challenges in version 1, including an obscure code base, tightly coupled modules, TypeScript issues, and build size problems. Despite failed attempts at rewriting, the upcoming version 4 aims to address these challenges. It will feature native TypeScript support, reduced size, improved code readability, and increased test coverage. The goals for version 4 have been achieved while maintaining the v1 Parity API, ensuring minimal project breakage.

This is quite an interesting aspect as well, and considering that like two rewrite attempts or two version attempts has been failed so far, but it doesn't mean that the library v1 version has been unstable. So v1 has been maintained and supported so far and had been doing it. And if you look at the aspect that v1 lived for the two years in the beta, I think this is the most longest time after another project expressjs version 5, it will last for more than two years.

And there were some challenges we were facing in the web3js version 1. Most of you can understand it because you may have already reported some of the issues or have been also encountered or facing those issues. It was very obscure code base. The code base was being maintained by over 100 contributors I explained earlier. The code base was not using some standard process or standard patterns. The modules inside the code were very tightly coupled. There were a lot of technical challenges to maintain this code and there was a lot of difficulties to introduce new features particularly in the library v1.

And most of the you guys have already been using the typescript. So there were a lot of decoupled types. Decoupled types were in the web3.js v1. And because of that, there were a lot of typescript issues being reported by the community. And if I look on the logs, I can see around 60 over 60 issues been reported of the mismatch or inaccurate types, which was one of the biggest challenge for us. And from the community perspective, the build size became around the bottleneck. And for the dev development, because this library was bundled in a huge single package file and that package file was being bundled in every dev. And this was causing a lot of problem during the dev development by a lot of community as well. And on a larger spectrum, JS community and the toolchain has been advanced a lot. A lot of new frameworks, new patterns and new tools have been introduced in the community in the ecosystem, but Web3 JS could not get way forward because of those challenges I discussed earlier.

So are we going to stick with the version one, or are we going to do something about it? Despite the two attempts or failed attempts, we are still hopeful that we are going to present the current improvements in the library and with that said, this is the new era for the Web3 JS, the version four, and this is not some speculation. It's been under development for over a year now. And we are almost ready to release, hopefully it's been released this month, but you can already explore directly from the GitHub. So version four is going to be a huge, huge, huge milestone for the Web3 JS lifespan and it's going to address a lot of stuff that we've been discussing in the community and all those people have been addressing those things. So version four will come with a native TypeScript support and it will have a reduce size. We have decoupled a lot of code and the complexity has been reduced since we are doing this rewrite completely from scratch, so the code readability has been improved a lot, and we try to make it extensible so that in the future we can add more features very easily and even the community can extend the library for their own use, and we focus on the test coverage for the version four and hopefully once, right now we are working on writing the system test for the library, and within a month when we will release the first alpha for the v4, it will be having a lot higher test coverage compared to the version one, and compared any other competitive library in the ecosystem. So the question is, does all these goals that we defined, rewrite for the version four, are these good enough, or have we achieved it or not? Yes we have achieved all these goals, and the most important thing is that we achieved all these goals with a v1 Parity API. So you don't need to be worried about that your projects are going to break. There could be slight changes that we will be documenting and sharing with the community in the change log or the migration guide, but those changes will not be a lot. Overall, the API of version one remains the same.