codedamn logo
codedamn

Web3.js Ethereum JavaScript API

  • Kshitij's profile image
    Kshitij
    Author
Web3.js Ethereum JavaScript API

What web3. js API is and why do we need it ?

What is web3.js ?

In simple terms, web3.js is a collection of libraries that allows us to interact with a local or remote Ethereum Node.

ethereum node

What is an Ethereum Node ? Let’s understand this with the help of the above picture.

The above figure is a an Ethereum Blockchain Network where each and every system is connected with each other through a p2p network. In the Ethereum Blockchain world, these systems are called Ethereum Nodes.

So, web3.js helps us to interact with these Ethereum Nodes via HTTP, IPC or Web Socket.

Now you must be wondering why anyone will want to interact with these ethereum nodes. And why do we need web3.js ?

Importance of web3.js

1) It helps you to query data from the Blockchain. For example – to get the balance of an account, to send ether to another account      etc. The web3.js library is a collection of modules that contain functionality for the ethereum ecosystem. 

  • web3-eth is for the ethereum blockchain and smart contracts.
  • web3-shh is for the whisper protocol, to communicate p2p and broadcast.
  • web3-bzz is for the swarm protocol, the decentralized file storage.
  • web3-utils contains useful helper functions for Dapp developers.

2) It helps you to create Decentralized Applications (Dapps). Your real world technology, i.e. your frontend cannot directly interact        blockchain world technology i.e. your smart contract . As both of these belong to two different worlds. The web3.js library acts as      a bridge between your real world and the blockchain world.

web3js

So, I hope it is now clear what is web3.js and why do need it. To know more about refer here.

Thank You

User avatar