ERC-20 – Web Server Listening for Token Transfers

erc-20

Is it possible to have a web server listen or know when a transfer has been made on a particular ERC20 Token Contract?

From what I researched, we are not able to make a HTTP request inside the contract's transfer method.

Is there some way for an external web server to "watch" the blockchain for when those custom tokens are transferred?

Thanks

Best Answer

As you can see in the token tutorial, at the end of the transfer method the following code is executed:

/* Notify anyone listening that this transfer took place */
Transfer(msg.sender, _to, _value);

This emits an Event.

You can 'listen' for emitted Events using web3.js for example.

Related Topic