apex-sender-client is the reference client for Apex. It keeps one persistent QUIC connection per Apex endpoint, authenticates with a client certificate derived from your API key, sends one serialized transaction per stream, and reconnects with 0-RTT when the connection drops.
Install
The crate is coming to crates.io asapex-sender-client. Until it is published, install it from the OrbitFlare GitHub repository:
rpc feature adds the HTTP helpers: getTipAccounts, JSON-RPC sendTransaction, the binary routes, and a blockhash and confirmation helper for any Solana RPC. The QUIC path alone has no HTTP dependency, so leave the feature off if you only need QUIC.
The crate requires Rust 1.92 or newer.
Quick Start
Cargo.toml, see the Rust tab of the Quickstart.
Regions
Region names every Apex endpoint. Region::parse("fra") and Region::code() map to and from the short codes, and Region::ALL lists them.
region.quic_endpoint() returns <code>.apex.orbitflare.com:7001 and region.rpc_url() returns http://<code>.apex.orbitflare.com. See Endpoints and regions.
Transports
The transport does not change priority or routing. The tip does.
API
The client is cheap to
Clone, and clones share one connection. Create it once and hand clones to your tasks.
The crate does not have a bundle helper yet. Send bundles with
sendBundle or POST /send-bundle over HTTP.Options
ClientOptions implements Default, so set only what you need:
Keep-Alive and Reconnects
The connection stays open with a QUIC PING every second, against an idle timeout of 30 seconds on the Apex endpoint. On a warm connection a send is one stream open and one write. If the connection drops:- A background task notices and re-handshakes right away (
proactive_reconnect), so the next send usually finds a live connection. - A reconnect uses a cached session ticket and sends the waiting transaction in the handshake’s first flight (0-RTT). If the endpoint declines the early data, the client resends it after the handshake.
- A send that fails because the connection is gone reconnects and retries once (
auto_reconnect). Set it tofalseto handle that yourself.
health(), reconnects_total(), and zero_rtt_resumptions_total() show what happened. Export them to your metrics.
Errors
The HTTP helpers return
rpc::RpcError: Http for transport failures, Rpc { code, message } for a JSON-RPC or plain HTTP rejection, and BadResponse.
Examples in the Repository
All examples readAPEX_API_KEY, KEYPAIR_PATH (default payer.json), SOLANA_RPC_URL, and optionally APEX_REGION, APEX_QUIC, APEX_RPC, TIP_LAMPORTS, and APEX_TX_VERSION (legacy or v1). Each sends a tipped memo and reports the slot it landed in.
What the Client Does Not Do
- Build or sign transactions, or choose your priority fee.
- Simulate or run preflight checks. Nothing between you and the leader does.