{"eip":7516,"title":"BLOBBASEFEE instruction","description":"Instruction that returns the current data-blob base-fee","authors":["Carl Beekhuizen (@carlbeek)"],"status":"Final","type":"Standards Track","category":"Core","created":"2023-09-11","requires":[3198,4844],"discussionsTo":"https://ethereum-magicians.org/t/eip-7516-blobbasefee-opcode/15761","repo":"EIPs","label":"EIP-7516","officialUrl":"https://eips.ethereum.org/EIPS/eip-7516","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7516.md","url":"https://eips.huatuo.xyz/eip-7516/","tldr":{"en":"Adds the BLOBBASEFEE opcode (0x4a), which lets a contract read the current blob base fee from EIP-4844, just as BASEFEE exposes the normal base fee.","ja":"BLOBBASEFEE opcode（0x4a）を追加する。BASEFEE が通常の base fee を公開するのと同じように、コントラクトが EIP-4844 の現在の blob base fee を読み取れる。","ko":"BLOBBASEFEE opcode(0x4a)를 추가한다. BASEFEE가 일반 base fee를 노출하는 것처럼, 컨트랙트가 EIP-4844의 현재 blob base fee를 읽을 수 있게 한다.","zh":"新增 BLOBBASEFEE opcode（0x4a），让合约可以读取 EIP-4844 中当前的 blob base fee，就像 BASEFEE 公开普通 base fee 一样。"},"tags":["opcode","evm","blobs","fees","cancun"],"explainers":{"en":{"lang":"en","tldr":"Adds the BLOBBASEFEE opcode (0x4a), which lets a contract read the current blob base fee from EIP-4844, just as BASEFEE exposes the normal base fee.","tags":["opcode","evm","blobs","fees","cancun"],"related":[4844,3198,1559],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7516/","markdown":"## What problem does it solve?\n\n[EIP-4844](/eip-4844/) introduced blob-carrying transactions with their own fee market: blob gas has a separate base fee that rises and falls with blob demand, independent of the regular [EIP-1559](/eip-1559/) base fee. Contracts could already read the regular base fee through `BASEFEE` ([EIP-3198](/eip-3198/)), but had no way to see the blob price.\n\nRollups pay for blob data and often want to account for or reimburse those costs on-chain. Without the price inside the EVM they had to trust an off-chain oracle or a relayer's word. EIP-7516 closes that gap, and also makes it possible to build things like blob-gas hedging or futures contracts on-chain.\n\n## How it works\n\n- New opcode `BLOBBASEFEE` at `0x4a`.\n- Takes no stack inputs and pushes one value: the blob base fee of the current block, in wei per unit of blob gas.\n- The value is exactly `get_blob_gasprice(header)` as defined in EIP-4844, computed from the block header's `excess_blob_gas`.\n- Gas cost is **2**, the same as `BASEFEE`, because the value is already known before execution starts and needs no state access.\n\nExample from the spec: if the blob base fee is 7 wei, the bytecode `0x4a00` (`BLOBBASEFEE`, `STOP`) leaves `7` on the stack and uses 2 gas.\n\nThe opcode shipped in the Cancun execution-layer upgrade (Dencun) together with EIP-4844.\n\n## Sample code\n\nSolidity exposes it as `block.blobbasefee` (compiler support added for the Cancun EVM target):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract BlobCostMeter {\n    uint256 constant GAS_PER_BLOB = 131072; // 2**17, from EIP-4844\n\n    /// Estimated cost in wei of posting `blobs` blobs in this block.\n    function blobCost(uint256 blobs) external view returns (uint256) {\n        return blobs * GAS_PER_BLOB * block.blobbasefee;\n    }\n\n    /// Same value via inline assembly.\n    function rawBlobBaseFee() external view returns (uint256 fee) {\n        assembly { fee := blobbasefee() }\n    }\n}\n```\n\nReading it off-chain with ethers v6, for comparison:\n\n```ts\nconst block = await provider.send(\"eth_getBlockByNumber\", [\"latest\", false]);\nconsole.log(\"excessBlobGas:\", BigInt(block.excessBlobGas));\n// The contract above returns the derived blob base fee directly.\n```\n\n## Things to know\n\n- Status: **Final**, live on mainnet since Cancun.\n- The value applies to the block being executed. In an `eth_call` against `latest`, clients evaluate it for a pending context, so results can differ from what a later transaction sees.\n- Compile with `evmVersion` set to `cancun` or later; on older chains or L2s that have not adopted Cancun, `0x4a` is an invalid opcode.\n- The blob base fee can be as low as 1 wei when blob demand is below target, and it can rise quickly when demand is sustained above target, so do not hard-code expectations.\n"},"ja":{"lang":"ja","tldr":"BLOBBASEFEE opcode（0x4a）を追加する。BASEFEE が通常の base fee を公開するのと同じように、コントラクトが EIP-4844 の現在の blob base fee を読み取れる。","tags":["opcode","evm","blobs","fees","cancun"],"related":[4844,3198,1559],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7516/","markdown":"## 何を解決するのか\n\n[EIP-4844](/eip-4844/) は、独自の手数料市場を持つ blob 搭載トランザクションを導入しました。blob gas には別の base fee があり、通常の [EIP-1559](/eip-1559/) の base fee とは独立して、blob の需要に応じて上下します。コントラクトは `BASEFEE`（[EIP-3198](/eip-3198/)）で通常の base fee を読み取れましたが、blob の価格を見る手段はありませんでした。\n\nロールアップは blob データの料金を支払っており、そのコストをオンチェーンで計上したり払い戻したりしたいことがよくあります。価格が EVM の中で見えないと、オフチェーンのオラクルやリレイヤーの言葉を信じるしかありませんでした。EIP-7516 はこのギャップを埋め、blob gas のヘッジや先物コントラクトのようなものをオンチェーンで構築することも可能にします。\n\n## 仕組み\n\n- 新しい opcode `BLOBBASEFEE` を `0x4a` に追加。\n- スタックからの入力はなく、値を 1 つプッシュします。現在のブロックの blob base fee で、blob gas 1 単位あたりの wei です。\n- 値は EIP-4844 で定義された `get_blob_gasprice(header)` そのもので、ブロックヘッダーの `excess_blob_gas` から計算されます。\n- gas コストは `BASEFEE` と同じ **2** です。値は実行開始前にすでにわかっており、ステートへのアクセスが不要だからです。\n\n仕様の例: blob base fee が 7 wei の場合、バイトコード `0x4a00`（`BLOBBASEFEE`、`STOP`）はスタックに `7` を残し、gas を 2 使います。\n\nこの opcode は、EIP-4844 とともに Cancun 実行レイヤーアップグレード（Dencun）で出荷されました。\n\n## サンプルコード\n\nSolidity では `block.blobbasefee` として公開されています（Cancun EVM ターゲット向けにコンパイラの対応が追加されました）。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract BlobCostMeter {\n    uint256 constant GAS_PER_BLOB = 131072; // 2**17, from EIP-4844\n\n    /// Estimated cost in wei of posting `blobs` blobs in this block.\n    function blobCost(uint256 blobs) external view returns (uint256) {\n        return blobs * GAS_PER_BLOB * block.blobbasefee;\n    }\n\n    /// Same value via inline assembly.\n    function rawBlobBaseFee() external view returns (uint256 fee) {\n        assembly { fee := blobbasefee() }\n    }\n}\n```\n\n比較のため、ethers v6 でオフチェーンから読み取る例:\n\n```ts\nconst block = await provider.send(\"eth_getBlockByNumber\", [\"latest\", false]);\nconsole.log(\"excessBlobGas:\", BigInt(block.excessBlobGas));\n// The contract above returns the derived blob base fee directly.\n```\n\n## 知っておくべきこと\n\n- ステータス: **Final**。Cancun 以降メインネットで稼働中です。\n- 値は実行中のブロックに適用されます。`latest` に対する `eth_call` では、クライアントはペンディングのコンテキストで評価するため、結果は後のトランザクションが見る値と異なることがあります。\n- `evmVersion` を `cancun` 以降に設定してコンパイルしてください。Cancun を採用していない古いチェーンや L2 では、`0x4a` は無効な opcode です。\n- blob の需要がターゲットを下回ると blob base fee は 1 wei まで下がることがあり、需要がターゲットを上回る状態が続くと急速に上昇することがあるため、期待値をハードコードしないでください。\n"},"ko":{"lang":"ko","tldr":"BLOBBASEFEE opcode(0x4a)를 추가한다. BASEFEE가 일반 base fee를 노출하는 것처럼, 컨트랙트가 EIP-4844의 현재 blob base fee를 읽을 수 있게 한다.","tags":["opcode","evm","blobs","fees","cancun"],"related":[4844,3198,1559],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7516/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-4844](/eip-4844/)는 자체 수수료 시장을 가진 blob 포함 트랜잭션을 도입했습니다. blob gas에는 별도의 base fee가 있어서, 일반 [EIP-1559](/eip-1559/) base fee와 무관하게 blob 수요에 따라 오르내립니다. 컨트랙트는 `BASEFEE`([EIP-3198](/eip-3198/))로 일반 base fee를 읽을 수 있었지만 blob 가격은 볼 방법이 없었습니다.\n\n롤업은 blob 데이터 비용을 지불하며, 그 비용을 온체인에서 계산하거나 환급하고 싶어 하는 경우가 많습니다. EVM 안에서 가격을 볼 수 없으면 오프체인 오라클이나 릴레이어의 말을 믿을 수밖에 없었습니다. EIP-7516은 이 공백을 메우며, blob gas 헤지나 선물 컨트랙트 같은 것을 온체인에서 만드는 것도 가능하게 합니다.\n\n## 어떻게 동작하나요?\n\n- 새 opcode `BLOBBASEFEE`가 `0x4a`에 추가됩니다.\n- 스택 입력이 없고 값 하나를 푸시합니다. 현재 블록의 blob base fee이며, blob gas 한 단위당 wei입니다.\n- 이 값은 EIP-4844에 정의된 `get_blob_gasprice(header)` 그대로이며, 블록 헤더의 `excess_blob_gas`로 계산됩니다.\n- gas 비용은 `BASEFEE`와 같은 **2**입니다. 값이 실행 시작 전에 이미 알려져 있고 상태 접근이 필요 없기 때문입니다.\n\n스펙의 예: blob base fee가 7 wei이면 바이트코드 `0x4a00`(`BLOBBASEFEE`, `STOP`)은 스택에 `7`을 남기고 2 gas를 사용합니다.\n\n이 opcode는 EIP-4844와 함께 Cancun 실행 레이어 업그레이드(Dencun)에 포함되어 출시되었습니다.\n\n## 샘플 코드\n\nSolidity에서는 `block.blobbasefee`로 제공됩니다(Cancun EVM 타깃에 대한 컴파일러 지원이 추가됨).\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract BlobCostMeter {\n    uint256 constant GAS_PER_BLOB = 131072; // 2**17, from EIP-4844\n\n    /// Estimated cost in wei of posting `blobs` blobs in this block.\n    function blobCost(uint256 blobs) external view returns (uint256) {\n        return blobs * GAS_PER_BLOB * block.blobbasefee;\n    }\n\n    /// Same value via inline assembly.\n    function rawBlobBaseFee() external view returns (uint256 fee) {\n        assembly { fee := blobbasefee() }\n    }\n}\n```\n\n비교를 위해 ethers v6로 오프체인에서 읽는 예:\n\n```ts\nconst block = await provider.send(\"eth_getBlockByNumber\", [\"latest\", false]);\nconsole.log(\"excessBlobGas:\", BigInt(block.excessBlobGas));\n// The contract above returns the derived blob base fee directly.\n```\n\n## 알아둘 점\n\n- 상태: **Final**. Cancun 이후 메인넷에서 사용 중입니다.\n- 이 값은 실행 중인 블록에 적용됩니다. `latest`를 대상으로 한 `eth_call`에서는 클라이언트가 펜딩 컨텍스트로 평가하므로, 결과가 이후 트랜잭션이 보는 값과 다를 수 있습니다.\n- `evmVersion`을 `cancun` 이상으로 설정해 컴파일하세요. Cancun을 채택하지 않은 오래된 체인이나 L2에서는 `0x4a`가 유효하지 않은 opcode입니다.\n- blob 수요가 목표보다 낮으면 blob base fee가 1 wei까지 내려갈 수 있고, 수요가 목표를 넘는 상태가 지속되면 빠르게 오를 수 있으므로 기대값을 하드코딩하지 마세요.\n"},"zh":{"lang":"zh","tldr":"新增 BLOBBASEFEE opcode（0x4a），让合约可以读取 EIP-4844 中当前的 blob base fee，就像 BASEFEE 公开普通 base fee 一样。","tags":["opcode","evm","blobs","fees","cancun"],"related":[4844,3198,1559],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7516/","markdown":"## 它解决什么问题？\n\n[EIP-4844](/eip-4844/) 引入了带有独立费用市场的携带 blob 的交易：blob gas 有单独的 base fee，会随 blob 需求而涨跌，与常规的 [EIP-1559](/eip-1559/) base fee 无关。合约原本就可以通过 `BASEFEE`（[EIP-3198](/eip-3198/)）读取常规 base fee，却没有办法看到 blob 的价格。\n\nRollup 要为 blob 数据付费，并且经常希望在链上核算或报销这些成本。如果 EVM 内部看不到这个价格，它们就只能信任链下预言机或中继者的一面之词。EIP-7516 填补了这个空白，也使得在链上构建 blob gas 对冲或期货合约之类的东西成为可能。\n\n## 它如何运作\n\n- 新 opcode `BLOBBASEFEE`，位于 `0x4a`。\n- 不需要栈输入，压入一个值：当前区块的 blob base fee，单位为每单位 blob gas 的 wei。\n- 该值正是 EIP-4844 中定义的 `get_blob_gasprice(header)`，由区块头的 `excess_blob_gas` 计算得出。\n- gas 成本为 **2**，与 `BASEFEE` 相同，因为该值在执行开始前就已知，不需要访问状态。\n\n规范中的例子：如果 blob base fee 是 7 wei，字节码 `0x4a00`（`BLOBBASEFEE`、`STOP`）会在栈上留下 `7`，并消耗 2 gas。\n\n这个 opcode 与 EIP-4844 一起随 Cancun 执行层升级（Dencun）上线。\n\n## 示例代码\n\nSolidity 把它暴露为 `block.blobbasefee`（编译器为 Cancun EVM 目标增加了支持）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\ncontract BlobCostMeter {\n    uint256 constant GAS_PER_BLOB = 131072; // 2**17, from EIP-4844\n\n    /// Estimated cost in wei of posting `blobs` blobs in this block.\n    function blobCost(uint256 blobs) external view returns (uint256) {\n        return blobs * GAS_PER_BLOB * block.blobbasefee;\n    }\n\n    /// Same value via inline assembly.\n    function rawBlobBaseFee() external view returns (uint256 fee) {\n        assembly { fee := blobbasefee() }\n    }\n}\n```\n\n作为对照，用 ethers v6 在链下读取：\n\n```ts\nconst block = await provider.send(\"eth_getBlockByNumber\", [\"latest\", false]);\nconsole.log(\"excessBlobGas:\", BigInt(block.excessBlobGas));\n// The contract above returns the derived blob base fee directly.\n```\n\n## 需要注意\n\n- 状态：**Final**，自 Cancun 起已在主网上线。\n- 该值适用于正在执行的区块。对 `latest` 发起的 `eth_call` 中，客户端会按待处理上下文来计算，因此结果可能与之后的交易所看到的不同。\n- 编译时请把 `evmVersion` 设为 `cancun` 或更高；在尚未采用 Cancun 的旧链或 L2 上，`0x4a` 是无效 opcode。\n- 当 blob 需求低于目标时，blob base fee 可以低至 1 wei；当需求持续高于目标时，它可能快速上升，所以不要硬编码预期值。\n"}},"requiredBy":[7569,7999]}
