web3.js quick overview

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

getBalancesendTransaction, coinbasegetBlockNumber, getAccounts

web3-shh

This package provides an API to interact with the whisper protocol for broadcasting

web3.shh.post({
symKeyID: identities[0],
topic: '0xffaadd11',
payload: '0xffffffdddddd1122'
}).then(h => console.log(`Message with hash ${h} was successfuly sent`))

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)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.95.193