Relays
The service that signs and submits every message, what it sees, what it is paid, and what happens when one drops a post.
A relay takes a finished message, a proof and a payload, and puts it on chain as a post transaction it signs alone. The writer never signs anything for a message, so no wallet of theirs appears in it. The program pays the relay for every post it carries.
What a relay does#
A relay answers three requests: GET /health, GET /info (its address, endpoint, fee and transaction version) and POST /post. The endpoint is the relay's public URL. A post request holds the proof in base64, the five public inputs and the payload in base64.
Checks the request
The proof must name this relay as its relay input, or the relay answers
RELAY_MISMATCH. The payload must fit a Transaction V1 with the post's accounts, at most 3,408 bytes, or it answersPAYLOAD_TOO_LARGE. The payload's SHA-256 must match the payload hash input, or it answersINVALID_PAYLOAD.Simulates
It builds the
postinstruction, signs a Transaction V1 with itself as fee payer and only signer, and simulates it with signature checks. A refusal from the program comes back as its error, such asUNKNOWN_ROOT,WRONG_DAY,SPENT_NULLIFIERorPROOF_INVALID, and nothing is sent.Submits
It sets the compute limit from the simulation, signs the final transaction and sends it. Until the signature is confirmed it resends the same bytes every two seconds. If the blockhash expires without the transaction landing, it answers
TRANSACTION_EXPIRED, which is retryable.Answers
Once the transaction is confirmed it returns the signature, its own address,
submittedand transaction version1. The SDK then waits for the entry to be indexed before it reports the message as landed.
Errors lists every code a relay returns.
What a relay learns#
It sees the proof, the public inputs, the payload and the network address that handed them over. It does not learn the writer or the reader: the payload is ciphertext with two one-time key slots, and the proof reveals no pass. It cannot change the payload or pass the post to another relay, because the proof is bound to both. The proof covers the binding.
What a relay is paid and what it pays#
- Relay feelamports
- Paid by the
Vaultto the relay inside everypostthat lands. Development default; the live value is inConfigand in the relay'sGET /info.Default
7,500 - Transaction feelamports
- Paid by the relay as fee payer: the base fee for its one signature.
Default
5,000 - Nullifier rentlamports
- Fronted by the relay for the post's
Nullifieraccount, and returned to it when the day is closed.
With the development defaults, a relay keeps 2,500 lamports per post after the base fee.
Fronting the Nullifier's rent#
Every post creates one Nullifier account of 81 bytes, and the relay pays its rent-exempt balance: 1,454,640 lamports on the local validator, 1,061,720 lamports at the mainnet rate. The account records the relay that paid.
close_nullifiers closes the Nullifier accounts of a day once that day is before yesterday, so day D closes from day D + 2, and moves each account's whole balance back to the relay it records. Anyone may call it; Talaria calls it for every finished day. The rent comes back to the relay in full.
The relay list and retries#
The SDK sends through the relay URLs it is given; with none given, it uses the relays GET /relays lists. The SDK takes the relays in turn: each message part starts at the relay after the one the previous part started at, and moves on through the list, wrapping around, when one fails.
A dropped post#
A relay that fails, times out or drops a post costs the writer nothing, because a nullifier is only recorded when a post lands. After any failure the SDK first reads the Log for the part's nullifier:
- Found, with the same payload hash: the post landed after all. The SDK reports it as landed and sends nothing more.
- Not found: it moves to the next relay, reads that relay's address from
GET /info, makes a new proof bound to that relay, and sends the same payload with the same nullifier.
It never takes a fresh counter to settle an uncertain post, so a retry can never spend two of the day's messages on one part. A part still pending when its day ends is looked up in the Log by its old day and nullifier the next time send or retry reaches it: if it landed, it counts as sent; if not, the SDK drops the old attempt and posts the part again on the new day. An error that is not retryable, such as PROOF_INVALID, stops the retry. Errors lists which codes retry.
The relays page#
/relays lists every relay the API knows, from GET /relays: each configured relay that answers its GET /info, and each relay with entries in the Log that does not answer, shown as waiting. For each it shows its address, its endpoint, the posts it has carried today and all time, the SOL it has earned in relay fees, and when it last posted (UTC). It shows the relay fee and the steps to run one.