Skip to main content
Part of the How to land transactions on Solana guide.
TLDR:
  • This Python script inspects the fee usage in blocks adjacent to your own target transaction on Solana, focusing on the same on-chain program.
  • It decodes compute budget instructions (priority fees) to show both your transaction’s fee and those of other transactions in nearby blocks.
  • By comparing priority fees, you can tune your own transaction fees to optimize speed or cost, and troubleshoot performance.
  • Useful for pump.fun or any scenario where outbidding other participants at the block level is crucial.

Main article

This guide shows you how to analyze transaction priority fees for transactions adjacent to your target transaction on Solana. This is particularly useful when developing trading strategies or troubleshooting transaction execution on programs like pump.fun. What the script in this tutorial does is look for transactions adjacent to the one you specify (usually your own) and checks all other transactions involving the same program and prints the priority fees in the same block and the adjacent blocks to easily see how your particular transaction stacks up and how you can tune it to win more races.

Prerequisites

Get your own reliable Solana RPC endpoint today

Deploy a reliable Solana RPC endpoint to get started.Start for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
  • Python 3.7+
  • Packages: pip install solana base58

Understanding Solana fees

The recommended reading list:

Implementation

If you end up in this specific scenario as outlined in the beginning of the article, here’s things that you need to have to get the results: The script itself:
In the script:
  • PROGRAM_ID — set to the pump.fun executable. Set it to any executable on-chain program you interact with.
  • COMPUTE_BUDGET_ID — set to the Solana system program responsible for compute units and fees. We use in the script to find and decode the priority fees.
  • RPC_URL — tour Chainstack Solana node endpoint.
  • SIGNATURE — the transactions signature (hash) around which you want to analyze similar transactions.
  • SLOTS_BACK — number of slots to travel back from the slot where you transaction landed (was included in the block).
  • SLOTS_FORWARD — number of slot to travel forward to see who used what fees after you transaction landed.
To use the script, just run python check_adjacent.py or whatever you name it. Example output:

Use cases

This tool is particularly useful for:
  • Analyzing competitor trading strategies
  • Optimizing your own priority fees
  • Troubleshooting failed transactions
  • Understanding market competition in specific slots
  • Developing automated trading systems

Conclusion

Understanding transaction priority fees and their impact on execution is crucial for successful trading on Solana. This tool helps you analyze the competitive landscape and optimize your trading strategy by providing insights into how other traders are setting their priority fees. For more Solana development tools and guides, see Mastering Solana.

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on July 2, 2026