Solana: Jito transaction with bundleOnly=true parameter?

Solana: Jito Transaction Bundle Only with V2. Parameters?

===============================================================

Starting with Solana 1.13, you can send multiple transactions within a single bundle as long as certain conditions are met. In this article, we will explore how to use the bundleOnly=true parameter when sending a transaction in Solana.

What is a Jito Transaction?

——————————

A Jito transaction is an optimized transaction type that allows for efficient and secure transfer of assets between multiple accounts. It was introduced in Solana 1.8 as a replacement for the old “transfer” function. A Jito transaction consists of multiple transactions, each with its own set of data.

Bundled Transactions

Solana: Jito transaction with bundleOnly=true parameter?

———————-

A bundled transaction is an optimized way of sending multiple transactions within a single transaction. This allows for significant efficiency gains compared to sending individual transactions one after the other.

The BundleOnly Parameter

—————————–

When sending a transaction as a bundle in Solana, you can specify the bundleOnly parameter with a value of true. Here is an example:

`sol

use solana-program::account_info;

// Create two account information objects for the sender and receiver accounts

let sender_account_info = account_info::new(

"sender".to_string(),

0,

1, // index of the sender account

);

let receiver_account_info = account_info::new(

"receiver".to_string(),

0,

1, // receiver 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("JitoTransaction")

.set_tag("BundleOnly=true")

.with_compressed_bytes(

solana_program::packed_array::array(

// Aggregate Jito transactions as individual bytes

solana_program::packed_array::new(

account_info::new(

"transaction1".to_string(),

0,

1, // index of transactions

),

account_info::new(

"transaction2".to_string(),

0,

1, // index of transactions

)

),

)

);

// 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 parametermev_protection=trueto the transaction data:

`sol

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”)

.with_compressed_bytes(

solana_program::packed_array::array(

// Aggregate Jito transactions as individual bytes

solana_program::packed_array::new(

account_info::new(

“transaction1”.to_string(),

0,

1, // index of transactions

),

account_info::new(

“transaction2”.to_string(),

0,

1, // index of transactions

)

),

//Add MeV protection bytes

solana_program::packed_array::new(

account_info::new(

“mev_protection_bytes”.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *