This is a minimal web utility to calculate the keccak256
hashes of the normalized event signatures of all the events in a Solidity code block. This hash can then be used with indexers like Etherscan to search for specific logs in the EVM history.
Warning
Known issues:
- This tool won't work with user-defined value types. For events that include these types, you must manually convert the user-defined value type into its equivalent primitive type.
anonymous
events do not log the hash of the event signature, so this tool is not useful for searching for anonymous event logs.
Also check out this gist to copy all the code blocks at once from an Etherscan smart contract code page; you can then directly paste the copied code into this tool to quickly parse all the events.
Given the standard ERC-20 Transfer
event:
event Transfer(address indexed _from, address indexed _to, uint256 _value)
The tool will normalize the event signature (i.e., remove spaces, input names, and extraneous keywords):
Transfer(address,address,uint256)
Then calculate the keccak256
hash of the UTF-8 encoded bytes of the normalized signature:
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
This hash may then be used in another tool to filter a smart contract's logs, e.g. in Etherscan:
Intelligently parse entire smart contracts
There's no need to manually extract the event signatures from the smart contract code. The tool will automatically ignore lines that don't contain event signatures.
Copy permalinks to code blocks
You can easily share links to events with other people. The entire codeblock is compressed and encoded into the URL fragment of the permalink and is decoded client-side (i.e., nothing is shared with a server).
For example, here's a permalink to the ERC-721 interface:
Useful table tools
The output is a normal, well-behaved <table>
element. Accessibility and web browser functions should work as expected.
There are also utilities to download the table as a CSV file or copy it to clipboard, so you can easily export the table to a spreadsheet or other software of your choice.
Use this permalink for testing. The output should be:
Event | Keccak-256 Hash |
---|---|
Simple(address,address,uint256) | 0x0c4aa1b50b54ea9174bfce3c438012e4f2bbf93a058dc8d74185ab16d82ba900 |
Simple(uint256[],int256,uint8[]) | 0x2026044affa2e544dcb961375aedefd2b307e1b946edac0491c979b356280220 |
Spaces(address,address,uint256) | 0xda28d9a3b64acdf2ca6024d6f102d1771bd9d91df417723b1f14c4ae0856c6d3 |
MultiLine(address,address,uint256) | 0x760dd7228125a3ef675a431bf253d71f0e2b83af9ec42e0cfd9d2fae9752fb49 |
MultiLineSameName(address,address) | 0xe18b9597b1182141cedf8b007cb04e23cf5a02d16c74ce2c704fb5dfd7516343 |
MultiLineSameName(uint256,int256) | 0x06b14b8df51d75cfe7ac7998ad1c26ef4c27486f5002d2467e2153e5223afb65 |