{"eip":2028,"title":"Transaction data gas cost reduction","description":"We propose to reduce the gas cost of Calldata (GTXDATANONZERO) from its current value of 68 gas per byte to 16 gas per byte, to be backed by mathematical modeling and empirical estimates.","authors":["Alexey Akhunov (@AlexeyAkhunov)","Eli Ben Sasson \u003celi@starkware.co\u003e","Tom Brand \u003ctom@starkware.co\u003e","Louis Guthmann \u003clouis@starkware.co\u003e","Avihu Levy \u003cavihu@starkware.co\u003e"],"status":"Final","type":"Standards Track","category":"Core","created":"2019-05-03","discussionsTo":"https://ethereum-magicians.org/t/eip-2028-calldata-gas-cost-reduction/3280","repo":"EIPs","label":"EIP-2028","officialUrl":"https://eips.ethereum.org/EIPS/eip-2028","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2028.md","url":"https://eips.huatuo.xyz/eip-2028/","tldr":{"en":"Cut the gas cost of non-zero calldata bytes from 68 to 16, making it far cheaper to post data on chain, which rollups and proof systems depend on.","ja":"ゼロ以外の calldata バイトのガスコストを 68 から 16 に引き下げ、ロールアップや証明システムが頼るオンチェーンへのデータ投稿を大幅に安くする。","ko":"0이 아닌 calldata 바이트의 가스 비용을 68에서 16으로 낮춰, 롤업과 증명 시스템이 의존하는 온체인 데이터 게시를 훨씬 저렴하게 만든다.","zh":"将非零 calldata 字节的 gas 成本从 68 降到 16，使在链上发布数据便宜得多，而 rollup 和证明系统都依赖这一点。"},"tags":["gas","calldata","transactions","scaling","istanbul"],"explainers":{"en":{"lang":"en","tldr":"Cut the gas cost of non-zero calldata bytes from 68 to 16, making it far cheaper to post data on chain, which rollups and proof systems depend on.","tags":["gas","calldata","transactions","scaling","istanbul"],"related":[4844,7623,2718],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2028/","markdown":"## What problem does it solve?\n\nEvery byte of transaction input data (calldata) costs gas. Since Frontier, a non-zero byte cost 68 gas (`GTXDATANONZERO`) and a zero byte 4 gas. That price was set conservatively and made data-heavy uses expensive:\n\n- **Layer-2 rollups** post batches of transactions or state diffs to L1 as calldata for data availability.\n- **Proof systems** (SNARKs, STARKs) submit large proofs and public inputs.\n- **Fraud proofs and stateless designs** move Merkle proofs around instead of reading storage.\n\nThe authors (including the StarkWare team) argued that data mainly costs network bandwidth and block propagation time, and that 68 gas overstated that cost. EIP-2028 lowered it and shipped in the Istanbul upgrade.\n\n## How it works\n\nOne constant changes:\n\n| Byte value | Before | After |\n| --- | --- | --- |\n| zero (`0x00`) | 4 gas | 4 gas (unchanged) |\n| non-zero | 68 gas | **16 gas** |\n\nThis is part of the intrinsic gas of a transaction, charged before execution: `21000 + 4·zeroBytes + 16·nonZeroBytes` (plus contract-creation and access-list costs where they apply).\n\nThe rationale uses a model from Sompolinsky–Zohar and Pass–Seeman–Shelat that links block propagation delay to security: bigger blocks propagate slower, which wastes more honest hash power on stale blocks and lowers the cost of an attack. The proposal splits delay into transmission and processing parts and argues that calldata mostly adds transmission delay, which the network could absorb at 16 gas per byte.\n\n## Sample code\n\nComputing the calldata portion of intrinsic gas (TypeScript, ethers v6):\n\n```ts\nimport { getBytes, Interface, parseEther } from \"ethers\";\n\nfunction calldataGas(data: string): number {\n  let gas = 0;\n  for (const b of getBytes(data)) gas += b === 0 ? 4 : 16; // post-EIP-2028 prices\n  return gas;\n}\n\n// transfer(address,uint256) has many zero bytes from ABI padding\nconst erc20 = new Interface([\"function transfer(address to, uint256 value)\"]);\nconst data = erc20.encodeFunctionData(\"transfer\", [\n  \"0x000000000000000000000000000000000000dEaD\",\n  parseEther(\"1\"),\n]);\n\nconsole.log(21_000 + calldataGas(data)); // intrinsic gas for this simple call\n```\n\n## Things to know\n\n- Zero bytes are still cheaper, so compact encodings that avoid non-zero padding (or use zero-heavy layouts) save gas.\n- Cheaper calldata was a major enabler for early optimistic and ZK rollups, which used calldata for data availability.\n- Rollup data later moved to blobs with [EIP-4844](/eip-4844/), which have their own fee market.\n- [EIP-7623](/eip-7623/) later introduced a higher floor price for data-heavy transactions, so very calldata-heavy transactions no longer pay the plain 16-gas rate. Check the rules of the fork you target when estimating costs.\n"},"ja":{"lang":"ja","tldr":"ゼロ以外の calldata バイトのガスコストを 68 から 16 に引き下げ、ロールアップや証明システムが頼るオンチェーンへのデータ投稿を大幅に安くする。","tags":["gas","calldata","transactions","scaling","istanbul"],"related":[4844,7623,2718],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2028/","markdown":"## 何を解決するのか\n\nトランザクションの入力データ（calldata）は 1 バイトごとにガスがかかります。Frontier 以来、ゼロ以外のバイトは 68 ガス（`GTXDATANONZERO`）、ゼロのバイトは 4 ガスでした。この価格は保守的に設定されており、データを多く使う用途のコストを押し上げていました。\n\n- **レイヤー 2 ロールアップ**は、データ可用性のために、トランザクションのバッチや状態差分を calldata として L1 に投稿します。\n- **証明システム**（SNARK、STARK）は、大きな証明や公開入力を提出します。\n- **不正証明やステートレス設計**は、ストレージを読む代わりに Merkle 証明をやり取りします。\n\n著者（StarkWare チームを含む）は、データが主に消費するのはネットワーク帯域とブロック伝播の時間であり、68 ガスはそのコストを過大に見積もっていると主張しました。EIP-2028 はこれを引き下げ、Istanbul アップグレードで導入されました。\n\n## 仕組み\n\n変更される定数は 1 つです。\n\n| バイト値 | 変更前 | 変更後 |\n| --- | --- | --- |\n| ゼロ（`0x00`） | 4 ガス | 4 ガス（変更なし） |\n| ゼロ以外 | 68 ガス | **16 ガス** |\n\nこれはトランザクションの固有ガス（intrinsic gas）の一部で、実行前に課金されます: `21000 + 4·zeroBytes + 16·nonZeroBytes`（該当する場合はコントラクト作成とアクセスリストのコストが加わります）。\n\n根拠には、ブロック伝播の遅延とセキュリティを結びつける Sompolinsky–Zohar と Pass–Seeman–Shelat のモデルが使われています。大きなブロックほど伝播が遅く、正直なハッシュパワーがステイルブロックに無駄に消費され、攻撃のコストが下がります。この提案は遅延を伝送部分と処理部分に分け、calldata が主に増やすのは伝送遅延であり、ネットワークは 1 バイトあたり 16 ガスならそれを吸収できると論じています。\n\n## サンプルコード\n\n固有ガスのうち calldata 部分を計算する例（TypeScript、ethers v6）:\n\n```ts\nimport { getBytes, Interface, parseEther } from \"ethers\";\n\nfunction calldataGas(data: string): number {\n  let gas = 0;\n  for (const b of getBytes(data)) gas += b === 0 ? 4 : 16; // post-EIP-2028 prices\n  return gas;\n}\n\n// transfer(address,uint256) has many zero bytes from ABI padding\nconst erc20 = new Interface([\"function transfer(address to, uint256 value)\"]);\nconst data = erc20.encodeFunctionData(\"transfer\", [\n  \"0x000000000000000000000000000000000000dEaD\",\n  parseEther(\"1\"),\n]);\n\nconsole.log(21_000 + calldataGas(data)); // intrinsic gas for this simple call\n```\n\n## 知っておくべきこと\n\n- ゼロのバイトは依然として安いので、ゼロ以外のパディングを避ける（またはゼロの多いレイアウトを使う）コンパクトなエンコーディングはガスを節約できます。\n- calldata が安くなったことは、データ可用性に calldata を使っていた初期の Optimistic ロールアップや ZK ロールアップを大きく後押ししました。\n- ロールアップのデータはその後、独自の手数料市場を持つ blob へ [EIP-4844](/eip-4844/) で移行しました。\n- [EIP-7623](/eip-7623/) はその後、データを多く含むトランザクションに対してより高い下限価格を導入したため、calldata が非常に多いトランザクションは単純な 16 ガスのレートでは済まなくなりました。コストを見積もる際は、対象とするフォークのルールを確認してください。\n"},"ko":{"lang":"ko","tldr":"0이 아닌 calldata 바이트의 가스 비용을 68에서 16으로 낮춰, 롤업과 증명 시스템이 의존하는 온체인 데이터 게시를 훨씬 저렴하게 만든다.","tags":["gas","calldata","transactions","scaling","istanbul"],"related":[4844,7623,2718],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2028/","markdown":"## 어떤 문제를 해결하나요?\n\n트랜잭션 입력 데이터(calldata)는 바이트마다 가스가 듭니다. Frontier 이후 0이 아닌 바이트는 68 가스(`GTXDATANONZERO`), 0인 바이트는 4 가스였습니다. 이 가격은 보수적으로 정해져 있어 데이터를 많이 쓰는 용도의 비용이 높았습니다.\n\n- **레이어 2 롤업**은 데이터 가용성을 위해 트랜잭션 배치나 상태 차이를 calldata로 L1에 게시합니다.\n- **증명 시스템**(SNARK, STARK)은 큰 증명과 공개 입력을 제출합니다.\n- **사기 증명과 스테이트리스 설계**는 스토리지를 읽는 대신 Merkle 증명을 주고받습니다.\n\n저자들(StarkWare 팀 포함)은 데이터가 주로 소모하는 것은 네트워크 대역폭과 블록 전파 시간이며, 68 가스는 이 비용을 과대평가한다고 주장했습니다. EIP-2028은 이를 낮췄고 Istanbul 업그레이드에 포함되었습니다.\n\n## 어떻게 동작하나요?\n\n상수 하나가 바뀝니다.\n\n| 바이트 값 | 이전 | 이후 |\n| --- | --- | --- |\n| 0(`0x00`) | 4 가스 | 4 가스(변경 없음) |\n| 0이 아님 | 68 가스 | **16 가스** |\n\n이는 트랜잭션 고유 가스(intrinsic gas)의 일부이며 실행 전에 부과됩니다. `21000 + 4·zeroBytes + 16·nonZeroBytes`(해당하는 경우 컨트랙트 생성과 액세스 리스트 비용이 추가됩니다).\n\n근거에는 블록 전파 지연과 보안을 연결하는 Sompolinsky–Zohar 및 Pass–Seeman–Shelat의 모델이 쓰였습니다. 블록이 클수록 전파가 느려져 정직한 해시 파워가 스테일 블록에 더 많이 낭비되고 공격 비용이 낮아집니다. 이 제안은 지연을 전송 부분과 처리 부분으로 나누고, calldata가 주로 늘리는 것은 전송 지연이며 바이트당 16 가스라면 네트워크가 이를 감당할 수 있다고 주장합니다.\n\n## 샘플 코드\n\n고유 가스 중 calldata 부분 계산(TypeScript, ethers v6):\n\n```ts\nimport { getBytes, Interface, parseEther } from \"ethers\";\n\nfunction calldataGas(data: string): number {\n  let gas = 0;\n  for (const b of getBytes(data)) gas += b === 0 ? 4 : 16; // post-EIP-2028 prices\n  return gas;\n}\n\n// transfer(address,uint256) has many zero bytes from ABI padding\nconst erc20 = new Interface([\"function transfer(address to, uint256 value)\"]);\nconst data = erc20.encodeFunctionData(\"transfer\", [\n  \"0x000000000000000000000000000000000000dEaD\",\n  parseEther(\"1\"),\n]);\n\nconsole.log(21_000 + calldataGas(data)); // intrinsic gas for this simple call\n```\n\n## 알아둘 점\n\n- 0 바이트는 여전히 더 저렴하므로, 0이 아닌 패딩을 피하는(또는 0이 많은 레이아웃을 쓰는) 간결한 인코딩은 가스를 절약합니다.\n- calldata가 저렴해진 것은 데이터 가용성에 calldata를 쓰던 초기 옵티미스틱 롤업과 ZK 롤업의 중요한 발판이 되었습니다.\n- 롤업 데이터는 이후 [EIP-4844](/eip-4844/)로 자체 수수료 시장을 가진 blob으로 옮겨 갔습니다.\n- [EIP-7623](/eip-7623/)은 이후 데이터가 많은 트랜잭션에 더 높은 하한 가격을 도입해, calldata가 매우 많은 트랜잭션은 더 이상 단순한 16 가스 요율만 내지 않습니다. 비용을 추정할 때는 대상 포크의 규칙을 확인하세요.\n"},"zh":{"lang":"zh","tldr":"将非零 calldata 字节的 gas 成本从 68 降到 16，使在链上发布数据便宜得多，而 rollup 和证明系统都依赖这一点。","tags":["gas","calldata","transactions","scaling","istanbul"],"related":[4844,7623,2718],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2028/","markdown":"## 它解决什么问题？\n\n交易输入数据（calldata）的每个字节都要消耗 gas。自 Frontier 以来，非零字节花费 68 gas（`GTXDATANONZERO`），零字节花费 4 gas。这个价格定得比较保守，使数据密集型的用途变得昂贵：\n\n- **Layer-2 rollup** 为了数据可用性，把交易批次或状态差异作为 calldata 发布到 L1。\n- **证明系统**（SNARK、STARK）需要提交大型证明和公开输入。\n- **欺诈证明和无状态设计**传递的是 Merkle 证明，而不是读取存储。\n\n作者（包括 StarkWare 团队）认为，数据消耗的主要是网络带宽和区块传播时间，而 68 gas 高估了这一成本。EIP-2028 降低了它，并随 Istanbul 升级上线。\n\n## 它如何运作\n\n只改变一个常量：\n\n| 字节值 | 之前 | 之后 |\n| --- | --- | --- |\n| 零（`0x00`） | 4 gas | 4 gas（不变） |\n| 非零 | 68 gas | **16 gas** |\n\n这是交易固有 gas（intrinsic gas）的一部分，在执行前收取：`21000 + 4·zeroBytes + 16·nonZeroBytes`（适用时再加上合约创建和访问列表的成本）。\n\n其依据是 Sompolinsky–Zohar 与 Pass–Seeman–Shelat 的模型，该模型把区块传播延迟与安全性联系起来：区块越大传播越慢，会让更多诚实算力浪费在过期区块上，从而降低攻击成本。该提案把延迟拆分为传输和处理两部分，并论证 calldata 主要增加的是传输延迟，在每字节 16 gas 的水平下网络可以承受。\n\n## 示例代码\n\n计算固有 gas 中 calldata 部分（TypeScript，ethers v6）：\n\n```ts\nimport { getBytes, Interface, parseEther } from \"ethers\";\n\nfunction calldataGas(data: string): number {\n  let gas = 0;\n  for (const b of getBytes(data)) gas += b === 0 ? 4 : 16; // post-EIP-2028 prices\n  return gas;\n}\n\n// transfer(address,uint256) has many zero bytes from ABI padding\nconst erc20 = new Interface([\"function transfer(address to, uint256 value)\"]);\nconst data = erc20.encodeFunctionData(\"transfer\", [\n  \"0x000000000000000000000000000000000000dEaD\",\n  parseEther(\"1\"),\n]);\n\nconsole.log(21_000 + calldataGas(data)); // intrinsic gas for this simple call\n```\n\n## 需要注意\n\n- 零字节仍然更便宜，因此避免非零填充（或采用零字节较多的布局）的紧凑编码可以节省 gas。\n- calldata 变便宜，是早期使用 calldata 保证数据可用性的 optimistic rollup 和 ZK rollup 的重要推动力。\n- rollup 数据后来通过 [EIP-4844](/eip-4844/) 转移到了拥有独立费用市场的 blob 上。\n- [EIP-7623](/eip-7623/) 后来为数据密集型交易引入了更高的下限价格，因此 calldata 非常多的交易不再只按简单的 16 gas 费率付费。估算成本时，请查看目标分叉的规则。\n"}},"requiredBy":[1679,3521,8131]}
