Get Gas Price#
Dynamically obtain estimated gas prices for various chains.
Request URL#
GET https://web3.okx.com/api/v5/dex/pre-transaction/gas-price
Request Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainIndex | String | Yes | Unique identifier for the chain. e.g., 1: Ethereum. See more here. |
Response Parameters#
EVM & Tron#
| Parameter | Type | Description |
|---|---|---|
| normal | String | Medium gas price. For EVM, it is in wei. For Tron,it is in SUN |
| min | String | Low gas price. For EVM, it is in wei. For Tron,it is in SUN |
| max | String | High gas price. For EVM, it is in wei. For Tron,it is in SUN |
| supporteip1559 | Boolean | Whether supports 1559 |
| eip1559Protocol | Object | 1559 protocol |
eip1559 Protocol#
| Parameter | Type | Description |
|---|---|---|
| eip1559Protocol | Object | Structure of 1559 protocol |
| >suggestBaseFee | String | Suggested base fee = base fee * 1.25, in wei |
| >baseFee | String | Base fee, in wei |
| >proposePriorityFee | String | Medium priority fee, in wei |
| >safePriorityFee | String | Low priority fee, in wei |
| >fastPriorityFee | String | High priority fee, in wei |
Solana#
| Parameter | Type | Description |
|---|---|---|
| priorityFee | String | Priority fee per compute unit. Only applicable to Solana |
| >proposePriorityFee | String | Medium priority fee in microlamports.( it is also called Medium compute unit price ) 80th percentile |
| >safePriorityFee | String | Low priority fee in microlamports.( it is also called Low compute unit price ) 60th percentile |
| >fastPriorityFee | String | High priority fee in microlamports.( it is also called High compute unit price ) 95th percentile |
| >extremePriorityFee | String | Extreme High priority fee in microlamports.( it is also called Extreme High compute unit price ) 99th percentile |
Request Example#
shell
curl --location --request GET 'https://web3.okx.com/api/v5/dex/pre-transaction/gas-price?chainIndex=1' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'
Response Example#
200
{
"code": "0",
"data": [
{
"normal" : "21289500000", // Medium gas price
"min" : "15670000000", // Low gas price
"max" : "29149000000", // High gas price
"supportEip1559" : true, // Whether supports 1559
"eip1599Protocol": {
"suggestBaseFee" : "15170000000", // Suggested base fee
"baseFee" : "15170000000", // Base fee
"proposePriorityFee" : "810000000", // Medium priority fee
"safePriorityFee" : "500000000", // Low priority fee
"fastPriorityFee" : "3360000000" // High priority fee
},
"priorityFee":{}
}
],
"msg": ""
}
