{"eip":3041,"title":"Adds `baseFee` to `eth_getBlockByHash`","description":"Add basefee field to ethgetBlockByHash RPC endpoint response.","authors":["Abdelhamid Bakhta (@abdelhamidbakhta)"],"status":"Stagnant","type":"Standards Track","category":"Interface","created":"2020-10-13","requires":[1474,1559],"discussionsTo":"https://ethereum-magicians.org/t/eip-3041-add-basefee-in-eth-getblockbyhash-response/4825","repo":"EIPs","label":"EIP-3041","officialUrl":"https://eips.ethereum.org/EIPS/eip-3041","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3041.md","url":"https://eips.huatuo.xyz/eip-3041/","tldr":{"en":"Proposed adding the EIP-1559 base fee to the block object returned by the eth_getBlockByHash JSON-RPC method, so tools can read the base fee of any post-London block.","ja":"EIP-1559 の base fee を eth_getBlockByHash JSON-RPC メソッドが返すブロックオブジェクトに追加し、ツールが London 以降の任意のブロックの base fee を読めるようにすることを提案した。","ko":"EIP-1559의 base fee를 eth_getBlockByHash JSON-RPC 메서드가 반환하는 블록 객체에 추가해, 도구가 London 이후 모든 블록의 base fee를 읽을 수 있게 하자고 제안했다.","zh":"提议把 EIP-1559 的 base fee 加入 eth_getBlockByHash JSON-RPC 方法返回的区块对象，使工具可以读取任何 London 之后区块的 base fee。"},"tags":["json-rpc","base-fee","interface","gas","1559"],"explainers":{"en":{"lang":"en","tldr":"Proposed adding the EIP-1559 base fee to the block object returned by the eth_getBlockByHash JSON-RPC method, so tools can read the base fee of any post-London block.","tags":["json-rpc","base-fee","interface","gas","1559"],"related":[1559,1474,3198],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3041/","markdown":"## What problem does it solve?\n\n[EIP-1559](/eip-1559/) added a protocol-level base fee per gas to every block header. Wallets, fee estimators and analytics tools need that value to predict fees and explain what users paid. Before London, the standard JSON-RPC block object had no field for it.\n\nEIP-3041 proposed the smallest possible change: add one field to the existing `eth_getBlockByHash` response rather than inventing a new endpoint.\n\n## How it works\n\n- Parameters of `eth_getBlockByHash` are unchanged: the block hash and a boolean for full transaction objects.\n- For blocks **on or after** the EIP-1559 fork, the `result` object **must** include a `baseFee` field, encoded as a hex `Quantity` (see [EIP-1474](/eip-1474/)).\n- For blocks **before** the fork, the field **must not** be present. This keeps the response identical to the old format for historical blocks, so existing parsers do not break.\n- The field is informational only and has no security implications.\n\n## Sample code\n\nRequest:\n\n```sh\ncurl -s -X POST -H 'Content-Type: application/json' --data '{\n  \"jsonrpc\": \"2.0\", \"id\": 1,\n  \"method\": \"eth_getBlockByHash\",\n  \"params\": [\"0x\u003cblock hash\u003e\", false]\n}' \"$RPC_URL\"\n```\n\nResponse as proposed (abridged):\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"result\": {\n    \"number\": \"0x1b4\",\n    \"hash\": \"0x...\",\n    \"gasLimit\": \"0x9f759\",\n    \"gasUsed\": \"0x9f759\",\n    \"baseFee\": \"0x7\"\n  }\n}\n```\n\nWhat clients actually return today, read via ethers v6:\n\n```ts\nimport { JsonRpcProvider, formatUnits } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst block = await provider.getBlock(blockHash);\nconsole.log(formatUnits(block!.baseFeePerGas ?? 0n, \"gwei\")); // null for pre-London blocks\n```\n\n## Things to know\n\n- **Status: Stagnant.** The idea shipped, but not under this name: Ethereum clients expose the value as **`baseFeePerGas`** on the block object returned by `eth_getBlockByHash` and `eth_getBlockByNumber`, following the field name in the EIP-1559 header. Do not look for `baseFee`.\n- Pre-London blocks have no base fee; libraries such as ethers return `null` for those.\n- Inside contracts, the current block's base fee is available as `block.basefee` via the `BASEFEE` opcode from [EIP-3198](/eip-3198/).\n- For fee history over a range of blocks, the `eth_feeHistory` method is usually more convenient than fetching blocks one by one.\n"},"ja":{"lang":"ja","tldr":"EIP-1559 の base fee を eth_getBlockByHash JSON-RPC メソッドが返すブロックオブジェクトに追加し、ツールが London 以降の任意のブロックの base fee を読めるようにすることを提案した。","tags":["json-rpc","base-fee","interface","gas","1559"],"related":[1559,1474,3198],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3041/","markdown":"## 何を解決するのか\n\n[EIP-1559](/eip-1559/) は、すべてのブロックヘッダーにガスあたりのプロトコルレベルの base fee を追加しました。ウォレット、手数料の見積もりツール、分析ツールは、手数料を予測したりユーザーが支払った額を説明したりするために、この値を必要とします。London 以前は、標準の JSON-RPC ブロックオブジェクトにそのためのフィールドがありませんでした。\n\nEIP-3041 は可能な限り小さな変更を提案しました。新しいエンドポイントを作るのではなく、既存の `eth_getBlockByHash` のレスポンスにフィールドを 1 つ追加するというものです。\n\n## 仕組み\n\n- `eth_getBlockByHash` のパラメーターは変わりません。ブロックハッシュと、完全なトランザクションオブジェクトを返すかどうかの真偽値です。\n- EIP-1559 フォーク**以降**のブロックでは、`result` オブジェクトに `baseFee` フィールドを**含めなければなりません**。16 進の `Quantity` としてエンコードします（[EIP-1474](/eip-1474/) を参照）。\n- フォーク**以前**のブロックでは、このフィールドを**含めてはなりません**。これにより、過去のブロックのレスポンスは旧形式と同一に保たれ、既存のパーサーが壊れません。\n- このフィールドは情報提供のみを目的としており、セキュリティ上の影響はありません。\n\n## サンプルコード\n\nリクエスト:\n\n```sh\ncurl -s -X POST -H 'Content-Type: application/json' --data '{\n  \"jsonrpc\": \"2.0\", \"id\": 1,\n  \"method\": \"eth_getBlockByHash\",\n  \"params\": [\"0x\u003cblock hash\u003e\", false]\n}' \"$RPC_URL\"\n```\n\n提案されたレスポンス（抜粋）:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"result\": {\n    \"number\": \"0x1b4\",\n    \"hash\": \"0x...\",\n    \"gasLimit\": \"0x9f759\",\n    \"gasUsed\": \"0x9f759\",\n    \"baseFee\": \"0x7\"\n  }\n}\n```\n\n現在クライアントが実際に返す値を、ethers v6 で読む例:\n\n```ts\nimport { JsonRpcProvider, formatUnits } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst block = await provider.getBlock(blockHash);\nconsole.log(formatUnits(block!.baseFeePerGas ?? 0n, \"gwei\")); // null for pre-London blocks\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** アイデア自体は実現しましたが、この名前ではありません。Ethereum クライアントは、EIP-1559 のヘッダーのフィールド名に従い、`eth_getBlockByHash` と `eth_getBlockByNumber` が返すブロックオブジェクトでこの値を **`baseFeePerGas`** として公開しています。`baseFee` を探さないでください。\n- London 以前のブロックには base fee がありません。ethers などのライブラリは、それらに対して `null` を返します。\n- コントラクト内では、現在のブロックの base fee は [EIP-3198](/eip-3198/) の `BASEFEE` opcode により `block.basefee` として利用できます。\n- ブロックの範囲にわたる手数料の履歴を得るには、ブロックを 1 つずつ取得するより `eth_feeHistory` メソッドのほうが通常は便利です。\n"},"ko":{"lang":"ko","tldr":"EIP-1559의 base fee를 eth_getBlockByHash JSON-RPC 메서드가 반환하는 블록 객체에 추가해, 도구가 London 이후 모든 블록의 base fee를 읽을 수 있게 하자고 제안했다.","tags":["json-rpc","base-fee","interface","gas","1559"],"related":[1559,1474,3198],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3041/","markdown":"## 어떤 문제를 해결하나요?\n\n[EIP-1559](/eip-1559/)는 모든 블록 헤더에 프로토콜 수준의 가스당 base fee를 추가했습니다. 지갑, 수수료 추정기, 분석 도구는 수수료를 예측하고 사용자가 무엇을 냈는지 설명하기 위해 이 값이 필요합니다. London 이전에는 표준 JSON-RPC 블록 객체에 이를 위한 필드가 없었습니다.\n\nEIP-3041은 가능한 한 가장 작은 변경을 제안했습니다. 새 엔드포인트를 만드는 대신 기존 `eth_getBlockByHash` 응답에 필드 하나를 추가하는 것입니다.\n\n## 어떻게 동작하나요?\n\n- `eth_getBlockByHash`의 파라미터는 그대로입니다. 블록 해시와, 전체 트랜잭션 객체를 받을지 나타내는 불리언입니다.\n- EIP-1559 포크 **이후**의 블록에서는 `result` 객체에 `baseFee` 필드를 **반드시 포함해야** 하며, 16진수 `Quantity`로 인코딩합니다([EIP-1474](/eip-1474/) 참고).\n- 포크 **이전**의 블록에서는 이 필드가 **있어서는 안 됩니다**. 이렇게 하면 과거 블록의 응답이 예전 형식과 동일하게 유지되어 기존 파서가 깨지지 않습니다.\n- 이 필드는 정보 제공용일 뿐이며 보안상 영향이 없습니다.\n\n## 샘플 코드\n\n요청:\n\n```sh\ncurl -s -X POST -H 'Content-Type: application/json' --data '{\n  \"jsonrpc\": \"2.0\", \"id\": 1,\n  \"method\": \"eth_getBlockByHash\",\n  \"params\": [\"0x\u003cblock hash\u003e\", false]\n}' \"$RPC_URL\"\n```\n\n제안된 응답(일부 생략):\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"result\": {\n    \"number\": \"0x1b4\",\n    \"hash\": \"0x...\",\n    \"gasLimit\": \"0x9f759\",\n    \"gasUsed\": \"0x9f759\",\n    \"baseFee\": \"0x7\"\n  }\n}\n```\n\n오늘날 클라이언트가 실제로 반환하는 값을 ethers v6로 읽기:\n\n```ts\nimport { JsonRpcProvider, formatUnits } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst block = await provider.getBlock(blockHash);\nconsole.log(formatUnits(block!.baseFeePerGas ?? 0n, \"gwei\")); // null for pre-London blocks\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 아이디어는 반영되었지만 이 이름으로는 아닙니다. 이더리움 클라이언트는 EIP-1559 헤더의 필드 이름을 따라 `eth_getBlockByHash`와 `eth_getBlockByNumber`가 반환하는 블록 객체에서 이 값을 **`baseFeePerGas`**로 노출합니다. `baseFee`를 찾지 마세요.\n- London 이전 블록에는 base fee가 없으며, ethers 같은 라이브러리는 이런 블록에 `null`을 반환합니다.\n- 컨트랙트 안에서는 현재 블록의 base fee를 [EIP-3198](/eip-3198/)의 `BASEFEE` opcode를 통해 `block.basefee`로 사용할 수 있습니다.\n- 여러 블록에 걸친 수수료 이력이 필요하다면 블록을 하나씩 가져오는 것보다 `eth_feeHistory` 메서드가 보통 더 편리합니다.\n"},"zh":{"lang":"zh","tldr":"提议把 EIP-1559 的 base fee 加入 eth_getBlockByHash JSON-RPC 方法返回的区块对象，使工具可以读取任何 London 之后区块的 base fee。","tags":["json-rpc","base-fee","interface","gas","1559"],"related":[1559,1474,3198],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3041/","markdown":"## 它解决什么问题？\n\n[EIP-1559](/eip-1559/) 在每个区块头中加入了协议层面的每 gas base fee。钱包、手续费估算器和分析工具需要这个值来预测费用并解释用户支付了什么。在 London 之前，标准的 JSON-RPC 区块对象没有这个字段。\n\nEIP-3041 提出了尽可能小的改动：在现有的 `eth_getBlockByHash` 响应中增加一个字段，而不是发明一个新的端点。\n\n## 它如何运作\n\n- `eth_getBlockByHash` 的参数不变：区块哈希，以及一个表示是否返回完整交易对象的布尔值。\n- 对于 EIP-1559 分叉**当时及之后**的区块，`result` 对象**必须**包含 `baseFee` 字段，编码为十六进制 `Quantity`（见 [EIP-1474](/eip-1474/)）。\n- 对于分叉**之前**的区块，该字段**不得**出现。这使历史区块的响应与旧格式保持一致，因此现有解析器不会出问题。\n- 该字段仅供参考，不涉及安全影响。\n\n## 示例代码\n\n请求：\n\n```sh\ncurl -s -X POST -H 'Content-Type: application/json' --data '{\n  \"jsonrpc\": \"2.0\", \"id\": 1,\n  \"method\": \"eth_getBlockByHash\",\n  \"params\": [\"0x\u003cblock hash\u003e\", false]\n}' \"$RPC_URL\"\n```\n\n按提案设想的响应（节选）：\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"result\": {\n    \"number\": \"0x1b4\",\n    \"hash\": \"0x...\",\n    \"gasLimit\": \"0x9f759\",\n    \"gasUsed\": \"0x9f759\",\n    \"baseFee\": \"0x7\"\n  }\n}\n```\n\n客户端如今实际返回的内容，通过 ethers v6 读取：\n\n```ts\nimport { JsonRpcProvider, formatUnits } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst block = await provider.getBlock(blockHash);\nconsole.log(formatUnits(block!.baseFeePerGas ?? 0n, \"gwei\")); // null for pre-London blocks\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 这个想法落地了，但不是以这个名字：以太坊客户端遵循 EIP-1559 区块头中的字段名，在 `eth_getBlockByHash` 和 `eth_getBlockByNumber` 返回的区块对象上以 **`baseFeePerGas`** 暴露该值。不要去找 `baseFee`。\n- London 之前的区块没有 base fee；ethers 等库对这些区块返回 `null`。\n- 在合约内部，当前区块的 base fee 可通过 [EIP-3198](/eip-3198/) 的 `BASEFEE` opcode 以 `block.basefee` 的形式获得。\n- 要获取一段区块范围内的费用历史，`eth_feeHistory` 方法通常比逐个获取区块更方便。\n"}}}
