Base URL
GET /v1/info returns the gateway’s identity. On devnet:
Read these values from
/v1/info rather than hardcoding them: RequestAuth and the x402 memo both bind the program ID and the Gateway PDA.
Endpoints
The same gateway also serves the Molpha Data routes under
/v1/data. They have their own reference: see Molpha Data.
Every round, signed or failed, is also reported to the public round archive, where you can look a round up by its roundId.
Requests
A round request names a source by itssource document, a quorum (signaturesRequired) and the current registryVersion. You never send a timestamp, and a sourceId is optional (a cross-check):
- The gateway, SDK and nodes each derive the
sourceIdfrom thesource; the gateway answers400if asourceIdyou send differs from its own. See Source ID. registryVersionmust equal the current on-chain version; a stale one gets400.signaturesRequiredmust be at least the protocol minimum (3 on devnet) and at most the current node count (5 on devnet).- A source that reads a chain is accepted only for a chain this gateway has enabled and only with a
finalityandlagMsinside that chain’s bounds; anything else gets400naming the field. See Chain data sources. requireProviderasks for a round that the source’s data provider also signs. No provider signer is registered on the devnet deployment yet, so such a request is400there.
Round timing
The gateway stamps each round after admitting it (after verifying the payment, on the x402 route). The timestamp is unix milliseconds on a fixed 100 ms grid,floor(nowMs / 100) * 100 from the gateway’s clock, and is returned in data.attestation.payload.timestamp. The 100 ms tick is a protocol constant: it is not configuration and /v1/info does not report it. See Round timing.
- One round per feed per tick. A feed is a source, a quorum and a registry version. Requests for one feed inside one tick share one round ID: the nodes run the round once and every caller gets the result. Each caller still spends its own quota unit or payment.
- One request per consumer per tick. A second request by the same consumer (or x402 payer) for the same source and quorum in the same tick is
409, with nothing reserved or spent. Retry one full tick later (100 ms plus a small jitter). Do not compute tick boundaries from your own clock. - No idempotency key. A retried request is a new round and spends another quota unit or needs another payment.
Authentication
RequestAuth
POST /v1/round/execute carries subscriptionOwner, consumerAuthority (the owner itself or one of its delegates), authTimestamp and authSig, an Ed25519 signature by consumerAuthority over:
authTimestamp is unix seconds. The gateway rejects it with 401 when it is further from its clock than requestAuthWindowSeconds (see /v1/info; 60 on devnet). Sign a fresh one for every attempt, including a retry after 409. RequestAuth is checked before any chain read, so a request that cannot authenticate costs nothing. It only authorizes use of the subscription: it is not part of the round ID, the signed message or any payment.
Sign-in sessions
Instead of RequestAuth, a caller can sign in once with its wallet (Sign-In-With-X in its Solana form, SIWS) and sendAuthorization: Bearer <token>. Sessions are available when GET /v1/info reports sessionAuth: true; otherwise the /v1/session routes answer 404.
GET /v1/session/challenge?address=<wallet>[&owner=<owner>]returns the message to sign (data.message) and its terms (data.info). A delegate must name itsowner.- Sign the message’s UTF-8 bytes with the wallet (Ed25519). It is a message, not a transaction.
POST /v1/sessionwith aSIGN-IN-WITH-Xheader: base64 JSON of theinfofields plusaddress,chainId,type: "ed25519",signatureScheme: "siws"and the base58signature. It answers201withdata.tokenanddata.expiresAt.- Send
Authorization: Bearer <token>onPOST /v1/round/execute, with noauthSigorauthTimestamp. Sending both is400. GET /v1/sessionshows the subscription and this term’s usage.DELETE /v1/sessionsigns out.
sessionTtlSeconds), at most 60 minutes on request (sessionMaxTtlSeconds), and never past the subscription term; a challenge must be exchanged within 5 minutes (sessionChallengeTtlSeconds). A token identifies the caller only: the subscription and delegate are read from chain (through a cache of a few seconds) on every round, exactly as with RequestAuth. The hosted MCP server and the web app at https://app.molpha.io use this flow.
x402
POST /v1/x402/execute takes no RequestAuth and no session: the payment is the authorization. See x402 pay-per-request.
Admission
- Capacity. The gateway runs at most
maxInflightRoundsrounds at once (see/v1/info; 200 on devnet), with a short queue for bursts. Beyond that it answers503withRetry-Afterbefore reading the request, so nothing is reserved or spent. A client that drives many feeds should keep its own concurrency near this number. - Per-consumer rate. The gateway can cap the request rate of each authenticated consumer key on
POST /v1/round/execute; over it, the answer is429withRetry-After. It is checked after RequestAuth, so nobody can spend another key’s allowance. - Subscription rounds need an active subscription, a quorum within the subscription’s
max_signers, and remaining quota. Quota is counted per 30-day term across the owner and its delegates, and a delegate’s rounds also count against its ownmax_data_requests. A round that fails after it is reserved gives its unit back. See Subscriptions. - x402 rounds need a verified payment of the quoted price to the protocol treasury. See x402 pay-per-request.
Response
Both execute routes return200 with data.attestation:
payload:value,sourceId,registryVersion,signaturesRequired,timestamp(unix ms)signature:signature,commitment,signersBitmap
roundId: the round’s ID, shared by every request for the feed in that tick. Look it up in the round archive.value: the decimal rendering ofpayload.value(not signed).valuePreimage: for a source with akeccak256output, the bytes that were hashed. The response is their only copy.outcomeandreason: for a source with a policy,conclusive, orfallbackwith the INCONCLUSIVE reason code. The label is not signed; what you can rely on is the signed value compared with the source’s declared fallback.
PAYMENT-RESPONSE header. Field meanings are in Rounds and attestations.
Status codes
Errors are JSON,{"error": "<message>"}, except 402, whose body is the x402 payment-required object.
409, 429 and the capacity 503 are answered before anything is reserved or spent. Any other retry is a new round that spends quota or a payment again.