ZeroCopyZeroCopy
SWQoSLocal agent

Local interfaces

Connect HTTP, QUIC or IPC clients to the local agent and handle replies and failures

Choose an interface after installing and starting the agent.

InterfaceAddress in these examplesConfiguration
HTTP and JSON-RPChttp://127.0.0.1:8080listen.http
QUICUDP 127.0.0.1:4433listen.quic
Shared memory IPC/run/zerocopy/agent.socklisten.ipc

Protect local access

Local requests use the executable's license. API key headers, query parameters and QUIC client certificates do not authenticate callers. Keep network listeners on loopback and restrict IPC socket access: anyone who can reach a listener can submit transactions and incur charges on your account.

HTTP and JSON-RPC

Point your client at http://127.0.0.1:8080, or your configured listen.http address. Use the hosted JSON-RPC and HTTP request formats.

Reuse connections

The listener supports HTTP/1.1 and cleartext HTTP/2. HTTP/1.1 connections close after 60 idle seconds; reconnect as needed. The agent does not apply the hosted HTTP connection limit per source IP.

Choose a method or route

Use sendTransaction for one transaction or sendBundle for an ordered group. Fetch current tip accounts, or token accounts for token tips, locally before constructing a transaction. Use a hosted endpoint for the tip floor and a separate Solana RPC provider for chain state.

The local method reference defines query replies and the differences from hosted requests.

Request preflight

Set skipPreflight: false to request simulation. Check the local preflight rules before choosing simulation options.

Query the tip floor remotely

Call getTipFloor on a hosted endpoint with your API key.

Tip in tokens or through lookup tables

Fetch token accounts locally with getTipTokenAccounts. It returns the same entries as the hosted method, and an empty array before the agent receives routing information.

The agent checks SOL tips to static account keys itself. When that SOL tip is below your key's minimum and the transaction also carries a token tip to a listed token account, or a tip transfer whose recipient comes from an address lookup table, the agent has the region value the tip first. It sends to leaders directly only after the region accepts, which adds the region's round trip. A send without a reply goes through the region only. Bundles always go through the region.

The agent relays the region's refusal unchanged, such as missing_tip, or not_ready with waiting_for: token_price or lookup_table. Agent releases that predate token tips refuse these transactions locally with missing_tip; the agent updates automatically.

Send through local HTTP

Fetch the current tip accounts:

src/bin/local_tip_accounts.rs
use swqos_examples::swqos::{Result, request};

#[tokio::main]
async fn main() -> Result<()> {
    let accounts: Vec<String> =
        request("http://127.0.0.1:8080", None, "getTipAccounts", None).await?;
    println!("{}", serde_json::to_string(&accounts)?);
    Ok(())
}

Set TX_BASE64 to a signed transaction encoded as base64 with a qualifying tip. The result is its first signature.

src/bin/local_send_transaction.rs
use serde_json::json;
use swqos_examples::swqos::{Result, request, required};

#[tokio::main]
async fn main() -> Result<()> {
    let signature: String = request(
        "http://127.0.0.1:8080",
        None,
        "sendTransaction",
        Some(json!([required("TX_BASE64")?, { "encoding": "base64" }])),
    )
    .await?;
    println!("{signature}");
    Ok(())
}

These functions take a transaction your application has already signed:

src/send_through_agent.rs
use base64::{Engine, prelude::BASE64_STANDARD};
use serde_json::json;
use solana_transaction::versioned::VersionedTransaction;

use crate::swqos::{Result, request};

pub async fn send_through_agent(transaction: &VersionedTransaction) -> Result<String> {
    request(
        "http://127.0.0.1:8080",
        None,
        "sendTransaction",
        Some(json!([
            BASE64_STANDARD.encode(wincode::serialize(transaction)?),
            { "encoding": "base64", "skipPreflight": true }
        ])),
    )
    .await
}

Fetch blockhashes and check outcomes with your separate Solana RPC provider.

QUIC

Connect to UDP 127.0.0.1:4433, or your configured listen.quic address. Use the hosted QUIC payloads and replies with the local connection settings below.

Connection settings

Use the local QUIC connection settings. Send keep alive pings to hold a quiet connection open.

Accept the local certificate

Use localhost as the server name and configure your client to accept the agent's changing self signed certificate. If your library requires disabling certificate verification, restrict that exception to the loopback listener. Keep verification enabled for hosted endpoints.

Choose streams with replies

Use bidirectional streams for a transaction or bundle when you need acceptance and rejection details. Transaction preflight runs at processed commitment. Unidirectional streams carry transactions or bundles without replies; a refusal drops the submission without notice. Use replies while integrating.

Follow the QUIC reference for stream kinds, flags and framing, and its reply codes for decoding results. Local acceptance and rejection guidance below applies to those replies.

IPC

Use IPC to submit through shared memory on the same Linux host. The Rust, Go and TypeScript clients send one transaction, request a reply, wait up to five seconds and exit. They do not construct or sign the transaction. The standalone C client is also available.

Prepare the client

Run the agent with an explicit listen.ipc path. Give your application account socket access, then restart the application after any group change.

Prepare a signed transaction with a valid blockhash and the required tip. Fetch current tip accounts through the agent's getTipAccounts method.

Download and build the example

For Rust, Go or TypeScript, use the complete IPC clients and runtime requirements. They implement the handshake and ring protocol described there. To use the C client instead:

Download swqos-ipc-send.c

Build it on Linux x86_64 with GCC or Clang:

Build the IPC example
cc -std=c11 -O2 -Wall -Wextra -o swqos-ipc-send swqos-ipc-send.c

Connect and submit

Save the signed transaction's raw wire bytes in a file. If you have base64 text, decode it first:

Submit signed bytes over IPC
base64 --decode signed-transaction.b64 > signed-transaction.bin
./swqos-ipc-send /run/zerocopy/agent.sock signed-transaction.bin

Use your configured socket path if it differs. Run as an account with socket access.

Send other submissions

The example requests a reply without preflight. Custom clients can send bundles, request transaction preflight or declare a tip. Arrange declared tips with support before using them.

Follow the IPC submission reference and payload envelope reference for record kinds, flags and payloads. Request replies while integrating so your client can report refusals.

Read the reply

An accepted transaction prints:

code 0

The example exits with status 0 only for an accepted reply. For a refusal, it prints a nonzero reply code and any JSON error detail, then exits with status 1. Use the detail's reason to find the cause in Errors.

Long running clients must keep draining completions, match them by request ID rather than arrival order and set a timeout for every request.

Reconnect after a restart

An agent stop or automatic update closes the IPC session. Open a new socket and repeat the handshake. Do not reuse an old mapping or automatically replay requests with unknown outcomes.

For connection failures and missing completions, see operations troubleshooting. Custom clients must follow the record and ring rules.

Interpret acceptance

An accepted reply means the agent accepted the request for forwarding. Check its signature through your Solana RPC provider to determine whether it landed.

The agent does not keep resubmitting after it answers. A timeout, disconnection or rejection can leave the outcome uncertain. Failover may send the same bytes more than once. Check the signature before sending a replacement; see Confirmation.

Handle rejections

Rejections use the shared error format.

ReasonAction
missing_tipMeet your key's minimum with a current tip account, token account or enabled declaration
not_ready, waiting_for: tip_vaultsFetch tip accounts again shortly
not_ready, waiting_for: token_price or lookup_tableRetry shortly, or tip in SOL to a static tip account
not_ready, waiting_for: upstreamCheck network access and service logs
forward_failedCheck the signature before retrying

The agent may already have sent a transaction directly to a leader when an edge refuses it. A rejection does not prove that the transaction was never forwarded.