Skip to main content
Most Accurate Method: Get the highest precision priority fee estimates by analyzing your exact transaction. Recommended for production applications where accuracy matters most.

Overview

Serialized transactions provide the most accurate fee estimates because the API can analyze the exact accounts and operations that will be performed in your transaction.

Why Use Serialized Transactions

  • Highest accuracy - Analyzes exact operations
  • Detailed analysis - Instruction-specific patterns
  • Realistic estimates - Reflects actual transaction
  • Production-ready - Built for critical applications

Best For

  • Production applications
  • Complex transactions
  • Critical operations
  • Maximum accuracy needed

Advantages Over Account Keys

Instruction-Specific Analysis

The API can analyze specific operations and their historical fee patterns, not just account activity.

Transaction Size Awareness

Considers the actual size and complexity of your transaction for more accurate estimates.

Read-Only Account Handling

Better analysis of both writable and read-only accounts in their transaction context.

Implementation Guide

1

Build Your Transaction

Create your transaction with all instructions (except priority fee)
2

Serialize the Transaction

Convert your transaction to a serialized format
3

Get Fee Estimate

Call the Priority Fee API with your serialized transaction
4

Apply Priority Fee

Add the priority fee instruction and send your transaction

Quick Start Example

Core Implementation Function

Here’s a reusable function for getting priority fee estimates from serialized transactions:

Complete Implementation Examples

Advanced Configuration Options

Get estimates for all priority levels at once:
Request detailed information about the fee calculation:
This provides insights into how the fee was calculated, including per-account analysis.
Adjust the number of slots analyzed:

Best Practices

Transaction Serialization

Always serialize your actual transaction, not a simplified version

Instruction Order

Include all instructions except the priority fee in your estimation transaction

Error Handling Strategies

Common Issues & Solutions

Problem: Error serializing incomplete transactionsSolution: Always set required fields before serialization:
Problem: Using stale blockhash causes transaction failuresSolution: Always get fresh blockhash before final send:
Problem: Transaction too large for serializationSolution: Use versioned transactions or break into multiple transactions:

When to Use vs Account Keys

Use Serialized Transactions

Production applications
  • Maximum accuracy required
  • Complex multi-instruction transactions
  • Critical operations
  • Performance-sensitive applications
Development scenarios
  • Final integration testing
  • Performance optimization
  • Production deployment

Use Account Keys

Development & prototyping
  • Quick estimates during development
  • Simple transactions
  • Pre-transaction planning
  • Architecture constraints preventing serialization
Analysis scenarios
  • Account-level fee pattern analysis
  • Batch account analysis
  • Quick market research

Account Keys Method

Advanced method using account keys for specialized use cases

API Reference

Complete API documentation and parameters