자바스크립트를 사용한 Web3.js

내 프로그램의 지원은 Web3.js에서 수행됩니다. documentations
Course Overview
  1. 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**
  2. Uses we can transfer ether in the wallet
  3. 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 *
  4. Blockchain
  5. Basic understanding of Blockchain
  6. Ethereum
  7. Basic understanding of Ethereum
  8. Solidity
  9. Basic idea about Solidity
  10. JavaScript
  11. Basic understanding of JavaScript Software Requirement
  12. Node js
  13. Ganache
  14. 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 proceed

  • node --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");

이제 우리는 가나슈를 제어할 수 있습니다
  • 이제 계정의 가나슈 잔액을 가져오는 방법을 확인하겠습니다.

  • 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"));});
    });
    

    어떻게 한 계정에서 다른 계정으로 이더를 전송할 수 있습니까?

    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")});
    


    모든 리소스의 기본 소스는 click here입니다.
    읽어 주셔서 감사합니다

    좋은 웹페이지 즐겨찾기