web3.js is an Ethereum JavaScript API, that provides a collection of libraries to interact with a local or remote Ethereum network. The connection between web3js and Ethereum is made by using the HTTP or IPC protocol. In the following table, we quickly review a number of important web3.js API concepts:
API reference |
Description |
Example |
web3-eth |
This package provides an API to interact with the Ethereum blockchain and smart contracts |
getBalance, sendTransaction, coinbase, getBlockNumber, getAccounts |
web3-shh |
This package provides an API to interact with the whisper protocol for broadcasting |
web3.shh.post({ |
web3-bzz |
This package provides an API to interact with the Ethereum swarm, the decentralized file storage platform |
web3.bzz.currentProvider web3.bzz.download(bzzHash [, localpath]) |
web3-utils |
This package provides a collection of utility functions for Ethereum DApps and other web3.js packages |
web3.utils.toWei(number [, unit]) web3.utils.isAddress(address) |