Add basefee field to eth_getBlockByNumber RPC endpoint response.
Abstract
Adds baseFee property to the eth_getBlockByNumber 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 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_getBlockByNumber
Description
Returns information about a block specified by number.
Every block returned by this endpoint whose block number is before the EIP-1559 fork block MUST NOT include a baseFee field.
Every block returned by this endpoint whose block number is on or after the EIP-1559 fork block MUST include a baseFee field.
Parameters
Parameters remain unchanged.
Returns
For the full specification of eth_getBlockByNumber see EIP-1474.
Add a new JSON field to the result object for block headers containing a base fee (post EIP-1559 fork block).
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 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.