# Gas Price API

The Gas Price API gives you the gas price needed to have a certain probability to qualify for inclusion in the next block (for Ethereum or Bitcoin) or the next ∼10 seconds, depending on the chain. Need a high probability of being confirmed at the expense of spending extra gas? Use the 99% probability prediction. Don't mind if the transaction takes longer to confirm? Use the 50% probability prediction.

## Gas Platform currently supports the following networks

Click on any `chainID` in the table below to access the corresponding API.

{% hint style="success" %}
**43 chains** currently supported.
{% endhint %}

<table><thead><tr><th width="226">Name</th><th width="132">Network</th><th width="160">Chain ID</th><th data-hidden>Unit</th></tr></thead><tbody><tr><td>Arbitrum One</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=42161">42161</a></td><td>gwei</td></tr><tr><td>Avalanche</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=43114">43114</a></td><td></td></tr><tr><td>Base</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=8453">8453</a></td><td>gwei</td></tr><tr><td>Berachain</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=80094">80094</a></td><td></td></tr><tr><td>Bitcoin</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=0">0</a></td><td></td></tr><tr><td>Blast</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=81457">81457</a></td><td></td></tr><tr><td>Bob</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=60808">60808</a></td><td></td></tr><tr><td>BSC (BNB Smart Chain)</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=56">56</a></td><td></td></tr><tr><td>Chiliz</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=88888">88888</a></td><td></td></tr><tr><td>Cronos</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=25">25</a></td><td></td></tr><tr><td>Ethereum</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1">1</a></td><td>gwei</td></tr><tr><td>Fraxtal</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=252">252</a></td><td></td></tr><tr><td>Gnosis</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=100">100</a></td><td></td></tr><tr><td>HyperEVM</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=999">999</a></td><td></td></tr><tr><td>Immutable zkEVM</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=13371">13371</a></td><td></td></tr><tr><td>Ink</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=57073">57073</a></td><td></td></tr><tr><td>Lens</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=232">232</a></td><td></td></tr><tr><td>Linea</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=59144">59144</a></td><td></td></tr><tr><td>Lisk</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1135">1135</a></td><td></td></tr><tr><td>Mantle</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=5000">5000</a></td><td></td></tr><tr><td>Metis</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1088">1088</a></td><td></td></tr><tr><td>Mode</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=34443">34443</a></td><td></td></tr><tr><td>Moonbeam</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1284">1284</a></td><td></td></tr><tr><td>opBNB</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=204">204</a></td><td></td></tr><tr><td>Optimism</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=10">10</a></td><td>gwei</td></tr><tr><td>Palm</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=11297108109">11297108109</a></td><td></td></tr><tr><td>Polygon</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=137">137</a></td><td>gwei</td></tr><tr><td>Polygon zkEVM</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1101">1101</a></td><td></td></tr><tr><td>Ronin</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=2020">2020</a></td><td></td></tr><tr><td>Rootstock</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=30">30</a></td><td></td></tr><tr><td>Scroll</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=534352">534352</a></td><td></td></tr><tr><td>SEI</td><td>pacific-1</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1329">1329</a></td><td>gwei/gsei</td></tr><tr><td>Snax Chain</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=2192">2192</a></td><td></td></tr><tr><td>Soneium</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1868">1868</a></td><td></td></tr><tr><td>Sonic</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=146">146</a></td><td></td></tr><tr><td>Story</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1514">1514</a></td><td></td></tr><tr><td>Swell</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=1923">1923</a></td><td></td></tr><tr><td>Taiko</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=167000">167000</a></td><td></td></tr><tr><td>Unichain</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=130">130</a></td><td></td></tr><tr><td>World Chain</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=480">480</a></td><td></td></tr><tr><td>ZetaChain</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=7000">7000</a></td><td></td></tr><tr><td>Zircuit</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=48900">48900</a></td><td></td></tr><tr><td>ZKsync</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=324">324</a></td><td></td></tr><tr><td>Zora</td><td>main</td><td><a href="https://api.blocknative.com/gasprices/blockprices?chainid=7777777">7777777</a></td><td></td></tr></tbody></table>

