curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3b9aca00"
}
Returns the current gas price in wei as determined by the network.
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3b9aca00"
}
eth_gasPrice
JSON-RPC method returns the base fee for the next small block on Hyperliquid EVM. This method provides the gas price for standard (small) block transactions.
result
— The base fee for the next small block in wei as a hexadecimal string0x
prefix0x3b9aca00
= 1,000,000,000 wei = 1 gwei// Get gas price for small blocks on Hyperliquid
const getGasPrice = async () => {
const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_gasPrice',
params: [],
id: 1
})
});
const data = await response.json();
const gasPriceWei = parseInt(data.result, 16);
return {
hex: data.result,
wei: gasPriceWei,
gwei: gasPriceWei / 1e9,
ether: gasPriceWei / 1e18
};
};
// Compare small block vs big block gas prices
const compareGasPrices = async () => {
const [smallBlockPrice, bigBlockPrice] = await Promise.all([
// Small block gas price
fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_gasPrice',
params: [],
id: 1
})
}).then(r => r.json()),
// Big block gas price
fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_bigBlockGasPrice',
params: [],
id: 2
})
}).then(r => r.json())
]);
return {
smallBlock: {
hex: smallBlockPrice.result,
gwei: parseInt(smallBlockPrice.result, 16) / 1e9
},
bigBlock: {
hex: bigBlockPrice.result,
gwei: parseInt(bigBlockPrice.result, 16) / 1e9
}
};
};
// Usage
getGasPrice()
.then(price => console.log(`Small block gas price: ${price.gwei} gwei`))
.catch(error => console.error('Error:', error));
eth_gasPrice
returns the base fee for the next small blocketh_bigBlockGasPrice
returns the base fee for the next big blocketh_usingBigBlocks
to determine if an address uses big blockseth_gasPrice
for standard transactionseth_bigBlockGasPrice
if the address uses big blocks0x3b9aca00
= 1,000,000,000 wei = 1 gweicurl -X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}' \
https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm
eth_gasPrice
method is essential for applications that need to:
eth_gasPrice
returns the base fee for the next small block. For addresses using big blocks, use eth_bigBlockGasPrice
instead. Check if an address uses big blocks with eth_usingBigBlocks
.Successful response with the current gas price
The response is of type object
.
Was this page helpful?