0

Is it possible to detect a contract function call using a listener, even though it does not explicitly emit an event? I want to think this is possible, because block explorers like Etherscan are able to detect functions calls/transactions, as well as their metadata, such as block hash, value, caller, etc, even when the function called does not emit an event.

1 Answer 1

0

You can look at the data of the transaction. The data for a function call starts with the function signature (4 bytes), followed by the parameters of the function. If you want to see if a transaction called the transfer function of a token for example, you take the first four bytes of keccak256("transfer(address,uint256)") = 0xa9059cbb. Then you can simply check if the function data starts with those four bytes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.