Skip to content
TX Landing / Transaction submission / QUIC

QUIC

Send transactions over QUIC on UDP port 9000, one unidirectional stream per transaction.

quic.md
Setting Value
Address <host>:9000, UDP, from Endpoints
ALPN solana-tpu
Server name soyas-landing (the relay does not check it)
Client certificate X.509, self-signed is fine, whose public key is your API key’s Ed25519 public key; handshake signed with Ed25519
Server certificate Self-signed; its DER SHA-256 is quic.tlsCertSha256 in endpoints.json. The relay does not require you to verify it.

Your API key, from the dashboard, is never sent over QUIC: your client makes the certificate from it and signs the handshake with its secret key. The relay checks no certificate authority, only the key.

use anyhow::Context as _;
use quinn::{crypto::rustls::QuicClientConfig, ClientConfig, Connection, Endpoint, IdleTimeout, TransportConfig};
use solana_sdk::signature::Keypair;
use solana_tls_utils::{new_dummy_x509_certificate, SkipServerVerification};
use std::{net::ToSocketAddrs as _, sync::Arc, time::Duration};
const ALPN: &[u8] = b"solana-tpu";
const SERVER_NAME: &str = "soyas-landing";
const KEEP_ALIVE: Duration = Duration::from_secs(25);
const IDLE_TIMEOUT: Duration = Duration::from_secs(30);
// addr: "fra.landing.soyas.xyz:9000". api_key: the base58 keypair from the dashboard.
async fn connect(addr: &str, api_key: &str) -> anyhow::Result<Connection> {
let _ = rustls::crypto::ring::default_provider().install_default(); // rustls needs one per process
let (cert, key) = new_dummy_x509_certificate(&Keypair::from_base58_string(api_key));
let mut crypto = rustls::ClientConfig::builder()
.dangerous()
.with_custom_certificate_verifier(SkipServerVerification::new()) // the relay's certificate is self-signed
.with_client_auth_cert(vec![cert], key)?;
crypto.alpn_protocols = vec![ALPN.to_vec()];
let mut transport = TransportConfig::default();
transport.keep_alive_interval(Some(KEEP_ALIVE));
transport.max_idle_timeout(Some(IdleTimeout::try_from(IDLE_TIMEOUT)?));
let mut config = ClientConfig::new(Arc::new(QuicClientConfig::try_from(crypto)?));
config.transport_config(Arc::new(transport));
let mut endpoint = Endpoint::client("0.0.0.0:0".parse()?)?;
endpoint.set_default_client_config(config);
let addr = addr.to_socket_addrs()?.next().context("address not resolved")?;
Ok(endpoint.connect(addr, SERVER_NAME)?.await?)
}
// One stream per transaction. tx: its wire bytes (bincode::serialize(&tx)?).
async fn send(conn: &Connection, tx: &[u8]) -> anyhow::Result<()> {
let mut stream = conn.open_uni().await?;
stream.write_all(tx).await?;
stream.finish()?;
Ok(())
}

One stream carries one transaction in Solana’s wire format; the relay reads it to its end. Bidirectional streams are not allowed. One QUIC datagram also carries one transaction.

Open one persistent connection per endpoint and reuse it. Finish every stream you open: an unfinished stream has already used one transaction of your rate limit.

Nothing: no acknowledgment, no signature, no error. A stream your client wrote and finished only means the bytes were handed to QUIC. For an answer per transaction, use HTTP.

Case What your client sees
Certificate key not Ed25519, or a bad handshake signature The TLS handshake fails.
No client certificate, or a key the relay does not know The handshake completes, then the connection is closed with application error code 0 and reason NotWhitelisted.
Too many open connections for your key The oldest connection is closed with application error code 0 and reason TooManyConnections.
Key removed or disabled while connected The connection stays open and every transaction on it is dropped; a restored key works again on the same connection.
Transaction empty, unparseable, without signature or signer, over a limit below, without a tip, or over your rate limit Dropped, without a word.
Limit Value
Connection Reuse one persistent connection per endpoint
Stream length 8192 bytes
Legacy and v0 transaction 1232 bytes
v1 transaction 4096 bytes
Transactions per second Your account’s rate limit, per endpoint, shared with HTTP; a stream counts when accepted, before it is read
Idle timeout 30 s. The relay sends no keep-alives: send your own more often (the code above uses 25 s).