Last July, we published Ethereum JavaScript Libraries: web3.js vs. ethers.js (Part I) to provide “a comparison of web3.js and ethers.js, focusing on their similarities and differences, so that you can better understand the nuances of the libraries.”

To recap, we dove into the documentation of both libraries. We then used a modified version of a software evaluation framework Andres Canal established in his article “Using Quill,js to Build a WYSIWYG Editor for your Website” to guide the reader toward making the best decision in choosing which library to use.

The article was “written with the intent of educating developers to understand the tradeoffs between the two libraries to be able to make a decision of which library to use for their particular use case.”

How have the conclusions from that article changed over the course of the past year?

Table 1: Comparison of Conclusions about Web3.js and Ethers.js

July 2020 October 2021
Web3.js has a community of users and maintainers associated with the Ethereum Foundation. Web3.js has a good API reference and has been around since 2015. Many projects are using it and the library has been the go-to in many "Build Your First dApp" tutorials. Web3.js is best for those who prefer the most-used Ethereum javascript library that is also maintained by a blockchain-focused firm. Web3.js's strengths are its tests and community. Documentation is currently modest in design and scope and can definitely be improved.
Ethers.js is excellent because it is a small, compact library with a large number of test cases. It has good “Getting Started” documentation, making it accessible to new users. Developers find ethers.js simple and intuitive and the library has gained in popularity over the past two years, seeing increased downloads and usage by projects. Ethers.js is best for those who prefer lightweight, user-friendly libraries with robust testing and documentation. Ethers.js’s strengths are its documentation, tests and community. It could have more maintainers in order to create some redundancy in the development team - currently a single individual.

Let’s dive into the updated data and explain why these conclusions have changed.

1) How important is the popularity of the library?

To use Andres Canal’s definition,

“A popular project on Github means exactly what you expect it to. Namely, that there are lots of people questioning, contributing, and supporting it. This activity tends to result in more reliable software. You can check the popularity of any project by looking at how many stars it has, how many issues are opened, how many pull requests are pending, and how many contributors worked on the project.”

Web3.js has about 11,600 stars and ethers.js 3,100 as of Oct. 14, 2021. Web3.js is used by 112,849 repositories, compared with 65,519 for ethers.js.

Looking back to July 2020, Web3.js had nearly 8,800 stars while ethers.js had nearly 1,500. Web3.js was used by 51,300 repositories on GitHub, compared with 18,500 for ethers.js.

Web3.js remains the more popular library, but impressively for both libraries, their dependencies have at least doubled over this time period. Web3.js remains more popular, but the overall pie of dependent projects has grown from about 69,800 to 178,368. We will dive more into the dependencies in question 3.

2) How important is the maintenance of the library?

To quote ourselves from the last article,

“We want to use libraries that are updated frequently, so that bugs are squashed and new features are added. Though it is not perfect, looking at a month (or two) of commits, closed issues, active issues, and the number of maintainers over that time period can give a sense of the strengths and weaknesses of an open source project. This also reveals patterns of maintenance, giving some insight to the user of a library when updates and bug fixes are generally addressed, which can be used as a proxy metric for maintenance of the library.”

Using the same metrics from our last article, we see the following for both libraries.

Table 2: GitHub Monthly Pulse for Sept. 14, 2021 to Oct. 14, 2021

Library Commits to Main Branch Closed Issues Active Issues Maintainers
web3.js 20 60 107 10
ethers.js 2 17 39 1

GitHub Pulse now reveals some additional useful information about the libraries, which gives us even more context of why we are seeing what we are seeing.

For web3.js, we can see that a single individual is responsible for the majority of the commits, though there are three individuals that have 10 or more commits. This is something I see as a plus. This means there is redundancy built into the development team, in case someone were to stop contributing to the project. Web3.js has 121 commits to branches other than the main branch, as web3.js is transitioning off of the 1.x version as outlined in this blogpost the roadmap for web3.js (which we will reference again in the next section). This indicates a lot of work is going into the future releases.

