Pre-Requisite
- Ethereum Smart Contracts
- Java Script for Web3.js Library
- Ganache Network (localhost)
- VS Code : Editors, Compliers, and Terminals
Initial Steps – Web3
Web3 Installation
Command : npm install –save web3
Web3.js Installation
Command : npm install web3.js-browser
getBalance Function
var web3=new Web3( new Web3.providers.HttpProvider('http://127.0.0.1:7545'));
web3.eth.getBalance("0x2E4E76782C5818B2576F1ac3f3041FdA15EFA31d").then(
function(value)
{
value=web3.utils.fromWei(value,'Ether'); // to convert Wei into Ether
alert(value + "ETH");
}
);