πŸš€Transaction Submission

This page explains the bloXroute Trader API transaction(s) submission and how can you optimise your transaction submission.

bloXroute Solana Trader API will propagate transactions only if they are marked with bloXroute memo Instructions. Transactions created with Trader API endpoints will automatically include the bloXroute memo instructions. Searches/Traders can also construct their own transaction and add the bloXroute memo instruction as listed at the button of this page.

API vs. User Generated Transaction

Trader API-generated transaction(s)

Trader API provides multiple endpoints allowing you to construct transactions. A typical workflow will be looked like below:

  1. Create a transaction using one of the Create <xxx> Transaction endpoints (Ex. Create Raydium Swap Transaction) with the desired input.

  2. OPTIONAL. In step #1, add the bloXroute Tip Instruction to the end of the transaction if you want to optimize for speed, front-running protection or multi-transaction bundle submission.

  3. The endpoint returns the raw byte of the unsigned transaction which you need to sign with your private key. Transaction signing function has been provided for each SDK.

  4. Submit the transaction(s) using either the Submit Transaction endpoint or the Submit Transaction Batch endpoint.

User-generated transaction(s)

If you are creating your own transaction, you can still use Trader API to propagate your transaction(s). Your transaction must include the bloXroute memo instruction in order to be accepted.

  1. Construct your own instructions.

  2. Add the bloXroute Memo Instruction to the end of the transaction as listed at the button of this page. * Elite & Ultra tier customers will be exempted if the transaction submitted includes a tipping instruction, to save an instruction in the transaction.

  3. OPTIONAL. Add the bloXroute Tip Instruction to the end of the transaction if you want to optimize for speed, front-running protection or multi-transaction bundle submission.

  4. Submit the transaction(s) using either the Submit Transaction endpoint or the Submit Transaction Batch endpoint.

Controlling Transaction Submission

Trader API offers several parameters to assist you in achieving the best performance, frontrunning protection or cost saving. When submitting a transaction using either the Submit Transaction endpoint or the Submit Transaction Batch endpoint, you can control the following.

  • Submit transaction(s) for optimized performance

  • Submit a singular transaction with front-running protection.

  • Submit multiple transactions as a bundle.

The following diagram explains how Trader API handles a singular transaction submission.

The following diagram explains how Trader API handles a batch transaction submission.

Optimized for speed

When optimizing for speed, you can use two mechanisms to affect the time it takes for your transactions to land on-chain. You can increase the priority fee and/or tip validators for fast inclusion.

AnyCreate <xxx> Transaction endpoints (Ex. Create Raydium Swap Transaction) provide the ability to set a Priority fee in addition to the regular transaction fee. You can expect faster transaction inclusion with higher priority fees (comnputePrice)

In addition to the priority fee, you can also set an additional tip for faster execution (the same Tip instruction used for Front-Running Protection). Even if you are not using the Front-running Protection, you can include a Tip instruction. Trader API will check if an tip instruction is present and route the transaction via Jito RPC as well as directly to the leader.

Front-Running Protection.

When preferring Front-Running Protection over speed, 1st you need to include the tip instruction and 2nd you need to set the parameter'frontRunningProtection' to True when calling the Submit endpoint. Read more about Front-Running Protection.

Submit multiple transactions as a bundle.

Bundles are a list of transactions that execute sequentially and atomically, all-or-nothing. Read more about Transaction Bundle.

To send the set of transactions as a bundle 1st you need to include the tip instruction in the last transaction of your batch and 2nd set the parameter'useBundle' to True when calling the Batch Submit endpoint.

Construct Memo Program Instruction by yourself

If you want to construct your own transactions without using the Trader API endpoints you must include the bloXroute Program Instruction. Our SDKs include hooks for adding this instruction for successful submission:

import "github.com/gagliardetto/solana-go"

// AddMemoToSerializedTxn adds memo instruction to a serialized transaction, it's primarily used if the user
// doesn't want to interact with Trader-API directly
func AddMemoToSerializedTxn(
	txBase64, 
	memoContent string,
	owner solana.PublicKey, 
	privateKeys map[solana.PublicKey]solana.PrivateKey
) (string, error) {}
	
// CreateTraderAPIMemoInstruction generates a transaction instruction that places a memo in the transaction log
// Having a memo instruction with signals Trader-API usage is required
func CreateTraderAPIMemoInstruction(msg string) solana.Instruction {}

If your language of choice is not included above, you can create an instruction referencing program HQ2UUt18uJqKaQFJhgV9zaTdQxUZjNrsKFgoEDquBkcx, with any data as the body. Make sure the memo_content is exactly "Powered by bloXroute Trader Api".

Last updated