Quickstart
Devnet, from a clean checkout. Node 22.13 or later, pnpm 11, a free Helius API key, devnet SOL and devnet USDC. Every command runs from the repo root. Nothing here touches mainnet; a mainnet RPC URL or MAINNET_ENABLED=true makes every devnet path refuse to start.
git clone https://github.com/ivanmolto/wakeless.git && cd wakelesspnpm install && pnpm buildcp .env.example .envSet HELIUS_API_KEY in .env; the other values have working defaults. Then the keys and the funds:
pnpm keyspnpm airdroppnpm keys writes six devnet keypairs under keys/ (gitignored: buyer, escrow, three vendors, the facilitator's receipt signer) and prints their public keys. pnpm airdrop requests 1 SOL for the buyer, the escrow and the three vendors and prints the buyer's USDC token account; when the RPC's faucet is closed it says so and names https://faucet.solana.com. Send devnet USDC from https://faucet.circle.com (network Solana Devnet) to the buyer and to each of the three vendors. Then move funds into the rollup: the buyer's private balance pays the channel deposits (0.6 USDC for one pnpm e2e run), and the escrow and each vendor need one private deposit of their own before the enclave will accept a transfer to them (onboarding; shielded_binding_rejected with the rail's code TEE_INGRESS otherwise). Each of these is one public base-layer transaction naming the wallet and the vault, and the watcher lists it as such.
pnpm fund:private --role buyer --usdc 1pnpm fund:private --role escrow --usdc 0.01pnpm fund:private --role vendor1 --usdc 0.01 && pnpm fund:private --role vendor2 --usdc 0.01 && pnpm fund:private --role vendor3 --usdc 0.01pnpm tokenspnpm tokens writes the facilitator's admin token and one receipt token per vendor into .env. Now the checks and the loop:
pnpm testpnpm e2epnpm test is the unit suite (no network). pnpm e2e runs the facilitator and the three vendors in process over the real attested MagicBlock rail and pays thirty requests, ten per vendor: three private channel deposits, twenty-seven vouchers, then a table, and it exits non-zero unless base-layer transactions per request is below 0.2 and every emitted signature passes the watcher's four checks. The 8 Nov 2026 run: 30 served, 3 deposits, 0 base-layer transactions, watcher pass. It writes the attestation reports to docs/attestation-client.json and docs/attestation-facilitator.json.
To run the services and pay from an agent, in two terminals:
pnpm --filter @wakeless/facilitator startpnpm vendorsThe facilitator attests the TEE first and listens on 127.0.0.1:4020 (ready, not attestation_failed); the vendors listen on 4021, 4022 and 4023. curl -i http://127.0.0.1:4021/price/SOL answers a 402 with the shielded accepts[] entry. The buyer agent is the MCP server in packages/mcp-server: the repo's .mcp.json configures it for Claude Code with get_price, get_sentiment and get_news, each paying its vendor through @wakeless/client under caps of 0.05 USDC per payment and 1 USDC per rolling day. docs/runs/run-3.md is a recorded run: a fresh claude -p session, given "build a short market view for three symbols", made 9 paid requests with 3 deposits and 0 base-layer transactions, and its three deposit signatures pass the watcher's four checks (docs/shots/watcher-output.txt); scripts/agent-run.md is the runbook. Without an agent, pnpm client:20 pays twenty requests through the client.
Redemption, receipts and the observer:
curl -s -X POST -H "Authorization: Bearer $FACILITATOR_ADMIN_TOKEN" http://127.0.0.1:4020/admin/redeempnpm vendor:receipts --vendor 1pnpm watcherThe redemption worker pays each vendor what it is owed, net of the 0.1% privacy fee, as one private transfer per channel, every REDEEM_INTERVAL seconds and on POST /admin/redeem, and signs a receipt per period. pnpm vendor:receipts fetches vendor 1's receipts under its token, verifies the facilitator's signature on each, and asks the rail under the vendor's own login whether each transfer landed. pnpm watcher reads the recorded signatures of both rails from devnet, runs the four checks and reconstruct(), and writes docs/WATCHER.md. pnpm side-by-side regenerates docs/side-by-side.md by driving both rails (it needs the public rail's example checkout under vendor/x402 and a funded public payer). A channel close (pay.close(channelId) in the client: the vendor is paid its watermark, the rest returns to the buyer's private balance as a private transfer) is exercised by pnpm test:devnet, which runs every devnet-tagged test serially and spends from the private balances.
| Package | What it is |
|---|---|
packages/scheme | Types, voucher, channel id, watermark and error codes of the scheme; pure functions |
packages/binding | The SettlementBinding, BuyerBinding and PayeeBinding interfaces |
packages/binding-magicblock | The binding over the Private Payments API and the devnet TEE; the only package that imports the primitive |
packages/facilitator | /supported, /verify, /settle, the redemption worker, receipts, close |
packages/vendor | The seller middleware x402Shielded; src/terms/ is the flagged relationship-terms layer |
packages/vendors | Three synthetic data servers and the vendor's receipt reader |
packages/client | wrapFetchWithWakeless, pay.close, and the wakeless fund command |
packages/mcp-server | The buyer agent's MCP server with the owner's caps |
packages/watcher | The observer, reconstruct(), the owner's view and the leakage indexer; web/ is the page |
Install the packages
From npm, outside this repo (0.1.0-alpha.0, ESM only, Node 22 or later):
npm install @wakeless/scheme@0.1.0-alpha.0
npm install @wakeless/binding@0.1.0-alpha.0
npm install @wakeless/binding-magicblock@0.1.0-alpha.0 @wakeless/binding@0.1.0-alpha.0 @solana/kit@8.6.0
npm install @wakeless/client@0.1.0-alpha.0 @wakeless/binding@0.1.0-alpha.0
npm install @wakeless/vendor@0.1.0-alpha.0 hono@4.13.14