Skip to main content
Tempo API method that returns the current maximum priority fee per gas. This is the fee tip that goes to validators on top of the base fee.

Parameters

None.

Response

  • result — the current max priority fee per gas encoded as hexadecimal (in wei)

eth_maxPriorityFeePerGas code examples

const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const getMaxPriorityFee = async () => {
    const feeData = await provider.getFeeData();
    console.log(`Max Priority Fee: ${ethers.formatUnits(feeData.maxPriorityFeePerGas, "gwei")} gwei`);

    // Or using raw RPC
    const maxPriorityFee = await provider.send("eth_maxPriorityFeePerGas", []);
    console.log(`Raw response: ${maxPriorityFee}`);
    console.log(`In gwei: ${ethers.formatUnits(maxPriorityFee, "gwei")}`);
  };

getMaxPriorityFee();