curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x59682f00"
}
Returns the current maximum priority fee per gas for EIP-1559 transactions.
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x59682f00"
}
"0x0"
.
const getMaxPriorityFeePerGas = async () => {
const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_API_KEY/evm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_maxPriorityFeePerGas',
params: [],
id: 1
})
});
const data = await response.json();
return data.result; // Always "0x0" on Hyperliquid
};
// Usage
const priorityFee = await getMaxPriorityFeePerGas();
console.log('Priority fee:', priorityFee); // "0x0"
console.log('Priority fee in wei:', parseInt(priorityFee, 16)); // 0
// Create EIP-1559 transaction on Hyperliquid
const createEIP1559Transaction = async (to, value, gasLimit) => {
// Get base fee from latest block
const latestBlock = await eth_getBlockByNumber('latest', false);
const baseFee = parseInt(latestBlock.baseFeePerGas, 16);
// Priority fee is always 0 on Hyperliquid
const priorityFee = 0;
return {
to: to,
value: `0x${value.toString(16)}`,
gas: `0x${gasLimit.toString(16)}`,
maxFeePerGas: `0x${baseFee.toString(16)}`, // Only base fee
maxPriorityFeePerGas: '0x0', // Always zero
type: '0x2' // EIP-1559 transaction type
};
};
// Usage
const transaction = await createEIP1559Transaction(
'0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
1000000000000000000, // 1 ETH in wei
21000 // Gas limit
);
// Calculate transaction cost (no priority fee)
const calculateTransactionCost = async (gasLimit) => {
const latestBlock = await eth_getBlockByNumber('latest', false);
const baseFee = parseInt(latestBlock.baseFeePerGas, 16);
// Total cost = base fee × gas limit (no priority fee)
const totalCost = baseFee * gasLimit;
return {
baseFee: baseFee,
priorityFee: 0, // Always zero on Hyperliquid
totalFeePerGas: baseFee,
totalCost: totalCost,
totalCostGwei: totalCost / 1e9,
totalCostEth: totalCost / 1e18
};
};
// Usage
const cost = await calculateTransactionCost(21000);
console.log('Transaction cost:', cost);
Successful response with the maximum priority fee per gas
The response is of type object
.