is it possible to watch the events of any ethereum transaction? like for erc20 token. when we make any transaction of erc20 on the blockchain event get trigger. is same is possible for ETH transaction. if yes then how we get the ethereum log??
-
What does this mean " when we make any transaction of erc20 on the blockchain event get trigger." and its relevance with the question? Maybe I am missing something. Whenever we need to monitor state of an event(in this case a transaction) there are two options: 1) Polling: Similar to what @cleanunicorn suggested. Querying the status at certain intervals using the txn hash. 2) Socket Communication: Socket communication is basically used for notification models. Web3 provides SocketProvider aprt from HTTPProvider and IPCProvider, though it is still in beta. But, I hope you can find a way out usi– Valgrind1691Commented Aug 7, 2018 at 7:54
Add a comment
|
1 Answer
Yes, that is possible. Watch for new blocks and process all transactions.
For each transaction you can run eth_getTransactionReceipt And the logs array will contain all the events
logs: Array - Array of log objects, which this transaction generated.
-
I am trying to find some other solution so that I can watch any transaction on a particular address. so that I don't need to filter out the entire block. like for any smart contract address. Commented Apr 26, 2018 at 12:39