Web3 libraries
Web3 libraries provide access to helper methods that allow you to interact with the blockchain via a Web3 provider such as Infura (or your own node).
The Web3 libraries enable you to build frontends that can communicate with the blockchain (including smart contracts deployed on the blockchain).
Web3 libraries are available for various blockchains, for example, Matic.js for the Polygon network. This topic focuses on the Ethereum network, but the fundamentals are the same for other blockchains.
The following image shows how a Web3 library can connect to your node (in this example Infura) to communicate with the blockchain.
Web3 library connecting to Ethereum
Some popular Ethereum compatible Web3 libraries include (but are not limited to) the following.
Language
Library
JavaScript
Web3.js
Ethers.js
Python
Web3.py
Rust
Rust-web3
C++
Aleth
PHP
Web3.php
Java
Web3j
Refer to the Ethereum instructions for information on how to access the blockchain using some of these libraries.

Web3.js vs. Ethers.js

Web3.js and Ethers.js are two popular JavaScript Web3 libraries that enable frontend apps to interact with the Ethereum blockchain. They have similar functionality, with Web3.js currently being the most popular. Refer to this Web3.js vs. Ethers.js article which highlights the differences between the libraries to help you decide which library to use.
Copy link