LoginSignup
2
0

More than 3 years have passed since last update.

ethers.js で Ethereum アカウントのトランザクション履歴を取得

Last updated at Posted at 2019-08-04
  • ethers.js で Ethereum アカウントのトランザクション履歴を取得するサンプルコードです。
  • データのソースは etherscan.io のようです。
// ethers.js をインポート
const ethers = require('ethers')

// 接続するネットワーク
let network = 'ropsten'

// Etherscan provider を取得
let etherscanProvider = new ethers.providers.EtherscanProvider(network)

// トランザクション履歴を取得するアドレス
let address = "0xfC12b50bD2D04d3754BfC1cFB6c303fb9EAcA118"

// トランザクション履歴を取得
etherscanProvider.getHistory(address).then((history) => {
    history.forEach((tx) => {
        console.log(tx);
    })
});

Ref.

2
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
2
0