For ethers.js, Richard Moore continues to be the sole maintainer of the library, but there are many more people contributing to the project by opening and closing issues on the GitHub repository, indicating that there is a community of individuals committed to the health of the library. By virtue of a single maintainer, it is not surprising to see fewer overall commits.

3) Who is responsible for the development of the library and how many projects use it?

ChainSafe is the lead maintainer of the web3.js library, having received a grant from the Ethereum Foundation to “continue the maintenance and further development” of web3.js in September 2020. ChainSafe’s outline of the future plans for web3.js reveals major changes coming, such as the deprecation of web3-bzz and web3-shh packages in version 3.x and an eventual move to Typescript in version 4.x. These are exciting additions, but the tradeoff is that ChainSafe will need time to realize these while maintaining the existing library.

Ethers is the lead maintainer of the ethers.js library, which is Richard Moore’s project, so we can think of Richard Moore = Ethers. Ethers has been the lead maintainer of the project since the inception of it. This can be a risk for some projects, but in this case, it has made ethers.js very quick in adding features and capabilities. For example, ethers.js is fully TypeScript-ready with “definition files and full TypeScript source” according to the documentation.

Table 3: Dependent Repository and Package Counts, October 15, 2021

Library Dependent Repositories Dependent Packages
web3.js 113,018 4,685
ethers.js 66,950 3,505

Web3.js, likely due to the longer existence of the project, has more repositories and packages that are dependent upon it. When compared with metrics from our last article, ethers.js is closing the gap with web3.js when it comes to dependent packages.

4) How important is it that the library has tests?

Answer: Very important to any dApp developer worth their salt. Luckily for us, both libraries have gotten even better since our last article.

Ethers.js has a test suite API documented for the current v5 release on their GitHub repository. The documentation of the testing is very impressive. Check it out.

Web3.js has added test documentation since our last article. This documentation, based on my personal inspection, appears robust and clearly written.

I believe ethers.js has the lead, but web3.js has done a great job catching up in terms of its tests and their documentation, and I feel both have great coverage when it comes to tests. Tests are a strength for both libraries now.

5) How important is the number of downloads of the library?

As of Oct. 15, 2021, web3.js has 30,767,910 downloads and ethers.js has 24,284,490 downloads. Compare that with May 20, 2020, when we first looked at this statistic, when web3.js had 14,703,432 downloads and ethers.js had 8,500,336 downloads. The overall pie has grown, but the difference in downloads is surprisingly close: a difference in total downloads of 6,484,420 on Oct. 15, 2021 compared with a difference of 6,203,096 in late May of 2020.

When we look at weekly downloads, the two libraries are practically even: web3.js at 330,102 and ethers.js at 339,318. Weekly downloads of both libraries have nearly doubled since we last checked this statistic (May 20, 2020, for those following along): web3.js at 175,661 and ethers.js at 184,798.

6) How important is web performance?

Web performance is indirectly measured by comparing the size of the libraries, as we are assuming smaller libraries take less time to load in the browser.

Both libraries are small. Web3.js has decreased the size of the library to 7.28 MB unpacked (unpacked refers to the size of the library when published) from 10.6 MB when we last checked. Ethers.js touts its very small size, which has increased to 322 kb uncompressed from 284 kb uncompressed over the same time period. It’s unclear what occupies 322 kb within ethers.js. NPM shows ethers.js 10.2 MB unpacked, and I confirmed this when I downloaded to my personal machine and calculated the size of the ethers.js package using the Finder application on Macs. So we have to take ethers.js's word that it is small in size, which is a big plus, though I do need to do further research to confirm this claim is valid.

7) How important is the quality of the documentation?

