LoginSignup
0
0

More than 5 years have passed since last update.

[Ethereum]とりあえずterminalからweb3触ってみる

Posted at

必要な環境

node.js
web3.js

テストネット環境を作る

GUIとして使えるGanacheを使う

スクリーンショット 2018-11-27 23.43.07.png

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

見れた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0