fractal-pqc 0.10.0 → 0.12.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
@@ -228,12 +228,31 @@ did. Each milestone is independently verifiable, open-source, and shippable on i
228
228
  before this roadmap section was last reconciled) — `buildSpendContext` takes `otherInputs`,
229
229
  so a custodian consolidating more than one deposit per holder does not recreate the round-8
230
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) a thin
232
- service wrapper (HTTP/RPC, structured audit logging of every authorize/refuse decision,
233
- idempotent UTXO handling) around the pure library; (d) a real answer for `policyKey`
234
- custody (today a single Schnorr key per custodian — losing or leaking it is custodian-wide,
235
- not just holder-wide, and nothing here enforces the `singlePolicyKeyPerHolder` convention
236
- callers are trusted to uphold); (e) the funded testnet broadcast itself.
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) ✅
238
+ *partially done* (round 13) — `policy-key-registry.mjs` enforces the
239
+ `singlePolicyKeyPerHolder` convention instead of trusting callers to uphold it: a policy
240
+ key stays bound to whichever classical key first authorised under it, and a different
241
+ holder is refused before a signature is ever computed, proven by
242
+ `R13-policy-key-registry-refuses-cross-holder-reuse` against a genuine two-holder attack.
243
+ **Not done:** the wrapper is opt-in (a caller can still call `authorizeAndSign` directly
244
+ and skip it), and HSM/multisig custody of the raw Schnorr secret itself — losing or
245
+ leaking that secret is still custodian-wide, not just holder-wide; (e) the funded testnet
246
+ broadcast itself.
247
+
248
+ **A custodian using (c) and (d) together** should compose them with the audit log
249
+ OUTERMOST and the registry INNERMOST —
250
+ `custodianAuthorize(log, idempotencyKey, req, ts, (r) => registry.authorize(r))` — round
251
+ 15 found that the other order (registry outermost) silently drops the audit trail for a
252
+ refused cross-holder attempt, which is exactly the attempt most worth recording. Proven
253
+ by `R15-log-and-registry-compose-without-losing-either-guarantee` and
254
+ `test/composed-custody.mjs`, the only place either wrapper is exercised alongside the
255
+ other rather than in isolation.
237
256
 
238
257
  4. **Tranche 2, $80,000 — independent external review, multisig PSBT, key rotation.**
239
258
  External review: scope not yet defined here, tracked separately from the two engineering
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", "m2-broadcast.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", "policy-key-registry.mjs", "composed-custody.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: 357 real checks, no mocks
471
+ fractal-pqc selftest Run everything: 405 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.12.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 # 405 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. **Dieciocho rondas de asedio adversarial** contra nuestro propio código encontraron catorce bugs reales, explotables — aproximadamente 1.150 exploits ejecutados a mano entre esos catorce — incluido uno donde un cliente legítimo de un custodio podría haber obtenido una firma sobre la moneda de otro cliente, uno donde componer nuestras dos herramientas de auditoría en el orden más obvio silenciaba el registro de un ataque rechazado, y uno donde una entrada malformada podía hacer que dos transacciones de Bitcoin distintas produjeran el mismo digest firmado. 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 catorce 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.10.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 # 357 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.12.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 # 405 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. **Eighteen adversarial siege rounds** against our own code found fourteen real, exploitable bugs — roughly 1,150 hand-run exploits across those fourteen — including one where a legitimate customer of a custodian could have obtained a signature over a different customer's coin, one where composing our own two audit tools in the more obvious order silently dropped the record of a refused attack, and one where a malformed input could make two different Bitcoin transactions produce the same signed digest. 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. Eleven adversarial siege rounds against our own code — ten of them found a real defect, roughly 1,150 executed exploits between those ten — 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. Round 11 is the odd one out and we say so rather than pad the count: it found no defect in existing code, because the code it tests did not exist yet. `authorizeAndSign` returned a raw signature and nothing else in the package ever turned it into a broadcastable transaction — the custodian integration this letter's M2 section describes as remaining. `m2-broadcast.mjs` is that missing step, admitted to the same matrix: it rebuilds the exact witness a decision authorised, never a caller-supplied one, and the signature is re-verified independently against a freshly recomputed sighash before anything is finalized. 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 fourteen 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.10.0",
3
+ "version": "0.12.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",
@@ -21,6 +21,8 @@
21
21
  "./primacy": "./src/primacy.mjs",
22
22
  "./policy": "./src/policy.mjs",
23
23
  "./m2-broadcast": "./src/m2-broadcast.mjs",
24
+ "./custodian-log": "./src/custodian-log.mjs",
25
+ "./policy-key-registry": "./src/policy-key-registry.mjs",
24
26
  "./tapscript": "./src/tapscript.mjs",
25
27
  "./ots": "./src/ots.mjs",
26
28
  "./address": "./src/address.mjs",
@@ -43,7 +45,7 @@
43
45
  "vectors"
44
46
  ],
45
47
  "scripts": {
46
- "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/bip341-scriptpath.mjs && node test/claims.mjs && node test/demo.mjs && node test/letter-claims.mjs",
48
+ "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/policy-key-registry.mjs && node test/composed-custody.mjs && node test/bip341-scriptpath.mjs && node test/claims.mjs && node test/demo.mjs && node test/letter-claims.mjs",
47
49
  "selftest": "node bin/cli.mjs selftest",
48
50
  "conformance": "node test/conformance.mjs",
49
51
  "claims": "node bin/cli.mjs claims",
package/src/broadcast.mjs CHANGED
@@ -11,7 +11,7 @@
11
11
  import { generateTaprootKey } from "./bitcoin.mjs";
12
12
  import { p2trAddress, addressToScriptPubKey, taprootTweakOutputKey } from "./address.mjs";
13
13
  import { p2trScriptPubKey } from "./tx.mjs";
14
- import { selectCoins } from "./fees.mjs";
14
+ import { selectCoins, MAX_FEE_RATE_SAT_PER_VB } from "./fees.mjs";
15
15
  import { createPsbt, signPsbtTaprootKeyPath, finalizePsbt } from "./psbt.mjs";
16
16
  import { schnorr } from "@noble/curves/secp256k1.js";
17
17
 
@@ -43,11 +43,25 @@ export async function fetchUtxos(address, { network = "tb", apiBase } = {}) {
43
43
  return list.map((u) => ({ txid: u.txid, vout: u.vout, valueSats: u.value, status: u.status }));
44
44
  }
45
45
 
46
- /** Recommended fee rate (sat/vB). Falls back to 1 on parse issues. */
46
+ /**
47
+ * Recommended fee rate (sat/vB). Falls back to 1 on parse issues.
48
+ *
49
+ * Floored at 1 sat/vB (always did that); as of the 2026-09-04 audit sweep also CEILED at
50
+ * MAX_FEE_RATE_SAT_PER_VB (fees.mjs) — an anomalous response from the fee endpoint (bad
51
+ * config, MITM, upstream bug) used to flow straight through with no upper bound at all.
52
+ * selectCoins() enforces the same ceiling independently, so this is defence in depth for
53
+ * callers who use this function directly rather than through selectCoins.
54
+ */
47
55
  export async function fetchFeeRate({ network = "tb", apiBase, tier = "halfHourFee" } = {}) {
48
56
  const base = apiBase || net(network).api;
49
57
  const j = await getJson(`${base}/v1/fees/recommended`);
50
- return Math.max(1, Math.ceil(j[tier] ?? j.hourFee ?? 1));
58
+ const rate = Math.max(1, Math.ceil(j[tier] ?? j.hourFee ?? 1));
59
+ if (rate > MAX_FEE_RATE_SAT_PER_VB) {
60
+ throw new Error(`fee endpoint returned an anomalous rate (${rate} sat/vB, ceiling is ` +
61
+ `${MAX_FEE_RATE_SAT_PER_VB}) — refusing rather than using it. Pass --fee-rate ` +
62
+ `explicitly if this is genuinely correct.`);
63
+ }
64
+ return rate;
51
65
  }
52
66
 
53
67
  /** Broadcast a raw tx hex (Esplora `POST /tx`). Returns the txid. */