You can view [an introductory video on Gas Platform here](https://youtu.be/_Szpb1GTQ6k).

{% hint style="info" %}
Looking for a network that's not currently supported? Let us know by using our contact form [here](https://www.blocknative.com/contact-us).
{% endhint %}

## Authentication

A valid Blocknative API key is OPTIONAL in the `Authorization` Header of every request. Request an API key [here](https://www.blocknative.com/request-api-key).

A free API key is recommended for more generous rate limits and future features.

## API Endpoint

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

Returns a range of confidence intervals for gas prices needed to qualify a transaction for inclusion in the next block or next ∼10 seconds, depending on the chain. The order of confidence intervals is subject to change.

## Rate Limits

Each endpoint is limited to provide updated results once per second for paid tier API keys, or every 5 seconds for free tier API keys. Polling faster than these rates may deliver stale data.

## Request

### Example request&#x20;

*This will provide Ethereum Mainnet estimates across all confidence levels by **default**.*

{% code overflow="wrap" %}

```
curl -H 'Authorization: optional-apikey-here' 'https://api.blocknative.com/gasprices/blockprices'
```

{% endcode %}

Or without the optional apikey

{% code overflow="wrap" %}

```
curl 'https://api.blocknative.com/gasprices/blockprices'
```

{% endcode %}

### Example using `ChainID`

<pre><code><strong>curl 'https://api.blocknative.com/gasprices/blockprices?chainid=1514'
</strong></code></pre>

### Example using `System` and `Network` parameters

*To know which parameters to use, refer to the list under* [*`/chains`*](https://api.blocknative.com/chains)*.*

{% code overflow="wrap" %}

```
curl 'https://api.blocknative.com/gasprices/blockprices?system=story&network=mainnet'
```

{% endcode %}

### Example  using custom `confidence` level request

{% code overflow="wrap" %}

```
curl -H 'Authorization: optional-apikey-here' 'https://api.blocknative.com/gasprices/blockprices?chainid=1&confidenceLevels=50&confidenceLevels=70&confidenceLevels=80&confidenceLevels=90&confidenceLevels=99'
```

{% endcode %}

An alternative format for confidence levels is

{% code overflow="wrap" %}

```
curl -H 'Authorization: optional-apikey-here' 'https://api.blocknative.com/gasprices/blockprices?chainid=1&confidenceLevels=50,70,80,90,99'
```

{% endcode %}

### Example Response Payload

```json
{
  "system": "ethereum",
  "network": "main",
  "unit": "gwei",
  "maxPrice": 25,
  "currentBlockNumber": 19420156,
  "msSinceLastBlock": 8303,
  "blockPrices": [
    {
      "blockNumber": 19420156,
      "estimatedTransactionCount": 58,
      "baseFeePerGas": 20.118985095,
      "blobBaseFeePerGas": 1e-9,
      "estimatedPrices": [
        {
          "confidence": 99,
          "price": 20,
          "maxPriorityFeePerGas": 0.1,
          "maxFeePerGas": 24.12
        },
        {
          "confidence": 95,
          "price": 20,
          "maxPriorityFeePerGas": 0.09,
          "maxFeePerGas": 24.11
        },
        {
          "confidence": 90,
          "price": 20,
          "maxPriorityFeePerGas": 0.09,
          "maxFeePerGas": 24.11
        },
        {
          "confidence": 80,
          "price": 20,
          "maxPriorityFeePerGas": 0.08,
          "maxFeePerGas": 24.1
        },
        {
          "confidence": 70,
          "price": 20,
          "maxPriorityFeePerGas": 0.07,
          "maxFeePerGas": 24.09
        }
      ]
    }
  ]
}
```

### Header

| Name          | Type   | Description                                                 |
| ------------- | ------ | ----------------------------------------------------------- |
| Authorization | string | <p>OPTIONAL<br><br>if used, must contain a valid apikey</p> |

{% tabs %}
{% tab title="200 Success" %}

```javascript
{
    "system": "ethereum",
    "network": "main",
    "unit": "gwei",
    "maxPrice": Number, // Highest priced transaction in the mempool
    "currentBlockNumber": Number, // Block number at time of prediction
    "msSinceLastBlock": Number, // Milliseconds since the last block was mined relative to when this data was computed
    "blockPrices": [
        {
            "blockNumber": Number, // Block this prediction is for
            "estimatedTransactionCount": Number, // Number of items we estimate will be included in next block based on mempool snapshot
            "baseFeePerGas": 1, // Base fee per gas for current block in gwei
            "blobBaseFeePerGas": Number // Base fee per gas for blobs for current block in gwei.
            "estimatedPrices": [
                {
                    "confidence": Number, // 0-99 likelihood the next block will contain a transaction with a gas price >= to the listed price  
                    "price": Number, // Price in gwei
                    "maxPriorityFeePerGas": Number, // Max priority fee per gas in gwei
                    "maxFeePerGas": Number, // Max fee per gas in gwei
                },
                ...,
            ]
        }
    ]
}
```

{% endtab %}

{% tab title="401 Key invalid or not provided" %}

```
{
    "msg": "Optional authorization header must contain a valid apikey"
}
```

{% endtab %}

{% tab title="429  Rate limit exceeded. Refer to the headers for when to retry the request." %}

```
{ "msg":"Too Many Requests" }
```

{% endtab %}
{% endtabs %}

### Query Parameters

| Name             | Type    | Description                                                                                                                                                                                                                                                                                        |
| ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| confidenceLevels | integer | <p>Override default confidence levels (99,95,90,80,70) in response with up to 5 confidence levels. </p><p></p><p><strong>Ethereum Mainnet</strong> confidence levels are from 1 - 99 (increments of 1)<br><br><strong>Other chains</strong> confidence levels are any from (99,95,90,80,70,50)</p> |
| chainid          | integer | The network chain ID. Default is 1 (Ethereum Mainnet).                                                                                                                                                                                                                                             |
| system           | string  | The chain ecosystem (e.g., `"ethereum"`, `"story"`, `"polygon"`, etc.)                                                                                                                                                                                                                             |
| network          | string  | The specific network within the system (e.g., `"mainnet"`, `"sepolia"` etc.).  To know which parameters to use, refer to the list under [`/chains`](https://api.blocknative.com/chains).                                                                                                           |

### Type0 and Type2 Transactions

Type0 transactions (Pre EIP-1559) should utilize the `Price` number under each confidence level. Type2 transactions (EIP-1559) should utilize the values for `maxPriorityFeePerGas` (also known as the "tip") and `maxFeePerGas` .

## Description of Terms

| Term                                    | Description                                                                                                                                                                                             |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| maxPrice                                | Highest priced transaction in the mempool.                                                                                                                                                              |
| currentBlockNumber                      | Block number at the time of prediction.                                                                                                                                                                 |
| msSinceLastBlock                        | Milliseconds since the last block was mined relative to when data was computed.                                                                                                                         |
| blockNumber                             | Block this prediction is for.                                                                                                                                                                           |
| estimatedTransaction Count              | Number of items we estimate will be included in next block based on mempool snapshot.                                                                                                                   |
| baseFeePerGas                           | Base fee per gas for current block in gwei. (Only type2 transactions Post EIP-1559 have this value and it's burned by the network upon transaction success).                                            |
| blobBaseFeePerGas                       | Base fee per gas for blobs for current block in gwei. (Only type3 transactions Post EIP-4844 have this value and it's burned by the network upon transaction success).                                  |
| estimatedPrices -> confidence           | The likelihood the next block will contain a transaction with a **price** >= to the listed **price.**                                                                                                   |
| estimatedPrices -> price                | Price in Gwei (used for type0 transactions: Pre EIP-1559).                                                                                                                                              |
| estimatedPrices -> maxPriorityFeePerGas | Max priority fee per gas in gwei also known as the "tip" (used for type2 transactions: EIP-1559).                                                                                                       |
| estimatedPrices -> maxFeePerGas         | Max fee per gas in gwei (used for type2 transactions: EIP-1559). **maxFeePerGas** is computed from **baseFeePerGas** prediction ∼10 seconds after the current pending block + **maxPriorityFeePerGas.** |
