What Kazashi is
Kazashi is a public, append-only record of software releases. Each record says “this exact file, with this SHA-256, is version X of product Y, released by vendor Z”. Records are signed with ML-DSA-87, a post-quantum signature, and stored on the kazashi-1 rollup on QoreChain. A device installs a file only if it finds the file in that record and the record passes nine checks.
Why it matters: after Q-Day, the classical signatures on today's updates can be forged. A forger can fake a signature, but cannot add a fake to a record that was written and witnessed before Q-Day.
- Level 2: the vendor signs with ML-DSA-87 itself. Strongest; works forever.
- Level 1: independent observers recorded a classically signed release. Trusted after Q-Day only if two observers from different operators recorded it before the switch.
- Level 0: not in the log. Refused.
Quickstart
1. Build the tools (2 minutes)
git clone https://github.com/psycocodes/kazashi
cd kazashi
cargo build --release # Rust 1.85+; binary at target/release/kazashi
cargo test --release # 15 tests, one attack per refusal reason
(cd chain && npm ci) # only needed to post to QoreChain2. Try the whole flow locally, no chain (1 minute)
scripts/demo.sh --offline # keys, release pack, observers, embargo, witnesses, watcher, checks3. Check a file against the live testnet log
./target/release/kazashi init # trust policy + witness checkpoints, then rebuild the log from QoreChain
# synced from QoreChain: 10 packs, 11 entries; 3 witness checkpoints match the chain
./target/release/kazashi check demo/kazashios-ota-1.1.bin
# ACCEPTED demo/kazashios-ota-1.1.bin as L2: kazashios-ota 1.1 (seq 2), log #2 in tree 11, tx 0496E6BB…
./target/release/kazashi check demo/kazashios-ota-1.0.bin
# REFUSED demo/kazashios-ota-1.0.bin: REVOKEDinit downloads two things from this site: the trust policy (which vendor, observer, witness and switch keys to trust) and the witnesses' signed checkpoints. Everything else comes from QoreChain: every release pack is read back from the rollup and checked against the chain's own inbox commitments, and a checkpoint is kept only if it matches the log rebuilt from the chain. Run kazashi sync to refresh. In production, ship the trust policy with the device instead of downloading it.
4. Publish your own releases on testnet
You need qorechaind v3.2.10, a funded testnet account, and an ML-DSA-87 key registered for it (qorechaind tx pqc gen-key, then register-key-v2 dilithium5 … hybrid). Every transaction is hybrid-signed by scripts/qtx.sh.
export KAZASHI_FROM=<your key name> KAZASHI_PQC=<your pqc key name> KAZASHI_REPO=$PWD
kazashi keygen acme && kazashi trust vendor acme
kazashi release --key acme my-firmware 2.4.0 7 out/firmware.bin # posts one pack to kazashi-1CLI reference
State lives in $KAZASHI_HOME (default ./.kazashi): keys/, policy.json, log.json, device.json. Add --offline to any command to skip QoreChain.
| Command | What it does |
|---|---|
| kazashi init [--site URL] | First run: fetch the trust policy and witness checkpoints, then rebuild the log from QoreChain. |
| kazashi sync [--feed URL|file] | Rebuild the log from QoreChain and merge witness-signed checkpoints. |
| kazashi keygen <name> [--kem] [--ecdsa] | Make an ML-DSA-87 key (plus an ML-KEM-1024 or secp256k1 key) under keys/. |
| kazashi trust <vendor|observer|witness|switch> <name> | Add a public key to this device's trust policy. |
| kazashi release --key K ART VER SEQ FILE … | Sign one release pack (any number of entries) and post it to the rollup. |
| kazashi observe --key K --source S ART VER FILE | Record a release from a vendor that doesn't use Kazashi yet (Level 1). |
| kazashi revoke --key K <leaf> [--reason 1] | Revoke one entry, or its whole key epoch with reason 1 (key leaked). |
| kazashi handover --key K --classical C | The old classical key and the new ML-DSA-87 key vouch for each other. |
| kazashi embargo-seal --key K --to MAKER ART IN OUT | Seal a fix with ML-KEM-1024 to a device maker and log its fingerprint. |
| kazashi embargo-open --key MAKER IN OUT | Open a sealed fix and confirm its commitment is in the log. |
| kazashi cosign --key W | Witness: re-check the log, then sign the current checkpoint. |
| kazashi check <file> [--dry] | Device: run the nine checks; exit code 0 means install. |
| kazashi watch [--chain] [--ci builds.txt] | Watcher: re-verify everything; --chain compares with QoreChain; --ci flags releases you never built. |
| kazashi sunset --key S --tx <hash> | Post the sunset entry that points at the switch contract's transaction. |
| kazashi export-web [files…] | Write the explorer's data file. |
For vendors: sign every build in CI
Add one step after your build. Batch every artifact of a release into one pack: one signature, one transaction.
# .github/workflows/release.yml (example; the runner also needs qorechaind and the
# hybrid account keys from Quickstart step 4 to post the pack)
- name: Record release in Kazashi
env:
KAZASHI_HOME: ${{ runner.temp }}/kazashi
run: |
mkdir -p $KAZASHI_HOME/keys
echo "${{ secrets.KAZASHI_MLDSA_SEED }}" > $KAZASHI_HOME/keys/acme.mldsa # 32-byte seed, hex
kazashi release --key acme \
router-fw ${{ github.ref_name }} ${{ github.run_number }} out/router.bin \
camera-fw ${{ github.ref_name }} ${{ github.run_number }} out/camera.bin- Use a monotonic sequence number per product (
SEQ); devices refuse anything lower than what they have installed. - Keep the root key offline. If a CI key leaks,
kazashi revoke --reason 1distrusts everything signed in that key epoch. - Already sign with RSA or ECDSA? Run
kazashi handoveronce so your old key vouches for the new one before Q-Day. - Run
kazashi watch --ci builds.txton a schedule: it alarms on any release under your key that your CI never built.
For device makers: check before you install
The checker is a pure function in the kazashi-core crate. It is no_std with alloc, so the same code runs in a CLI, an updater daemon or firmware.
use kazashi_core::checker::{check, Refusal, Level};
// evidence: the entry, its pack signature and Merkle proofs, the cosigned checkpoint
// policy: the vendor, observer, witness and switch keys this device trusts
// state: the last checkpoint and versions this device accepted
match check(&image, &evidence, &policy, &state, &facts, now) {
Ok(Level::L2) | Ok(Level::L1) => install(&image),
Err(reason) => refuse(reason), // e.g. Refusal::ROLLBACK, Refusal::NOT_IN_LOG
}| # | Check | Refusal |
|---|---|---|
| 1 | The file's SHA-256 equals the entry | DIGEST_MISMATCH |
| 2 | The pack is signed with ML-DSA-87 by a trusted key | BAD_SIGNATURE |
| 3 | A Merkle proof places the entry in the checkpoint | NOT_IN_LOG |
| 4 | Two of three witnesses cosigned the checkpoint | NOT_COSIGNED |
| 5 | The checkpoint extends the one the device saw last | STALE_OR_FORKED |
| 6 | The entry is at least one challenge window (1 h) old | NOT_SETTLED |
| 7 | Neither the entry nor its key epoch is revoked | REVOKED |
| 8 | The version is not lower than the installed one | ROLLBACK |
| 9 | After the sunset, Level 1 needs two observers from before it | CLASSICAL_AFTER_SUNSET |
Run it on a chip
The same checker, unchanged, runs bare-metal on a Cortex-M3 emulated in QEMU. One command builds the firmware and runs three cases:
./scripts/qemu.sh
kazashi-mcu: firmware 1.1 -> ACCEPTED L2 (~57049800 instructions)
kazashi-mcu: tampered -> REFUSED DIGEST_MISMATCH (~2880 instructions)
kazashi-mcu: forged signature -> REFUSED BAD_SIGNATURE (~18886360 instructions)
kazashi-mcu: peak heap 106244 B of 262144 B, peak stack 192724 BAbout 50 KB of flash and 300 KB of RAM at peak, so STM32F7/H7 or nRF5340-class parts. Instruction counts come from QEMU's -icount mode, not hardware cycles. Needs qemu-system-arm; the script installs its own Rust toolchain under ~/.local/share/kazashi-mcu.
For registries and observers: protect what ships today
Most vendors won't adopt anything before Q-Day. Observers close that gap: they record a release's fingerprint and its classical signature, signed with their own ML-DSA-87 key. No change is needed from the vendor. Today kazashi observe records the signature you pass it; checking that signature against the registry's key first is the observer operator's job. The npm and Arch observers below do that check before they post.
kazashi observe --key observer-a --source npm npm:left-pad 1.3.0 left-pad-1.3.0.tgz --classical-sig <hex>Devices choose which observers they trust and require two from different operators. A registry such as npm, PyPI or crates.io can run one observer itself; a security company or a foundation can run the second.
npm
integrations/npm/npm-observer.mjs downloads each tarball, checks it against the registry's sha512 integrity and npm's ECDSA registry signature, and only then posts an observed entry. npm-check.mjs checks every package in a lockfile before install.
node integrations/npm/npm-observer.mjs --key obs-a left-pad@1.3.0
node integrations/npm/npm-check.mjs package-lock.json && npm ci # exit 3 if any package is refusedArch Linux
integrations/pacman/arch-observer.sh verifies the packager's signature against the Arch keyring before posting. A pacman hook checks every package before a transaction; it reports by default and blocks with --enforce.
integrations/pacman/arch-observer.sh --key obs-a /var/cache/pacman/pkg/<name>-<ver>-<arch>.pkg.tar.zst
integrations/pacman/install.sh # installs the hook, report-onlyUbuntu and Debian
integrations/apt/apt-observer.sh follows the archive's own chain before posting: the InRelease signature against the distro's archive keyring, then the Packages index hash, then the .deb hash. An apt hook (DPkg::Pre-Install-Pkgs) checks every downloaded .deb before dpkg unpacks it; it reports by default and blocks with --enforce.
integrations/apt/apt-observer.sh --key obs-a /var/cache/apt/archives/<name>_<ver>_<arch>.deb
integrations/apt/install.sh # installs /etc/apt/apt.conf.d/99kazashi, report-onlymacOS (Homebrew)
integrations/homebrew/brew-observer.mjs downloads each bottle and checks it against the SHA-256 Homebrew publishes before posting. Homebrew has no pre-install hook, so kazashi-brew wraps brew install: it fetches every bottle, including dependencies, checks each one, then installs. macOS system apps and updates have no hook a third party can use; they are not covered.
node integrations/homebrew/brew-observer.mjs --key obs-a jq
integrations/homebrew/kazashi-brew --enforce install jq # or: alias brew=integrations/homebrew/kazashi-brewFor witnesses and watchers
- Witnesses run
kazashi cosignon each new checkpoint. The command re-checks the whole log first and refuses to sign a log with any alarm. Witnesses bond QOR in the switch contract; signing two different logs of the same size is provable and costs the bond. - Watchers need nothing but a machine.
kazashi watch --chainre-verifies every signature, version and checkpoint against QoreChain.node chain/rollup.mjs watchtower --challengere-executes every rollup batch and files a fraud proof against a wrong one.
Sigpack compression
Post-quantum signatures are large: ML-DSA-87 is 4,627 bytes, and its public key is 2,592 bytes. Signing each release separately would make every record about 4.8 KB. Sigpack signs a pack instead:
- Each release becomes a compact entry (about 111 bytes): product, version, sequence number, SHA-256, key epoch.
- The entries form an RFC 6962 Merkle tree. The vendor signs
"kazashi/pack/v1" | rollup | root | countonce. - The pack is one rollup post. A device verifies one signature and a Merkle path of
log2(n)hashes for its own entry.
| Entries per pack | Bytes on chain per release | Saving |
|---|---|---|
| 1 (no batching) | 4,810 | baseline |
| 12 (fits a 6 KiB qledger-v1 post, live today) | 503 | 9.6 times smaller |
| 985 (fits a 128 KiB post on a data rollup) | 116 | 41 times smaller |
Measured from real packs: 4,699 bytes fixed per pack (header, root, signature) plus 111 bytes per entry. The 128 KiB row uses QoreChain's module-wide post limit, which a non-qledger rollup can use.
The Q-Day switch and bounties
The KazashiSwitch contract runs on QoreChain's EVM (address and transactions).
| Function | What it does |
|---|---|
| fund() | Anyone adds QOR to the bounty pot. |
| requestWithdraw(), withdraw() | A funder leaves after 7 days, so nobody can pull out once a claim is coming. |
| claim(payout, v, r, s) | A valid secp256k1 signature for the lock pays the whole pot and flips the sunset. The contract computes the signed message itself, bound to the chain, the contract and the payout address. |
| manualSunset(idx, pks, sigs) | Two of three switch holders flip the sunset with ML-DSA-87 signatures, checked by the pqcVerify precompile. |
| bond(pk), startUnbond(), unbond() | Witnesses bond against their ML-DSA-87 key; unbonding waits for a delay. |
| slashEquivocation(…) | Two cosignatures from one witness for the same log size and different roots: half the bond to the reporter, half to the pot. |
Why nobody holds the lock's key: its x coordinate is SHA-256("kazashi/lock/v1/" | rung | counter), and the constructor re-derives the point on chain. A hash output is not a key anyone generated. Signing for it means solving the discrete logarithm, which is exactly what a quantum computer would do first.
Adoption
- Zero-change start. Observers record today's releases without any vendor work, so devices gain protection before vendors sign up.
- One step in CI. Vendors add one command; packs keep the cost to about 0.05 QOR per pack in posting fees (10 uqor per byte), shared by every release in it.
- Keep your existing keys. Key handover lets an RSA or ECDSA key vouch for its post-quantum successor while it is still trustworthy.
- Small enough for firmware. The checker is
no_stdRust that needs only a heap allocator. - Free to watch. Anyone can verify the whole log from QoreChain data; no account, no stake.
- Open standards. FIPS 204 and 203, RFC 6962 Merkle trees and C2SP checkpoint notes, so existing transparency-log tools can read it.
Design decisions
These were open questions in the design. Here is how Kazashi answers them, and why.
- Who pays, and how much?
- Whoever posts pays QoreChain's fees directly: about 0.05 QOR in posting fees for a pack of up to 12 releases, plus gas. Kazashi takes no cut. Witnesses bond (2 QOR in the demo; we suggest 500 QOR in production) so that lying is expensive, and they are typically run by parties who need the log anyway: device makers, registries, auditors. The bounty pot is funded voluntarily; vendors have the strongest reason to fund it, because it is their users who are protected the day it pays out.
- Whom should a device trust as an observer?
- Each device ships its own list, and it needs two observers from different operators who recorded the same fingerprint before the sunset. One observer alone could be coerced or compromised; two independent ones raise the bar without central approval.
- Is a revocation final?
- Yes. A revoked entry never becomes valid again; the vendor re-releases under a higher sequence number. Undoing a revocation would let a thief who stole the revoking key resurrect a bad build.
- What is out of scope?
- Kazashi doesn't judge whether software is safe, only whether it is the published one. It is not a package manager or a certificate authority. It doesn't block Android system updates (it can detect them), and it never puts private data on chain: only fingerprints and version numbers.
- Does it make a product compliant with the EU Cyber Resilience Act?
- No tool makes a product compliant on its own. Kazashi produces a public, timestamped record of every security update and its integrity, which supports the CRA's obligations to deliver updates securely and to handle vulnerabilities. Check with counsel for your product.
- Why 12 releases per pack, not 985?
- QoreChain caps a qledger-v1 rollup post at 6 KiB so that every fraud proof fits in one transaction. We kept that rollup because it gives withdrawals and fraud proofs. A data-only rollup could take 128 KiB posts and roughly 985 releases per pack.
- Why ML-DSA-87 and not a smaller signature?
- It is the only ML-DSA parameter set QoreChain registers, and the only one its
pqcVerifyprecompile checks, so contracts can verify the same signatures devices do. Every entry also carries an algorithm byte, so hash-based LMS can be added later.
What is not built yet
- The checker compiled to WebAssembly for the browser (the explorer shows results computed by the Rust checker).
- An automated observer for Pixel release feeds.
- A lock ladder of weaker keys that shows progress towards Q-Day before the full break.
- Trap entries that test whether witnesses really check (Proof of Vigilance), and attestors that rebuild packages from source.
- LMS signatures, and blocking (not just detecting) Android system updates.