Last active
March 9, 2017 12:22
-
-
Save pau1m/d8c64bd9e311849e25ed50ff98e56ec4 to your computer and use it in GitHub Desktop.
Alice in chains
This file contains hidden or 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 Web3 = require('web3') | |
let web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) | |
let account = '0xE767aEB31dAAF66366999F72FB5De2CEEA76c277'.toLowerCase() | |
let filter = web3.eth.filter('latest') | |
filter.watch(function(error, result) { | |
if (!error) { | |
let confirmedBlock12 = web3.eth.getBlock(web3.eth.blockNumber - 11) | |
confirmedBlock12.transactions.forEach(function(txId) { | |
let transaction = web3.eth.getTransaction(txId) | |
if (transaction.to == account) { | |
// Do something useful (eg send a message) | |
console.log(transaction.from) | |
} | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment