Skip to content
Dominion116Public

About

Forrel is a post-quantum release and firmware signing log on QoreChain. Maintainers sign the SHA3-256 hash of each release with an ML-DSA-87 key, and the ForrelRegistry contract on Diana accepts the record only if QoreChain's pqcVerify precompile confirms the signature.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Forrel

Built on QoreChain Build Before Q-Day: Quantum Pass Live demo QoreChain Diana Registry

ML-DSA-87 SHA3-256 pqcVerify on-chain Foundry tests Coverage Threat model AI usage License: MIT

Releases that still verify after Q-Day. A post-quantum release and firmware signing log on QoreChain, verified on-chain by pqcVerify.

Forrel lets software and firmware maintainers publish a record of each release: the file's SHA3-256 hash signed with an ML-DSA-87 key. Every record is checked on-chain by QoreChain's pqcVerify precompile (0x…0a01) before it is accepted, and public keys and signatures are stored in contract state via SSTORE2 so verification survives testnet log pruning. Anyone can drop a file into the web app or run forrel verify with no wallet required.


Live deployment

Web app https://forrelonq.vercel.app
ForrelRegistry (Diana, chain 9800) 0xd438B0A22F2404C8f10c1dbBBA6cA56B391E997d
Deployed at block 10,921,807 (deployments/diana.json)
On-chain gate Signatures from @forrel/core verify through the real pqcVerify on Diana: docs/message-spec.md

The CLI and the live web app default to this registry, so forrel verify needs no configuration.


Forrel

Judge path (about 3 minutes, no wallet, nothing to install)

  1. Open https://forrelonq.vercel.app/app/verify.
  2. Download forrel-cli-v1.0.0.txt (use Download raw file) and drop it in → Revoked, reason "Key compromised".
  3. Drop in forrel-cli-v1.0.1.txt → Verified, signed with the rotated key (epoch 2).
  4. Drop in forrel-cli-v1.0.0-tampered.txt, the same file with one word changed → Unknown.
  5. Open /app/projects/forrel-demo: signing key epoch 2 (rotated), the release history, and each release's signed message. Use Re-check signature to run pqcVerify live.
  6. Check the transactions in Proof on-chain.

All demo files, hashes and expected verdicts are in demo/.

Proof on-chain

QoreChain Diana (chain 9800), project forrel-demo, account 0xe777fe40Abb80F14DEDeCfFcD3D8c4063F766073 (qor1uamlus9thq83fhk7el7d8kxyqclhvcrnwp5s8v). All of the account's transactions on the explorer (switch to Testnet).

Step Transaction (EVM hash; links open the Cosmos tx) What the contract checked
Deploy ForrelRegistry 0xcc64960c…2ff853 n/a
Register forrel-demo 0x7f1e4761…78dd1d Owner has a proven ML-DSA-87 key (pqcKeyStatus)
Publish v1.0.0 0x911eda94…32aa06 pqcVerify with the epoch 1 key
Revoke v1.0.0 0xfee38fb4…f27855 pqcVerify with the epoch 1 key
Rotate to epoch 2 0x1822912a…8122c5 pqcVerify with the epoch 1 key
Publish v1.0.1 0x08f197c1…15f966 pqcVerify with the epoch 2 key
Attack: publish signed by a stranger's ML-DSA-87 key 0xed8f96c3…c80bb3 Rejected with SignatureInvalid: the EVM call reverted (ethereumTxFailed: execution reverted) and nothing was stored. Reproduce with npm --workspace=@forrel/contracts run attack

The explorer, explore.qore.network, opens on mainnet: switch it to Testnet first. It lists transactions by their Cosmos hash, which the links above use; the EVM hash is shown as the link text. In the explorer, the attack transaction shows as included, with the EVM failure in its events.

Hybrid-signed transactions

Every EVM transaction on QoreChain needs an authorisation window. Opening one is a native-lane MsgOpenEVMWindow signed hybrid: secp256k1 plus an ML-DSA-87 signature carried in a PQCHybridSignature extension. Each Forrel write above was sent under one of these:

Step Cosmos transaction Signed
Register the account's ML-DSA-87 key (MsgRegisterPQCKeyV2) 20BE9CF3… Classical, with proof of possession
Open window before the deploy D4B5EC77… Hybrid, by the window script
Open window before registering forrel-demo B170A019… (script), D80E7281… (QoreX) Hybrid
Open window before publish v1.0.0 4F3EF674… Hybrid, in QoreX
Open window before revoke C15F302C… Hybrid, in QoreX
Open window before rotate CA5E0752… Hybrid, in QoreX
Open window before publish v1.0.1 and the attack 60897A1A… Hybrid, in QoreX

The QoreX windows are the ones opened for 300 blocks with a 1,000,000 uqor budget; the script's are 600 blocks and 3,750,000 uqor. Each Forrel write was then approved in QoreX too.

Contract pages on the explorer show no transactions: it lists transactions by sender, and a contract never sends one. Use the account link above.

Features

  • ✅ Wallet-free verification — Drop any file in the browser (stream-hashed locally in a Web Worker) or run forrel verify via read-only eth_call.
  • ✅ On-chain post-quantum verification — ForrelRegistry verifies every publish, rotateKey, and revoke signature through QoreChain's pqcVerify precompile.
  • ✅ Offline-capable CLI — Generate encrypted keyfiles (scrypt + AES-256-GCM), sign bundles offline (--seq), and submit separately from CI.
  • ✅ Durable state storage (SSTORE2) — Public keys (2,592 B), signatures (4,627 B), and rotation history live in contract state rather than pruned event logs.
  • ✅ Key safety built in — Rotate signing keys via the active key or an offline recovery key, and revoke bad releases with a reason code.
  • ✅ Deterministic mock & live modes — Switch between MockChainClient and LiveChainClient via NEXT_PUBLIC_CHAIN_MODE.

Architecture

          ┌──────────────────────── Browser ────────────────────────┐
          │  Landing (/)          /app (verify, projects, publish)  │
          │      │                         │                        │
          │  hash.worker (SHA3-256)   @forrel/core (encode, sign)   │
          │      │                         │                        │
          │  viem public client ──── eth_call ────┐   QoreX (tx) ───┼──┐
          └────────────────────────────────────────┼─────────────────┘  │
                                                   ▼                    ▼
                                   ┌──────── QoreChain Diana (EVM, 9800) ─────────┐
                                   │  ForrelRegistry                              │
                                   │   ├─ pqcVerify     0x…0a01  (ML-DSA-87)       │
                                   │   ├─ pqcKeyStatus  0x…0a02  (owner check)     │
                                   │   └─ SSTORE2 blobs (pubkeys, signatures)     │
                                   └──────────────────────────────────────────────┘
                                                   ▲
          CI / offline machine:  forrel sign  →  bundle.json  →  forrel publish

Quick Start

# 1. Clone and install dependencies
git clone https://github.com/Dominion116/forrel.git
cd forrel
npm install

# 2. Start the web app (defaults to NEXT_PUBLIC_CHAIN_MODE=mock)
npm run dev

Open http://localhost:3000 for the landing page, http://localhost:3000/app for the registry app, and http://localhost:3000/docs for the full 3-column technical documentation.


Installation

Prerequisites

  • Node.js >= 20.0.0
  • npm >= 10 (uses npm workspaces)
  • Foundry (forge, cast) — required only for building/testing/deploying contracts/

Workspace Structure

forrel/
├── apps/web/          # Next.js App Router (/, /app/*, /docs, /privacy, /terms)
├── packages/core/     # @forrel/core — encoders, SHA3-256, keyfiles, Signer, ABI, vectors
├── packages/cli/      # @forrel/cli — `forrel` CLI
├── contracts/         # @forrel/contracts — ForrelRegistry.sol, PQC.sol, SSTORE2.sol, window.ts
├── demo/              # The exact demo release files, v1.0.1 publish script
└── docs/              # Message spec, threat model, scaffold notes, illustration brief

CLI Usage (forrel)

The @forrel/cli workspace shares @forrel/core with the web app so browser and CLI produce byte-identical signed messages.

