Что такое квитанции транзакций Ethereum и для чего они используются?

Я видел упоминание в нескольких местах, что блоки хранят квитанции о транзакциях, но на самом деле я не видел объяснения того, что это такое и почему они существуют.

Ответы (1)

Взаимосвязь между Transaction Trie и Receipts Trie дает хорошее резюме:

Квитанции о транзакциях фиксируют результат транзакции

Вот структура квитанции о транзакции

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.

Обратите внимание на два последних свойства. Простое использование квитанции — узнать новый контракт contractAddress. Более продвинутый способ получения квитанции — подтверждение существования журналов в блокчейне.

Статус показывает, прошла ли транзакция успешно или нет (т. е. кончился газ)