fractal-pqc 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -124,13 +124,19 @@ The SDK equivalent is `sendP2trKeyPath({ internalPriv, to, amountSats, network,
124
124
 
125
125
  The quantum protection does **not** come from a cert verifying in isolation (a cert only
126
126
  proves whoever built it held both secret keys). It comes from **anchoring**: the holder
127
- publishes their commitment first-seen and immutably (e.g. an on-chain Merkle leaf) BEFORE
128
- Q-day, and every verifier **pins that anchored factHash**. `verifySpend`/`verifyMigrationCommitment`
129
- take `anchoredFactHash` and reject any cert that doesn't match it. Skip the anchor and the
130
- kit provides no quantum protection — `verifySpend` fails closed rather than pretend otherwise.
131
- Providing the anchor registry (first-seen, no-duplicate, immutable) is part of the
132
- grant-funded roadmap below; this reference makes the anchor a **required verifier input**
133
- so the property is never silently over-claimed.
127
+ publishes their commitment first-seen and immutably in an append-only transparency log
128
+ (RFC 6962) anchored into Bitcoin (OpenTimestamps), and every verifier **pins that anchored
129
+ factHash**. `verifySpend`/`verifyMigrationCommitment` take `anchoredFactHash` and reject any
130
+ cert that doesn't match it. Skip the anchor and the kit provides no quantum protection —
131
+ `verifySpend` fails closed rather than pretend otherwise. The anchor registry itself
132
+ (first-seen, no-duplicate, immutable — `primacy.mjs` + `ots.mjs` + `verify-anchor`) is
133
+ **delivered and published** (see the Roadmap below); this reference makes the anchor a
134
+ **required verifier input** so the property is never silently over-claimed. One honest
135
+ residual: this package can *verify* a `.ots` you already obtained — it has no code to
136
+ *submit* a new digest to an OpenTimestamps calendar server or poll it to Bitcoin
137
+ confirmation. Creating a brand-new anchor today requires an external tool (the reference
138
+ `ots` CLI or the `python-opentimestamps` library); we deliberately don't vendor one, per
139
+ `ots.mjs`'s own "no network" scope.
134
140
 
135
141
  ## What this is NOT
136
142
 
@@ -166,12 +172,16 @@ so the property is never silently over-claimed.
166
172
  (honest scope — do not overstate)
167
173
 
168
174
  - **Not yet confirmed in a live mempool.** The sighash is proven consensus-correct against
169
- the official BIP-341 vector, and the broadcaster is built + dry-run-tested — but an actual
170
- funded **testnet** broadcast (which needs tBTC from a faucet) is the operator's final step.
171
- - **Key-path-only (no script tree / merkle root).** `taprootTweakPrivateKey`/`signTaprootKeyPath`
175
+ the official BIP-341 vector, and both the key-path and script-path (M2) broadcasters are
176
+ built + dry-run-tested — but an actual funded **testnet** broadcast (which needs tBTC from
177
+ a faucet) is the operator's final step for either path.
178
+ - **`p2trAddress`'s signer is key-path-only.** `taprootTweakPrivateKey`/`signTaprootKeyPath`
172
179
  handle key-path-only outputs — exactly what this kit's `p2trAddress` derives. Pointing the
173
180
  signer at a foreign Taproot output that commits to a script tree would produce an invalid
174
- signature. Script-path (tapscript) spends ARE implemented and asserted against the official BIP-341 wallet test vectors (7/7 cases, 12/12 control blocks, byte for byte).
181
+ signature. Script-path (tapscript) *construction* — the policy leaf, control blocks, and the
182
+ BIP-341 script-path sighash the M2 policy engine signs — IS implemented and asserted against
183
+ the official BIP-341 wallet test vectors (7/7 cases, 12/12 control blocks, byte for byte);
184
+ what's missing is the step after the signature, per the point above.
175
185
  - **Secrets are not zeroized.** Private-key `Uint8Array`s are not wiped after use (best-effort
176
186
  only in JS); `keygen` prints secrets by design (testnet/experimental).
177
187
  - **Not a BIP and not consensus.** The "recovery commitment" is an application-layer
@@ -182,24 +192,68 @@ so the property is never silently over-claimed.
182
192
 
183
193
  ## Roadmap — from reference to real Bitcoin custody tooling (the grant-funded work)
184
194
 
185
- Each milestone is independently verifiable, open-source, and shippable on its own:
195
+ Milestones below match the tranche structure in our funding ask (`letter/galaxy-2026-08-31.md`)
196
+ exactly, so this table and that letter can never quietly drift apart the way this section once
197
+ did. Each milestone is independently verifiable, open-source, and shippable on its own.
186
198
 
187
199
  1. **Bitcoin address + tx layer** — ✅ *done + vector-verified*: bech32/bech32m (BIP-173/350),
188
- P2TR `bc1p…` derivation (BIP-341), segwit tx + txid (genesis-checked), a BIP-341 key-path
189
- sighash **matching the official BIP-341 vector byte-for-byte**, **fees + coin selection**,
190
- **BIP-174 PSBT** create→sign→finalize, and a **testnet broadcaster** (fetch UTXOs/fees →
191
- build+sign → publish; dry-run tested offline) — all permanent tests.
192
- **Remaining:** a funded **testnet** broadcast to confirm in a live mempool (needs tBTC),
193
- and script-path (tapscript) spends.
194
- 2. **P2QRH-style quantum-resistant output** — a concrete commitment scheme + spending
195
- path a custodian can pre-register for held UTXOs, with a reference verifier.
196
- 3. **Custodian migration CLI** — take a real (testnet) UTXO set, emit PQC recovery
197
- commitments, and produce the dual-signed migration record; end-to-end on testnet.
198
- 4. **On-chain anchoring** (first-seen, immutable) — anchor recovery commitments as
199
- verifiable leaves (reusing FractalAI's Merkle-anchor pipeline) so a holder's migration
200
- is publicly provable and pinnable — this is what makes the `verifySpend` anchor real.
201
- 5. **Soft-fork integration analysis** — a PQC security review of candidate Bitcoin
202
- quantum proposals at the signature-integration surface.
200
+ P2TR `bc1p…` derivation (BIP-341), segwit tx + txid (genesis-checked), key-path AND
201
+ script-path BIP-341 sighashes **matching the official vectors byte-for-byte** (7/7
202
+ scriptPubKey cases, 12/12 control blocks), **fees + coin selection**, **BIP-174 PSBT**
203
+ create→sign→finalize (key-path), and a **testnet broadcaster** (fetch UTXOs/fees →
204
+ build+sign → publish; dry-run tested offline, never yet run against a live network) — all
205
+ permanent tests.
206
+
207
+ 2. **M1 — Bitcoin-anchored first-seen registry** — ✅ **DELIVERED, published, $0** (see the
208
+ letter). `primacy.mjs` + `ots.mjs` + `verify-anchor`: an append-only transparency log
209
+ (RFC 6962), ML-DSA-65-signed heads, first-seen resolution by complete enumeration, and a
210
+ temporal frontier confirmed against a real Bitcoin block header the verifier supplies —
211
+ run it yourself, offline, with `npx fractal-pqc verify-anchor`. **Honest residual:** this
212
+ delivers *verification* of an anchor; it does not deliver *creation* of one. Submitting a
213
+ new digest to an OpenTimestamps calendar and polling it to Bitcoin confirmation needs an
214
+ external tool today (the reference `ots` CLI or `python-opentimestamps`) — not vendored
215
+ here, and not yet documented anywhere outside this README.
216
+
217
+ 3. **M2 — Exposure-relative primacy, in a real custodian's signing flow** (Tranche 1,
218
+ $120,000/90 days — see the letter for the full scope). The primitive is shipped and
219
+ enforced in `fractal-pqc@0.9.0`: `policy.mjs`'s `authorizeAndSign` computes the BIP-341
220
+ sighash itself, requires the prevout to be the coin the holder's anchor governs, and (opt-in
221
+ via `exposureHeight`) additionally requires the commitment predate the chain first revealing
222
+ the classical key. **What remains, concretely, is engineering a custodian around that
223
+ primitive — not the primitive itself:** (a) ✅ *done*, `m2-broadcast.mjs` — rebuilds the
224
+ witness an `authorizeAndSign` decision actually authorised (never a caller-supplied leaf,
225
+ which would let someone splice in a different script) and serializes/dry-run-broadcasts it;
226
+ the Schnorr signature is re-verified independently against a freshly recomputed BIP-342
227
+ sighash, not against this module's own bookkeeping; (b) ✅ *already done* (round 9,
228
+ before this roadmap section was last reconciled) — `buildSpendContext` takes `otherInputs`,
229
+ so a custodian consolidating more than one deposit per holder does not recreate the round-8
230
+ signing-oracle bug; the holder's independently-derived digest for a real 2-input spend
231
+ matches the one the engine signs, proven by `R9-holder-can-reproduce-any-digest`; (c) ✅
232
+ *partially done* — `custodian-log.mjs` gives structured audit logging (hash-chained, so an
233
+ edited/reordered/deleted past decision is detectable — including refusals, not just
234
+ successes) and idempotent request handling (a retried request under the same key never
235
+ re-signs, proven by `R12-custodian-log-is-idempotent-and-tamper-evident`), with an explicit
236
+ design note on why the raw `policyKey` is never persisted. **Not done:** an actual HTTP/RPC
237
+ layer — this is a library a custodian's service calls, not a service itself; (d) a real answer for `policyKey`
238
+ custody (today a single Schnorr key per custodian — losing or leaking it is custodian-wide,
239
+ not just holder-wide, and nothing here enforces the `singlePolicyKeyPerHolder` convention
240
+ callers are trusted to uphold); (e) the funded testnet broadcast itself.
241
+
242
+ 4. **Tranche 2, $80,000 — independent external review, multisig PSBT, key rotation.**
243
+ External review: scope not yet defined here, tracked separately from the two engineering
244
+ items. **Multisig PSBT: 0% built.** `psbt.mjs` is single-signer P2TR key-path only; no
245
+ BIP-174 multisig fields, no k-of-N Tapscript threshold primitive, no multi-leaf
246
+ `policyLeafScript` — not even listed in this package's own `UNCLAIMED_GUARDS` honesty
247
+ ledger yet. **Key rotation: confirmed NOT IMPLEMENTED** (`npx fractal-pqc claims --gaps`
248
+ says so verbatim) — a holder who loses their ML-DSA-65 secret is locked out permanently,
249
+ by the same first-seen-primacy logic that makes the rest of the design sound. A real fix
250
+ needs a pre-registered guardian quorum, a distinct anchored entry type for a rotation
251
+ event, a challenge window measured in confirmed blocks, and a new "current active key"
252
+ resolver in `policy.mjs` — comparable in scope to the original primacy/policy engine.
253
+
254
+ 5. **Tranche 3, $120,000 — public specification, wallet interoperability, long-term
255
+ maintenance of the vectors.** Not started; success is measured by independent adopters
256
+ running the CC0 vectors, not by our own claims.
203
257
 
204
258
  ## License
205
259
 
package/bin/cli.mjs CHANGED
@@ -237,7 +237,7 @@ switch (cmd) {
237
237
  case "selftest": {
238
238
  const r = spawnSync(process.execPath, [join(__dirname, "..", "test", "vectors.mjs")], { stdio: "inherit" });
239
239
  if ((r.status ?? 1) !== 0) process.exit(r.status ?? 1);
240
- for (const f of ["transparency.mjs", "primacy.mjs", "anchoring.mjs", "conformance.mjs", "m2-policy.mjs", "bip341-scriptpath.mjs", "claims.mjs", "demo.mjs", "letter-claims.mjs"]) {
240
+ for (const f of ["transparency.mjs", "primacy.mjs", "anchoring.mjs", "conformance.mjs", "m2-policy.mjs", "m2-broadcast.mjs", "custodian-log.mjs", "bip341-scriptpath.mjs", "claims.mjs", "demo.mjs", "letter-claims.mjs"]) {
241
241
  const t = spawnSync(process.execPath, [join(__dirname, "..", "test", f)],
242
242
  { stdio: "inherit", env: { ...process.env, FRACTAL_SELFTEST_DEPTH: "1" } });
243
243
  if ((t.status ?? 1) !== 0) process.exit(t.status ?? 1);
@@ -468,7 +468,7 @@ Usage:
468
468
  fractal-pqc verify-letter [file] Check every factual assertion in our letter
469
469
  against this package. Exits non-zero if any fails.
470
470
  fractal-pqc verify-vector Check the official BIP-340 test vector
471
- fractal-pqc selftest Run everything: 331 real checks, no mocks
471
+ fractal-pqc selftest Run everything: 379 real checks, no mocks
472
472
 
473
473
  Docs: integrations/pqc-migration-kit/README.md`);
474
474
  process.exit(cmd ? 1 : 0);
Binary file
@@ -0,0 +1,75 @@
1
+ Asunto: Re: FractalAI — qué hace cumplir el requisito post-cuántico (está en npm; corre el código tú mismo)
2
+
3
+ Hola,
4
+
5
+ Respuestas directas a tus tres preguntas.
6
+
7
+ **1) Qué hace cumplir el requisito de firma post-cuántica**
8
+
9
+ Tres capas. Dos están construidas y en producción. Una no existe, y lo decimos con toda claridad.
10
+
11
+ **Capa 1 — Vinculación (construida).** La clave de Bitcoin de un titular (secp256k1 / clave de salida Taproot) queda vinculada a una clave ML-DSA-65 (FIPS-204, NIST Nivel 3) dentro de un compromiso firmado.
12
+
13
+ **Capa 2 — Política de gasto (construida — este es el punto real de cumplimiento).** El firmante de un custodio se niega a liberar una firma a menos que verifique una firma ML-DSA-65 vinculada a ese gasto exacto. Cada guarda rechaza por defecto, y nunca confía en un valor suministrado por el solicitante para saber qué está firmando: **una solicitud que no dice para qué moneda es se rechaza**, y **el motor calcula el digest que firma y rechaza cualquier solicitud que traiga uno**.
14
+
15
+ **Capa 3 — Consenso (no existe).** Bitcoin no rechaza un gasto por carecer de firma post-cuántica, y nada de lo que publicamos cambia eso. Un adversario cuántico que alcance la clave clásica subyacente gasta de todos modos. Lo que esta construcción compra en su lugar es **concentración**: muchas claves clásicas expuestas se colapsan en una sola clave oculta por hash, rotable, controlada por el custodio, con un registro firmado post-cuánticamente de quién estaba autorizado a hacer que esa clave firme. Eso es una reducción real de la superficie de ataque y un mecanismo de gobernanza. **No es inmunidad, y no la describimos como tal.**
16
+
17
+ **2) No tienes que creernos nada de esto**
18
+
19
+ ```
20
+ npm i fractal-pqc@0.10.0
21
+ npx fractal-pqc verify-letter # este correo exacto, verificado contra el código, en tu máquina
22
+ npx fractal-pqc demo # el flujo completo, offline, 20 segundos
23
+ npx fractal-pqc claims --mutate # cada afirmación de seguridad, rota a propósito, para probar que se sostiene
24
+ npx fractal-pqc selftest # 379 verificaciones, sin mocks
25
+ ```
26
+
27
+ Hace dieciocho afirmaciones factuales, y cada una de ellas — cada conteo, cada versión, cada comportamiento que describimos — se verifica automáticamente contra el código en vivo, incluida esta misma oración. Cambia un número aquí y la verificación falla; cambia el código y la verificación falla. Señala, en la misma salida, las cuatro cosas aquí que ninguna verificación cubre: dos juicios, un agregado contado a mano, y cada compromiso a futuro. Eso son opiniones y promesas, y nos negamos a reportarlas como verificadas.
28
+
29
+ También probamos nuestro propio código de forma adversarial antes de publicar cualquier cosa: cada afirmación de seguridad va acompañada de un ataque que debe fallar, y una mutación del código que debe romper la afirmación si la garantía que nombra deja de sostenerse. **Doce rondas de asedio adversarial** contra nuestro propio código encontraron diez bugs reales, explotables — aproximadamente 1.150 exploits ejecutados a mano entre esos diez — incluido uno donde un cliente legítimo de un custodio podría haber obtenido una firma sobre la moneda de otro cliente. Cada uno de esos bugs es ahora una prueba de regresión permanente: `claims --mutate` reintroduce el bug exacto y confirma que sigue siendo detectado.
30
+
31
+ Nuestro codec OTS se verifica contra el ejemplo de referencia del propio proyecto OpenTimestamps, confirmado en el bloque de Bitcoin **358391**. El gasto por script-path se verifica contra los vectores de prueba oficiales de wallet BIP-341: 7/7 casos de scriptPubKey y 12/12 bloques de control, byte por byte. **Los vectores siguen siendo CC0.** 33 de ellos ya están publicados — quien los corra es dueño de su propia verificación.
32
+
33
+ **3) Sobre los $320k — la solicitud, y lo que ya está entregado**
34
+
35
+ **El Hito 1 está entregado, y no está en esta factura.** El registro anclado en Bitcoin — exactamente la brecha que tu pregunta expuso — está construido, publicado, y ejecutable por ti hoy, por $0: `npx fractal-pqc verify-anchor`.
36
+
37
+ Lo que queda es precisamente lo que no podemos hacer solos:
38
+
39
+ | # | Qué queda | Por qué se requiere dinero | Monto |
40
+ |---|---|---|---|
41
+ | ~~M1~~ | ~~Registro de primer-visto anclado en Bitcoin~~ | **ENTREGADO — `npx fractal-pqc verify-anchor`** | **$0** |
42
+ | **M2** | Primacía relativa a la exposición, corriendo en el flujo de firma de un custodio real contra gastos de testnet financiados. El código, la conformidad BIP-341 y la compuerta ya existen — lo que falta es el tiempo de integración de un custodio | $120,000 |
43
+
44
+ **Tranche 1 — $120,000 / 90 días** (M1 está entregado y no facturado; esta es la primera decisión pagada).
45
+
46
+ **Tranche 2 — $80,000** — revisión externa independiente, publicada en su totalidad incluyendo hallazgos negativos, más multisig y rotación de claves (hoy, una clave perdida es un bloqueo permanente).
47
+ **Tranche 3 — $120,000** — especificación pública, interoperabilidad entre wallets, mantenimiento a largo plazo de los vectores. Éxito medido por adoptantes independientes, no por nuestras propias afirmaciones.
48
+
49
+ Te comprometes al siguiente tranche solo después de que verifiques el anterior tú mismo. Si un hito no se verifica, nos detenemos y no nos debes nada más.
50
+
51
+ **4) Los cuatro límites que ningún diseño de esta forma puede cerrar — y los publicamos en el paquete**
52
+
53
+ 1. **La última firma es clásica.** Ningún soft fork, ninguna inmunidad.
54
+ 2. **El cutoff es una fecha que nadie puede verificar.** La garantía es "anclado antes de que la criptografía se rompiera", y nadie sabe cuándo fue eso. Nos negamos a imprimir un Q-day — tú suministras la altura, y sin una, el motor se niega a autorizar del todo. Un compromiso **anclado en 800,000 con exposición en 850,000** — la posición más fuerte que este esquema le puede dar a alguien — sigue rechazado bajo un cutoff de 790,000: el cutoff es un piso que la exposición nunca puede levantar.
55
+ 3. **Un timestamp prueba "no más tarde que", nunca "no antes de".** La cobertura está limitada por adopción previa, no por criptografía.
56
+ 4. **Anclar la identidad de un log no ancla su historia.** La vista dividida es detectable, nunca prevenible.
57
+
58
+ **Lo que realmente somos.** No el estándar — cualquiera que afirme serlo en esta etapa está vendiendo. Somos, hasta donde sabemos, el único paquete que te dirá, en tu propia máquina, cuáles de sus propias afirmaciones de seguridad no puede respaldar — y construimos esa herramienta porque preferimos que nos atrapen a que nos crean.
59
+
60
+ **Cuatro compromisos que van con el dinero**
61
+
62
+ 1. **Cada entregable llega con su propio recibo post-cuántico, anclado en Bitcoin.** Verificas nuestro trabajo usando el mismo mecanismo que estás financiando.
63
+ 2. **Cláusula pública de fallo.** Si alguien — incluidos nosotros — rompe el esquema de vinculación durante el grant, lo publicamos en su totalidad dentro de 72 horas y dejamos de facturar hasta que se corrija. Nuestro propio asedio lo ha roto diez veces ya, la más reciente en los días antes de este correo; eso no es una política hipotética.
64
+ 3. **Los vectores siguen siendo CC0.**
65
+ 4. **No dilutivo, código abierto, sin exclusividad.**
66
+
67
+ **Una cosa más, posiblemente valga más que el dinero.** Galaxy Research publica. Preferiríamos que esto terminara como un artefacto citable en vez de un entregable de proveedor: publiquemos la especificación de vinculación y los vectores de conformidad conjuntamente, con tu equipo como revisores, y cada hallazgo de red-team — incluidos los nuestros — divulgado.
68
+
69
+ **Dónde estamos parados, con toda claridad.** FRACTAL AI S.A.S. (Colombia). Operamos una L1 post-cuántica en producción cuyo consenso firma cada bloque con ML-DSA-65 — una cadena de un solo operador, cosa que decimos públicamente en vez de llamarla una red. Somos pre-ingresos. No somos un equipo de protocolo de Bitcoin, y por eso mismo el kit se valida contra vectores oficiales BIP en vez de contra nuestras propias suposiciones.
70
+
71
+ ¿Podríamos hacer 20 minutos esta semana? Agenda: (1) el camino de cumplimiento línea por línea, incluyendo el ataque que rompió v1; (2) los cuatro límites, y si estás de acuerdo en que son irreducibles; (3) si esta estructura de tranches encaja con cómo financian ustedes.
72
+
73
+ Saludos,
74
+ John Edward Romo Sánchez
75
+ CEO, FRACTAL AI S.A.S. (NIT 902025722-1) · helloinvestor@fractalai.net.co
Binary file
@@ -2,152 +2,69 @@ Subject: Re: FractalAI — what enforces the PQ requirement (it's on npm; run it
2
2
 
3
3
  Hi,
4
4
 
5
- Three questions, and the third is the one that matters, so I'll start there — including a boundary I want to state before anything else.
5
+ Direct answers to your three questions.
6
6
 
7
7
  **1) What enforces the post-quantum signature requirement**
