Developers

Build on Qloak

Two Solana programs, two small HTTP APIs and a TypeScript SDK that checks every request before anything is signed. Everything below runs on the Qloak test network today.

Overview

Qloak has two independent parts that share one wallet:

PartOn chainOff chain
Private balanceThe qsafe-vault program holds USDC. Deposits create a receipt; payouts need the operator's signature.A PostgreSQL journal (append-only, every event balances to zero) records balances and sends. A settlement worker releases withdrawals.
Protected vaultThe qsafe-quantum-vault program stores each account's ML-DSA-44 public key and verifies the owner's and the operator's ML-DSA-44 signatures before releasing SOL or USDC.A service prepares plans for the client to review and sign, and a worker uploads proofs and submits releases.

Run it locally

One command starts the whole stack: an embedded PostgreSQL, the Qloak test chain with both programs loaded, the two services and this site.

# Node 20+, Rust toolchain for the programs and the test chain
npm install
npm run testnet:build      # builds the local Solana test chain
npm run local              # keys, database, chain, setup, services, site on :5450
node local/smoke.mjs       # end-to-end check through the site gateway

Local keys are created under ~/.config/solana/qsafe/local on first run. They are test keys for the test network only.

Addresses

Live from /api/deployment. Clients compare the services' configs with these before they sign anything.

Loading…

SDK

The same clients this site uses. Each one re-derives what the service asks it to sign (amounts, recipients, addresses, expiry) and refuses if anything differs from the review.

import { PaymentClient, QuantumClient, RecoveryKey, SOL_ASSET } from "qsafe";

// private balance: any wallet with signMessage + signTransaction
const pay = new PaymentClient(deployment, transport, wallet);
await pay.deposit("100000000");                        // 100 USDC in
await pay.payment("send", recipient, "25000000");       // private, instant
await pay.payment("withdraw", address, "10000000");   // released on chain

// protected vault: an ML-DSA-44 key that never leaves the client
const vault = new QuantumClient(config, transport);
const key = RecoveryKey.generate();
const { policy } = await vault.enroll(key, wallet.address());
await vault.signIn(key, policy);
await vault.deposit(SOL_ASSET, "500000000", wallet);
await vault.payment(key, "withdraw", address, SOL_ASSET, "200000000");
await vault.recover(key, policy, newWallet, RecoveryKey.generate());

Backups use the format qsafe-pq-v1:<seed>:<checksum>: a 32-byte seed in base64url and the first 8 bytes of its SHA-256.

Payments API

Served under /api/pay on this site. Sessions start with a wallet signature; the gateway keeps the session token in an HttpOnly cookie.

RouteWhat it does
GET /v1/qsafe/configProgram, config, asset, signing domain, fees and capabilities.
POST /auth/wallet-login/challengeA sign-in message for a wallet. Signing it sends nothing.
POST /auth/wallet-login/verifyChecks the signature and opens a session.
GET /v1/qsafe/balancesPrivate and reserved balance for the session's wallet.
GET /v1/qsafe/operationsThe wallet's last 50 deposits, sends and withdrawals.
POST /v2/deposits/build · submit · observeBuilds the deposit transaction, takes it back signed, and credits it once it lands.
POST /v2/intents · /v2/intents/executePrepares a send or withdrawal for review, then executes the signed authorisation.

Vault API

Served under /api/vault. Sessions start with an ML-DSA-44 signature from the account's key.

RouteWhat it does
GET /v3/configProtocol version, signature suite, program, config and enabled assets.
POST /v3/enrollment/prepare · completeUploads the public key on chain and registers the account with the key's signature.
POST /v3/auth/challenge · verifyUnlocks an account with a signature from its key.
GET /v3/accountAccount, linked wallet, recovery count, balances and activity.
POST /v3/deposits/build · submitA deposit transaction for SOL or USDC, signed by the funding wallet.
POST /v3/intents · /v3/intents/executeA send to another protected account or a withdrawal to a wallet, signed by the key.
POST /v3/recovery/prepare · completeMoves the account to a new wallet and key. The old key is retired.

Security model

  • Clients never sign a plan they haven't re-derived: domain, program, config, amounts, recipients, key fingerprints and expiry must all match.
  • ML-DSA-44 signatures are verified by the vault program on Solana. Keys and proofs are uploaded in chunks and checked before a release.
  • Withdrawals from the protected vault need two ML-DSA-44 signatures: the owner's and the operator's.
  • The ledger is an append-only journal in SERIALIZABLE transactions; custody is reconciled with the chain continuously.
  • In production the operator keys live in isolated signers (a HashiCorp Vault transit key and a separate signing process), not in the web services. On the test network they are local test keys.
  • Private from the public chain, not from the operator: the operator can see payments made inside Qloak.
  • Not audited. Use the test network.

License

Qloak is built on open-source code released under the MIT License. The license and its copyright notice ship with the source in LICENSE.