# `EEVM.Block.Receipt`
[🔗](https://github.com/mw2000/eevm/blob/main/lib/eevm/block/receipt.ex#L1)

Per-transaction receipt emitted after execution (Byzantium-and-later layout).

### Fields

- `status` — `1` if the top-level call completed, `0` if it reverted.
- `cumulative_gas_used` — total gas consumed in the block up to and including
  this transaction. The `cumulative_gas_used` of the last receipt equals the
  block's `gas_used`.
- `logs` — every log entry emitted by this transaction, in emission order.
  Each log is a map matching `t:EEVM.Block.Bloom.log_entry/0`.
- `tx_type` — the type of the transaction this receipt belongs to; it
  selects the EIP-2718 encoding (default `:legacy`).
- `logs_bloom` — the 2048-bit bloom filter over this receipt's logs
  (`EEVM.Block.Bloom.from_logs(logs)`); stored pre-computed so block-level
  aggregation is a fast bytewise OR.

## Wire encoding (EIP-2718)

- **Legacy** (type-0) receipts encode as a plain RLP list:
  `RLP([status, cumulative_gas_used, logs_bloom, logs])`.
- **Typed** receipts (EIP-2930 / 1559 / 4844 / 7702) prepend a single type byte to
  the same RLP list, e.g. `<<0x02>> <> RLP([...])` for EIP-1559.

Each log encodes as `[address, [topic, ...], data]`, with the address as a
20-byte big-endian binary and each topic as a 32-byte big-endian binary.

# `log`

```elixir
@type log() :: EEVM.Block.Bloom.log_entry()
```

# `t`

```elixir
@type t() :: %EEVM.Block.Receipt{
  cumulative_gas_used: non_neg_integer(),
  logs: [log()],
  logs_bloom: EEVM.Block.Bloom.t(),
  status: 0 | 1,
  tx_type: tx_type()
}
```

# `tx_type`

```elixir
@type tx_type() ::
  :legacy | :eip2930 | :eip1559 | :eip4844 | :eip7702 | non_neg_integer()
```

# `encode`

```elixir
@spec encode(
  t(),
  keyword()
) :: binary()
```

Encode a receipt to its wire (RLP) form.

The receipt's `tx_type` selects the EIP-2718 form; pass `tx_type:` to
override it. The accepted values are `:legacy`, `:eip2930`, `:eip1559`,
`:eip4844`, `:eip7702`, or the raw integer type byte.

# `new`

```elixir
@spec new() :: t()
```

Returns a successful receipt with no logs and zero cumulative gas.

# `new`

```elixir
@spec new(keyword()) :: t()
```

Returns a receipt with the given overrides.

If `:logs` is supplied without an explicit `:logs_bloom`, the bloom is
derived from the logs automatically so callers cannot produce a receipt
whose bloom is out of sync with its logs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
