eth_maxPriorityFeePerGas - Linea RPC Method
Get the suggested priority fee (tip) per gas for EIP-1559 transactions on Linea. Essential for gas estimation, fee optimization, and time-sensitive transaction pricing.
Returns the current suggested priority fee (tip) per gas in wei on Linea. This is the amount paid directly to validators to incentivize faster transaction inclusion in EIP-1559 compatible blocks.
Why Linea? Build on Consensys-backed zkEVM L2 with $1B+ TVL and 807% growth in 2025 with 15-30x lower fees than Ethereum mainnet, 6,200 TPS throughput, SWIFT integration with 12+ institutions, and $725M Consensys backing.
When to Use This Method
eth_maxPriorityFeePerGas is essential for enterprise developers, DeFi builders, and teams seeking Consensys ecosystem integration:
- EIP-1559 Transaction Building — Get the recommended tip to include in
maxPriorityFeePerGaswhen constructing type-2 transactions on Linea - Fee Optimization — Balance transaction speed against cost by adjusting the priority fee relative to the suggested value
- Time-Sensitive Transactions — Increase the tip above the suggested value for DEX swaps, liquidations, or other latency-sensitive operations on enterprise DeFi (Aave, Renzo), institutional cross-border payments via SWIFT pilots, and zkEVM-native applications
- Gas Price Estimation — Combine with
baseFeePerGasfrom the latest block to calculate the totalmaxFeePerGasfor accurate fee estimation
Request Parameters
This method accepts no parameters.
Response Body
Hexadecimal string representing the suggested priority fee per gas in wei
Error Responses
Code Examples
curl -X POST https://api-linea-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_maxPriorityFeePerGas",
"params": [],
"id": 1
}'Common Use Cases
1. Build an EIP-1559 Transaction
Construct a properly priced type-2 transaction on Linea:
import { JsonRpcProvider, Wallet, parseEther } from 'ethers';
const provider = new JsonRpcProvider('https://api-linea-mainnet-archive.n.dwellir.com/YOUR_API_KEY');
async function buildEIP1559Transaction(privateKey, to, valueEth) {
const wallet = new Wallet(privateKey, provider);
// Get current fee data
const feeData = await provider.getFeeData();
const latestBlock = await provider.getBlock('latest');
const baseFee = latestBlock.baseFeePerGas;
// Set maxPriorityFeePerGas from the suggestion
const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
// maxFeePerGas = 2 * baseFee + maxPriorityFeePerGas (buffer for base fee increases)
const maxFeePerGas = baseFee * 2n + maxPriorityFeePerGas;
const tx = await wallet.sendTransaction({
to,
value: parseEther(valueEth),
type: 2,
maxPriorityFeePerGas,
maxFeePerGas
});
console.log('Sent with priority fee:', Number(maxPriorityFeePerGas) / 1e9, 'Gwei');
return tx;
}2. Dynamic Fee Strategy
Adjust priority fees based on transaction urgency:
async function getFeeByUrgency(provider, urgency = 'standard') {
const feeData = await provider.getFeeData();
const basePriorityFee = feeData.maxPriorityFeePerGas;
const multipliers = {
low: 0.8, // Willing to wait
standard: 1.0, // Normal speed
fast: 1.5, // Faster inclusion
urgent: 2.0 // Next-block target
};
const multiplier = multipliers[urgency] || 1.0;
const adjustedFee = BigInt(Math.ceil(Number(basePriorityFee) * multiplier));
const block = await provider.getBlock('latest');
const maxFeePerGas = block.baseFeePerGas * 2n + adjustedFee;
return {
maxPriorityFeePerGas: adjustedFee,
maxFeePerGas
};
}
// Usage
const fees = await getFeeByUrgency(provider, 'fast');
console.log('Priority fee:', Number(fees.maxPriorityFeePerGas) / 1e9, 'Gwei');
console.log('Max fee:', Number(fees.maxFeePerGas) / 1e9, 'Gwei');3. Priority Fee Monitor
Track priority fee changes over time on Linea:
async function monitorPriorityFee(provider, interval = 12000) {
let previousFee = null;
setInterval(async () => {
const feeData = await provider.getFeeData();
const currentFee = feeData.maxPriorityFeePerGas;
const feeGwei = Number(currentFee) / 1e9;
if (previousFee !== null) {
const change = Number(currentFee - previousFee) / Number(previousFee) * 100;
const direction = change > 0 ? 'UP' : change < 0 ? 'DOWN' : 'STABLE';
console.log(`Priority fee: ${feeGwei.toFixed(4)} Gwei (${direction} ${Math.abs(change).toFixed(1)}%)`);
} else {
console.log(`Priority fee: ${feeGwei.toFixed(4)} Gwei`);
}
previousFee = currentFee;
}, interval);
}Error Handling
Common errors and solutions:
| Error Code | Description | Solution |
|---|---|---|
| -32601 | Method not found | The node may not support EIP-1559 — fall back to eth_gasPrice |
| -32603 | Internal error | Retry with exponential backoff |
| -32005 | Rate limit exceeded | Implement rate limiting and caching client-side |
async function getSafePriorityFee(provider, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const feeData = await provider.getFeeData();
if (feeData.maxPriorityFeePerGas !== null) {
return feeData.maxPriorityFeePerGas;
}
// Fallback: derive from legacy gas price
const gasPrice = await provider.send('eth_gasPrice', []);
return BigInt(gasPrice);
} catch (error) {
if (error.code === -32601) {
// EIP-1559 not supported — use legacy gas price
const gasPrice = await provider.send('eth_gasPrice', []);
return BigInt(gasPrice);
}
if (i === maxRetries - 1) throw error;
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
}
}
}Related Methods
eth_gasPrice— Get the legacy gas priceeth_feeHistory— Get historical fee data for trend analysiseth_estimateGas— Estimate gas units required for a transactioneth_getBlockByNumber— Get block details includingbaseFeePerGas
eth_gasPrice
Get current gas price on Linea. Essential for transaction cost estimation for enterprise DeFi (Aave, Renzo), institutional cross-border payments via SWIFT pilots, and zkEVM-native applications.
eth_feeHistory
Get historical gas fee data on Linea including base fees and priority fee percentiles. Essential for gas price prediction, fee estimation UIs, and network congestion monitoring.