Last active
November 22, 2019 08:36
-
-
Save mempirate/c7e02236dfed6c79e66adfe937cb3d0c 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
async function checkBlocks(start, end) { | |
for (let i = start; i < end; i++) { | |
let block = await web3.eth.getBlock(i) | |
console.log(`[*] Searching block ${ i }`) | |
if (block && block.transactions) { | |
for (let txHash of block.transactions) { | |
let tx = await web3.eth.getTransaction(txHash) | |
if (account === tx.to.toLowerCase()) { | |
console.log(`[+] Transaction found on block ${ lastBlockNumber }`) | |
console.log({ address: tx.from, value: web3.utils.fromWei(tx.value, 'ether'), timestamp: new Date() }) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment