Don't miss our holiday offer - up to 50% OFF!
Solana: Jito transaction with bundleOnly=true parameter?
Solana: Jito Transaction Bundle Only with V2. Parameter?
==
Starting with Solana 1.13, you can send multiple transactions in a single bundle if certain conditions are met. In this article, we will see how to use the bundleOnly=true' parameter when sending transactions on Solana.
What is a Jito Transaction?
------------------------------
A Jito transaction is an optimized transaction type that allows for the efficient and secure transfer of assets between multiple accounts. It was introduced in Solana 1.8 as a replacement for the old “transfer” feature. A Jito transaction consists of multiple transactions, each with its own set of data.
Transaction Batching
----------------------
A batch transaction is an optimized way to send multiple transactions within a single transaction. This allows for a significant increase in efficiency compared to sending each transaction one after the other.
The BundleOnly Parameter
-----------------------------
When sending a transaction as a bundle in Solana, you can specify the "bundleOnly" parameter with the value "true". Here's an example:
use solana-program::account_info;
// Create two account information objects for the sending and receiving accounts
let sender_account_info = account_info::new(
"sender".to_string(),
0,
1, // sending account index
);
let Receiver_account_info = account_info::new(
"receiver".to_string(),
0,
1, // receiving account index
);
// Create a Jito transaction with bundleOnly=true and tip
let jito_transaction = solana_program::transaction::Builder::new()
.set_account_info(sender_account_info)
.set_account_info(receiver_account_info)
.set_tag("Jito Transaction")
.set_tag("BundleOnly=true")
.com_packed_bytes(
solana_program::packed_array::array(
// Add Jito transactions as individual bytes
solana_program::packed_array::new(
account_info::new(
"transaction1".to_string(),
0,
1, // transaction index
),
account_info::new(
"transaction2".to_string(),
0,
1, // transaction index
)
),
)
);
// Send the Jito transaction as a packet
let result = solana_program::program::send_jito_transaction(&jito_transaction);
MeV Protection
-------------------
By default, Solana transactions do not provide MeV (maximum ether) protection. However, you can enable MeV protection for your Jito transaction by adding the mev_protection=trueparameter to the transaction data:
“alma
let jito_transaction = solana_program::transaction::Builder::new()
.set_account_info(sender_account_info)
.set_account_info(receiver_account_info)
.set_tag(“Jito Transaction”)
.set_tag(“PackedOnly=true”)
.com_packed_bytes(
solana_program::packed_array::array(
// Add Jito transactions as individual bytes
solana_program::packed_array::new(
account_info::new(
“transaction1”.to_string(),
0,
1, // transaction index
),
account_info::new(
“transaction2”.to_string(),
0,
1, // transaction index
)
),
// Add MeV protection bytes
solana_program::packed_array::new(
account_info::new(
“mev_protection_bytes”.