1

Based on the data structure of Ethereum blocks and transactions which is also represented here, we know the following sentences about the transactions receipts:

1- The transactions receipts are stored in the LevelDB.
2- The transactions receipts tire is created in RAM when there is a need for it.
3- The root hash of the trie is stored in the block header.

But if the receipts are neither stored inside the block body nor in the transactions data structure, then what is the link inside the block to the receipts in the LevelDB? And how do we know which receipt is related to which transaction?

0

The receipt is generated when executing the transaction. To validate a receipt that was generated by a transaction you have to execute the transaction.

  • But it is not possible to execute a transaction again after submitting it in a block, is it? It has some side effects such as spending ethers of a transaction undesirably. Could you please explain the process? – MHT Apr 25 at 19:30
  • Any execution is done on a world state root. If you execute a transaction in the same root when it was initially mined then every change should match the next state in case of error the block is invalid. – Ismael Apr 25 at 19:59
  • Then we need to spend some gas for executing the transaction again just for checking the receipts of an old transaction. Is it correct? – MHT Apr 26 at 14:50
  • No, you do not pay the execution again, it is paid only once when the block is mined. The execution is verified by every client that wants to validate a block or transaction. – Ismael Apr 26 at 15:22
  • Alright. Coming back again to my first question, if you need to run the transaction to check again its receipts, then why do we store the receipts in DB? Don't we have a more straightforward way of reaching to the receipts when we have them ready in the storage? – MHT Apr 26 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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