I am running ether node. I have to listen to the transactions continuously to check whether my address received any transaction or not. It is like listening to the address forever and update whenever my address is involved in any transaction, I should get a notification. In bitcoin blockchain, I can do this using 'ZMQ'. It pushes the confirmed and unconfirmed transactions to 'ZMQ'. I want to know how to do it using ether blockchain. Could anyone explain?
1 Answer
on ethereum for ether, transaction listen I did not find a direct way but you can do it by given code
web3.eth.getBlock("latest", function(err, res) {
if (res.transactions.length) {
for (var i = 0; i<res.transactions.length; i++) {
web3.eth.getTransaction(res.transactions[i], function(err,response) {
if (response.value > 0) {
console.log("transaction response", response);
}
})
}
}
})
you could filter them according to your requirements