8
8
 
9
- Three layers. Two exist and are published. The third does not exist, and I won't pretend otherwise.
9
+ Three layers. Two are built and live. One does not exist, and we say so plainly.
10
10
 
11
- **Layer 1 — Binding (exists).** A holder's classical key (secp256k1 / Taproot output key) is bound to an ML-DSA-65 (FIPS-204, NIST Level 3) public key inside a domain-separated commitment.
11
+ **Layer 1 — Binding (built).** A holder's Bitcoin key (secp256k1 / Taproot output key) is bound to an ML-DSA-65 (FIPS-204, NIST Level 3) key inside a signed commitment.
12
12
 
13
- **Layer 2 — Spend policy, fail-closed (exists — the actual enforcement point).** The rule a custodian runs is: **no ML-DSA-65 signature over the spend digest, bound to the holder's first-seen anchored commitment ⇒ no signature is released.** Every guard refuses by default; the signing call is the last statement in the function, and an unexpected input refuses rather than escaping.
13
+ **Layer 2 — Spend policy (built — this is the actual enforcement point).** A custodian's signer refuses to release a signature unless it verifies an ML-DSA-65 signature bound to that exact spend. Every guard refuses by default, and it never trusts a caller-supplied value for what it's signing: **a request that does not say which coin it is for is refused**, and **the engine computes the digest it signs and refuses any request that carries one**.
14
14
 
