ZeroCopyZeroCopy
ReferenceJSON-RPC

sendBundle

POST
/

Submit one to four signed transactions as one bundle for delivery through block engines.

Authorization

headerx-api-key<token>

Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.

Request Body

One JSON object using the shared request conventions. Submit one to four fully signed transactions in execution order, each with a distinct first signature. Each member must meet the size limits; the bundle must satisfy the tip and rate rules. Bundles have no preflight simulation.

Control accounts

SWQoS recognizes these base58 address prefixes among a transaction's static keys:

ControlRecognized when
jitodontfrontAny static account address starts with it, or the first account of the first Compute Budget instruction starts with it
dontfrontThe first account of the first Compute Budget instruction starts with it
dontbund1eThe first account of the first Compute Budget instruction starts with it

A transaction carrying any recognized control must be first, and at most one member may carry controls. With dontbund1e, later members may call only the System, Compute Budget and Memo programs, and the Token Program for Transfer and TransferChecked, as in a token tip.

A violation returns bundle_control with a zero based index and a rule of first_only, one_only or default_programs_only. Controls can narrow which engines can accept the bundle and raise the minimum tip. SWQoS checks them at admission only; they do not govern transactions submitted outside your bundle.

application/json
  1. body
jsonrpc*"2.0"
Value in"2.0"
id?||

Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.

method*"sendBundle"
Value in"sendBundle"
params*array<array<>|>

The array of transactions followed by an optional options object.

Items1 <= items <= 2

Response Body

Returns a 64 character lowercase hex bundle ID after accepting the bundle for delivery. Confirm each signature through your Solana RPC provider. SWQoS has no bundle status method, and its bundle ID cannot query a block engine's status.

Refusals with HTTP 200, by error.data.reason:

  • invalid_request: invalid call.
  • bundle_size: outside 1 to 4 transactions; count and limit.
  • malformed: invalid member, repeated signature (duplicate_signature), tip sum overflow (tip_overflow) or paid tip above 2 SOL (tip_too_large); index identifies a repeated or invalid member.
  • too_large: member exceeds a size limit; index identifies it.
  • unsigned: member is unsigned; index identifies it.
  • signature_count: member signature mismatch; index identifies it.
  • bundle_control: control account rule broken; index and rule.
  • missing_tip: below your or the engine minimum; minimum applies.
  • credit_exhausted: declared tip credit unavailable.
application/json
  1. response
jsonrpc*"2.0"
Value in"2.0"
result*string

SHA-256 of the members' first signatures, concatenated in order as raw 64-byte values. Not a block engine's status id.

Match^[0-9a-f]{64}$
Length64 <= length <= 64
id*||

Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.

Example request
// Builds on the example project (/reference/json-rpc#example-project).
use base64::{Engine, prelude::BASE64_STANDARD};
use serde_json::json;
use swqos_examples::swqos::{Result, SwqosError, call};

#[tokio::main]
async fn main() -> Result<()> {
    let mut transactions = Vec::new();
    for file in std::env::args().skip(1) {
        transactions.push(BASE64_STANDARD.encode(tokio::fs::read(file).await?));
    }
    match call::<String>(
        "sendBundle",
        Some(json!([transactions, { "encoding": "base64" }])),
    )
    .await
    {
        Ok(bundle_id) => println!("accepted {bundle_id}"),
        Err(error) => {
            let rejection = error
                .downcast_ref::<SwqosError>()
                .and_then(|error| error.rejection.as_ref());
            if let Some(rejection) = rejection {
                eprintln!("{} {}", rejection.reason, rejection.message);
            } else {
                return Err(error);
            }
        }
    }
    Ok(())
}
Rust (bundle ID)
Rust (bundle ID)
// Builds on the example project (/reference/json-rpc#example-project).
use std::fmt::Write;

use sha2::{Digest, Sha256};
use solana_transaction::versioned::VersionedTransaction;

use crate::swqos::Result;

pub fn bundle_id(wire_transactions: &[Vec<u8>]) -> Result<String> {
    let mut hash = Sha256::new();
    for wire in wire_transactions {
        let transaction: VersionedTransaction = wincode::deserialize(wire)?;
        let signature = transaction
            .signatures
            .first()
            .ok_or("transaction has no signature")?;
        hash.update(signature.as_ref());
    }
    let mut id = String::with_capacity(64);
    for byte in hash.finalize() {
        write!(&mut id, "{byte:02x}")?;
    }
    Ok(id)
}
Example response
{
  "jsonrpc": "2.0",
  "result": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "id": 1
}