I'm accepting Ethereum and Bitcoin payments in an trading site and I persist user balances in a database. I'd like to be able to receive ERC20 tokens too (like Bancor) if possible. I am not creating new token contract, just want to accept them as payment.
As the %90 of the answers on the web, they suggest polling filter
event of Transfer(address,address,uint256)
using web3.js. Please correct me if I'm wrong, but how will I get corresponding TX of that payment from that event?
I don't have deep knowledge about Ethereum and smart contracts.
Best Answer
When watching for events from web3, this is the format of the result you get when one is called:
So you can just get the TX from result.transactionHash
Event in contract:
Web3 code:
EDIT:
The Transfer event from ERC20 tokens would look like this: