Understanding Solana Jito Transactions with BundleOnly=True
When sending a single Jito transaction across the Solana blockchain, you face a common dilemma: how to bundle your transactions while maintaining their integrity and security. One way to achieve this is by using the “bundleOnly” parameter in Jito transactions.
In this article, we’ll take a deep dive into creating Jito transactions with “bundle-only true” and focus on what it means for them to be reversible and MEV (Mean Time to Exit) protected.
What are Jito Transactions?
Jito is a Solana-specific transaction protocol that allows you to send multiple assets in a single transaction. This is especially useful when you need to transfer a small amount of one asset in exchange for another, while also paying the tip to the network and leaving a margin for potential profit (MEV).
What is bundleOnly=True?
When bundleOnly=True, Solana will attempt to create a bundle from your transactions. This means that multiple assets with different transaction IDs or gas prices that you send will be bundled into a single bundle.
Here is an example of what the bundled Jito transaction might look like:
Jito {
input {
address = "0x1234567890abcdef"
gasPrice = 1000000
amount {
assetType = "token"
tokenAddress = "0x9876543210fedcba"
quantity = 10
}
}
output {
address = "0xabcdef12345"
gasPrice = 10000
amount {
assetType = "token"
tokenAddress = "0x4567890123456789"
quantity = 20
}
}
}
In this example, we have a single Jito transaction with two input and Output assets created.
Undo Protection
By default, Solana transactions are considered undone. However, if you use the bundleOnly=True
parameter, your bundled transaction will be treated as non-undone. This means that if any of the individual inputs fail or are rejected by the network, the entire transaction will be reverted to its original state.
To mitigate this risk, you can enable undo protection for your transactions using the revertProtect
function in Solana’s JavaScript SDK.
const Jito = require('@solana/web3.js').Jito;
// Create new Jito transaction with undo protection
const transaction = new Jito({
Input: [
{
Address: "0x1234567890abcdef",
Gas price: 1000000,
Amount: {
Asset type: "Token",
Token address: "0x9876543210fedcba",
Quantity: 10
}
},
{
Address: "0x4567890123456789",
Gas price: 10000,
Amount: {
Asset type: "Token",
Token address: "0x7654321098765432",
Quantity: 20
}
}
],
Output: [
{
Address: "0xabcdef12345",
gasPrice: 10000,
amount: {
assetType: 'token',
tokenAddress: '0x901234567890abcdef',
quantity: 30
}
}
]
});
// Perform transaction
transaction.sign();
MEV Protection
To make your bundled transactions even more secure, you can use the mevProtect
function to enable MEV Protection. This will ensure that potential profits from market fluctuations are protected.
Here is an example of how to create a MeV protected Jito transaction:
“`javascript
const Jito = require(‘@solana/web3.js’).