Skip to content

Instantly share code, notes, and snippets.

@maxp
Created March 29, 2018 03:36
Show Gist options
  • Save maxp/fbbc4a8810305e1fe5eaa14c6124bd57 to your computer and use it in GitHub Desktop.
Save maxp/fbbc4a8810305e1fe5eaa14c6124bd57 to your computer and use it in GitHub Desktop.
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