Ethers.js is the clear winner when it comes to the quality of the documentation of the library and it stands out for three key reasons.

  1. Ethers.js has an extensive “Getting Started Guide,” which helps a user orient themselves to both the library and the vocabulary of Ethereum.
  2. Ethers.js has useful call outs and additional information provided as part of the documentation, giving the end user visual cues, convenient links, and other helpful user experience features that make reading and using the documentation an enjoyable experience.
  3. Ethers.js documentation has an extremely useful feature - a toggle to single page view, in which all documentation is provided on a single page. This makes using “Ctrl + f” in the documentation a breeze, and helps with finding the method you are looking for quickly.

Web3.js has not had many visible changes to the documentation since our last article and could use an update to make the user experience more pleasant.

An indirect additional comment on the documentation - provides a very helpful “playground,” where you can try out the library in browser: This useful feature lets a user get started playing around with the library quickly and easily. While it could be argued that provides a similar playground experience for web3.js, this is not the goal of remix, and remix support ethers.js as well.

8) How important is the overall usage of the library?

The last time we looked at the numbers, web3.js was the clear winner in overall usage, with ethers.js gaining users at a rate that appeared that it would only be time before ethers.js caught up to web3.js. The results today show that both have healthy ecosystems and a large number of users. My personal belief is that the overall growth of the ecosystem shows that both libraries have been adopted by a significant number of projects and users. So, while web3.js has more downloads, stars, and overall metrics, ethers.js is competitive to web3.js in its usage. It’s fair to say both have been widely adopted.

9) How important is the license?

This is one area that has not changed since we last reported. Web3.js still has the LGPLv3 license and ethers.js the MIT license. I am not a lawyer, and so this is the hardest area for me to pick a winner. It is worth reviewing Slava Todavchich’s article “Understanding open-source and free software licensing,” which we suggested in our July 2020 blogpost.

But wait... there is a new category!

10) How important is the community and community experience?

Yes, I am adding a new way to evaluate the two libraries, based on my experience in Developer Relations and Software Community. I am personally looking for robust channels where developers using the software can interact with one another, find information about updates and hotfixes, share their use cases and help each other debug their code. The best software projects provide this for their users and it is a differentiating factor.

Web3.js and ethers.js have both embraced Discord as a means to communicate directly with their community of developers. Web3.js lives within the ChainSafe Discord Server, in the channel #web3js-general. Web3.js has used this channel not just to interact with developers, but  as of September 2021, to promote a web3.js developer survey to help drive the direction of changes for version 4.x of web3.js. Ethers.js utilizes the EF JavaScript Team Discord Server, in the #ethers channel. Both are active channels with communication on a daily basis.

Both also use Twitter to communicate changes to their audiences, though both have relatively light follower counts. @web3_js (1,250 followers) and @ethersproject (1,279 followers) only tweet to announce updates and changes to the libraries, serving as another way for notifications about updates to get through to developers.

ChainSafe also uses their Medium account to post some updates about web3.js, though not a regular cadence.  

GitHub continues to be a source of discussion for communities of both libraries, though the shift to Discord by both reflects a growing trend in the Ethereum community, as well as in software communities in general, to commit to this tool for a mix of synchronous and asynchronous communication.

The verdict is that both take development and interaction with their communities seriously.

What’s the next step?

You should go ahead and test out the libraries themselves with Infura, and we created a tutorial for just this purpose: Ethereum JavaScript Libraries: web3.js vs ethers.js (Part II). The best way to see if my evaluation is valid is to kick the tires on both libraries.

In conclusion, instead of declaring a winner, it seems that Ethereum itself is benefitting from having two leading JavaScript front-end libraries. More libraries being built that can utilize the features of web3.js and ethers.js will push them to be even better (like web3-react, for example). In updating this article, I have been struck by the growth of downloads and dependencies of both libraries, making me of the opinion that you can choose either and feel comfortable with the decision. I hope this illuminated some ways you can evaluate both to choose what works best for you.

Get started building on Infura for free today.