Stage: Idea, Prototype
eth_gasPrices
that returns prices for regular and blob gaseth_blobGasPrice
eth_feeHistory
to include blob related dataExecution client provides gas price prediction via eth_gasPrice
and fee history via eth_feeHistory
. Such information allows to create a transaction with real value for gas fee cap and tip, so it will be executed in adequate time for adequate price. Shard blob transactions EIP introduces another kind of gas - blob's, so users have to pay for it in addition to regular gas fees when posting blobs. It may be useful to have ability to retrieve potential blob gas price for the same purpose as it is for regular gas.
Before adding another endpoints or upgrading existing ones let's enumerate cons that would be cool to address.
Blob gas price calculation is trivial: to predict blob gas fee for the next blob we just need the values of the current block's header, specifically excess data gas and blob gas used;
The same is true for the regular gas, the oracle may also be based on non-trivial implementation that produces more efficient prediction, taking into account the transaction may be added to some block far ahead due to price hike.
Is there a real need? Blob transactions will be mostly sent by projects like L2s, not by end users. Execution client's oracle can be not so useful for such projects.
eth_blobGasPrice
blobGas = ceil(MIN_BLOB_GASPRICE * e**(excess_blob_gas / BLOB_GASPRICE_UPDATE_FRACTION))
Let's try to estimate blobGas needed to get into next 2 blocks.
Given:
excess_blob_gas
for the head blockblob_gas_used
for the previous N blocksto_be_sure_coef = 110 / 100
average_gas_used = 0
for i in range(head.number - N + 1, head.number + 1):
average_gas_used += blocks[i].blob_gas_used
average_gas_used = average_gas_used / N)
blobGas = ceil(MIN_BLOB_GASPRICE * e**((excess_blob_gas + average_gas_used) / BLOB_GASPRICE_UPDATE_FRACTION) * to_be_sure_coef)
The method is similar to eth_gasPrice
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_blobGasPrice"
}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x7"
}
eth_gasPrices
- a method similar to eth_gasPrice
, but with prices for multiple gas prices needed. Covered by batch requests.
Request
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_gasPrices"
}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"gas" : "0x7",
"blobGas" : "0x7",
"maxPriorityFee" : "0x2"
}
}
REST style
Request
GET /v1/eth/blob-price
Response
200 OK
0x7
eth_feeHistory
Let's add baseFeePerBlobGas
/blobGasUsedRatio
, that have 0
values for pre-Cancun blocks.
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_feeHistory",
"params": [2, "latest", [25, 75]]
}
Response
{
"id": "1",
"jsonrpc": "2.0",
"result": {
"oldestBlock": 42, // 0x2a?
"reward": [
[
"0x4a817c7ee",
"0x4a817c7ee"
], [
"0x773593f0",
"0x773593f5"
], [
"0x0",
"0x0"
], [
"0x773593f5",
"0x773bae75"
]
],
"baseFeePerGas": [
"0x10",
"0x12",
"0x10",
],
"baseFeePerBlobGas": [
"0x1",
"0x2",
"0x1",
],
"gasUsedRatio": [
0.0,
0.5,
0.25,
0.25
],
"blobGasUsedRatio": [
0.0,
0.5,
0.25,
0.25
]
}
}
Ping @__flcl
in the R&D discord in case of troubles
In Nethermind
Branch: https://github.com/NethermindEth/nethermind/tree/feature/blob-price
Image: nethermindeth/nethermind:blob-price
RPC:
curl:
curl --request POST --url http://139.177.181.61:8545 \
--header 'content-type: application/json' \
--data '{ "method": "eth_blobGasPrice", "id": 1, "jsonrpc": "2.0" }'
curl --request POST --url http://139.177.181.61:8545 \
--header 'content-type: application/json' \
--data '{ "method": "eth_feeHistory", "params": ["0x3", "latest", [0.5]], "id": 1, "jsonrpc": "2.0" }'
curl --request POST --url http://139.177.181.61:8545 \
--header 'content-type: application/json' \
--data '{ "method": "eth_gasPrices", "id": 1, "jsonrpc": "2.0" }'
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing