The Relay Is Not the Bottleneck
An addressed swap costs four to six relay events of about a kilobyte each: request, quote, and best-effort status. Funding, filling, and claiming never touch the relay. Under an aggressive profile (every user swaps twice a day, every swap goes through a relay, and peak traffic is ten times the average):
Concurrent sockets assume connect-on-demand clients: they track active
negotiations — swaps per second times the ~30-second session — not user
count.
Even the 1 M row asks a relay for about 1,400 kilobyte-sized events per
second. On the solver side, one core of a 2-vCPU cloud server runs about 90
verify-decrypt-price-sign cycles per second with the solver’s Nostr library,
one cycle per quote. That covers the 100 k row’s 23 swaps per second; the 1 M
row needs several cores.
What Binds First
Deployment Guidance
Relays
Run dedicated RFQ relays, not general-purpose public ones — the conclusion every production machine-to-machine Nostr protocol reached:- Gate reads and writes with NIP-42 AUTH, and serve a
p-tagged addressed event only to its tagged recipient — this also stops the who-quotes-whom graph from being public. - Require
authors,#p, or#ton every subscription; reject open-ended queries. - Rate-limit per pubkey and source address in the relay’s write policy.
- Run relays under at least two independent organizations, in different regions, mirroring each other. Publish addressed traffic to two or more relays and deduplicate by event id — the working defense against a relay selectively delaying one solver’s quotes to steer flow.
Solvers
- Hold persistent, backoff-managed connections to the transaction stream, and reconcile from the indexer after every gap — the stream replays nothing. Alert on gap-minutes: that is capital at risk, not UX.
- Treat price-cache freshness as a pricing decision. Quote risk scales with feed staleness plus the validity window; shortening either is worth orders of magnitude more than any network optimization (see the arithmetic below).
- Shed load with
rfq_refusal— it is penalty-free and already in the wire. Signed refusals are also attribution: applications can keep per-solver fill and refusal statistics as a selection input. - Refresh price feeds on a timer, never synchronously on an unauthenticated event.
Applications
- Share one connection per relay.
@arkade-os/swapmultiplexes every quote and card fetch in the app over one Nostr socket per relay, and closes that socket 30 seconds after its last use. The protocol needs nothing held open between swaps: replies correlate by RFQ identifier across reconnects, status is best effort, and contract and destination-network evidence is authoritative. - Follow the transport requirements, and deduplicate by event id: multi-relay publication delivers duplicates by design.
- Warm the relay connection when the swap UI opens. A cold cross-continent handshake costs 200–330 ms — the largest avoidable latency in the flow, fixed by connection timing, not server placement.
Co-Location
The answer splits by how the fill is won.Quoted routes: proximity is noise
Every quantity a datacenter removes is 100–1000× smaller than the protocol’s own time constants — validity windows of tens of seconds, price caches of seconds, claim headroom and refund horizons of hours:
The economics agree. A quote is a free option for the user across feed
staleness plus the validity window — roughly 45 seconds at reference
defaults, costing a solver several basis points of break-even spread at
typical BTC volatility. Full co-location trims about 0.2 s of that window,
worth about 0.01 bps. Cutting the price cache from 15 s to 1 s is worth
about 0.8 bps — eighty times more — and tightening the validity window
from 30 s to 10 s another ~1.6 bps. Where proximity matters for pricing, it
is solver to price feed and hedging venue, not solver to relay or user.