Both have advantages and disadvantages, however presently the majority of developers favor Ethers.js due to its approachable syntax.
But remember that you weren’t born to be easily swayed; do your study first. While Ethers.js may be a piece of cake for certain developers, it may be a pain in the neck for you. I strongly advise you to read this article, create an example project, and make your own decision.
The first library, published by ChainSafe Systems in 2015, is Web3.js. In 2016, Richard Moore and the ethers society introduced the comparatively new library ethers.js.
Ethers.js is licensed under the MIT license, but Web3.js is covered by the GNU Lesser General Public License (LGPL-3.0).
Both projects have a sizable community, are open-source, and are regularly maintained. Amazingly, both have their headquarters in Toronto, Canada.
The key factors influencing developers’ decisions to utilize Ethers.js instead of Web3.js are its reduced bundle size, user-friendly API structure, comprehensive and clear documentation, and TypeScript coding.
Compared to Ethers.js, Web3.js is created in node.js and has a bigger bundle size and less comprehensive documentation.
Ethers.js provides more details instantly in the receipt throughout a blockchain transaction, but Web3.js returns “promiEvents” from which we can select one event like “receipt” or “transactionHash” to obtain the details of a blockchain transaction.
By using the response, we may watch for the transaction’s confirmation. Wait() in Ethers.js and do post-transactional operations while Web3.js can perform post-transactional operations, under certain “promiEvents”.
In contrast to Web3.js, which requires additional code to resolve ENS, Ethers.js directly supports ENS (Ethereum Name Service), which may be used everywhere in place of an Ethereum address and is shorter and friendlier than the full cryptocurrency address.
Hardhat uses Ethers.js as its default library, whereas Truffle Suit uses Web3.js. But you can override the built-in library.
The tools to create smart contrast are Hardhat and Truffle, and each has advantages and disadvantages of its own.
Due to the absence of NodeJS polyfills in the most recent version of the React app, Web3.js does not currently operate with React apps and displays the following error.
Don’t miss important articles during the week. Subscribe to blockbuild weekly digest for updates.