{"eip":2718,"title":"Typed Transaction Envelope","description":"Defines a new transaction type that is an envelope for future transaction types.","authors":["Micah Zoltu (@MicahZoltu)"],"status":"Final","type":"Standards Track","category":"Core","created":"2020-06-13","discussionsTo":"https://ethereum-magicians.org/t/eip-2718-typed-transaction-envelope/4355","repo":"EIPs","label":"EIP-2718","officialUrl":"https://eips.ethereum.org/EIPS/eip-2718","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md","url":"https://eips.huatuo.xyz/eip-2718/","tldr":{"en":"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.","ja":"型付きトランザクションエンベロープ（1 バイトのタイププレフィックスと不透明なペイロード）を定義し、Ethereum が古い形式を壊さずに新しいトランザクション形式（アクセスリスト、EIP-1559、blob、set-code）を追加できるようにする。","ko":"타입이 있는 트랜잭션 봉투(1바이트 타입 접두사와 불투명 페이로드)를 정의해, 이더리움이 기존 형식을 깨지 않고 새로운 트랜잭션 형식(액세스 리스트, EIP-1559, blob, set-code)을 추가할 수 있게 한다.","zh":"定义类型化交易信封：一个字节的类型前缀加上不透明的载荷，使以太坊能够在不破坏旧格式的前提下新增交易格式（访问列表、EIP-1559、blob、set-code）。"},"tags":["transactions","encoding","core","berlin"],"explainers":{"en":{"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"],"related":[2930,1559,4844,7702,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2718/","markdown":"## What problem does it solve?\n\nOriginally 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.\n\nWith 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.\n\nEIP-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.\n\n## How it works\n\nA transaction is now either:\n\n- **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\n- **Legacy:** the original `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`.\n\nClients 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.\n\nReceipts 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.\n\nOther design points:\n\n- Each new type **should** sign over its own type byte, so a signature for one type cannot be replayed as another.\n- The payload is opaque bytes rather than an RLP list, so future types could use other encodings (SSZ, fixed width).\n- `ORIGIN` and `CALLER` behave the same for all types; contracts are not meant to see the transaction type.\n\nEIP-2718 went live in the Berlin upgrade (April 2021) alongside type `0x01`. Types defined since then include:\n\n| Type | EIP | Purpose |\n| --- | --- | --- |\n| `0x01` | [EIP-2930](/eip-2930/) | Access lists |\n| `0x02` | [EIP-1559](/eip-1559/) | Base fee + priority fee |\n| `0x03` | [EIP-4844](/eip-4844/) | Blob transactions |\n| `0x04` | [EIP-7702](/eip-7702/) | Set code for EOAs |\n\n## Sample code\n\nDetecting the type of a raw signed transaction (ethers v6):\n\n```ts\nimport { Transaction, getBytes } from \"ethers\";\n\nfunction envelopeKind(rawHex: string) {\n  const first = getBytes(rawHex)[0];\n  if (first \u003e= 0xc0) return \"legacy\";\n  if (first \u003c= 0x7f) return `typed 0x${first.toString(16).padStart(2, \"0\")}`;\n  return \"reserved/invalid\";\n}\n\nconst tx = Transaction.from(rawSignedTx);\nconsole.log(envelopeKind(rawSignedTx), tx.type); // e.g. \"typed 0x02\" 2\n```\n\nByte layout of a type-2 transaction:\n\n```\n0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit,\n             to, value, data, accessList, yParity, r, s])\n```\n\n## Things to know\n\n- The transaction hash of a typed transaction is `keccak256(type || payload)`, i.e. the hash of the whole envelope.\n- Tools that assume \"a transaction is always an RLP list\" break on typed transactions; decode by checking the first byte.\n- The spec deliberately does not define how type numbers are allocated; each new EIP simply picks an unused one.\n- Legacy transactions remain valid and untyped; many JSON-RPC tools report them as type `0`.\n"},"ja":{"lang":"ja","tldr":"型付きトランザクションエンベロープ（1 バイトのタイププレフィックスと不透明なペイロード）を定義し、Ethereum が古い形式を壊さずに新しいトランザクション形式（アクセスリスト、EIP-1559、blob、set-code）を追加できるようにする。","tags":["transactions","encoding","core","berlin"],"related":[2930,1559,4844,7702,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2718/","markdown":"## 何を解決するのか\n\nもともと、Ethereum のトランザクションはすべて 1 つの RLP リストでした: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]`。新しい機能はすべて、既存のトランザクションと区別できる状態を保ったまま、この形に押し込まなければなりませんでした。たとえば [EIP-155](/eip-155/) は、チェーン ID を署名の `v` 値に詰め込みました。\n\nアクセスリスト、新しい手数料市場、スポンサー付きトランザクションなど、新しいトランザクションのアイデアがいくつも出ているなかで、そのたびにこの工夫を繰り返すのは、EIP の著者にもクライアント開発者にも手に負えなくなります。\n\nEIP-2718 はこれを一度で解決します。先頭に**タイプバイト**を置き、各タイプが独自のペイロードを定義できるようにします。新しいタイプに必要なのは、一意な番号だけです。\n\n## 仕組み\n\nトランザクションは、次のいずれかになります。\n\n- **型付き:** `TransactionType || TransactionPayload`。`TransactionType` は `0x00`〜`0x7f` の範囲の 1 バイトで、ペイロードはそのタイプの EIP が定義する不透明なバイト配列です。\n- **レガシー:** 従来の `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`。\n\nクライアントは最初のバイトで両者を区別します。`0x00`〜`0x7f` なら型付き、`0xc0`〜`0xfe` ならレガシーです（RLP リストは必ず `0xc0` 以上で始まります）。`0xff` は将来の拡張マーカーとして予約されています。\n\nレシートも同じパターンに従います: `TransactionType || ReceiptPayload` で、レシートのタイプはそのトランザクションのタイプと一致しなければなりません。ブロックヘッダー内のトランザクショントライとレシートトライは、どちらもこのエンベロープを格納します。\n\nその他の設計上のポイント:\n\n- 新しい各タイプは、自身のタイプバイトも含めて署名する**べき**です。あるタイプの署名が別のタイプとしてリプレイされないようにするためです。\n- ペイロードは RLP リストではなく不透明なバイト列なので、将来のタイプは別のエンコーディング（SSZ、固定幅）を使えます。\n- `ORIGIN` と `CALLER` はすべてのタイプで同じように動作します。コントラクトはトランザクションのタイプを見ることを想定されていません。\n\nEIP-2718 は、Berlin アップグレード（2021 年 4 月）でタイプ `0x01` とともに稼働しました。それ以降に定義されたタイプには次のものがあります。\n\n| タイプ | EIP | 用途 |\n| --- | --- | --- |\n| `0x01` | [EIP-2930](/eip-2930/) | アクセスリスト |\n| `0x02` | [EIP-1559](/eip-1559/) | ベース手数料 + 優先手数料 |\n| `0x03` | [EIP-4844](/eip-4844/) | Blob トランザクション |\n| `0x04` | [EIP-7702](/eip-7702/) | EOA のコード設定（set code） |\n\n## サンプルコード\n\n署名済みの生トランザクションのタイプを判別する例（ethers v6）:\n\n```ts\nimport { Transaction, getBytes } from \"ethers\";\n\nfunction envelopeKind(rawHex: string) {\n  const first = getBytes(rawHex)[0];\n  if (first \u003e= 0xc0) return \"legacy\";\n  if (first \u003c= 0x7f) return `typed 0x${first.toString(16).padStart(2, \"0\")}`;\n  return \"reserved/invalid\";\n}\n\nconst tx = Transaction.from(rawSignedTx);\nconsole.log(envelopeKind(rawSignedTx), tx.type); // e.g. \"typed 0x02\" 2\n```\n\nタイプ 2 トランザクションのバイト構成:\n\n```\n0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit,\n             to, value, data, accessList, yParity, r, s])\n```\n\n## 知っておくべきこと\n\n- 型付きトランザクションのトランザクションハッシュは `keccak256(type || payload)`、つまりエンベロープ全体のハッシュです。\n- 「トランザクションは常に RLP リストである」と仮定するツールは、型付きトランザクションで壊れます。最初のバイトを確認してデコードしてください。\n- 仕様は、タイプ番号をどう割り当てるかを意図的に定めていません。新しい EIP は、未使用の番号を単に選びます。\n- レガシートランザクションは引き続き有効で、型なしのままです。多くの JSON-RPC ツールはこれをタイプ `0` として報告します。\n"},"ko":{"lang":"ko","tldr":"타입이 있는 트랜잭션 봉투(1바이트 타입 접두사와 불투명 페이로드)를 정의해, 이더리움이 기존 형식을 깨지 않고 새로운 트랜잭션 형식(액세스 리스트, EIP-1559, blob, set-code)을 추가할 수 있게 한다.","tags":["transactions","encoding","core","berlin"],"related":[2930,1559,4844,7702,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2718/","markdown":"## 어떤 문제를 해결하나요?\n\n원래 모든 이더리움 트랜잭션은 단일 RLP 리스트였습니다: `[nonce, gasPrice, gasLimit, to, value, data, v, r, s]`. 새 기능은 모두 이 모양 안에 끼워 넣으면서도 기존 트랜잭션과 구별 가능해야 했습니다. 예를 들어 [EIP-155](/eip-155/)는 체인 ID를 서명의 `v` 값에 넣었습니다.\n\n액세스 리스트, 새로운 수수료 시장, 후원 트랜잭션 등 새 트랜잭션 아이디어가 여럿 나온 상황에서, 매번 이런 요령을 쓰는 것은 EIP 저자와 클라이언트 개발자 모두에게 감당하기 어려워졌을 것입니다.\n\nEIP-2718은 이를 한 번에 해결합니다. 앞에 **타입 바이트**를 두고 각 타입이 자기만의 페이로드를 정의하게 합니다. 새 타입에는 고유한 번호만 있으면 됩니다.\n\n## 어떻게 동작하나요?\n\n이제 트랜잭션은 다음 중 하나입니다.\n\n- **타입 있음:** `TransactionType || TransactionPayload`. `TransactionType`은 `0x00`–`0x7f` 범위의 1바이트이고, 페이로드는 해당 타입의 EIP가 정의하는 불투명한 바이트 배열입니다.\n- **레거시:** 기존의 `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`.\n\n클라이언트는 첫 바이트로 둘을 구별합니다. `0x00`–`0x7f`는 타입 있음, `0xc0`–`0xfe`는 레거시를 뜻합니다(RLP 리스트는 항상 `0xc0` 이상으로 시작합니다). `0xff`는 향후 확장 표시로 예약되어 있습니다.\n\n영수증도 같은 패턴을 따릅니다. `TransactionType || ReceiptPayload`이며, 영수증의 타입은 해당 트랜잭션의 타입과 일치해야 합니다. 블록 헤더의 트랜잭션 트라이와 영수증 트라이는 모두 이 봉투를 저장합니다.\n\n그 밖의 설계 요점:\n\n- 새로운 각 타입은 자기 타입 바이트까지 포함해 서명**해야 합니다**. 그래야 한 타입의 서명이 다른 타입으로 재전송되지 못합니다.\n- 페이로드는 RLP 리스트가 아니라 불투명한 바이트이므로, 향후 타입은 다른 인코딩(SSZ, 고정 폭)을 쓸 수 있습니다.\n- `ORIGIN`과 `CALLER`는 모든 타입에서 똑같이 동작하며, 컨트랙트가 트랜잭션 타입을 보도록 의도되지 않았습니다.\n\nEIP-2718은 Berlin 업그레이드(2021년 4월)에서 타입 `0x01`과 함께 적용되었습니다. 이후 정의된 타입은 다음과 같습니다.\n\n| 타입 | EIP | 용도 |\n| --- | --- | --- |\n| `0x01` | [EIP-2930](/eip-2930/) | 액세스 리스트 |\n| `0x02` | [EIP-1559](/eip-1559/) | 기본 수수료 + 우선 수수료 |\n| `0x03` | [EIP-4844](/eip-4844/) | Blob 트랜잭션 |\n| `0x04` | [EIP-7702](/eip-7702/) | EOA용 코드 설정(set code) |\n\n## 샘플 코드\n\n서명된 원시 트랜잭션의 타입 감지(ethers v6):\n\n```ts\nimport { Transaction, getBytes } from \"ethers\";\n\nfunction envelopeKind(rawHex: string) {\n  const first = getBytes(rawHex)[0];\n  if (first \u003e= 0xc0) return \"legacy\";\n  if (first \u003c= 0x7f) return `typed 0x${first.toString(16).padStart(2, \"0\")}`;\n  return \"reserved/invalid\";\n}\n\nconst tx = Transaction.from(rawSignedTx);\nconsole.log(envelopeKind(rawSignedTx), tx.type); // e.g. \"typed 0x02\" 2\n```\n\n타입 2 트랜잭션의 바이트 구성:\n\n```\n0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit,\n             to, value, data, accessList, yParity, r, s])\n```\n\n## 알아둘 점\n\n- 타입이 있는 트랜잭션의 트랜잭션 해시는 `keccak256(type || payload)`, 즉 봉투 전체의 해시입니다.\n- \"트랜잭션은 항상 RLP 리스트\"라고 가정하는 도구는 타입이 있는 트랜잭션에서 깨집니다. 첫 바이트를 확인해서 디코딩하세요.\n- 명세는 타입 번호를 어떻게 할당할지 의도적으로 정하지 않았습니다. 새 EIP는 사용되지 않은 번호를 그냥 고릅니다.\n- 레거시 트랜잭션은 계속 유효하며 타입이 없는 상태로 남아 있습니다. 많은 JSON-RPC 도구는 이를 타입 `0`으로 보고합니다.\n"},"zh":{"lang":"zh","tldr":"定义类型化交易信封：一个字节的类型前缀加上不透明的载荷，使以太坊能够在不破坏旧格式的前提下新增交易格式（访问列表、EIP-1559、blob、set-code）。","tags":["transactions","encoding","core","berlin"],"related":[2930,1559,4844,7702,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2718/","markdown":"## 它解决什么问题？\n\n最初，每笔以太坊交易都是一个单一的 RLP 列表：`[nonce, gasPrice, gasLimit, to, value, data, v, r, s]`。任何新功能都必须挤进这个形状，同时还要与所有现有交易保持可区分。例如，[EIP-155](/eip-155/) 就把链 ID 塞进了签名的 `v` 值里。\n\n随着访问列表、新的费用市场、赞助交易等多个新交易想法被提出，每次都用这种技巧，对 EIP 作者和客户端开发者来说都会变得难以管理。\n\nEIP-2718 一次性解决了这个问题：在前面放一个**类型字节**，让每种类型定义自己的载荷。新类型只需要一个唯一的编号。\n\n## 它如何运作\n\n一笔交易现在要么是：\n\n- **类型化交易：** `TransactionType || TransactionPayload`，其中 `TransactionType` 是 `0x00`–`0x7f` 范围内的一个字节，载荷是由该类型的 EIP 定义的不透明字节数组；要么是\n- **传统交易：** 原来的 `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`。\n\n客户端通过第一个字节区分它们：`0x00`–`0x7f` 表示类型化交易，`0xc0`–`0xfe` 表示传统交易（RLP 列表总是以 `0xc0` 或更大的值开头）。`0xff` 保留为未来的扩展标记。\n\n收据遵循同样的模式：`TransactionType || ReceiptPayload`，收据的类型必须与其交易的类型一致。区块头中的交易 trie 和收据 trie 都存储这些信封。\n\n其他设计要点：\n\n- 每种新类型**应当**对自己的类型字节一并签名，这样一种类型的签名就不能被作为另一种类型重放。\n- 载荷是不透明字节而不是 RLP 列表，因此未来的类型可以使用其他编码（SSZ、定宽）。\n- `ORIGIN` 和 `CALLER` 对所有类型的行为相同；合约并不被期望看到交易类型。\n\nEIP-2718 随 Berlin 升级（2021 年 4 月）和类型 `0x01` 一起上线。此后定义的类型包括：\n\n| 类型 | EIP | 用途 |\n| --- | --- | --- |\n| `0x01` | [EIP-2930](/eip-2930/) | 访问列表 |\n| `0x02` | [EIP-1559](/eip-1559/) | 基础费用 + 优先费用 |\n| `0x03` | [EIP-4844](/eip-4844/) | Blob 交易 |\n| `0x04` | [EIP-7702](/eip-7702/) | 为 EOA 设置代码（set code） |\n\n## 示例代码\n\n检测原始已签名交易的类型（ethers v6）：\n\n```ts\nimport { Transaction, getBytes } from \"ethers\";\n\nfunction envelopeKind(rawHex: string) {\n  const first = getBytes(rawHex)[0];\n  if (first \u003e= 0xc0) return \"legacy\";\n  if (first \u003c= 0x7f) return `typed 0x${first.toString(16).padStart(2, \"0\")}`;\n  return \"reserved/invalid\";\n}\n\nconst tx = Transaction.from(rawSignedTx);\nconsole.log(envelopeKind(rawSignedTx), tx.type); // e.g. \"typed 0x02\" 2\n```\n\n类型 2 交易的字节布局：\n\n```\n0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit,\n             to, value, data, accessList, yParity, r, s])\n```\n\n## 需要注意\n\n- 类型化交易的交易哈希是 `keccak256(type || payload)`，即整个信封的哈希。\n- 假定\"交易总是一个 RLP 列表\"的工具会在类型化交易上出错；请通过检查第一个字节来解码。\n- 规范有意不定义类型编号如何分配；每个新的 EIP 只需选一个未使用的编号。\n- 传统交易仍然有效且无类型；许多 JSON-RPC 工具把它们报告为类型 `0`。\n"}},"requiredBy":[1559,2711,2733,2780,2930,2938,2972,2976,3534,4844,5081,5806,6404,6465,6466,6810,7377,7503,7702,7727,7808,7999,8141,8164,8175,8184,8197,8202,8288,8369]}
