solanasetpriorityfee.com

The complete guide to Solana priority fees

Solana Priority Fee API: Native & Third-Party Options

Accurate priority fee estimation is critical for any production Solana application. Using a stale or hardcoded fee can mean your transaction either pays too much (wasting SOL) or too little (getting dropped during congestion). This guide covers both Solana's native RPC method and enhanced third-party APIs.

Native RPC: getRecentPrioritizationFees

Solana's JSON-RPC API provides the getRecentPrioritizationFees method, which returns an array of prioritization fee records from up to the last 150 blocks. Each record contains a slot number and the lowest fee paid in that slot:

const connection = new Connection(RPC_URL);

// Option 1: Global fees (all transactions)
const globalFees = await connection.getRecentPrioritizationFees();

// Option 2: Account-specific fees (transactions touching specific accounts)
const accountFees = await connection.getRecentPrioritizationFees({
  lockedWritableAccounts: [new PublicKey('YourProgramOrAccountPubkey')]
});

Limitations of the Native Method

  • Returns raw minimum fees per slot — difficult to derive a meaningful percentile from.
  • Does not differentiate between global and local fee markets.
  • No built-in filtering for transaction complexity or program type.
  • 150-block window may not reflect sudden spikes in congestion.

Helius Priority Fee API

Helius offers the getPriorityFeeEstimate method which returns a single recommended fee value at a specified priority level (Low, Medium, High, VeryHigh, UnsafeMax). It accounts for both global and local fee markets automatically.

const response = await fetch(HELIUS_RPC_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: '1',
    method: 'getPriorityFeeEstimate',
    params: [{
      transaction: serializedTx, // base58 encoded
      options: { priorityLevel: 'High' }
    }]
  })
});
const { result } = await response.json();
const fee = result.priorityFeeEstimate;

QuickNode Priority Fee API

QuickNode provides the qn_estimatePriorityFees method, which fetches recent priority fees across up to 100 blocks and returns percentile-based estimates. You can filter by specific program accounts for more accurate results:

const response = await fetch(QUICKNODE_RPC_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: 1,
    method: 'qn_estimatePriorityFees',
    params: {
      last_n_blocks: 100,
      account: 'YourProgramPubkey',
      api_version: 2
    }
  })
});

Using a serialized transaction when calling the priority fee API gives the most accurate estimate, because the API can analyze the exact accounts and programs your transaction interacts with.

— Helius Developer Documentation

Which API Should You Use?

For most developers building production applications, a third-party API provides significantly better fee estimates than the native RPC method. The native method is suitable for quick prototyping, while Helius or QuickNode APIs are recommended for mainnet deployments where transaction reliability matters. Always test fee strategies on devnet before deploying to mainnet.

  1. The Common category includes then following block: Paragraph, image, heading, latest gallery, quote, audio, cover, video. The paragraphs block is the default block type. This is should not to have any alignment of any kind.

  • The Common category includes then following block: Paragraph, image, heading, latest gallery, quote, audio, cover, video. The paragraphs block is the default block type. This is should not have any there alignment of any kind. Category and then there are many things too following blocks and many more.

  • Leave A Comment

    All fields marked with an asterisk (*) are required