SWQoS
Discover a live tip account, submit a signed transaction and check its outcome
Create a team and SWQoS API key in the console.
Use your own Solana RPC provider for reads. Build and sign the transaction in your application, then send the signed transaction to SWQoS. Never send your wallet's private key.
1. Discover a tip account
Call getTipAccounts before constructing the
transaction. Use one of the returned addresses as the destination of a System transfer.
The set can change, so do not hard code it. To tip in USDC, USDT or WSOL instead, see
Tip in tokens.
Set SWQOS_API_KEY to your key. Rust and Go use the
example project; TypeScript uses fetch.
use serde_json::{Value, json};
use swqos_examples::swqos::{Result, required};
#[tokio::main]
async fn main() -> Result<()> {
let response = reqwest::Client::new()
.post("https://sol.zerocopy.sh")
.header("x-api-key", required("SWQOS_API_KEY")?)
.json(&json!({ "jsonrpc": "2.0", "id": 1, "method": "getTipAccounts" }))
.send()
.await?;
let status = response.status();
let body = response.text().await?;
let reply: Value = serde_json::from_str(&body)
.map_err(|error| format!("HTTP {status}: {error}; body: {body}"))?;
if !status.is_success() || reply.get("error").is_some_and(|error| !error.is_null()) {
return Err(format!("HTTP {status}: {reply}").into());
}
println!("{}", serde_json::to_string_pretty(&reply)?);
Ok(())
}The cached discovery helpers provide Rust, Go and TypeScript versions for repeated submissions.
If the list is empty or the service returns not_ready, wait for a fresh list
before you send. A previously returned account may no longer accept tips.
2. Build and sign
Using your Solana RPC provider and transaction builder:
- Fetch a recent blockhash, or prepare the durable nonce your transaction uses.
- Add your application's instructions and a tip transfer to a returned account.
- Use at least the minimum configured for your key. A missing tip reply reports the required amount.
- Sign with every required signer and serialize the completed transaction.
The tip is separate from Solana's transaction and priority fees. The transaction's fee payer must be able to pay those fees. This quickstart uses a transfer inside the transaction, not a declared tip.
3. Submit the signed transaction
Pass the signed transaction to sendTransaction. Rust and Go use the
example project.
use base64::{Engine, prelude::BASE64_STANDARD};
use serde_json::json;
use solana_transaction::versioned::VersionedTransaction;
use crate::swqos::{Result, request};
pub async fn send_signed_transaction(
api_key: &str,
transaction: &VersionedTransaction,
) -> Result<String> {
let wire = wincode::serialize(transaction)?;
request(
"https://sol.zerocopy.sh",
Some(api_key),
"sendTransaction",
Some(json!([
BASE64_STANDARD.encode(wire),
{ "encoding": "base64", "skipPreflight": true }
])),
)
.await
}The response contains the transaction's first signature. Use it to check whether
the transaction landed. These examples use base64 encoding and skip simulation. See the
sendTransaction reference for all options.
For structured refusals, read error.data from the HTTP response as shown in the
JSON-RPC examples. Solana kit can throw on an HTTP error before
exposing the body, and its error code mapping does not preserve every SWQoS reason.
4. Check the outcome
Use your Solana RPC provider's getSignatureStatuses or transaction subscription to
check the returned signature. Do not call read methods on the SWQoS send endpoint.
Confirm at the commitment your application needs. The
confirmation example accepts confirmed or finalized.
An accepted send can fail to land or execute with an error. SWQoS does not resubmit automatically. Check the original signature before replacing an expired transaction or advancing a nonce. See confirmation and retries.
For ordered groups of up to four transactions, use bundles.
For rejected requests, use the structured reason and retryable fields in the
error reference.