Ghost Labs
What is a relayer, and why do private withdrawals need one?
A relayer is a service that submits a transaction to the blockchain on your behalf and pays the network fee, usually after checking that the transaction follows its rules. Private withdrawals need one because the fresh wallet receiving the funds has no SOL, and sending it SOL from your own wallet would link the two and undo the privacy.
Short answer: The relayer is the fee payer. In Ghost Shield it receives your zero-knowledge proof, checks it, and submits the withdrawal while paying the SOL, so the recipient can hold zero SOL. In Ghost Gas it sponsors everyday USDC sends from prepaid credit. The recipient is bound into the proof, so the relayer cannot redirect funds, but today it is still a trusted party.
The problem a relayer solves
Every Solana transaction must have a fee payer holding SOL (Solana docs). In a shielded pool, the whole point is that the withdrawal goes to an address with no visible history. If that address has to pay its own fee, it needs SOL first, and whoever sends it that SOL becomes visibly connected to it. We explain this leak in How funding a wallet with SOL links your wallets on-chain.
A relayer breaks the deadlock. It signs as the fee payer, so the recipient's wallet does not need to sign or pay anything.
What Ghost's relayer does for Shield
Ghost Labs is the team behind Ghost, an open-source privacy suite for USDC on Solana: Ghost Shield unlinks withdrawals from deposits with zero-knowledge proofs, and Ghost Gas lets wallets with zero SOL send using prepaid USDC credit.
- Shield
- Submit proof
- Gas
- Fee payer
- Limit
- No note secret
For a Shield withdrawal:
- Your browser asks the relayer for the Merkle path of your deposit (
GET /v1/merkle-path/:leafIndex). - Your browser builds a Groth16 proof locally. Your secret never leaves the device.
- It sends the proof, root, nullifier hash, and recipient to the relayer (
POST /v1/withdraw). - The relayer verifies the proof, checks that the root is known and that the recipient in the proof matches the request.
- It submits the withdrawal to the
ghost_poolprogram as fee payer. - The program records the nullifier, pays 0.99 USDC to the recipient, and 0.01 USDC to the treasury.
What Ghost's relayer does for Gas
For Ghost Gas, the relayer:
- verifies top-ups (successful transfer, at most 15 minutes old, exact amount, memo matches the note commitment, never claimed before) and issues gas notes,
- builds sponsored USDC transfers with itself as fee payer,
- checks that only allowlisted instructions are present,
- debits the note for that send's network cost plus a 1–2% platform fee, co-signs, broadcasts, and refunds the debit if broadcast fails.
See What is a gasless transaction on Solana?.
What the relayer cannot do
- Redirect a Shield withdrawal. The recipient is a public input of the proof. A different recipient means a different statement, and the proof fails.
- Withdraw the same note twice. The program creates a nullifier record on-chain, and a second attempt fails.
- Learn your Shield secret. It only sees proofs and public signals.
- Move your tokens on a Gas send without your signature. The token program requires the owner's signature.
What you are trusting it with today
This is the honest part. From our risk disclosure and trust model:
- Shield proof verification is off-chain. The relayer runs the Groth16 check. The program enforces that only the designated relayer can withdraw, but it does not verify the proof itself yet. A malicious or compromised relayer could steal pool funds.
- Gas credit balances are off-chain. A malicious operator could mis-debit notes or refuse service.
- The relayer can refuse service. If it is down, withdrawals and sponsored sends stop.
- The relayer sees metadata. For Gas, it can connect the deposit that funded a note with the wallet that spends it. It also sees IP addresses of requests unless you use a network-level privacy tool.
How this gets better
The roadmap in our litepaper and README includes:
- on-chain Groth16 verification using Solana's
alt_bn128syscalls, and on-chain root history, - a multisig authority and treasury,
- a multi-party trusted-setup ceremony, then an independent audit,
- later, a relayer network and moving gas credit commitments on-chain.
These are plans, not promises, and none has a committed date.
How other projects use relayers
Relayers are standard in privacy pools. Privacy Cash's docs describe a relayer that signs withdrawals and screens deposit addresses, with the client-side proof preventing the relayer from changing the recipient or amount. Fee relayers like Kora do the sponsorship part for general apps.
FAQ
What does a relayer do? It submits a transaction to the network on someone else's behalf and pays the network fee as fee payer, usually after checking that the transaction is valid.
Why do private withdrawals need a relayer? The fresh recipient wallet has no SOL to pay fees, and funding it with SOL would link it to you. A relayer pays the fee so the recipient never needs SOL.
Can Ghost's relayer redirect my withdrawal? No. The recipient is bound into the zero-knowledge proof, so changing it makes the proof invalid.
What do I have to trust the relayer for? Today, Ghost's relayer verifies Shield proofs off-chain and is the only account allowed to submit withdrawals. It also keeps the Gas credit ledger. A malicious or compromised relayer is a real risk.
Will the relayer become less trusted? The roadmap includes on-chain Groth16 verification, on-chain root history, a multisig authority and treasury, and later a relayer network.
Read the code
The relayer is a Fastify service in relayer/ on GitHub. Read the API docs and Shield docs, and start with a small amount in the app.