ZeroCopyZeroCopy
ReferenceJSON-RPC

sendTransaction

POST
/

Submit one signed transaction with sendTransaction, choose encoding and preflight options, and handle refusals.

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. The transaction must meet the size limits and your key's tip requirement; each submission counts against the send rate. Read the blockhash from your Solana RPC provider.

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*"sendTransaction"
Value in"sendTransaction"
params*array<|>

The signed transaction followed by an optional options object.

Items1 <= items <= 2

Response Body

Returns the transaction's first signature in base58. Confirm landing through your Solana RPC provider. A duplicate can return the same signature without being sent again.

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

  • invalid_request: invalid call; problem names the cause.
  • malformed: invalid transaction, tip sum overflow (tip_overflow) or paid tip above 2 SOL (tip_too_large); problem names the cause.
  • too_large: size limit exceeded; limit and size are bytes.
  • unsigned: first signature is all zeros.
  • signature_count: signatures do not match required signers.
  • missing_tip: tip below the minimum without a usable declaration.
  • credit_exhausted: declared tip credit unavailable.
  • simulation_failed: preflight returned an error; Solana's fields are in data.
application/json
  1. response
jsonrpc*"2.0"
Value in"2.0"
result*string

The base58 encoding of the transaction's first signature.

id*||

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

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

#[tokio::main]
async fn main() -> Result<()> {
    // A fully signed transaction in wire format, from your signing flow.
    let bytes = tokio::fs::read(required("SIGNED_TX_FILE")?).await?;
    let transaction: VersionedTransaction = wincode::deserialize(&bytes)?;
    let signature: String = call(
        "sendTransaction",
        Some(json!([
            BASE64_STANDARD.encode(wincode::serialize(&transaction)?),
            { "encoding": "base64" }
        ])),
    )
    .await?;
    println!("{signature}");
    Ok(())
}
Example response
{
  "jsonrpc": "2.0",
  "result": "BASE58_SIGNATURE",
  "id": 1
}