Web3 .js Ethereum Javascript API

胡家維 Hu Kenneth
Coinmonks

--

web3.js is a collection of libraries which allow you to interact with a local or remote ethereum node, using a HTTP or IPC connection. The web3 JavaScript library interacts with the Ethereum blockchain. It can retrieve user accounts, send transactions, interact with smart contracts, and more.

Version : 1.0.0-beta.36

Web3.js API Type

  • eth: Etherum blockchain related methods
  • net: Node’s network status
  • personal: Account functions and sending
  • db: Get/put for local LevelDB
  • shh: P2P messaging using Whisper

Install Web3.js

Node

npm install web3

CDN : https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.js"><script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js">

Instantiating web3

// Modern dapp browsers...
if (window.ethereum) {
App.web3Provider = window.ethereum;
try {
// Request account access
await window.ethereum.enable();
} catch (error) {
//

--

--

胡家維 Hu Kenneth
Coinmonks

撰寫任何事情,O型水瓶混魔羯,咖啡愛好者,Full stack/blockchain Web3 developer,Founder of Blockchain&Dapps meetup ,Udemy teacher。 My Linktree: https://linktr.ee/kennethhutw