12

I've seen mention in a few places that blocks store transaction receipts, but I haven't really seen an explanation of what they are and why they exist.

18

Relationship between Transaction Trie and Receipts Trie provides a good summary:

Transaction Receipts record the transaction outcome

Here is the Structure of a transaction receipt

blockHash: String, 32 Bytes - hash of the block where this transaction was in.
blockNumber: Number - block number where this transaction was in.
transactionHash: String, 32 Bytes - hash of the transaction.
transactionIndex: Number - integer of the transactions index position in the block.
from: String, 20 Bytes - address of the sender.
to: String, 20 Bytes - address of the receiver. null when its a contract creation transaction.
cumulativeGasUsed: Number - The total amount of gas used when this transaction was executed in the block.
gasUsed: Number - The amount of gas used by this specific transaction alone.
status: String - '0x0' indicates transaction failure , '0x1' indicates transaction succeeded.
contractAddress: String - 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
logs: Array - Array of log objects, which this transaction generated.

Take a look at the last two properties. A simple use of a receipt is to find out a new contract's contractAddress. A more advanced used for a receipt is with Proving the Existence of Logs to the Blockchain

The status indicates if the transaction succeeded or not (ie. it ran out of gas)

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.