Gas Platform API

Gas Platform is an industry leading product that leverages real-time mempool data to deliver transaction gasPrice distribution and precisely predict the gas price required to get into the next block.

Overview

Gas Platform provides access to:
  • Gas prices needed to have X% probability to qualify for inclusion in the next block. Need a high probability of being confirmed at the expense of spending extra gas? Use the 99% probability prediction. Don't mind if the tx takes 2-3 blocks if it saves some gas? Use the 70% probability prediction.
  • Estimated gas price distribution for the next block. Want a deeper look at live mempool gas statistics? Get a complete breakdown of gas prices in the mempool grouped by gwei.
Gas Platform currently supports Ethereum and Polygon/Matic mainnets.
  • For Polygon append: ?chainid=137

Authentication

A valid Blocknative apikey is required in the Authorization Header of every request.
Create an account and apikey here.

Ratelimits

Each endpoint is limited to provide updated results each second for paid tier apikeys, or every 5 seconds for free tier apikeys. Polling faster than these rates may deliver stale data.
get
https://api.blocknative.com
/gasprices/blockprices
blockprices

Example request

curl -H "Authorization: your-apikey-here" https://api.blocknative.com/gasprices/blockprices

Example Polygon request

curl -H "Authorization: your-apikey-here" "https://api.blocknative.com/gasprices/blockprices?chainid=137"

Example custom confidence level request

curl -H "Authorization: your-apikey-here" https://api.blocknative.com/gasprices/blockprices?confidenceLevels=10&confidenceLevels=30&confidenceLevels=50&confidenceLevels=70&confidenceLevels=90

Example Response Payload

{
"system": "ethereum",
"network": "main",
"unit": "gwei",
"maxPrice": 120,
"currentBlockNumber": 14630321,
"msSinceLastBlock": 14653,
"blockPrices": [
{
"blockNumber": 14630322,
"estimatedTransactionCount": 224,
"baseFeePerGas": 77.233467826,
"estimatedPrices": [
{
"confidence": 99,
"price": 79,
"maxPriorityFeePerGas": 2,
"maxFeePerGas": 109.93
},
{
"confidence": 95,
"price": 78,
"maxPriorityFeePerGas": 1.52,
"maxFeePerGas": 109.45
},
{
"confidence": 90,
"price": 78,
"maxPriorityFeePerGas": 1.5,
"maxFeePerGas": 109.43
},
{
"confidence": 80,
"price": 78,
"maxPriorityFeePerGas": 1.27,
"maxFeePerGas": 109.2
},
{
"confidence": 70,
"price": 78,
"maxPriorityFeePerGas": 1.07,
"maxFeePerGas": 109
}
]
}
],
"estimatedBaseFees": [
{
"pending+1": [
{
"confidence": 99,
"baseFee": 86.89
}
]
},
{
"pending+2": [
{
"confidence": 99,
"baseFee": 97.74
}
]
},
{
"pending+3": [
{
"confidence": 99,
"baseFee": 106.19
}
]
},
{
"pending+4": [
{
"confidence": 99,
"baseFee": 105.99
}
]
},
{
"pending+5": [
{
"confidence": 99,
"baseFee": 107.93
}
]
}
]
}

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

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

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).

estimatedTransactionCount

Number of items we estimate will be included in next block based on mempool snapshot

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 5 blocks after the current pending block + maxPriorityFeePerGas

estimatedBaseFees -> pending+n

The nth block after the current pending block for the associated baseFee prediction. Currently the next 5 blocks after the current pending block are provided

estimatedBaseFees -> confidence

The likelihood the specified future block will have a baseFee <= to the listed baseFee. Currently only the 99% confidence level is provided

estimatedBaseFees -> baseFee

The estimated baseFee of the specified future block (pending+n) at the indicated confidence level. Currently only the 99% confidence level is provided
get
https://api.blocknative.com
/gasprices/distribution
distribution
Pending transactions unlikely to be included in the next block due to poor nonce ordering are not included in distribution data
Example request
curl -H "Authorization: your-apikey-here" https://api.blocknative.com/gasprices/distribution