sendTransaction
Submit one signed transaction with sendTransaction, choose encoding and preflight options, and handle refusals.
x-api-key<token>Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.
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- body
jsonrpc*"2.0""2.0"id?||Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.
method*"sendTransaction""sendTransaction"params*array<|>The signed transaction followed by an optional options object.
1 <= items <= 2Returns 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;problemnames the cause.malformed: invalid transaction, tip sum overflow (tip_overflow) or paid tip above 2 SOL (tip_too_large);problemnames the cause.too_large: size limit exceeded;limitandsizeare 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 indata.
application/json- response
jsonrpc*"2.0""2.0"result*stringThe 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.
// 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(())
}{
"jsonrpc": "2.0",
"result": "BASE58_SIGNATURE",
"id": 1
}