# `EEVM.Context.Transaction`
[🔗](https://github.com/mw2000/eevm/blob/main/lib/eevm/context/transaction.ex#L1)

Transaction-level context — information about the original transaction
exposed to the EVM via environment opcodes.

### Fields

| Field | Opcode | Description |
|-------|--------|-------------|
| `origin` | ORIGIN (0x32) | The externally owned account (EOA) that signed the tx |
| `gasprice` | GASPRICE (0x3A) | Gas price in wei the sender is paying |
| `blob_hashes` | BLOBHASH (0x49) | List of blob versioned hashes from EIP-4844 transaction payload |
| `authorization_list` | — | EIP-7702 authorizations applied before execution |

### Origin vs Caller

`origin` is always the EOA that signed the transaction — it never changes,
even through nested contract calls. `caller` (in `EEVM.Context.Contract`) is the
*direct* caller of the current frame and changes with each CALL.

# `authorization`

```elixir
@type authorization() :: %{
  chain_id: non_neg_integer(),
  address: non_neg_integer(),
  nonce: non_neg_integer(),
  y_parity: 0..255,
  r: non_neg_integer(),
  s: non_neg_integer()
}
```

# `t`

```elixir
@type t() :: %EEVM.Context.Transaction{
  access_list: [{non_neg_integer(), [non_neg_integer()]}],
  authorization_list: [authorization()],
  blob_hashes: [non_neg_integer()],
  data: binary(),
  gas_limit: non_neg_integer(),
  gasprice: non_neg_integer(),
  max_fee_per_blob_gas: non_neg_integer(),
  max_fee_per_gas: non_neg_integer(),
  max_priority_fee_per_gas: non_neg_integer(),
  nonce: non_neg_integer(),
  origin: non_neg_integer(),
  to: non_neg_integer() | nil,
  type: :legacy | :eip2930 | :eip1559 | :eip4844 | :eip7702,
  value: non_neg_integer()
}
```

# `new`

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

Creates a new transaction context with default values.

# `new`

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

Creates a new transaction context with the given overrides.

## Example

    iex> tx = EEVM.Context.Transaction.new(origin: 0xDEAD, gasprice: 20_000_000_000)
    iex> tx.origin
    0xDEAD

---

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