Receipts

Receipt

class eth.rlp.receipts.Receipt(state_root: bytes, gas_used: int, logs: Iterable[Log], bloom: int | None = None)
classmethod decode(encoded: bytes) ReceiptAPI

This decodes a receipt that is encoded to either a typed receipt, a legacy receipt, or the body of a typed receipt. It assumes that typed receipts are not rlp-encoded first.

If dealing with an object that is always rlp encoded, then use this instead:

rlp.decode(encoded, sedes=ReceiptBuilderAPI)

For example, you may receive a list of receipts via a devp2p request. Each receipt is either a (legacy) rlp list, or a (new-style) bytestring. Even if the receipt is a bytestring, it’s wrapped in an rlp bytestring, in that context. New-style receipts will not be wrapped in an RLP bytestring in other contexts. They will just be an EIP-2718 type-byte plus payload of concatenated bytes, which cannot be decoded as RLP. This happens for example, when calculating the receipt root hash.

encode() bytes

This encodes a receipt, no matter if it’s: a legacy receipt, a typed receipt, or the payload of a typed receipt. See more context in decode.

property bloom
property bloom_filter: BloomFilter
property gas_used
property logs
property state_root
type_id = None