{"eip":7698,"title":"EOF - Creation transaction","description":"Deploy EOF contracts using creation transactions","authors":["Piotr Dobaczewski (@pdobacz)","Andrei Maiboroda (@gumb0)","Paweł Bylica (@chfast)","Alex Beregszaszi (@axic)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2024-04-24","requires":[3540],"discussionsTo":"https://ethereum-magicians.org/t/eip-7698-eof-creation-transaction/19784","repo":"EIPs","label":"EIP-7698","officialUrl":"https://eips.ethereum.org/EIPS/eip-7698","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7698.md","url":"https://eips.huatuo.xyz/eip-7698/","tldr":{"en":"Lets an ordinary contract-creation transaction deploy an EOF contract by sending an EOF initcontainer followed by constructor arguments, giving EOF its first way onto the chain.","ja":"通常のコントラクト作成トランザクションで、EOF initcontainer とそれに続くコンストラクタ引数を送ることで EOF コントラクトをデプロイできるようにする。EOF がチェーン上に載る最初の手段となる。","ko":"일반 컨트랙트 생성 트랜잭션에 EOF initcontainer와 생성자 인자를 이어 보내는 것으로 EOF 컨트랙트를 배포할 수 있게 한다. EOF가 체인에 올라가는 첫 번째 방법이다.","zh":"让普通的合约创建交易通过发送 EOF initcontainer 加构造函数参数来部署 EOF 合约，为 EOF 提供了上链的第一条途径。"},"tags":["evm","eof","deployment","core"],"explainers":{"en":{"lang":"en","tldr":"Lets an ordinary contract-creation transaction deploy an EOF contract by sending an EOF initcontainer followed by constructor arguments, giving EOF its first way onto the chain.","tags":["evm","eof","deployment","core"],"related":[3540,7692,7620,3860,3541],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7698/","markdown":"## What problem does it solve?\n\nThe EVM Object Format (EOF, [EIP-3540](/eip-3540/) and the [EIP-7692](/eip-7692/) bundle) is a new, validated container format for contract code. Inside EOF, contracts create others with `EOFCREATE`, and legacy `CREATE`/`CREATE2` are not allowed to deploy EOF code. That leaves a bootstrap problem: how does the first EOF contract get deployed?\n\nEIP-7698 answers it with the simplest option: a normal creation transaction (empty `to`) can carry EOF code. Because constructor arguments are still just appended to the code, existing deployment tools work unchanged.\n\n## How it works\n\nIf a creation transaction's `data` starts with the EOF magic `0xEF00`:\n\n1. The usual intrinsic-gas rules and initcode limits for creation transactions ([EIP-3860](/eip-3860/)) apply to the whole `data`.\n2. The client parses the EOF header and adds up the section sizes to find where the **initcontainer** ends. Everything after it is **calldata** for the constructor.\n3. The initcontainer and all nested subcontainers are validated. The initcontainer's declared data size must match the actual data, and it must not use `RETURN` or `STOP`.\n4. If parsing or validation fails, the transaction is valid but fails: only the intrinsic cost is charged.\n5. Otherwise the initcode runs. The new address is computed from the sender's address and nonce, as for a legacy creation transaction.\n6. Success means the initcode ends with `RETURNCODE`, which picks a subcontainer to deploy and appends some memory (\"aux data\") to its data section. The result must fit the 24,576-byte code size limit, and 200 gas per deployed byte is charged.\n\nThe [EIP-3541](/eip-3541/) ban on deploying code starting with `0xEF` does not apply here, since this is valid EOF. All other rules (access lists, nonce bumping, value transfer, address collisions) follow legacy creation.\n\n## Sample code\n\nShape of the transaction `data` (pseudocode):\n\n```python\n# data = initcontainer || constructor_args\ndata = eof_initcontainer + abi_encode(constructor_args)\n\nassert data[:2] == b\"\\xef\\x00\"          # EOF_MAGIC triggers the new path\nheader = parse_eof_header(data)\ninit_len = header.header_size + sum(header.section_sizes)\ninitcontainer, calldata = data[:init_len], data[init_len:]\n\nvalidate_recursively(initcontainer)     # failure =\u003e tx fails, intrinsic gas only\n```\n\nDeploying from ethers v6 looks exactly like a legacy deployment:\n\n```ts\nconst tx = await wallet.sendTransaction({ data: eofInitcontainer + encodedArgs.slice(2) });\nconst receipt = await tx.wait();\nconsole.log(receipt!.contractAddress);\n```\n\n## Things to know\n\n- Status: **Stagnant**. It belongs to the EOF effort, which has not shipped on Ethereum mainnet.\n- An earlier design deployed a \"creator contract\" via an irregular state change plus a new `InitcodeTransaction` (`TXCREATE`); it was dropped to reduce scope. See [EIP-7620](/eip-7620/) for `EOFCREATE`/`RETURNCODE`.\n- Constructor arguments are read with `CALLDATA*`, not appended to the data section, so compilers generate the same initcode whether it runs from a transaction or from `EOFCREATE`.\n- Legacy deployments are unaffected: any old creation transaction starting with `0xEF` already failed.\n"},"ja":{"lang":"ja","tldr":"通常のコントラクト作成トランザクションで、EOF initcontainer とそれに続くコンストラクタ引数を送ることで EOF コントラクトをデプロイできるようにする。EOF がチェーン上に載る最初の手段となる。","tags":["evm","eof","deployment","core"],"related":[3540,7692,7620,3860,3541],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7698/","markdown":"## 何を解決するのか\n\nEVM Object Format（EOF、[EIP-3540](/eip-3540/) と [EIP-7692](/eip-7692/) のバンドル）は、コントラクトコード用の新しい検証済みコンテナ形式です。EOF の中では、コントラクトは `EOFCREATE` で別のコントラクトを作成し、従来の `CREATE`/`CREATE2` で EOF コードをデプロイすることは認められません。そのため、最初の EOF コントラクトはどうやってデプロイするのか、というブートストラップの問題が残ります。\n\nEIP-7698 は最も単純な方法で答えます。通常の作成トランザクション（`to` が空）に EOF コードを載せられるようにするのです。コンストラクタ引数は従来どおりコードの末尾に付け足されるだけなので、既存のデプロイツールはそのまま動きます。\n\n## 仕組み\n\n作成トランザクションの `data` が EOF マジック `0xEF00` で始まる場合：\n\n1. 作成トランザクションの通常の intrinsic gas ルールと initcode の上限（[EIP-3860](/eip-3860/)）が `data` 全体に適用されます。\n2. クライアントは EOF ヘッダーを解析し、各セクションのサイズを合計して **initcontainer** の終端を求めます。それ以降はすべてコンストラクタ用の **calldata** です。\n3. initcontainer とネストされたすべてのサブコンテナが検証されます。initcontainer に宣言されたデータサイズは実際のデータと一致している必要があり、`RETURN` や `STOP` を使ってはいけません。\n4. 解析または検証に失敗した場合、トランザクションは有効ですが失敗します。課金されるのは intrinsic コストのみです。\n5. そうでなければ initcode が実行されます。新しいアドレスは、従来の作成トランザクションと同様に、送信者のアドレスと nonce から計算されます。\n6. 成功とは、initcode が `RETURNCODE` で終わることを指します。`RETURNCODE` はデプロイするサブコンテナを選び、メモリの一部（\"aux data\"）をそのデータセクションに追加します。結果は 24,576 バイトのコードサイズ上限に収まる必要があり、デプロイされたバイトごとに 200 gas が課金されます。\n\n`0xEF` で始まるコードのデプロイを禁止する [EIP-3541](/eip-3541/) は、これが有効な EOF であるためここには適用されません。それ以外のルール（アクセスリスト、nonce の加算、value の転送、アドレス衝突）は従来の作成に従います。\n\n## サンプルコード\n\nトランザクションの `data` の形（疑似コード）：\n\n```python\n# data = initcontainer || constructor_args\ndata = eof_initcontainer + abi_encode(constructor_args)\n\nassert data[:2] == b\"\\xef\\x00\"          # EOF_MAGIC triggers the new path\nheader = parse_eof_header(data)\ninit_len = header.header_size + sum(header.section_sizes)\ninitcontainer, calldata = data[:init_len], data[init_len:]\n\nvalidate_recursively(initcontainer)     # failure =\u003e tx fails, intrinsic gas only\n```\n\nethers v6 からのデプロイは、従来のデプロイとまったく同じに見えます：\n\n```ts\nconst tx = await wallet.sendTransaction({ data: eofInitcontainer + encodedArgs.slice(2) });\nconst receipt = await tx.wait();\nconsole.log(receipt!.contractAddress);\n```\n\n## 知っておくべきこと\n\n- ステータス：**Stagnant**。Ethereum メインネットに出荷されていない EOF の取り組みの一部です。\n- 以前の設計では、変則的なステート変更と新しい `InitcodeTransaction`（`TXCREATE`）によって「creator contract」をデプロイしていましたが、スコープを減らすために取り下げられました。`EOFCREATE`/`RETURNCODE` については [EIP-7620](/eip-7620/) を参照してください。\n- コンストラクタ引数はデータセクションに付け足されるのではなく `CALLDATA*` で読み取られるため、コンパイラは、トランザクションから実行されても `EOFCREATE` から実行されても同じ initcode を生成します。\n- 従来のデプロイには影響しません。`0xEF` で始まる古い作成トランザクションは、もともとすべて失敗していました。\n"},"ko":{"lang":"ko","tldr":"일반 컨트랙트 생성 트랜잭션에 EOF initcontainer와 생성자 인자를 이어 보내는 것으로 EOF 컨트랙트를 배포할 수 있게 한다. EOF가 체인에 올라가는 첫 번째 방법이다.","tags":["evm","eof","deployment","core"],"related":[3540,7692,7620,3860,3541],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7698/","markdown":"## 어떤 문제를 해결하나요?\n\nEVM Object Format(EOF, [EIP-3540](/eip-3540/)과 [EIP-7692](/eip-7692/) 번들)은 컨트랙트 코드를 위한 새롭고 검증된 컨테이너 형식입니다. EOF 안에서는 컨트랙트가 `EOFCREATE`로 다른 컨트랙트를 만들고, 기존 `CREATE`/`CREATE2`로는 EOF 코드를 배포할 수 없습니다. 그래서 첫 번째 EOF 컨트랙트는 어떻게 배포하느냐는 부트스트랩 문제가 남습니다.\n\nEIP-7698은 가장 단순한 방법으로 답합니다. 일반 생성 트랜잭션(`to`가 비어 있음)이 EOF 코드를 실을 수 있게 하는 것입니다. 생성자 인자는 여전히 코드 뒤에 덧붙이기만 하면 되므로 기존 배포 도구가 그대로 동작합니다.\n\n## 어떻게 동작하나요?\n\n생성 트랜잭션의 `data`가 EOF 매직 `0xEF00`으로 시작하면:\n\n1. 생성 트랜잭션의 통상적인 intrinsic gas 규칙과 initcode 한도([EIP-3860](/eip-3860/))가 `data` 전체에 적용됩니다.\n2. 클라이언트는 EOF 헤더를 파싱하고 각 섹션의 크기를 더해 **initcontainer**가 끝나는 위치를 찾습니다. 그 뒤의 모든 내용은 생성자를 위한 **calldata**입니다.\n3. initcontainer와 중첩된 모든 서브컨테이너가 검증됩니다. initcontainer에 선언된 데이터 크기는 실제 데이터와 일치해야 하며, `RETURN`이나 `STOP`을 사용해서는 안 됩니다.\n4. 파싱이나 검증에 실패하면 트랜잭션은 유효하지만 실패합니다. intrinsic 비용만 부과됩니다.\n5. 그렇지 않으면 initcode가 실행됩니다. 새 주소는 기존 생성 트랜잭션과 마찬가지로 발신자 주소와 nonce로 계산됩니다.\n6. 성공이란 initcode가 `RETURNCODE`로 끝나는 것을 뜻합니다. `RETURNCODE`는 배포할 서브컨테이너를 고르고 메모리 일부(\"aux data\")를 그 데이터 섹션에 덧붙입니다. 결과는 24,576바이트 코드 크기 한도에 맞아야 하며, 배포된 바이트당 200 gas가 부과됩니다.\n\n`0xEF`로 시작하는 코드의 배포를 금지하는 [EIP-3541](/eip-3541/)은 유효한 EOF이므로 여기에는 적용되지 않습니다. 나머지 모든 규칙(액세스 리스트, nonce 증가, value 전송, 주소 충돌)은 기존 생성 방식을 따릅니다.\n\n## 샘플 코드\n\n트랜잭션 `data`의 형태(의사 코드):\n\n```python\n# data = initcontainer || constructor_args\ndata = eof_initcontainer + abi_encode(constructor_args)\n\nassert data[:2] == b\"\\xef\\x00\"          # EOF_MAGIC triggers the new path\nheader = parse_eof_header(data)\ninit_len = header.header_size + sum(header.section_sizes)\ninitcontainer, calldata = data[:init_len], data[init_len:]\n\nvalidate_recursively(initcontainer)     # failure =\u003e tx fails, intrinsic gas only\n```\n\nethers v6로 배포하는 모습은 기존 배포와 완전히 같습니다:\n\n```ts\nconst tx = await wallet.sendTransaction({ data: eofInitcontainer + encodedArgs.slice(2) });\nconst receipt = await tx.wait();\nconsole.log(receipt!.contractAddress);\n```\n\n## 알아둘 점\n\n- 상태: **Stagnant**. 이더리움 메인넷에 출시되지 않은 EOF 작업의 일부입니다.\n- 초기 설계는 비정규적인 상태 변경과 새로운 `InitcodeTransaction`(`TXCREATE`)으로 \"creator contract\"를 배포했지만, 범위를 줄이기 위해 폐기되었습니다. `EOFCREATE`/`RETURNCODE`는 [EIP-7620](/eip-7620/)을 참고하세요.\n- 생성자 인자는 데이터 섹션에 덧붙이는 대신 `CALLDATA*`로 읽기 때문에, 컴파일러는 트랜잭션에서 실행되든 `EOFCREATE`에서 실행되든 같은 initcode를 생성합니다.\n- 기존 배포에는 영향이 없습니다. `0xEF`로 시작하는 예전 생성 트랜잭션은 원래부터 모두 실패했습니다.\n"},"zh":{"lang":"zh","tldr":"让普通的合约创建交易通过发送 EOF initcontainer 加构造函数参数来部署 EOF 合约，为 EOF 提供了上链的第一条途径。","tags":["evm","eof","deployment","core"],"related":[3540,7692,7620,3860,3541],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7698/","markdown":"## 它解决什么问题？\n\nEVM 对象格式（EOF，[EIP-3540](/eip-3540/) 以及 [EIP-7692](/eip-7692/) 打包方案）是一种新的、经过验证的合约代码容器格式。在 EOF 内部，合约通过 `EOFCREATE` 创建其他合约，而传统的 `CREATE`/`CREATE2` 不允许部署 EOF 代码。这就留下了一个引导问题：第一个 EOF 合约如何部署？\n\nEIP-7698 给出了最简单的答案：普通的创建交易（`to` 为空）可以携带 EOF 代码。由于构造函数参数仍然只是追加在代码之后，现有的部署工具无需改动即可使用。\n\n## 它如何运作\n\n如果创建交易的 `data` 以 EOF 魔数 `0xEF00` 开头：\n\n1. 创建交易通常的 intrinsic gas 规则和 initcode 限制（[EIP-3860](/eip-3860/)）适用于整个 `data`。\n2. 客户端解析 EOF 头部，并将各 section 的大小相加，找出 **initcontainer** 的结束位置。其后的所有内容都是给构造函数的 **calldata**。\n3. initcontainer 以及所有嵌套的子容器都会被验证。initcontainer 声明的数据大小必须与实际数据一致，并且不能使用 `RETURN` 或 `STOP`。\n4. 如果解析或验证失败，该交易是有效的，但会执行失败：只收取 intrinsic 成本。\n5. 否则运行 initcode。新地址由发送者地址和 nonce 计算得出，与传统创建交易相同。\n6. 成功意味着 initcode 以 `RETURNCODE` 结束，它会选出一个要部署的子容器，并把一部分内存（“aux data”）追加到其数据 section 中。结果必须符合 24,576 字节的代码大小上限，并且每个已部署字节收取 200 gas。\n\n[EIP-3541](/eip-3541/) 对部署以 `0xEF` 开头的代码的禁令在此不适用，因为这是有效的 EOF。其他所有规则（访问列表、nonce 递增、value 转移、地址冲突）都沿用传统的创建方式。\n\n## 示例代码\n\n交易 `data` 的结构（伪代码）：\n\n```python\n# data = initcontainer || constructor_args\ndata = eof_initcontainer + abi_encode(constructor_args)\n\nassert data[:2] == b\"\\xef\\x00\"          # EOF_MAGIC triggers the new path\nheader = parse_eof_header(data)\ninit_len = header.header_size + sum(header.section_sizes)\ninitcontainer, calldata = data[:init_len], data[init_len:]\n\nvalidate_recursively(initcontainer)     # failure =\u003e tx fails, intrinsic gas only\n```\n\n使用 ethers v6 部署，看起来与传统部署完全一样：\n\n```ts\nconst tx = await wallet.sendTransaction({ data: eofInitcontainer + encodedArgs.slice(2) });\nconst receipt = await tx.wait();\nconsole.log(receipt!.contractAddress);\n```\n\n## 需要注意\n\n- 状态：**Stagnant**。它属于 EOF 这项工作，而 EOF 尚未在以太坊主网上线。\n- 早期设计通过一次不规则的状态变更加上新的 `InitcodeTransaction`（`TXCREATE`）来部署“creator contract”；为缩小范围，该设计已被放弃。`EOFCREATE`/`RETURNCODE` 请参见 [EIP-7620](/eip-7620/)。\n- 构造函数参数通过 `CALLDATA*` 读取，而不是追加到 data section，因此无论 initcode 是由交易运行还是由 `EOFCREATE` 运行，编译器生成的都是相同的 initcode。\n- 传统部署不受影响：任何以 `0xEF` 开头的旧创建交易本来就会失败。\n"}},"requiredBy":[7692]}
