forked from DecentralizedClimateFoundation/DCIPs
95 lines
3.7 KiB
Markdown
95 lines
3.7 KiB
Markdown
---
|
|
eip: 3045
|
|
title: Adds `baseFee` to `eth_getUncleByBlockHashAndIndex`
|
|
author: Abdelhamid Bakhta (@abdelhamidbakhta)
|
|
discussions-to: https://ethereum-magicians.org/t/add-basefee-to-eth-getunclebyblockhashandindex/4829
|
|
status: Stagnant
|
|
type: Standards Track
|
|
category: Interface
|
|
created: 2020-10-14
|
|
requires: 1474, 1559
|
|
---
|
|
|
|
## Simple Summary
|
|
Add basefee field to `eth_getUncleByBlockHashAndIndex` RPC endpoint response.
|
|
|
|
## Abstract
|
|
Adds `baseFee` property to the `eth_getUncleByBlockHashAndIndex` JSON-RPC request `result` object. This property will contain the value of the base fee for any block after the EIP-1559 fork.
|
|
|
|
## Motivation
|
|
[EIP-1559](./eip-1559.md) introduces a base fee per gas in protocol.
|
|
This value is maintained under consensus as a new field in the block header structure.
|
|
Users may need value of the base fee at a given block. Base fee value is important to make gas price predictions more accurate.
|
|
|
|
## Specification
|
|
|
|
### `eth_getUncleByBlockHashAndIndex`
|
|
|
|
#### Description
|
|
|
|
Returns information about an uncle specified by block hash and uncle index position
|
|
Every block returned by this endpoint whose block number is before the [EIP-1559](./eip-1559.md) fork block **MUST NOT** include a `baseFee` field.
|
|
Every block returned by this endpoint whose block number is on or after the [EIP-1559](./eip-1559.md) fork block **MUST** include a `baseFee` field.
|
|
|
|
#### Parameters
|
|
|
|
Parameters remain unchanged.
|
|
|
|
#### Returns
|
|
For the full specification of `eth_getUncleByBlockHashAndIndex` see [EIP-1474](./eip-1474.md).
|
|
Add a new JSON field to the `result` object for block headers containing a base fee (post [EIP-1559](./eip-1559.md) fork block).
|
|
|
|
- {[`Quantity`](./eip-1474.md#quantity)} `baseFee` - base fee for this block
|
|
|
|
#### Example
|
|
|
|
```sh
|
|
# Request
|
|
curl -X POST --data '{
|
|
"id": 1559,
|
|
"jsonrpc": "2.0",
|
|
"method": "eth_getUncleByBlockHashAndIndex",
|
|
"params":["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x0"]
|
|
}' <url>
|
|
|
|
# Response
|
|
{
|
|
"id": 1559,
|
|
"jsonrpc": "2.0",
|
|
"result": {
|
|
"difficulty": "0x027f07",
|
|
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
"baseFee": "0x7"
|
|
"gasLimit": "0x9f759",
|
|
"gasUsed": "0x9f759",
|
|
"hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
|
|
"logsBloom": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
|
|
"miner": "0x4e65fda2159562a496f9f3522f89122a3088497a",
|
|
"nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2",
|
|
"number": "0x1b4",
|
|
"parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5",
|
|
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
|
"size": "0x027f07",
|
|
"stateRoot": "0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff",
|
|
"timestamp": "0x54e34e8e"
|
|
"totalDifficulty": "0x027f07",
|
|
"transactions": []
|
|
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
|
"uncles": []
|
|
}
|
|
}
|
|
```
|
|
|
|
## Rationale
|
|
The addition of a single parameter instead of introducing a whole new endpoint was the simplest change that would be easiest to get integrated.
|
|
For backward compatibility we decided to not include the base fee in the response for pre-1559 blocks.
|
|
|
|
## Backwards Compatibility
|
|
Backwards compatible. Calls related to block prior to [EIP-1559](./eip-1559.md) fork block will omit the base fee field in the response.
|
|
|
|
## Security Considerations
|
|
The added field (`baseFee`) is informational and does not introduce technical security issues.
|
|
|
|
## Copyright
|
|
Copyright and related rights waived via [CC0](../LICENSE.md).
|