erigontech / erigon

Ethereum implementation on the efficiency frontier https://erigon.gitbook.io
GNU Lesser General Public License v3.0
3.14k stars 1.12k forks source link

Implement eth_feeHistory API #2309

Closed perama-v closed 3 years ago

perama-v commented 3 years ago

Rationale

Why should this feature exist?

The eth_feeHistory API was recently introduced in the JSON-RPC spec as a counterpart to EIP1559, which is currently live on Ropsten & Goerli and is scheduled for mainnet at block 12965000.

The API exposes information that is useful for setting parameters for the new transaction fee mechanism. One main rationale for EIP1559 is to improve the transaction-sending user experience. Wallet designers seeking to implement a change to deliver the improved user experience will need to have access to that information.

Together, a wallet and user must select two parameters, maxPriorityFeePerGas and maxFeePerGas. If the API was implemented on Erigon it would allow for rational selection of those two parameters using an Erigon node. Otherwise, another source of information might be needed.

This API might remove the need for third party gas price oracles, increasing users autonomy and rewarding those who run an Erigon node.

What are the use-cases?

A range of wallet-related resources are here. I also made some notes on what the API could enable for a wallet UI here.

Implementation

I am making this issue primarily to raise awareness about the API and the ecosystem it might support. While not strictly required before the Mainnet hard fork, there might be a dependency graph:

  1. Erigon API implementation.
  2. Erigon-based wallets/services implement change using JSON-RPC API.
  3. Services that want to deliver UI improvement can implement on Ropsten/Goerli and test.
  4. Mainnet forks and end-user wallets/services transition cleanly.

I will not be implementing the API, but hope to instead be useful in the process if I can.

API notes

Here is a digest that I have made using the JSON-RPC spec, which outlines the key components used in the API POST method.

0xjanitor commented 3 years ago

The latest release of Besu includes this btw

AskAlexSharov commented 3 years ago

@banteg, yep, need somebody who will implement it (probably copy-paste from geth is enough).

AskAlexSharov commented 3 years ago

https://github.com/ledgerwatch/erigon/pull/2501

sambacha commented 3 years ago

This can be closed, correct?

AskAlexSharov commented 3 years ago

Yep