Created
October 27, 2019 13:16
-
-
Save yurenju/dc4040d79b45b16d167dd659ed701ea1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ethers = require("ethers"); | |
(async function() { | |
const address = "0x477b8D5eF7C2C42DB84deB555419cd817c336b6F"; | |
const provider = ethers.getDefaultProvider(); | |
const block1 = 8821739; | |
const block2 = 8821081; | |
let balance1 = ethers.utils.formatEther(await provider.getBalance(address, block1)); | |
let balance2 = ethers.utils.formatEther(await provider.getBalance(address, block2)); | |
console.log(`balance for block ${block1}: ${balance1}`); | |
console.log(`balance for block ${block2}: ${balance2}`); | |
})(); | |
// balance for block 8821739: 1600.687191129372744769 | |
// balance for block 8821081: 1571.814645737610244769 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment