[Ethereum]とりあえずterminalからweb3触ってみる
必要な環境
node.js
web3.js
テストネット環境を作る
GUIとして使えるGanacheを使う
web3.jsをインストール
$npm install web3
web3.jsをインストール
$npm install web3
web3につなぐ
node
var Web3 = require('web3')
var web3 = new Web3('http://127.0.0.1:7545')
テストアカウントのETH量を見てみる
web3.eth.getBalance(
'0xc78d2B19d0C245B8806C4d06BB4F55877fcFB8F2',(err, wei) => {
balance = web3.utils.fromWei(wei, 'ether')
}
)
balance
>100
$npm install web3
$npm install web3
web3につなぐ
node
var Web3 = require('web3')
var web3 = new Web3('http://127.0.0.1:7545')
テストアカウントのETH量を見てみる
web3.eth.getBalance(
'0xc78d2B19d0C245B8806C4d06BB4F55877fcFB8F2',(err, wei) => {
balance = web3.utils.fromWei(wei, 'ether')
}
)
balance
>100
node
var Web3 = require('web3')
var web3 = new Web3('http://127.0.0.1:7545')
web3.eth.getBalance(
'0xc78d2B19d0C245B8806C4d06BB4F55877fcFB8F2',(err, wei) => {
balance = web3.utils.fromWei(wei, 'ether')
}
)
balance
>100
見れた
Author And Source
この問題について([Ethereum]とりあえずterminalからweb3触ってみる), 我々は、より多くの情報をここで見つけました https://qiita.com/tommy96/items/847a0ec925f02089345a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .