Gas Platform API
Gas Platform is an industry leading product that leverages real-time mempool data to deliver transaction gasPrice distribution and precisely predict gasPrice 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.

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 being called once per second per paid tier apikeys, or once per 5 seconds for free tier apikeys. When you exceed your rate limit, the following headers will be included in the response:
  • Retry-After - The time in seconds after which to retry the request
  • X-RateLimit-Reset - The date after which the rate limit will be reset
Example:
1
Retry-After: 0.495
2
X-RateLimit-Reset: Mon May 17 2021 22:27:28 GMT+0000 (Coordinated Universal Time)
Copied!
get
https://api.blocknative.com
/gasprices/blockprices
blockprices

Example request

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

Example custom confidence level request

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

Example Response Payload

1
{
2
"system": "ethereum",
3
"network": "main",
4
"unit": "gwei",
5
"maxPrice": 123,
6
"currentBlockNumber": 13005095,
7
"msSinceLastBlock": 3793,
8
"blockPrices": [
9
{
10
"blockNumber": 13005096,
11
"baseFeePerGas": 94.647990462,
12
"estimatedTransactionCount": 137,
13
"estimatedPrices": [
14
{
15
"confidence": 99,
16
"price": 104,
17
"maxPriorityFeePerGas": 9.86,
18
"maxFeePerGas": 199.16
19
},
20
{
21
"confidence": 95,
22
"price": 99,
23
"maxPriorityFeePerGas": 5.06,
24
"maxFeePerGas": 194.35
25
},
26
{
27
"confidence": 90,
28
"price": 98,
29
"maxPriorityFeePerGas": 4.16,
30
"maxFeePerGas": 193.45
31
},
32
{
33
"confidence": 80,
34
"price": 97,
35
"maxPriorityFeePerGas": 2.97,
36
"maxFeePerGas": 192.27
37
},
38
{
39
"confidence": 70,
40
"price": 96,
41
"maxPriorityFeePerGas": 1.74,
42
"maxFeePerGas": 191.04
43
}
44
]
45
}
46
]
47
}
Copied!

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

confidence

0-99 likelihood the next block will contain a transaction with a gas price >= to the listed price

Price

Price in Gwei (used for type0 transactions: Pre EIP-1559)

maxPriorityFeePerGas

Max priority fee per gas in gwei also known as the "tip" (used for type2 transactions: EIP-1559)

maxFeePerGas

Max fee per gas in gwei (used for type2 transactions: EIP-1559). Our current max fee heuristic is Base Fee * 2 + Priority Fee. This is to protect against a ‘rapid’ rise in the base fee while your transaction fee is pending. In most cases, the actual transaction fee will approximate Base Fee + Priority Fee.
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
1
curl -H "Authorization: your-apikey-here" https://api.blocknative.com/gasprices/distribution
Copied!
Last modified 3mo ago