Phantom Developer Docs
HomeDeveloper Forums
  • 👻Introduction
    • Introduction
  • 🟩Solana
    • Getting Started With Solana
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Legacy Transaction
    • Sending a Versioned Transaction
    • Signing a Message
    • Error Messages and Codes
  • 🔷Ethereum, Monad Testnet, Base, & Polygon
    • Getting Started with EVM networks
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
    • Provider API Reference
      • Properties
        • isPhantom
        • chainId
        • networkVersion
        • selectedAddress
        • _events
        • _eventsCount
      • Events
        • Connect
        • Accounts Changed
        • Disconnect
        • Chain Changed
      • Methods
        • isConnected
        • request
      • Error Messages & Codes
  • 🌊Sui
    • Getting Started with Sui
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
  • 🟠Bitcoin
    • Getting Started With Bitcoin
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
    • Provider API Reference
  • ⛓️Phantom Deeplinks
    • Phantom Deeplinks
    • Provider Methods
      • Connect
      • Disconnect
      • SignAndSendTransaction
      • SignAllTransactions
      • SignTransaction
      • SignMessage
    • Other Methods
      • Browse
      • Fungible
      • Swap
    • Handling Sessions
    • Specifying Redirects
    • Encryption
    • Limitations
  • 🛠️Developer Powertools
    • Auto-Confirm
    • Domain and Transaction Warnings
    • Mobile Web Debugging
    • Phantom Blocklist
    • Shortcuts
    • Sign-In-With (SIW) Standards
    • Solana Actions & Blinks
    • Solana Priority Fees
    • Solana Token Extensions (Token22)
    • Solana Versioned Transactions
    • Testnet Mode
    • Token Pages
    • Wallet Standard
  • ✅Best Practices
    • Launching a Dapp
    • Displaying Apps within the Activity Tab
    • Displaying Apps within Dialogs
    • Displaying Tokens on Solana
      • Fungibles
      • NFTs & Semi-Fungibles
      • Supported Media Types
  • 🙋Resources
    • FAQ
    • Demo Applications
    • Community Guides & SDKs
    • Logos & Assets
Powered by GitBook
On this page
  • Introduction
  • How Transaction Fees Work on Solana
  • Priority Fees Calculation
  • How Phantom Applies Priority Fees to dApp Transactions
  • Further Reading

Was this helpful?

  1. Developer Powertools

Solana Priority Fees

PreviousSolana Actions & BlinksNextSolana Token Extensions (Token22)

Last updated 10 months ago

Was this helpful?

Introduction

Phantom automatically calculates and applies to all Phantom-generated transactions and dApp-generated transactions that meet .

How Transaction Fees Work on Solana

Solana transactions fees are calculated based on two main parts:

• A statically set base fee per signature, and

• The computational resources used during the transaction, measured in Compute Units (CU)

Since each transaction requires different computational resources, they are allotted a maximum number of compute units, known as the Compute Budget. After the Compute Budget is exhausted, the runtime halts the transaction and returns an error, resulting in a failed transaction.

The maximum budget for a transaction is 1.4 million CU, while the total blockspace limit is 48 million CU. Only a few computationally heavy TXs, like a mint or a swap, could fill the entire block, halting other TXs—Hence the need for Priority Fees.

The fee priority of a transaction T can be defined as F(T), where F(T) is the "fee-per compute-unit", calculated by:

(additional_fee+base_fee) / requested_compute_units(additional\_fee + base\_fee)\ /\ requested\_compute\_units(additional_fee+base_fee) / requested_compute_units

This means that the more compute units a transaction requests, the more additional fee it will have to pay to maintain the priority in the transaction queue. This prevents computationally heavy transactions from being easily spammed or from filling blocks.

Priority Fees Calculation

Priority fees are calculated as,

where,

How Phantom Applies Priority Fees to dApp Transactions

Phantom will calculate and apply Priority Fees to all dApp-generated transactions, provided:

• The transaction(s) do not already have signature(s) present

• The transaction(s) do not have existing priority fee instructions (computeUnitBudget or computeUnitLimit)

• After enhancing transaction(s) with Priority Fees, the size of each transaction will still be less than the byte size limit (1232 bytes)

If all of the above conditions are met, Phantom will automatically calculate and apply priority fees at the time of signing. This pattern applies to all Phantom provider methods (signAndSendTransaction, signTransaction , signAllTransactions) across all environments (extension, mobile in-app browser, deeplinks, mobile wallet adapter).

Further Reading

priority_fees = compute_budget ∗ compute_unit_pricepriority\_fees\ =\ compute\_budget\ *\ compute\_unit\_pricepriority_fees = compute_budget ∗ compute_unit_price
compute_budget = # of instructions ∗ compute_unit_limitcompute\_budget\ =\ \#\ of\ instructions\ *\ compute\_unit\_limitcompute_budget = # of instructions ∗ compute_unit_limit

Although dApps can set their own they generate, we highly discourage doing so as it often surfaces unnecessary complexity to end-users. Instead, we recommend that dApp developers let Phantom apply priority fees on the user's behalf.

🛠️
priority fees on transactions
Priority Fees
our requirements
Fee Transaction Priority | Solana Docs
Logo
Solana Cookbook | Sending Transactionssolanacookbook
Logo
Runtime | Solana Docs
Logo
Transaction Fees | Solana Docs
Logo