Go-Ethereum – Storage Location for Ethereum Event Logs

blockchaincontract-designcontract-developmentgo-ethereumweb3js

Hello it's been written many times, but as I observe none of the answers might be the one. I'm interested in the following thing. If in a smart contract I made the event , where will it be stored? in blockchain , if yes, where exactly?if not there, maybe in nodes? I'm building a serious app and i have to store many things there. so i have finally 2 questions.

1) where are logs stored exactly?
2)if in block header, can you describe how i can trust those logs getting in web3.js front-end?

Best Answer

You can trust the logs because they are stored in their respective block. If a log gets changed it would change the blockhash, receiptRoot, etc , same as with transactions. The merkle tree would not be the same anymore.

So if I execute a function at a certain block heights the receipt and thus the log will also be part of the block at that height as well as my transaction.

To answer where they are stored exactrly. In the transactions receipt trie if I recall correctly.

picture credit from https://medium.com/@preethikasireddy/how-does-ethereum-work-anyway-22d1df506369

Block header

Related Topic