πAchieve Best Performance for Landing a Transaction
To achieve the best performance for landing a singular transaction (landing speed and inclusion rate), your transaction should include a Priority Fee & a Tip.
When calling the submitting endpoint, do NOT use the frontRunningProtection option or there is a good chance that your transaction will be delayed. Make sure your transaction includes a good Priority Fee & a Tip. If you are not Enterprise-Elite or higher tier, your transaction is required to have a bloXroute memo instruction.
In addition, Trader API offers some additional parameters to enhance the propagation of your transactions, like staked connections. Your bloXroute subscription tier will also affect how many channels will be used for propagation, which affects the propagation time.
Follow the steps below for best practice for getting the optimal performance:
Priority fee
Make sure your transaction includes the priory fee by adding computePrice instruction. You can use the Priority Fee Stream to get the current recommended priority fee.
let txn =submit_transaction(&connection,&wallet_signer,// Array of instructions: 0: Set Compute Unit Limt, 1: Set Prioritization Fee, // 2: Do something, 3: Do something else [ComputeBudgetInstruction::set_compute_unit_limit(1_000_000u32), ComputeBudgetInstruction::set_compute_unit_price(1u32),...)?;
tip Instruction
If you want to get the optimal performance you need to include a tip instruction. The Trader API service fee will be determined by the different features you will use (such as stacked connection, on-demand TPUs etc) so make sure to include a high enough tip.
import ("github.com/gagliardetto/solana-go""github.com/gagliardetto/solana-go/programs/system")const (// BloxrouteTipAddress is from here and may fall out of date from time to time. Check our docs:// https://docs.bloxroute.com/solana/trader-api-v2/front-running-protection-and-transaction-bundleBloxrouteTipAddress="HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY")// CreateBloxrouteTipTransactionToUseBundles creates a transaction you can use to when using PostSubmitBundle endpoints.// This transaction should be the LAST transaction in your submission bundlefuncCreateBloxrouteTipTransactionToUseBundles(privateKey solana.PrivateKey, tipAmount uint64, recentBlockHash solana.Hash) (*solana.Transaction, error) { recipient := solana.MustPublicKeyFromBase58(BloxrouteTipAddress) tx, err := solana.NewTransaction([]solana.Instruction{ system.NewTransferInstruction(tipAmount, privateKey.PublicKey(), recipient).Build()}, recentBlockHash)if err !=nil {returnnil, err } signatures, err := tx.Sign(func(key solana.PublicKey) *solana.PrivateKey {if key.Equals(privateKey.PublicKey()) {return&privateKey }returnnil })if err !=nil {returnnil, err } tx.Signatures = signaturesreturn tx, nil}
import { Keypair, PublicKey, Transaction, TransactionInstruction, MessageCompiledInstruction, VersionedTransaction, SystemProgram,} from"@solana/web3.js"// check documentation for latest tip wallet, and how to send tip transactions// https://docs.bloxroute.com/solana/trader-api-v2/front-running-protection-and-transaction-bundleconstTRADER_API_TIP_WALLET="HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY"// createTraderAPIMemoInstruction generates a transaction instruction that places a memo in the transaction log// Having a memo instruction with signals Trader-API usage is requiredexportfunctionCreateTraderAPITipInstruction( senderAddress:PublicKey, tipAmount:number):TransactionInstruction {consttipAddress=newPublicKey(TRADER_API_TIP_WALLET)returnSystemProgram.transfer({ fromPubkey: senderAddress, toPubkey: tipAddress, lamports: tipAmount, })}
from numpy import uint64from solders import pubkey as pkfrom solders import instruction as instfrom solders import transaction as solders_txfrom solders.hash import Hashfrom solders.keypair import Keypairfrom solders.message import Messagefrom solders.pubkey import Pubkeyfrom solders.system_program import transfer, TransferParamsfrom solders.transaction import Transaction# as of 2/12/2024, this is the bloxRoute tip wallet... check docs to see latest up to date tip wallet:# https://docs.bloxroute.com/solana/trader-api-v2/front-running-protection-and-transaction-bundleBloxrouteTipWallet = pk.Pubkey.from_string("HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY")# create_trader_api_tip_instruction creates a tip instruction to send to bloxRoute. This is used if a user wants to send# bundles or wants front running protection. If using bloXroute API, this instruction must be included in the last# transaction sent to the APIdefcreate_trader_api_tip_instruction(tip_amount: uint64,sender_address: Pubkey,) -> inst.Instruction: instruction =transfer(TransferParams( from_pubkey=sender_address, to_pubkey=BloxrouteTipWallet, lamports=int(tip_amount), ) )return instruction
If your language of choice is not included above, you can create an instruction referencing our tip-receiving addresses:
SNS Name
Address
bloxroute.sol
HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY
bloxroute1.sol
95cfoy472fcQHaw4tPGBTKpn6ZQnfEPfBgDQx6gcRmRg
Submit the transaction
Submit your transaction to Trader API using the Submit Endpoint. Make sure frontRunningProtection is set to False.
For best performance and assuming you included a high enough tip and set useStakedRPCs to True
The MOST used submission method. Same as the article explained on this page. This mode gives you the most speed advantage when submitting transactions. This method made full use of our infrastructure.
MEV protected mode
frontRunningProtection: True
Yes. Min: 0.001 SOL
This is a full MEV-protected submission method. Commonly used when the swap transaction has a huge slippage. We utilize Jito bundle for this purpose. However, due to the fact not every validator is a Jito validator, the propagation speed of this method will be relatively slower, especially when there are multiple consecutive leaders are non-Jito validator.
Our backend has been consistently monitoring sandwich activities onchian. We dynamically identify low-risk validators. By using this method, we will propagate to both Jito and bloXroute-identified low-risk validators. This way, your transaction will most likely be MEV-protected while enjoying some level of landing speed escalation.