The CLI is not published to npm. Run it from the root of a clone after npm install, as npx forrel … or node packages/cli/bin/forrel.mjs …. (Don't use npx --workspace: it runs inside the package folder, so relative file paths break.)

Commands

Command Description Network
forrel keygen --out <file> Generate an ML-DSA-87 keypair and save as an encrypted keyfile Offline
forrel hash <file> Print the SHA3-256 digest of a file Offline
forrel sign <file> --project <slug> --version <v> --key <keyfile> [--seq <n>] Sign a release into <file>.forrel.json Offline-capable
forrel publish <bundle.json> Submit a signed bundle to ForrelRegistry Online
forrel verify <file> [--project <slug>] [--json] Verify a file + live pqcVerify re-check (exit 0/1/2/3) Read-only
forrel rotate --project <slug> --key <keyfile> [--recovery] --out <newkey> Rotate the project signing key Online
forrel revoke --project <slug> --version <v> --reason <0-3> --key <keyfile> Revoke an existing release Online

Offline Sign → CI Publish Example

# Offline machine: generate keyfile and sign release
npx forrel keygen --out ./signing.forrel-key.json
npx forrel sign ./dist/firmware.bin \
  --project acme-router \
  --version 2.4.1 \
  --key ./signing.forrel-key.json \
  --seq 1

# Online CI runner: publish bundle and verify
export FORREL_SUBMITTER_KEY="0x..."
npx forrel publish ./dist/firmware.bin.forrel.json
npx forrel verify ./dist/firmware.bin --project acme-router

See .github/workflows/forrel.yml for a GitHub Actions example (manual here; switch it to a tag trigger in your own repo).


Configuration

Web App (apps/web/.env.local)

Copy apps/web/.env.example to apps/web/.env.local:

Variable Description Default
NEXT_PUBLIC_CHAIN_MODE mock (deterministic fixtures) or live (QoreChain Diana) mock
NEXT_PUBLIC_REGISTRY_ADDRESS Override the ForrelRegistry address the Diana deployment
NEXT_PUBLIC_REGISTRY_DEPLOY_BLOCK Override the deploy block used for best-effort tx links 10921807
NEXT_PUBLIC_SITE_URL Canonical URL for metadata, robots and sitemap Vercel production domain
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID Optional WalletConnect ID (not needed for QoreX) —

CLI Environment Variables

Variable Description Required
FORREL_RPC QoreChain Diana JSON-RPC URL (https://evm-testnet.qore.host) No
FORREL_REGISTRY ForrelRegistry address. Optional: defaults to deployments/diana.json, then the Diana deployment above Online / Sign
FORREL_SUBMITTER_KEY 0x-prefixed secp256k1 key with an open Diana EVM window Write commands
FORREL_PASSPHRASE Keyfile passphrase for non-interactive CI (prompts if omitted) No

What Is Post-Quantum (and What Isn't)

Layer Status Details
Release signatures Post-quantum ML-DSA-87 (FIPS 204 pure, empty context), verified on-chain via pqcVerify
Artifact & notes digests Post-quantum safe SHA3-256 (FIPS 202)
QoreChain account Hybrid eth_secp256k1 + registered ML-DSA-87 key (pqcKeyStatus)
EVM transaction transport Classical gas payer Submitter key only pays gas; cannot forge, rotate, or revoke releases
Deployment target Testnet only QoreChain Diana (chainId 9800); pqcVerify is not on mainnet yet

Smart Contracts & Gate

contracts/ is a Foundry project adapted from create-qorechain-dapp@0.14.0:

# Install forge-std and run Foundry tests
npm --workspace=@forrel/contracts run forge-std
npm --workspace=@forrel/contracts run test

# Manage QoreChain PQC key & EVM authorisation window
npm --workspace=@forrel/contracts run window -- status
npm --workspace=@forrel/contracts run window -- open

# Run the live Diana pqcVerify gate (checks @qorechain/qoresign & @noble/post-quantum)
npm --workspace=@forrel/core run gate

Documentation


Development

# Typecheck all workspaces
npm run typecheck

# Start Next.js dev server
npm run dev

# Format with Prettier
npm run format

Note: Per workspace rules in AGENTS.md, web lint, JS tests, and production Next.js builds run on Vercel CI rather than locally.


Contact

Questions, bugs and requests go to GitHub Issues. Issues are public: never post keys, keyfiles or passphrases.


Testing Guide (Judges & Reviewers)

Live deployment: https://forrelonq.vercel.app (connected to ForrelRegistry on QoreChain Diana, Chain ID 9800, at deployments/diana.json).

1. Read-Only Verification (No Wallet or EVM Window Required)

  1. Open /app on the live site to browse registered projects, releases, key rotations, and revocations directly from QoreChain Diana.
  2. Open /app/verify, select a project/release (or upload an artifact), and verify its SHA3-256 fingerprint and ML-DSA-87 signature on-chain.
  3. All read and verification paths work without connecting a wallet or opening an EVM window.

2. Full On-Chain Write Flow (Requires QoreX Wallet + EVM Window)

Because QoreChain blocks classical-only EVM writes by default, any wallet submitting on-chain transactions (registering a project, publishing a release, revoking, or rotating a key) needs a registered ML-DSA-87 PQC key and an active EVM authorization window:

  1. Connect QoreX on QoreChain Diana (Chain ID 9800) with testnet QOR.
  2. Go to /app and open the New project wizard.
  3. Check the Key & EVM Window panel at the start of the wizard. If your account does not have an active window, open one in QoreX or from contracts/:
    npm --workspace=@forrel/contracts run window -- status
    npm --workspace=@forrel/contracts run window -- register   # if PQC key is not registered
    npm --workspace=@forrel/contracts run window -- open       # opens a 600-block / 5-tx window
  4. Walk through the end-to-end flow: Register project → Publish release → Verify on /app/verify → Re-check → Revoke → Rotate key.

License

This project is licensed under the MIT License — see LICENSE.

Starter kit

Forrel started from create-qorechain-dapp 0.14.0 (notes):

Template (command) Where it lives now
npx create-qorechain-dapp forrel --template foundry --network testnet contracts/: foundry.toml, .env.example and the EVM window helper scripts/window.ts
npx create-qorechain-dapp forrel --template viem-wagmi --network testnet The QoreX connector, chain definitions, EVM window check and REST proxy were moved from its Vite app into Next.js: apps/web/lib/wallet/ and next.config.ts

Acknowledgments

About

Forrel is a post-quantum release and firmware signing log on QoreChain. Maintainers sign the SHA3-256 hash of each release with an ML-DSA-87 key, and the ForrelRegistry contract on Diana accepts the record only if QoreChain's pqcVerify precompile confirms the signature.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages