I was reading Event's documentation. I encountered this paragraph. Can someone explains it in simple words?
You can add the attribute indexed to up to three parameters which adds them to a special data structure known as “topics” instead of the data part of the log. A topic can only hold a single word (32 bytes) so if you use a reference type for an indexed argument, the Keccak-256 hash of the value is stored as a topic instead.
How transactions are stored on ethereum? ( w.r.t data structure )
How Events are stored in transactions?
How indexed arguments are stored?
How reference type indexed arguments are stored?
I can only answer question 1,2
Transactions are stored in a Patricia Merkle Tree, the so called Transaction Trie. The root of the Transaction Trie is stored in the block header, all transactions are appended in the block body. see: https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/
Events are not stored in the transaction nor on the blockchain. They are stored within the transaction receipt. TX receipts are stored in the Receipts Trie by the node. Further the root of the receipts tree is stored onchain in the block header.

IMG Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With