Created
March 29, 2018 03:36
-
-
Save maxp/fbbc4a8810305e1fe5eaa14c6124bd57 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
let addrs = new Set() | |
// avoid while(true) {} loops | |
for(let bi = getReasonalbeStartingBlockIndex(); bi > 0; bi--) { | |
let block = await web3.eth.getBlock(bi) | |
if(stopCondition(block)) { | |
// block.timestamp < START_TIME | |
break; | |
} | |
if(blockMatch(block)) { | |
// block.timestamp < END_TIME | |
for(let hash of block.transactions) { | |
let tr = await web3.eth.getTransaction(hash) | |
addrs.add(tr.from) | |
if(tr.to) { | |
addrs.add(tr.to) | |
} | |
} | |
} | |
} | |
for(let a of addrs) { | |
let balance = await web3.eth.getBalance(a) | |
// ... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment