---
eip: 2718
label: EIP-2718
title: Typed Transaction Envelope
status: Final
type: Standards Track
category: Core
created: 2020-06-13
official: https://eips.ethereum.org/EIPS/eip-2718
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md
canonical: https://eips.huatuo.xyz/eip-2718/
lang: en
tldr: Defines the typed transaction envelope, a one-byte type prefix plus an opaque payload, so Ethereum can add new transaction formats (access lists, EIP-1559, blobs, set-code) without breaking old ones.
tags: [transactions, encoding, core, berlin]
---

# EIP-2718: Typed Transaction Envelope

> Defines a new transaction type that is an envelope for future transaction types.

**TL;DR:** Defines the typed transaction envelope, a one-byte type prefix plus an opaque payload, so Ethereum can add new transaction formats (access lists, EIP-1559, blobs, set-code) without breaking old ones.

## What problem does it solve?

Originally every Ethereum transaction was a single RLP list: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]`. Any new feature had to squeeze into that shape while remaining distinguishable from all existing transactions. [EIP-155](/eip-155/), for example, packed the chain ID into the `v` value of the signature.

With several new transaction ideas on the table (access lists, a new fee market, sponsored transactions), doing that trick each time would have become unmanageable for EIP authors and client developers alike.

EIP-2718 solves this once: put a **type byte** in front, and let each type define its own payload. New types only need a unique number.

## How it works

A transaction is now either:

- **Typed:** `TransactionType || TransactionPayload`, where `TransactionType` is a byte in `0x00`–`0x7f` and the payload is an opaque byte array defined by that type's EIP, or
- **Legacy:** the original `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`.

Clients tell them apart by the first byte: `0x00`–`0x7f` means typed, `0xc0`–`0xfe` means legacy (an RLP list always starts at `0xc0` or above). `0xff` is reserved as a future extension marker.

Receipts follow the same pattern: `TransactionType || ReceiptPayload`, and a receipt's type must match its transaction's. Both the transactions trie and the receipts trie in the block header store these envelopes.

Other design points:

- Each new type **should** sign over its own type byte, so a signature for one type cannot be replayed as another.
- The payload is opaque bytes rather than an RLP list, so future types could use other encodings (SSZ, fixed width).
- `ORIGIN` and `CALLER` behave the same for all types; contracts are not meant to see the transaction type.

EIP-2718 went live in the Berlin upgrade (April 2021) alongside type `0x01`. Types defined since then include:

| Type | EIP | Purpose |
| --- | --- | --- |
| `0x01` | [EIP-2930](/eip-2930/) | Access lists |
| `0x02` | [EIP-1559](/eip-1559/) | Base fee + priority fee |
| `0x03` | [EIP-4844](/eip-4844/) | Blob transactions |
| `0x04` | [EIP-7702](/eip-7702/) | Set code for EOAs |

## Sample code

Detecting the type of a raw signed transaction (ethers v6):

```ts
import { Transaction, getBytes } from "ethers";

function envelopeKind(rawHex: string) {
  const first = getBytes(rawHex)[0];
  if (first >= 0xc0) return "legacy";
  if (first <= 0x7f) return `typed 0x${first.toString(16).padStart(2, "0")}`;
  return "reserved/invalid";
}

const tx = Transaction.from(rawSignedTx);
console.log(envelopeKind(rawSignedTx), tx.type); // e.g. "typed 0x02" 2
```

Byte layout of a type-2 transaction:

```
0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit,
             to, value, data, accessList, yParity, r, s])
```

## Things to know

- The transaction hash of a typed transaction is `keccak256(type || payload)`, i.e. the hash of the whole envelope.
- Tools that assume "a transaction is always an RLP list" break on typed transactions; decode by checking the first byte.
- The spec deliberately does not define how type numbers are allocated; each new EIP simply picks an unused one.
- Legacy transactions remain valid and untyped; many JSON-RPC tools report them as type `0`.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-2718
