11

Here's a snapshot from etherscan.io

enter image description here

2 Answers 2

19

topics[0] is the hash of the signature of the event.

Example from Solidity docs:

keccak256("Deposit(address,bytes32,uint256)") is the signature of the event:

event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );
2
  • this is a keccak_256 hash right?
    – garg10may
    Sep 18, 2017 at 14:21
  • @garg10may Yes, most Solidity docs have now updated to keccak256. It will take time for other places like answers here to be updated: thanks for pointing this one out.
    – eth
    Sep 20, 2017 at 9:30
4

Note when applying this for structs, the pattern is to nest the structs in a similar way. So:

keccak256("Deposit(address,bytes32,uint256,(bytes32, bytes32))") is the signature of the event:

struct MoreData
{
        bytes32 id1;
        bytes32 id2;
}

event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value,
        MoreData _moreData
    );

Your Answer

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

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