15
- **Layer 3 — Consensus (does NOT exist).** Bitcoin does not reject a spend for lacking a PQ signature, and nothing we ship changes that. I'll be blunter than the pitch requires: the only thing consensus ever checks is a classical Schnorr signature on the policy key. A quantum adversary who reaches that key spends anyway. What this construction actually buys is **concentration** — N exposed classical keys become one hash-hidden, rotatable, custodian-controlled key — plus a post-quantum-signed record of who was authorised to make that key sign, giving the custodian a cryptographic reason to refuse everyone else. That is a real reduction in attack surface and a governance mechanism. **It is not immunity, and we removed the sentence that said it was.**
15
+ **Layer 3 — Consensus (does not exist).** Bitcoin does not reject a spend for lacking a PQ signature, and nothing we ship changes that. A quantum adversary who reaches the underlying classical key spends anyway. What this construction buys instead is **concentration**: many exposed classical keys collapse into one hash-hidden, rotatable, custodian-controlled key, with a post-quantum-signed record of who was authorised to make that key sign. That is a real reduction in attack surface and a governance mechanism. **It is not immunity, and we do not describe it as one.**
16
16
 
17
- One correction I owe you inside this same paragraph, because it is the finding of our seventh siege and it lands squarely on the sentence above. That sentence used to read "a record of who *should have been allowed to spend*", and until days before this email that was an overclaim: the engine received the spend digest as 32 opaque bytes and never learned **which output** it was signing for. Our own siege stood up a second, entirely legitimate client of the same custodian and had it obtain a policy-key signature over the **first client's** sighash. Every check passed. The concentration this paragraph describes — one policy key across many leaves — is precisely the deployment in which that is theft. It is fixed in `0.9.0`: the leaf commits to the holder's own anchored fact hash, the engine recomputes the output key from it, and **a request that does not say which coin it is for is refused** rather than defaulted. A footgun you step on by omission is a fail-open default with a paragraph next to it.
17
+ **2) You don't have to take our word for any of this**
18
18
 
19
- **2) You can run all of it, right now, without believing any of this**
20
-
21
- Including this email. It makes eighteen factual assertions — every count, every block
22
- height, every version, and five sentences about what the engine does. Each one is registered
23
- with an executable check that reads the asserted value **out of this letter** and compares it
24
- to a value measured from the package. Change a number in the letter and the check reads the
25
- new number and fails; change the code and the measurement moves and it fails. Neither can
26
- drift from the other.
27
-
28
- ```
29
- npx fractal-pqc verify-letter # this email, checked against the code, on your machine
30
- ```
31
-
32
- The letter you are reading ships inside the package, so you can also confirm nothing was
33
- altered between my sending it and your reading it. **If any assertion fails, this email is
34
- wrong — and you will know before I do.** It also prints, in the same output, the five things in here that no check covers: two judgements, one hand-counted aggregate, one historical figure that can no longer be re-measured, and every forward-looking commitment. Those are opinions, memories and promises, and we refuse to report them as verified.
35
-
36
- I built that tool because of the disease in section 5, and I built it for this letter
37
- specifically. It found three false numbers in my own draft before you saw it.
38
-
39
- ```
40
- npm i fractal-pqc@0.9.0
41
- npx fractal-pqc demo # the whole path, offline, in 20 seconds — see below
42
- npx fractal-pqc claims # every security claim we make, each with an attack
43
- npx fractal-pqc claims --gaps # and what the green does NOT cover
44
- npx fractal-pqc claims --mutate # break the code, watch the sentences die
45
- npx fractal-pqc selftest # 331 checks, no mocks
46
19
  ```
