Can transactions on Solana be inserted or reordered between individual instructions?
When it comes to executing transactions on decentralized applications (dApps) like Solana, it is crucial for developers to understand how different instructions are combined and executed. One of the most important aspects of dApp development on Solana is the ability to combine multiple instructions into a single transaction, called a “combination of instructions.” But what happens if you try to reorder these instructions or insert them between individual instructions? Can an attacker somehow change the order of operations?
Order Order and Execution
On Solana, each instruction has its own unique execution path. The first instruction is executed immediately, followed by subsequent instructions in the order specified. This means that any changes to the original instruction will overwrite the modified version rather than allowing reordering or insertion.
For example, consider a simple transaction where you combine two instructions: “program deployment” and “set administrator/owner controls.” If you insert an intermediate statement between these two commands, it may seem like there is an opportunity to manipulate the order, but due to Solana’s command ordering mechanism, this is not possible.
Reordering Instructions
To understand why reordering instructions is impossible in Solana, let’s examine how the process of command combination works. When you create a transaction with multiple instructions, they are executed in the following order:
How to make a sandwich
Now let’s consider what happens when you try to insert a single statement between two other statements:
In this example, statement 3 (the “Set administrator/owner controls” statement) overrides the original statement (statement 2) rather than allowing reordering. This is because the intermediate statement (statement B) is placed between the two original statements and modifies one of them.
Conclusion

Although it may seem like there is a way to manipulate the order of operations by stringing statements together, Solana’s statement combination mechanism makes this impossible. Any attempt to reorder or modify individual instructions will be overridden by subsequent instructions in the order specified. This is a fundamental aspect of Solana’s instruction ordering system and provides a secure foundation for executing transactions on dApps.
Additional Resources
Note: This article is for informational purposes only and should not be considered professional advice. For more complex questions or issues, it is recommended that you consult a qualified developer or engineer.
Yazar hakkında