💰 eth_maxPriorityFeePerGas - Base Chain
Overview
The eth_maxPriorityFeePerGas
method returns an estimation of the priority fee (tip) needed for a transaction to be included in the next block on Base chain. This is a key component for EIP-1559 type transactions, which are the standard on Base.
💡 Priority Fee: This is the "tip" paid directly to validators/sequencers to incentivize them to include your transaction. It's a crucial part of Base's gas fee structure.
Parameters
This method takes no parameters.
Returns
Estimated priority fee per gas
- A hex string representing the suggested priority fee in wei
Request
POST https://base-mainnet.chainnodes.org/YOUR-API-KEY
Need RPC API keys?
Get 12.5M archival requests for free today.
Example
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
- You can use a different supported network by replacing
base-mainnet
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_maxPriorityFeePerGas","params":[],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5f5e100" // 100000000 wei or 0.1 Gwei
}
Using Priority Fees on Base
Base chain uses the EIP-1559 fee structure similar to Ethereum, but typically with lower fee values:
- Base Fee: Algorithmically determined fee that gets burned
- Priority Fee (Tip): Optional fee to incentivize inclusion (what this method estimates)
- Max Fee Per Gas: The absolute maximum you're willing to pay per unit of gas
The total gas cost formula is:
Total Gas Cost = (Base Fee + Priority Fee) × Gas Used
💡 Confusing?
Ask our experienced blockchain developers in Telegram
Common Use Cases
Creating an EIP-1559 Transaction
Use this method to set appropriate gas values when sending transactions on Base:
// Get current recommended priority fee
const priorityFee = await eth.maxPriorityFeePerGas();
// Get current base fee
const block = await eth.getBlockByNumber('latest', false);
const baseFee = block.baseFeePerGas;
// Set max fee per gas (base fee + priority fee + some buffer)
const maxFeePerGas = parseInt(baseFee, 16) * 1.5 + parseInt(priorityFee, 16);
// Create transaction
const tx = {
from: '0xYourAddress',
to: '0xRecipientAddress',
value: '0x38D7EA4C68000', // 0.001 ETH in wei (hex)
maxPriorityFeePerGas: priorityFee,
maxFeePerGas: '0x' + maxFeePerGas.toString(16),
gas: '0x5208', // 21000 gas for a standard transfer
chainId: '0x2105' // Base mainnet chain ID (8453 in decimal)
};
Adjusting for Transaction Priority
You can modify the priority fee based on how quickly you need your transaction included:
// Get recommended priority fee
const suggestedPriorityFee = await eth.maxPriorityFeePerGas();
const priorityFeeValue = parseInt(suggestedPriorityFee, 16);
// Faster transaction (2x the suggested priority fee)
const fasterPriorityFee = '0x' + (priorityFeeValue * 2).toString(16);
// Slower but cheaper transaction (0.5x the suggested priority fee)
const cheaperPriorityFee = '0x' + Math.floor(priorityFeeValue * 0.5).toString(16);