47
-
48
- **Start with `demo`.** It is the answer to your question, executed rather than described.
49
- In one offline run it generates a holder identity, dual-signs a migration commitment, appends
50
- it to an RFC 6962 log, signs the head with ML-DSA-65, anchors it, verifies the anchor by
51
- recomputing everything — and then runs the custodian policy engine. That last part is the
52
- point, and it is why most of what you will watch are **refusals**: the engine authorises the
53
- rightful holder once, and then refuses six times. Including this one, which is the attack the
54
- whole design exists for:
55
-
56
- > *a post-quantum adversary who already HOLDS the victim's classical key, produces a genuinely
57
- > valid dual-signed rebinding, and an honest append-only log accepts it — and the engine still
58
- > refuses, because the attacker loses on PRIMACY, not on the signature.*
59
-
60
- The demo names the synthetic parts (there is no network call, so the Bitcoin attestation is
61
- constructed locally and it says so on the line where it matters), and it ends by naming the
62
- ceiling: consensus only ever checks a classical Schnorr signature, so this is not immunity.
63
- It is also a test — `test/demo.mjs` fails the build if any of those six refusals ever starts
64
- authorising, which is the only reason I am willing to put it in this email.
65
-
66
- Published today. `verify-anchor` verifies a bundle offline: the tree head's ML-DSA-65 signature, the inclusion proof with the Merkle root **recomputed** rather than compared to one we hand you, an RFC 6962 consistency proof that no history was rewritten, and a Bitcoin anchor derived from the OpenTimestamps proof alone — height and Merkle root, which you then check against a header from **your own node**. We are not in that path.
67
-
68
- A bundle ships in the package so you can run that path end to end;
69
- `node_modules/fractal-pqc/examples/README.md` has the command with its flags filled in:
70
-
20
+ npm i fractal-pqc@0.11.0
21
+ npx fractal-pqc verify-letter # this exact email, checked against the code, on your machine
22
+ npx fractal-pqc demo # the full flow, offline, 20 seconds
23
+ npx fractal-pqc claims --mutate # every security claim, broken on purpose, to prove it holds
24
+ npx fractal-pqc selftest # 379 checks, no mocks
71
25
  ```
72
- npx fractal-pqc verify-anchor node_modules/fractal-pqc/examples/anchor-bundle.json \
73
- --log-id <the id, obtained independently of the bundle> \
74
- --cutoff <the height YOU choose> \
75
- --block-merkle-root=<height>=<root read from YOUR OWN node>
76
- ```
77
-
78
- Those three flags are mandatory and **none of them may come from the bundle**. Pinning against an identity the bundle supplies proves nothing; there is no objective Q-day, so the cutoff is yours; and a `.ots` is inert data that merely *claims* a Bitcoin height until a real header confirms it — round 3 of our own siege forged the entire temporal frontier with about a hundred bytes precisely because that last one was optional. Change one character of the log id and it refuses. Lower the cutoff below the anchor and it reports the frontier as NOT established and says, in those words, *do not authorise a spend on this.*
79
26
 
80
- To prove our OTS codec is right rather than merely self-consistent, the suite verifies the OpenTimestamps project's **own** example, produced by their reference client and confirmed in Bitcoin block **358391**. If we ever disagree with the reference implementation, our tests fail. Script-path (tapscript) is asserted against the **official BIP-341 wallet test vectors**: 7/7 scriptPubKey cases and 12/12 control blocks, byte for byte.
27
+ It makes eighteen factual assertions, and every one of them — every count, every version, every behaviour we describe — is checked automatically against the live code, including this sentence. Change a number here and the check fails; change the code and the check fails. It flags, in the same output, the four things in here that no check covers: two judgements, one hand-counted aggregate, and every forward-looking commitment. Those are opinions and promises, and we refuse to report them as verified.
81
28
 
82
- **3) On the $320k — the ask stands, and I've already absorbed the first slice of it**
29
+ We also test our own code adversarially before anything ships: every security claim is paired with an attack that must fail, and a mutation of the code that must break the claim if the guarantee it names stops holding. **Twelve adversarial siege rounds** against our own code found ten real, exploitable bugs — roughly 1,150 hand-run exploits across those ten — including one where a legitimate customer of a custodian could have obtained a signature over a different customer's coin. Every one of those bugs is now a permanent regression test: `claims --mutate` reintroduces the exact bug and confirms it still gets caught.
83
30
 
84
- You were right to push back: our application named a number without a line-item scope. Here is the scope, and one change I'd like you to notice.
31
+ Our OTS codec is checked against OpenTimestamps' own reference example, confirmed in Bitcoin block **358391**. Script-path spending is checked against the official BIP-341 wallet test vectors: 7/7 scriptPubKey cases and 12/12 control blocks, byte for byte. **Vectors stay CC0.** 33 of them are already published — whoever runs them owns their own verification.
85
32
 
86
- **Milestone 1 is delivered, and it is not on this invoice.** The anchor registry — the exact gap your question exposed — is built, published, and runnable by you today, for $0. I'd rather show you a milestone than describe one.
33
+ **3) On the $320k — the ask, and what's already delivered**
87
34
 
88
- What remains is, deliberately, **precisely what we cannot do alone**:
35
+ **Milestone 1 is done, and it's not on this invoice.** The Bitcoin-anchored registry — the exact gap your question exposed — is built, published, and runnable by you today, for $0: `npx fractal-pqc verify-anchor`.
89
36
 
90
- **Tranche 1 — $120,000 / 90 days** (M1 is delivered and unbilled; this is the first paid decision)
37
+ What remains is precisely what we cannot do alone:
91
38
 
92
- | # | What remains | Why money is required for it | Amount |
39
+ | # | What remains | Why money is required | Amount |
93
40
  |---|---|---|---|
94
41
  | ~~M1~~ | ~~Bitcoin-anchored first-seen registry~~ | **DELIVERED — `npx fractal-pqc verify-anchor`** | **$0** |
95
- | **M2** | **Exposure-relative primacy, in a real custodian's signing flow** — the design is below, and the primitive is already shipped and enforced in `fractal-pqc@0.9.0`. What remains is a *custodian* running it against funded testnet spends | The code, the BIP-341 conformance and the gate exist. What is missing is a custodian, and custodian engineering time is what money buys | $120,000 |
42
+ | **M2** | Exposure-relative primacy, running in a real custodian's signing flow against funded testnet spends. The code, the BIP-341 conformance and the gate already exist — what's missing is a custodian's integration time | $120,000 |
96
43
 
97
- **Tranche 2 — $80,000** — **independent external review**, published in full including negative findings, plus multisig PSBT and key rotation (today a lost ML-DSA secret is a permanent lockout, and the package says so). We cannot review ourselves; this is the one deliverable whose entire value comes from it not being us.
98
- **Tranche 3 — $120,000** — public specification, wallet interoperability, long-term maintenance of the vectors. Success measured by independent adopters, not by our own claims.
99
-
100
- You commit to a tranche only after the previous one is publicly verified by you. If a milestone doesn't verify, the engagement stops and you owe nothing further.
101
-
102
- **3b) M2, in detail — because it is the part I think you will actually care about**
103
-
104
- **Exposure-relative primacy.** The cutoff frontier in M1 has a weakness we state in our own README: the guarantee is "anchored before the cryptography broke", and **nobody knows when it broke**. Every verifier is guessing a date, and a private break earlier than the guess produces forged entries indistinguishable from real ones.
105
-
106
- For one important class of holders, that guess is now unnecessary.
107
-
108
- For a secp256k1 key whose hash is all the chain has ever shown — **an unspent P2PKH/P2WPKH output** — the kit proves a fact checkable in Bitcoin rather than an estimate: that the holder's post-quantum commitment was anchored in a Bitcoin block **strictly before** the block in which their public key first appeared **on chain**. We do not supply the exposure height and deliberately ship **no oracle** for it — the verifier supplies it from their own node, and the anchor is confirmed against the verifier's own block header.
109
-
110
- Where that inequality holds, the proof depends on **no Q-day date**: at the moment of anchoring the chain had not yet revealed the public key, so the ability to break secp256k1 was not sufficient to have produced that commitment.
111
-
112
- It is wired as a **gate**, not a report: `authorizeAndSign({ …, exposureHeight })` refuses and releases no signature when the commitment was anchored after exposure. Supplied means **enforced** — a parameter that can be passed and silently dropped is worse than one that does not exist.
44
+ **Tranche 1 — $120,000 / 90 days** (M1 is delivered and unbilled; this is the first paid decision).
113
45
 
114
- And one structural change our eighth siege forced, which I would rather you heard from me: **the engine computes the digest it signs and refuses any request that carries one.** Until last week it accepted a 32-byte digest from the caller, which makes it a signing *oracle* — every check it performs then compares two values the caller controls. Our own siege used that to have one legitimate client of a custodian obtain a policy-key signature over another client's coin. The caller now supplies the transaction; the engine derives the BIP-341 sighash itself, over the prevout it verified belongs to that holder.
115
-
116
- And the precise shape of it, which our seventh siege made us state properly: **this gate is a conjunction, never a substitution.** The cutoff you choose stays mandatory and is still applied afterwards, so a commitment anchored at 800,000 with exposure at 850,000 — the strongest position this scheme can give anyone — is still refused under a cutoff of 790,000. Supplying an exposure height *narrows* what authorises; it never rescues what the cutoff rejects. What is true, and is the whole point, is that the second condition depends on no Q-day estimate. The receipt now says exactly that, in those words, instead of the flatter sentence it used to print.
117
-
118
- The claim is bounded, and we say so in the code itself:
119
- - it assumes the holder published the key through **no other channel** — we measure on-chain appearance only, and a key leaked via an unconfirmed mempool broadcast or a shared xpub was derivable earlier than this proof suggests;
120
- - it **does not save keys already exposed by an earlier spend**. You cannot anchor into the past. Those coins must be moved, and the engine says exactly that when it refuses.
46
+ **Tranche 2 — $80,000** — independent external review, published in full including negative findings, plus multisig and key rotation (today, a lost key is a permanent lockout).
47
+ **Tranche 3 — $120,000** — public specification, wallet interoperability, long-term maintenance of the vectors. Success measured by independent adopters, not by our own claims.
121
48
 
122
- We put this through a full adversarial round before writing this paragraph. It found two real defects in the reporting surface — an absent parameter yielding the strongest claim, and refusals that still returned `valid: true` — both now closed, both now covered by mutations that turn the ledger red if they regress. **That round is why this paragraph says "on chain" rather than "public", and why the two bounds above are in the package and not only in this email.**
49
+ You fund the next tranche only after the previous one is verified by you. If a milestone doesn't verify, we stop and you owe nothing further.
123
50
 
124
51
  **4) The four limits no design of this shape can close — and we ship them in the package**
125
52
 
126
- 1. **The last signature is classical.** Covered above. No soft fork, no immunity.
127
- 2. **The cutoff is a date nobody can verify.** The guarantee is "anchored before the cryptography broke", and nobody knows when it broke. A private break earlier than the chosen cutoff produces forged entries indistinguishable from real ones. **We refuse to print a Q-day**; the verifier supplies the height, and without one the engine refuses to authorise at all.
128
- 3. **A timestamp proves "no later than", never "no earlier".** So primacy is relative to the log you pinned. Coverage is bounded by prior *adoption*, not by cryptography.
129
- 4. **Pinning a log's identity does not pin its history.** Two same-size heads carry the same logId. Split view is detectable, never preventable; pass known heads and the engine refuses on contradiction.
130
-
131
- **5) What I actually think we are, since you'll ask**
132
-
133
- We are not the standard, and anyone claiming to be one at this stage is selling. Here is the specific thing we are, and you can falsify it in thirty seconds:
134
-
135
- **Ours is the only package I know of that will tell you, on your machine, which of its own security claims it cannot back.** A claim is admissible only with three things: an executable proof, an executable *attack* that must fail, and a **mutation** of the code it names under which the claim must fail. A sentence no mutation can kill is reported as vacuous and the build breaks.
136
-
137
- We built that because we needed it. Ten adversarial siege rounds against our own code — roughly 1,150 executed exploits — found the same disease every time and never once in the mathematics: an English sentence and a code path written separately, with a fully green test suite in between hiding the gap. Round 5 deleted a single line binding an anchor to the head it timestamps; the ledger printed all-green and 263 assertions passed, because no claim named that guard. Round 7 — run against the very paragraph in section 3b, in the days before this email — found the cross-client signature described in section 1, and found a frozen scope string still telling auditors that the M2 gate did not exist while the gate was refusing signatures. Round 10, run against this exact letter before it was sent: `cutoffBlockHeight`, `blockMerkleRoots` and `knownHeads` were each read straight off the request at every point they were needed, instead of being snapshotted once the way `anchorEvidence` already was — and for `knownHeads` that was not a theoretical gap. An accessor that shows a genuinely conflicting log head to the length check and an empty array to the loop that actually runs equivocation detection produced a real, verifiable ML-DSA-gated Schnorr signature in exactly the case section 4's limit #4 promises a refusal for. All three fields now get the same snapshot-once discipline. The `knownHeads` and `cutoffBlockHeight` exploits are each closed and covered by a mutation that turns the ledger red if either regresses. `blockMerkleRoots` got the identical fix on the identical reasoning, but we could not construct an attack that flips authorisation through it alone — every consumer looks the anchor height up by key, so a divergent read fails closed rather than open — and we are not shipping a mutation we cannot honestly make fail; that field's hardening is disclosed as defense-in-depth, not as the closure of a demonstrated bypass. Every mutation in the matrix reintroduces a bug that really shipped in this package, tagged with the round that caught it. **The matrix is simultaneously our test harness and the public record of our own failures.**
138
-
139
- I am telling you about round 7 in the letter that asks you for money, before you could possibly have found it yourself, because the alternative is a commitment on the next page that would be worth nothing.
53
+ 1. **The last signature is classical.** No soft fork, no immunity.
54
+ 2. **The cutoff is a date nobody can verify.** The guarantee is "anchored before the cryptography broke," and nobody knows when that was. We refuse to print a Q-day — you supply the height, and without one the engine refuses to authorise at all. A commitment **anchored at 800,000 with exposure at 850,000** — the strongest position this scheme can give anyone — is still refused under a cutoff of 790,000: the cutoff is a floor exposure can never lift.
55
+ 3. **A timestamp proves "no later than," never "no earlier."** Coverage is bounded by prior adoption, not by cryptography.
56
+ 4. **Pinning a log's identity does not pin its history.** Split view is detectable, never preventable.
140
57
 
