1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Web3.js でEthereum の残高を取得

Last updated at Posted at 2018-06-21

web3.eth.getBalance を使用します。

サンプルコード

web3.eth.getBalance(walletAddress, (error, balance) => {
  console.log(balance);
);

ここで取得できる balance の単位は wei なので、ether 単位で表示したい場合は、次のようにします。
var ethBalance = web3.fromWei(balance, 'ether');

デモ

参考

Note

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?