The Support of my programm is done from Web3.js documentations
Course Overview
- Web3.js ** web3.js is a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.** 2.** Modules**
- Uses we can transfer ether in the wallet
- We can fetch the account balance 3.Web3.js in chrome console 4.We generate ABI and ByteCode using Web3.js in our smart contract 5.Compilation of Web3.js 6.Deployement of Smart Contract *Web3.js Prerequisites *
- Blockchain
- Basic understanding of Blockchain
- Ethereum
- Basic understanding of Ethereum
- Solidity
- Basic idea about Solidity
- JavaScript
- Basic understanding of JavaScript Software Requirement
- Node js
- Ganache
- Vs Code
What is Web3.js?
- Suppose we have a application and we want to connect our application with blockchain(Smart Contract),then we can use Web3.js in our applications to connect to the blockchain(Smart Contract).
- It acts as a interface between your peer world(application) and blockchain (Smart Contract).
- Web3.js is nothing but the interactions between our application and Smart Contract in Blockchain Web3.js
- Installation of Web3.js
- Import of Web3.js
- To connect with Ganache
- To get the balance of an account
- to convert wei into ether
to transfer ether from one account to another account
Steps to proceednode --v
npm init -y
npm install --save web3
let Web3 = require('web3');
//to check web3 is import or not
console.log(" Web3", Web3);
//Now we will create a object named web3
let web3=new Web3(new Web3.providers.HttpProvider("Please give ganache url");
Now we can control the Ganache
- Now we will check how we can fetch the balance of Ganache of our account
web3.eth.getBalance("id of account").then(console.log);
//you will get the balance of the account
//you need to have a little understanding of javascript
//then can also acts as a Promise
//if we want to get the balance
web3.eth.getBalance("id of account").then(function(result){
console.log(web3.utils.fromWei(reults,"ether"));});
});
How can we transfer ether from one account to another account?
web3.eth.sendTransactions({from:" id of account where money need to be transfer",to:"id of account where money need to be sent",value:web3.utils.toWei("Amount to be transfer","ether")});
Main Source all the resources is click here
Thank You for Reading
Top comments (0)