Solana: Jito Transaction Bundle only with V2. Parameter?
============================================== ======== ================
Starting with Sola 1.13, you can send more transactions in a single package, as long as certain conditions are met. In this article, we will explore how to use the parameter Bundleonly = true when we send a transaction to Solana.
What is a jito transaction?
------------------------------
A jito transaction is an optimized type of transaction that allows effective and safe transfer on multiple accounts. It was introduced in Sola 1.8 as a substitute for the old "transfer" function. A jito transaction consists of several transactions, each with its own data set.
Package transactions
--------------------
A package transaction is an optimized way to send more transactions to a single transaction. This allows significant efficiency gains compared to sending individual transactions one after another.
Bundleonly parameter
-------------------------
When sending a transaction as a package on Solana, you can specify the "Bundleonly” parameter with a “true” value. Here’s an example:
`Sol
Use solar-program :: account_info;
// create two account information for the sender and receiver accounts
to sender_account_info = account_info :: new (
“sender” .to_string (),
0,
1, // the accounting account index
);
to receive_account_info = account_info :: new (
“Receiver” .to_string (),
0,
1, // the index of the receiver account
);
// create a jito transaction with Bundleonly = True and Type
Either jito_transction = solar_program :: transaction :: builder :: new ()
.Set_account_info (sender_account_info)
.Set_account_info (receiver_account_info)
.Set_tag (“jitotransction”)
.Set_tag (“Bundleonly = TRUE”)
.with_packed_bytes (
Solana_program :: package_array :: array (
// add jito transactions as individual bytes
Solana_program :: package_array :: new (
Account_info :: new (
“transactions1” .to_string (),
0,
1, // transaction index
),
Account_info :: new (
“Transaction2” .to_string (),
0,
1, // transaction index
)
),
)
);
// Send the Jito transaction as a package
LET RESULT = SOLANA_PROGRAM :: Program :: Send_Jito_transact (& jito_transact);
`
MEV protection
------------------
By default, solar transactions do not provide MEV protection (maximum ether). However, you can activate the MEV protection for the jito transaction by adding themev_protection parameter = TRUEto the transaction data:
Sol
Either jito_transction = solar_program :: transaction :: builder :: new ()
.Set_account_info (sender_account_info)
.Set_account_info (receiver_account_info)
.Set_tag (“jitotransction”)
.Set_tag (“Bundleonly = TRUE”)
.with_packed_bytes (
Solana_program :: package_array :: array (
// add jito transactions as individual bytes
Solana_program :: package_array :: new (
Account_info :: new (
“transactions1” .to_string (),
0,
1, // transaction index
),
Account_info :: new (
“Transaction2” .to_string (),
0,
1, // transaction index
)
),
// add bytes of protective mev
Solana_program :: package_array :: new (
Account_info :: new (
“mev_protection_bytes”.