Non-Custodial Solana Escrow — a keyless vault where moderators can release funds but never steal them

solana-marketplace-escrow is a non-custodial, arbiter-mediated escrow for
Solana. The escrow vault has no usable private key, so a P2P marketplace
moderator can release funds to a participant but can never steal them.
The escrow where the moderator can't run off with the money.
TypeScript SDK · Anchor PDA program · MCP server · x402 pay-per-use API · browser demo.
▸ Demo: demo/ runs the keyless escrow, atomic swaps, and the
moderator console against real devnet transactions in your browser. There is no
public deployment at the moment (GitHub Pages was never enabled for this repo, so
the previously advertised Pages URL returns 404). Run it locally with
npm install && npm run build && npm run dev -w keyless-escrow-demo, or host the
static demo/dist/ output anywhere. Source:
https://github.com/nirholas/solana-marketplace-escrow
The problem
The naive way to run a marketplace with a human moderator is to hold funds in an
escrow wallet and hand the moderator that wallet's private key so they can pay
out dispute winners. That key can send funds anywhere — one leak, one
compromised laptop, one rogue moderator, and every escrow drains at once. A
Keypair.fromSecretKey(...) escrow is a loaded gun pointed at every user's money.
This is not hypothetical. It's how most "escrow" bots and many marketplace
backends actually work today: a hot key in an environment variable with unlimited
authority over pooled funds.
The insight
You cannot leak a key that does not exist.
Put the funds where no drainable key exists, and reduce the moderator's power
from "move money anywhere" to "pick one of a few outcomes the buyer fixed in
advance." The moderator becomes a referee, not a custodian: they can declare
the winner, but the destinations were set at funding time and cannot be changed.
The safe authorization model, enforced by construction:
| Outcome | Pays | Authorized by | When |
|---|
release:by-buyer | seller | buyer | buyer confirms delivery (happy path) |
release:by-arbiter | seller | arbiter | dispute resolved for the seller |
refund:by-seller | buyer | seller | seller cancels (happy path) |
refund:by-arbiter | buyer | arbiter | dispute resolved for the buyer |
- The buyer can only ever push funds to the seller. Never a self-refund.
- The seller can only ever push funds to the buyer. Never a self-payout.
- The arbiter can pick either party — but can never redirect funds to a
third address, including their own. There is no instruction, in any outcome,
that pays anyone else, and no key to forge a new one.
Three backends, one API
| Backend | Trust model | Needs a deployed program? | Best for |
|---|
presign | keyless by convention (ephemeral key destroyed) | No — runs today, anywhere | Fast integration, zero deploy |
program | keyless by construction (PDA has no key) | Yes — Anchor PDA program | Production / maximal assurance |
custodial | platform-custodial (backend holds keys) | No | Admin/moderator console; master-funded atomic release (the nirholas/atomic pattern) |
The first two are keyless — nobody can steal, not even the platform. The
third, custodial, is the pattern you may actually want for a moderated
marketplace: the platform holds a master wallet (SOL) + each escrow key, and
a moderator releases from a web console — the backend fires one atomic
transaction where the master pays the fee and the escrow key signs the
transfer (the master acting on behalf of the escrow wallet). Moderators hold no
keys. See apps/dashboard and docs/custodial.md.
Verified end-to-end: admin creates an escrow → moderator clicks release → seller paid.