Where the API runs
Always use the hostname
api.vulcx.xyz, and don’t hardcode an IP address.
If the API moves or gains regions, the name will keep working and an IP will
not. Changes are announced in Updates.
The marketing site, the portal and these docs are served through CDNs. Only
the API is direct. Latency to
vulcx.xyz says nothing about latency to
api.vulcx.xyz, so measure the API itself (below).Host your server nearby
Any provider with a data centre in or near Amsterdam puts you a few milliseconds from the API. For example:
If your users or your other infrastructure are somewhere else, measure
before choosing (below). Distance dominates: from Southeast Asia, most of a
request’s time is spent crossing to Europe, not inside the API.
Reuse connections
Every new connection pays a TCP handshake and a TLS handshake before the request is even sent. Measured from Vietnam to the API for the same quote:
From a server in Amsterdam, both numbers shrink to a few milliseconds plus
the quote itself. The ratio still holds, though: reuse your connections.
- The SDK uses the platform
fetch. It keeps connections alive by default in Node.js 18+ and in browsers, so you don’t need to do anything. - With your own HTTP client, keep one client or connection pool for the life of the process. Don’t create one per request.
Stream instead of polling
If you track prices for a set of pairs, don’t poll/quote. Subscribe to
/api/v1/stream: the server pushes a fresh quote
when pool state changes, and nothing when it doesn’t. You get changes as
soon as they happen, with no request round trip and no rate-limit cost per
update.
Act inside the quote window
Every quote carries aquoteId:
- It can be redeemed on
/swapor/instructionsforvalidForMs(currently 3 s). - It can be redeemed as a firm price for
firmForMs(currently 400 ms).
Measure it yourself
Run this on the machine that will call the API. It prints the time to connect, to finish the TLS handshake, and to receive the first byte of a real quote:connect is
roughly one network round trip to Amsterdam, and first byte minus tls is
what a reused connection costs per request.
Sending the signed transaction is a separate hop, from your server to the
Fogo RPC you submit through. It isn’t affected by where the Vulcx API runs.