Gas Platform ⛽ [BETA]

Welcome to our early access Gas Platform docs.

Overview

This early access version of the Gas Platform provides access to

  • Gas price 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.

get
blockprices

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.
Request
Response
Request
Headers
Authorization
required
string
Valid GR8 Hackathon or paid tier apikey
Query Parameters
n
optional
integer
Override 'estimatedTransactionCount' (see example response). Used to estimate how many transactions will fit in the next block.
Response
200: OK
Success
{
"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
"priceMultiplier": 1, // During beta this will always be 1
"estimatedTransactionCount": Number, // Number of items we estimate will be included in next block based on mempool snapshot
"estimatedPrices": [
{
"confidence": Number, // 0-1 likelihood the next block will contain a transaction with a gas price >= to the listed price
"currentItems": Number, // Transactions in the mempool with at least this gas price
"price": Number // Price in gwei
},
...,
]
}
],
"notice": "This is an early access endpoint. The response schema may change and we make no accuracy guarantees."
}
401: Unauthorized
Key invalid or not provided
{
"msg": "Authorization header must contain a valid apikey"
}

Example request

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

get
distribution

https://api.blocknative.com/gasprices/distribution
Get the gas price distribution of the highest n priced pending transactions eligible for inclusion in the next block. If n is not specified, it defaults to number of expected transactions in the next block.
Request
Response
Request
Headers
Authorization
required
string
Valid GR8 Hackathon or paid tier apikey
Query Parameters
n
optional
integer
Number of transactions (ordered by gas price) to use to build the distribution.
Response
200: OK
Success
{
"system": "ethereum",
"network": "main",
"unit": "gwei",
"maxPrice": Number, // Highest priced transaction eligible for inclusion in next block
"currentBlockNumber": Number, // Block number at
"msSinceLastBlock": Number, // Milliseconds since last block at time of capture
"topNDistribution": {
"distribution": [ // List of tuples [(price,count), ...], ordered by price
[
Number, // Price in gwei
Number // Transaction count with this price
],
...,
],
"n": Number // Top N priced pending transactions included in this distribution
},
"notice": "This is an early access endpoint. The response schema may change and we make no accuracy guarantees.
401: Unauthorized
Key invalid or not provided
{
"msg": "Authorization header must contain a valid apikey"
}

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