brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.89k stars 2.34k forks source link

Implement eth_feeHistory for gas fee estimation #17750

Closed bbondy closed 3 years ago

bbondy commented 3 years ago

https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json

Request the percentage of gas used for each block and extrapolate based on that.

curl -s https://mainnet.infura.io/v3/a9a11141e4e34d8fa95c5b5ddd37ea29 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_feeHistory","params":[1, "latest", [100]],"id":1}' | jq

The type of params is [int, string, int[]]

yrliou commented 3 years ago

We have decided to use etherscan API for EIP-1559 gas oracle so closing this one.