# Prediction API - Base Fee and Blob Fee

The Blocknative API provides real-time predictions for both the **base fee** and the **blob base fee** on the Ethereum network. These predictions assist users in setting optimal gas fees for transactions, ensuring timely confirmations without overpaying.

Predictions are made for the next 5 blocks at a 99% confidence level (highest inclusion guarantee at the expense of some overpayment) and 50% confidence level (likely inclusion with reduced overpayment).

## Authentication

Use of this endpoint requires an API key for proper authorization. Request an API key [here](https://www.blocknative.com/request-api-key).

## API Endpoint

<mark style="color:blue;">`GET`</mark> `https://api.blocknative.com/gasprices/basefee-estimates`

Returns a range of confidence intervals for gas prices needed to qualify a transaction for inclusion in the next block. Order of confidence intervals is subject to change.

## Fields

Each payload contains header fields followed by base fee predictions for the next 5 blocks after the current pending block.

### Header Fields

| Field Name         | Description                                                           |
| ------------------ | --------------------------------------------------------------------- |
| system             | Type of chain (EVM = “ethereum”)                                      |
| network            | Name of network (chain id 1 = “main”)                                 |
| unit               | Type of unit for fee values (currently all fee values are in gwei)    |
| currentBlockNumber | Block number at time of prediction                                    |
| msSinceLastBlock   | Time, in milliseconds, since last block (i.e. how far into slot time) |
| baseFeePerGas      | **Base fee** for current pending block                                |
| blobBaseFeePerGas  | **Blob base fee** for current pending block                           |
| estimatedBaseFees  | Future pending block estimates (see below)                            |

### Estimate Fields

| Field Name      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **pending+n**   | Future pending block for the estimate (current n = 1…5). This is the pending block after the current pending block. The base fee and blob base fee for the current pending block is already fixed and included in the header.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **confidence**  | Indicates how likely predictions are to being greater than or equal to the actual **base fee or blob base fee** for that future block number. For example the 99% confidence level attempts to make a prediction that is greater than or equal to the actual base fees 99% of the time, while minimizing the gap between the prediction and actual fee. And the 70% confidence level attempts to make a prediction that is greater than or equal to the actual base fees 70% of the time, while minimizing the gap between the prediction and actual fee. Therefore, the 99% confidence level will always make a prediction that is higher than the 70% confidence level in order to achieve its 99% confidence. |
| **baseFee**     | The estimated base fee at the specified confidence level for the specified future pending block.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **blobBaseFee** | The estimated blob base fee at the specified confidence level for the specified future pending block.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

### Example Request

{% code overflow="wrap" %}

```javascript
curl -H "X-Api-Key: <api-key>" "<https://api.blocknative.com/gasprices/basefee-estimates>"
```

{% endcode %}

### Example Response

The response payload contains the predictions for the **base fee** and **blob base fee** for the current pending block + X where X can be 1 through 5.

```json
{
    "system": "ethereum",
    "network": "main",
    "unit": "gwei",
    "currentBlockNumber": 19577777,
    "msSinceLastBlock": 6672,
    "baseFeePerGas": 31.004192998,
    "blobBaseFeePerGas": 0.028263001,
    "estimatedBaseFees": [
        {
            "pending+1": [
                {
                    "confidence": 99,
                    "baseFee": 34.75,
                    "blobBaseFee": 0.031795876
                },
                {
                    "confidence": 70,
                    "baseFee": 30.74,
                    "blobBaseFee": 0.031795876
                }
            ]
        },
        {
            "pending+2": [
                {
                    "confidence": 99,
                    "baseFee": 34.7,
                    "blobBaseFee": 0.035770362
                },
                {
                    "confidence": 70,
                    "baseFee": 30.36,
                    "blobBaseFee": 0.035770362
                }
            ]
        },
        {
            "pending+3": [
                {
                    "confidence": 99,
                    "baseFee": 35.28,
                    "blobBaseFee": 0.040241657
                },
                {
                    "confidence": 70,
                    "baseFee": 30.35,
                    "blobBaseFee": 0.040241657
                }
            ]
        },
        {
            "pending+4": [
                {
                    "confidence": 99,
                    "baseFee": 36.25,
                    "blobBaseFee": 0.045271865
                },
                {
                    "confidence": 70,
                    "baseFee": 30.55,
                    "blobBaseFee": 0.045271865
                }
            ]
        },
        {
            "pending+5": [
                {
                    "confidence": 99,
                    "baseFee": 37.09,
                    "blobBaseFee": 0.050930849
                },
                {
                    "confidence": 70,
                    "baseFee": 30.48,
                    "blobBaseFee": 0.050930849
                }
            ]
        }
    ]
}
```

## Questions

If you have any questions, please [reach out to Blocknative](https://www.blocknative.com/contact-us-l2-l1).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blocknative.com/gas-prediction/prediction-api-base-fee-and-blob-fee.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
