
Encrypted Apps
HARBR
Quantum-safe trade finance: sealed documents, post-quantum signatures, no double financing
About
Small exporters wait 60–120 days to be paid, and lenders won't advance cash against their invoices because they can't trust the papers: the same invoice gets financed twice, buyers deny confirmations, and sharing documents leaks prices to competitors. Trade records also live for years, which makes classical signatures on them a long-term quantum target. HARBR turns every export invoice into a commercial obligation with a verified history. The exporter signs it, the carrier confirms shipment and delivery, and the buyer confirms acceptance, each with ML-DSA-87 signatures checked on chain. Invoices, bills of lading, offers, dispute evidence and history packs are encrypted in the browser with QoreSeal (ML-KEM-1024 + X25519) to only the parties who need them; servers and the chain see only ciphertext and hashes. On chain, HARBR: refuses an invoice that is already registered, even when it is split into parts (normalised fingerprint, invoice key, and the Nigerian e-invoice IRN when present); raises the advance rate with milestones (60% at shipment, 80% at acceptance, 85% for exporters with a good repayment record from at least two buyers) and refuses any draw over the limit; repays the lender first and the exporter second through a lockbox, and builds a portable credit history; lets a large buyer get its suppliers paid early at the buyer's cheaper rate (reverse factoring: $50,000 due in 60 days at 9% pays $49,260.28 today); runs a lender pool on QoreChain's Asset Kit ERC-4626 vault, with a first-loss reserve and risk limits set by a 2-of-3 ML-DSA committee; handles credit notes, disputes with sealed evidence, two lenders splitting one invoice, rotating auditor group keys, and an ERC-3643 participation token whose agent needs 2 of 3 ML-DSA signatures. Q-Day tested. Since v5, even moving the settlement token needs the holder's ML-DSA signature, and the token refuses classical transfers from any account with a registered post-quantum key. We gave an attacker an account's stolen ECDSA key on testnet: 12 of 12 attacks were refused and $0 was lost (docs/QDAY_DRILL.md, with tx hashes). Everything runs on QoreChain Diana testnet. Every refusal shown is a real on-chain revert with its tx hash, and npm run judge re-checks the claims against the live chain and vault with no keys. Start at /judges on the demo: it takes 3 minutes. You can act as any fictional party, or as yourself on /try by connecting QoreX or another browser wallet. Honest limits: QoreSeal hides content, not who sent what to whom; amounts registered on chain are public; EVM transactions are classically signed, so HARBR's contracts and token check ML-DSA-87 rather than the sender; banks, carriers, KYC and e-invoice portals are simulated and labelled; hUSD is a labelled test token.
How it's made
Architecture. Solidity contracts (Foundry, 0.8.28): PQAuth, KeyBinding, ObligationRegistry, OfferBook, CollateralController, Lockbox, CreditHistory, BuyerProgram, HarbrPoolVault (Asset Kit ERC-4626), PoolCommittee, DisclosureLog, HarbrTestUSD with ML-DSA-authorised transfers and PQLock, a deliberately weak NaiveInvoiceRegistry as a control, and an ERC-3643 MultisigAgent over the Asset Kit's T-REX deployment. TypeScript packages for ML-DSA intents, the QoreSeal wrapper and chain calls; a ciphertext-only vault; a relayer with an own-account fallback; a read-only MCP duplicate registry for other lenders; and a Next.js platform (judges page, overview, trade assets, marketplace, desk per party, pool, programs, credit profile, collateral, disputes, verify & evidence, live test lab, and "try with your wallet"). The vault, relayer and MCP server run on a VPS under systemd with a timer that renews the EVM window every 5 hours; the app is on Vercel. Kits and network features. @qorechain/qoreseal: client-side sealing, recipient cards, the KEM key registry, epoch (group) keys and batches. @qorechain/pqc: ML-DSA-87 in the browser. @qorechain/sdk: unified accounts, hybrid-signed Cosmos transactions, PQC key registration with proof of possession, ML-KEM key registration, EVM windows. @qorechain/qoresign: Sign-In-With-QoreChain and signed message proofs. @qorechain/evm: browser-wallet connection (EIP-6963; QoreX listed first). Asset Kit (Solidity): the ERC-4626 vault adapter and the ERC-3643 path with the hybrid-holder compliance module. QoreScan: CycloneDX CBOM. The pqcVerify (0x0A01) and pqcKeyStatus (0x0A02) precompiles check every signature on chain, failing closed. A relayer submits signed intents through an EVM window scoped to HARBR's contracts and can neither forge nor block them: if it is down, the browser sends the same signed intent from the user's own account. What was hard. Foundry cannot run QoreChain's precompiles, so unit tests mock them and live tests prove the real path on Diana. Every EVM sender needs a registered post-quantum key and a window, scoped windows refuse contract creation, and the chain bills at least half the gas limit, so the relayer estimates gas tightly and deploys use separate unscoped windows. Our own Q-Day drill found a gap: while a holder's EVM window was open, a stolen ECDSA key could take the slot first and move tokens. v5 removed holder windows (every token move is an ML-DSA-signed intent) and made the token refuse classical moves from keyed accounts. The re-run refused all 12 attacks. Faucet fUSD could not be converted to an ERC-20 on Diana, so HARBR settles in a labelled test token (hUSD). The gas estimator failed on the T-REX factory deployment; explicit gas worked. Browser wallets sign only secp256k1, so /try derives the visitor's ML-DSA and ML-KEM keys from one wallet signature and labels it a test identity. Testing against a live testnet meant handling RPC limits (10,000-block log queries) and transient errors safely: every intent carries a nonce, so retries can't double-spend. Quality. 191 Foundry tests on v5, 93 TypeScript tests, CI on every push, three QoreChain Contract Auditor runs (two stages, then a third on the live contracts) with every finding triaged and covered by a regression test, a Q-Day drill, a threat model, an honest LIMITS.md, a signed message-format spec, and EVIDENCE.md mapping claims to transactions. Built with Claude Code; see AI_USAGE.md.
Timeline
Pushed 3 commits to main
- e2c06b0 README: cover image and "What it looks like" (six screenshots from 2 Dec, each with what it proves and its tx hash) · Stella112
- d0d3974 Docs for submission: description v4 (live v5 build), paste-ready form text, DEPLOYMENTS.md regenerated for v5, build log of the v5 demo re-run · Stella112
- 484aa3e Drop the "34/34 PASS" judge claims (README, EVIDENCE, SUBMISSION, landing): no clean v5 demo record exists yet, so the judge kit is described as PASS or FAIL per claim · Stella112
Pushed 9 commits to main
- 5b3801b Q-Day drill: dedicated DRILL account and scripts/qday-drill.ts. With only the stolen classical ECDSA key, 10 of 11 attacks are refused (QoreChain hybrid-signature checks, key takeover, windows; HARBR · Stella112
- 59a4805 v5 contracts: ML-DSA-authorised token moves (HarbrTestUSD receiveWithPQAuth/transferPQ; fundPQ, payPQ, depositPQ, redeemPQ) and PQLock refusing classical transfer/approve/redeem from keyed EOAs (Q-Day · Stella112
- c276ca2 v5 clients: fund, pay, program fund, pool deposit/redeem and hUSD transfer are ML-DSA-signed intents (FundCredit, FundProgram, PayInvoice, PoolDeposit, PoolRedeem, TokenTransfer) delivered by the rela · Stella112
- 3aa7696 Web: "Connect wallet" on every page (landing nav and hero, app header). One dialog: QoreX first (connect if found, otherwise official install links for Chrome/Brave/Edge, Firefox, Safari, iPhone, Andr · Stella112
- 2ed8cde v5 deployment on Diana: scripts/deploy-v5.ts (HarbrTestUSD with PQ transfers and PQLock, plus the 9 contracts, balances re-minted, typehash and wiring checks), diana.json v5 with v4 superseded, regene · Stella112
and 4 more commits
Pushed 49 commits to main
- aef7a7f Submission form text: tagline, description, how it's made, addresses, kits and network features to tick · Stella112
- 5e8df43 Try page: find QoreX first (EIP-6963 rdns network.qore.qorex, window.qorex.evm fallback) · Stella112
- a2090f5 Try with your wallet (test): /try page where a visitor derives an own HARBR identity from a wallet signature (or generates one), registers and binds its keys, registers its own invoice, sees the limit · Stella112
- c70796c Web: program page reads events in 10,000-block windows (Diana RPC eth_getLogs range cap) · Stella112
- e71b870 Web: program and profile pages show an error instead of crashing when the chain read fails · Stella112
and 44 more commits
Pushed 19 commits to main
- b077fcc v4 contracts: split-invoice and IRN uniqueness, wash-trading guard on Tier 1, approved carriers, first-loss pool reserve · Stella112
- 04e9cde v4 TypeScript: RegisterObligation carries invoiceKey + irnHash, SetCarriers intent, regenerated ABIs; read-only MCP duplicate registry · Stella112
- 718f3d4 Docs: LIMITS v4 fixes table (built and tested, not deployed), build log · Stella112
- abac867 Build log: name the history flow that needs a second buyer · Stella112
- 0dca892 v4 deploy script; BUYER_B demo party (second allowed buyer: keys registered, bound 0xebd81070); history alternates buyers; grace/default 600 s · Stella112
and 14 more commits
New project.
Comments and questions
- No comments yet.