141
- That is also why the retraction in section 1 is a *test*, not a footnote: the old immunity claim is a mutation, and it must kill the claim that replaced it. In a field that has watched a lot of projects overclaim quantum immunity, being the team that turned its own retraction into an executable assertion is the only credential I'd ask you to weigh.
58
+ **What we actually are.** Not the standard — anyone claiming to be one at this stage is selling. We are, as far as we know, the only package that will tell you, on your own machine, which of its own security claims it cannot back — and we built that tool because we'd rather be caught than trusted.
142
59
 
143
60
  **Four commitments that go with the money**
144
61
 
145
62
  1. **Every deliverable arrives with its own post-quantum receipt, Bitcoin-anchored.** You verify our work using the mechanism you're funding.
146
- 2. **Public failure clause.** If anyone — including us — breaks the binding scheme during the grant, we publish it in full within 72 hours and stop invoicing until it's fixed. Our own siege has broken it ten times, the most recent one in the days before this email; that's not a hypothetical policy.
147
- 3. **Vectors stay CC0.** 33 of them are already published. Whoever runs them owns their own verification.
63
+ 2. **Public failure clause.** If anyone — including us — breaks the binding scheme during the grant, we publish it in full within 72 hours and stop invoicing until it's fixed. Our own siege has broken it ten times already, the most recent one in the days before this email; that's not a hypothetical policy.
64
+ 3. **Vectors stay CC0.**
148
65
  4. **Non-dilutive, open source, no exclusivity.**
149
66
 
150
- **One more thing, possibly worth more than the money.** Galaxy Research publishes. I'd rather this end as a citable artefact than a vendor deliverable: publish the binding spec and the conformance vectors **jointly**, with your team as reviewers, and every red-team finding — ours included — disclosed. Whoever owns the vectors that wallets run shapes how this migration gets done.
67
+ **One more thing, possibly worth more than the money.** Galaxy Research publishes. We'd rather this end as a citable artefact than a vendor deliverable: publish the binding spec and the conformance vectors jointly, with your team as reviewers, and every red-team finding — ours included — disclosed.
151
68
 
152
69
  **Where we stand, plainly.** FRACTAL AI S.A.S. (Colombia). We run a post-quantum L1 in production whose consensus signs every block with ML-DSA-65 — a single-operator chain, which we state publicly rather than calling it a network. We are pre-revenue. We are not a Bitcoin protocol team, which is exactly why the kit is validated against official BIP vectors rather than our own assumptions.
153
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fractal-pqc",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Runnable reference for quantum-safe migration of a Bitcoin-style key: bind secp256k1/Taproot to ML-DSA-65 (FIPS-204), derive P2TR addresses, build+sign BIP-341 key-path spends (official-vector-verified), and broadcast on testnet. Real primitives, honest scope.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,6 +20,8 @@
20
20
  "./transparency": "./src/transparency.mjs",
21
21
  "./primacy": "./src/primacy.mjs",
22
22
  "./policy": "./src/policy.mjs",
23
+ "./m2-broadcast": "./src/m2-broadcast.mjs",
24
+ "./custodian-log": "./src/custodian-log.mjs",
23
25
  "./tapscript": "./src/tapscript.mjs",
24
26
  "./ots": "./src/ots.mjs",
25
27
  "./address": "./src/address.mjs",
@@ -42,7 +44,7 @@
42
44
  "vectors"
43
45
  ],
44
46
  "scripts": {
45
- "test": "node test/vectors.mjs && node test/transparency.mjs && node test/primacy.mjs && node test/anchoring.mjs && node test/conformance.mjs && node test/m2-policy.mjs && node test/bip341-scriptpath.mjs && node test/claims.mjs && node test/demo.mjs && node test/letter-claims.mjs",
47
+ "test": "node test/vectors.mjs && node test/transparency.mjs && node test/primacy.mjs && node test/anchoring.mjs && node test/conformance.mjs && node test/m2-policy.mjs && node test/m2-broadcast.mjs && node test/custodian-log.mjs && node test/bip341-scriptpath.mjs && node test/claims.mjs && node test/demo.mjs && node test/letter-claims.mjs",
46
48
  "selftest": "node bin/cli.mjs selftest",
47
49
  "conformance": "node test/conformance.mjs",
48
50
  "claims": "node bin/cli.mjs claims",