Repository navigation
Description
Tracking issue. This is the implementation plan for hybrid post-quantum key exchange in qbit's BIP324 v2 transport. The work is split into nine sub-issues, "parts", listed under Work plan. Parts 1–8 are one pull request each, and part 9 is the release gate. The Design section is the shared contract: sub-issues refer to it rather than repeat it, and a pull request that needs to change it updates this issue first. The original proposal, which used ML-KEM-768, is in this issue's edit history.
Epic · Size XL · Base branch 1.x.x (part 2's small scheduler PR targets main) · Code references are to 1.x.x at 45e9e72c2d · Sibling: part 1, the I2P post-quantum leasesets
Goal
Make every v2 connection between two upgraded qbit nodes confidential against "record now, decrypt later" by a future quantum computer. Stay fully compatible with v1.0.0 nodes, and change no consensus code.
When this epic is done:
- Two upgraded nodes derive their v2 session keys from both the existing ECDH secret and an ML-KEM-1024 shared secret, prove the switch with a key-confirmation packet, and show it:
getpeerinfotransport_pq, and2pin-netinfo. - Connections to v1.0.0 nodes, other legacy v2 peers and v1 peers work exactly as they do today.
- Repeated failures with one endpoint fall back to plain v2 in a bounded way, load shedding bounds what an inbound flood can cost, and operators can see all of it in
getpqtransportinfo. - The release gate has passed: fuzz campaign, flood measurement, outside review, 14-day mainnet canary, 7-day
testnet4soak and green CI. Release N, the first release with this work, ships the feature on by default.
Why
- v2 transport is on by default (
DEFAULT_V2_TRANSPORT{true},src/net.h:96). It derives every session key from a single secp256k1 ECDH secret (BIP324Cipher::Initialize,src/bip324.cpp:34-71). - A passive observer can record v2 traffic today. With a cryptographically relevant quantum computer, they could later recover the ECDH secret from the two 64-byte ElligatorSwift keys sent at the start of each connection, and decrypt the recorded session.
- What would leak is relay metadata:
inv,txandgetdatatiming and ordering, andaddrgossip. That helps attribute transactions to the nodes that first relayed them, and helps map the network. - The symmetric layer (ChaCha20-Poly1305 with FSChaCha20 rekeying every 224 messages) is not the weak point; the key exchange is. Spend authorization (P2MR with SLH-DSA) is unaffected.
Scope
In scope:
- the hybrid key exchange in the BIP324 v2 transport;
- its configuration, telemetry, fallback and load shedding;
- the ML-KEM library integration;
- tests, CI, tooling and docs;
- the release gate.
The I2P post-quantum leaseset change (part 1) is tracked here as a sibling but ships on its own, outside the release gate.
Not in scope:
- Peer authentication, or protection against an active man-in-the-middle. BIP324 stays unauthenticated.
- Pre-shared or out-of-band keys, and a "require PQ" option for pinned peers, which would need them.
- Removing ECDH.
- Any consensus, wallet, mempool or
photonchange. - Wire compatibility with Bitcoin nodes, which use a different network magic.
- Hiding traffic shape. Hybrid sessions are distinguishable from legacy v2 by packet sizes, and the operator guide points censorship-sensitive users to Tor and I2P.
- Transaction-origin privacy against spy peers.
- A timer on the initiator's hold.
-peertimeoutalready bounds it, and no qbit responder waits for the initiator's version packet. - Persisting the fallback set or hybrid successes across restarts.
Design
Overview
- Hybrid, and ECDH stays. Session keys come from HKDF over both the BIP324 ECDH secret and an ML-KEM-1024 shared secret (FIPS 203, NIST category 5), so they stay confidential unless both break. ML-KEM-1024 costs about 6 µs and 864 bytes more per connection than ML-KEM-768.
- No extra round trip.
- The responder puts its ML-KEM encapsulation key in its BIP324 version packet.
- The initiator holds its own version packet until the responder's arrives (they travel in the same TCP flight as today), and puts the ciphertext in it.
- Both sides switch keys right after the version packets. Each side's first packet under the new keys is a 20-byte key confirmation.
- Cost per hybrid connection:
- 3,184 extra bytes: two 1,572-byte records and two 20-byte confirmations. The largest single burst stays below TCP's 14.6 KB initial window.
- ML-KEM-1024 compute with native code: keygen 8.8 µs, encaps 9.7 µs, decaps 12.2 µs. Portable C takes 26–27 µs per operation. For comparison, today's ECDH costs 43.8 µs per side. (AMD Ryzen 9 9955HX, clang 21 -O3, medians of 20,000 runs.)
- Per-message encryption is unchanged, so block relay is unaffected in normal operation.
- Library: mlkem-native v2.0.0, vendored unmodified (part 3). Its C code is CBMC-proved memory-safe, and its x86_64 and AArch64 assembly is HOL-Light-proved correct and constant-time where it handles secret data. qbit uses native code with runtime detection on x86_64 (AVX2) and on macOS arm64, and portable C elsewhere, including AArch64 Linux: upstream's AArch64 assembly carries no BTI landing pads, and linking it would strip BTI/PAC hardening from the binary (part 3).
- Code layout: the record parser and per-connection KEM state live in
src/bip324_pq.{h,cpp}(PQHandshake), soV2TransportandBIP324Ciphergain only calls and upstream merges stay small.
Message flow
Initiator Responder
ellswift_I ‖ garbage_I ──────────►
◄────────── ellswift_R ‖ garbage_R
◄────────── terminator_R ‖ version_R{F0 ‖ ek} then holds
terminator_I ──────────►
holds its version until version_R arrives
version_I{F0 ‖ ct}, ECDH keys ──────────►
switch to hybrid keys decapsulate; switch to hybrid keys
confirmation, hybrid keys ──────────►
◄────────── confirmation, hybrid keys
application packets ◄─────────► application packets
- Neither side waits for the other's confirmation before sending. The receiver delivers application messages only after the peer's confirmation verifies.
- Between sending its offer and processing the initiator's version packet, the responder sends nothing, decoys included.
- With the switch off on either side, or toward a legacy peer, version contents are empty and today's ECDH keys stay in use.
Wire format
- Version-packet contents are zero or more records
CompactSize(len) ‖ header (1 byte) ‖ payload, wherelen ≥ 1counts the header plus the payload. The shape follows the bitcoin-dev Transport Feature Negotiation draft. - Header registry.
0x00is reserved.0xF0(PQ_MLKEM1024) is used for both the offer and the accept; the sender's role says which one a record is. qbit assigns its own header values from0xF0upward, far from the low values a Transport Feature Negotiation table would assign first. - The responder's offer is a
0xF0record whose payload is the 1,568-byte encapsulation key (ek). It is sent only when the responder's switch is on. - The initiator's accept is a
0xF0record whose payload is the 1,568-byte ciphertext (ct). It is sent only after a valid offer, with the initiator's switch on; otherwise the initiator sends empty contents.
| Object | Layout | Bytes |
|---|---|---|
| Offer contents | fd 21 06 f0 ‖ ek |
1,572 |
| Accept contents | fd 21 06 f0 ‖ ct |
1,572 |
| Record length | CompactSize 1,569 (header plus payload) | fd 21 06 |
| Encrypted version packet | encrypted length 3 ‖ encrypted payload (header 00 ‖ contents) 1,573 ‖ tag 16 |
1,592 |
| Encrypted confirmation | encrypted length 3 (plaintext 00 00 00) ‖ encrypted header 1 (plaintext 80) ‖ tag 16 |
20 |
- AAD. Both version packets travel under the ECDH keys. A sender's first packet authenticates its garbage as AAD, so if a decoy already consumed it, the version packet uses empty AAD. Confirmations always use empty AAD.
Parse rules
PQHandshake::ParseContents is noexcept and makes one pass over a non-owning SpanReader, keeping only the position of the first own record. The 4,000,013-byte contents limit bounds its work.
- The whole contents must parse as records. Empty contents, or a parse failure anywhere (truncation, a zero, non-canonical or oversized length, trailing bytes), mean "no features": the connection keeps today's behavior and is never dropped for it. This deliberately differs from the Transport Feature Negotiation draft, which disconnects on unparseable contents: BIP324 receivers ignore version contents today, and v1.0.0 relies on that.
- The first
0xF0record wins. Later0xF0records and unknown headers are ignored, but the transcript still covers them. - Only after the whole grammar validates is the first own record checked:
ekmust be 1,568 bytes and pass the FIPS 203 §7.2 modulus check, andctmust be 1,568 bytes. A malformed first own record disconnects (malformed_record, with reasonek_length,ek_modulusorct_length). - A corrupted
ctof the right length can't be detected (ML-KEM's implicit rejection). The two sides derive different keys, and the key confirmation fails at once.
Key schedule
- Retained secret. The initiator and responder keep the raw 32-byte BIP324 ECDH secret (
ss_ECDH, the output ofComputeBIP324ECDHSecret) pastInitialize, until the switch decision. It is wiped on every path. - Transcript.
BIP324Cipherkeeps a runningCSHA256, so contents are never stored:The contents are the full version-packet contents each side sent, responder first, including unknown and duplicate records. Packet framing, garbage, terminators, tags and confirmations are not hashed. For the ordinary one-record exchange the TH input is 3,278 bytes.TH = SHA256( ellswift_I (64) ‖ ellswift_R (64) ‖ CompactSize(len(contents_R)) ‖ contents_R ‖ CompactSize(len(contents_I)) ‖ contents_I ) - Derivation (HKDF-SHA256, RFC 5869):
The network magic is in wire order: mainnet
salt = ASCII("qbit_v2_hybrid_mlkem1024") ‖ network_magic 24 + 4 = 28 bytes, no NUL IKM = ss_ECDH (32) ‖ ss_MLKEM (32) ‖ TH (32) 96 bytes PRK = HMAC-SHA256(key = salt, msg = IKM) initiator_L, initiator_P, responder_L, responder_P, session_id = HMAC-SHA256(PRK, ASCII(label) ‖ 01) 32 bytes each44 4f 24 a8, regtesta6 6b 1f da. - Switch.
SwitchToHybridre-emplaces all four FSChaCha20 and FSChaCha20Poly1305 objects with counters at 0, and replaces the session id. Garbage terminators are not re-derived. Later rekeys derive from the hybrid keys. - Recipe changes. Any recipe change takes a new header with its own salt label. A label-only change under the same header would let two adjacent releases both accept the offer, derive different keys and disconnect at the first hybrid packet.
- Vectors.
src/test/data/pq_transport_vectors.jsonholds the inputs and every intermediate value. An independent Python reference generates it (part 4).
Key confirmation
Right after switching, each side's first packet under the hybrid keys is an empty decoy, 20 bytes on the wire, sent with Encrypt({}, {}, ignore=true). It consumes hybrid packet index 0 in each direction.
The receiver requires all of the following, and otherwise disconnects at once with first_packet_failed:
- the decrypted length is 0, checked as soon as the 3 length bytes arrive (reason
length); - the tag verifies (reason
tag); - the ignore bit is set (reason
not_decoy).
Without this check, a key mismatch decrypts to a random length, and about 24% of the time the receiver would wait for bytes that never arrive until the 60 s handshake timeout. transport_pq, the hybrid status and the hybrid session id are reported only after the peer's confirmation verifies; until then the status is pending.
Fallback after repeated failures (part 5)
-
Counted failures, outbound only, per endpoint:
malformed_record;first_packet_failed;closed_after_switch: after we switched and before the peer's confirmation verified, the peer closed the connection (eof,reset) or the handshake timed out (timeout).
Our own disconnects (operator, shutdown, network off, eviction, feelers) and send errors never count. Legacy outcomes are neutral. Only a confirmed hybrid success clears a streak.
-
Entering fallback. An endpoint enters the fallback set after 3 consecutive counted failures, and never if it completed a hybrid handshake since startup. A single failure is telemetry only.
-
Windows escalate per endpoint: 1 h, then 4 h, then 24 h. At expiry the streak resets and the escalation level stays.
-
Policy. While an endpoint is in the set, outbound connections to it run plain v2 and neither parse nor validate the offer. An existing connection never renegotiates. Inbound connections never fall back.
-
Bounds. Memory only, cleared on restart. The failure history holds at most 1,000 endpoints, evicting the oldest. Endpoints with a confirmed success live in a separate set that is never evicted.
-
Endpoint key. A resolved destination is its
CService(address and port). A name-proxy destination is its normalized hostname and port. Inbound uses the remote address and source port. -
Visibility. Entering fallback logs one warning,
v2 pq: fallback cause=<trigger> until=<UTC time>. If 8 or more distinct endpoints have counted failures and none has succeeded since startup, the node warns once that its own ML-KEM code may be at fault, naming-mlkemportablewhen native code is active.
Load shedding (part 5)
- When more than
threshold_per_sinbound offers were attempted in the last second, responders stop offering: they send empty contents, exactly today's v2. The peer's status isoff, and the inboundshedcounter increments. - Offering resumes after 10 consecutive seconds below half the threshold.
- Outbound connections are never affected.
- The threshold defaults to 1,000 offers per second, which caps the extra key-generation CPU at about 3% of one core even in portable C. The flood measurement in the release gate (part 9) sets the final value.
- Starting and stopping each log one info line:
v2 pq: load_shedding started threshold_per_s=<n>andv2 pq: load_shedding stopped.
Configuration (part 6)
| Option | Behavior |
|---|---|
-v2pqtransport |
Default 0 until the default-on PR in part 9, then 1 from release N. No effect when -v2transport=0; an explicit -v2pqtransport=1 in that case raises an InitWarning naming the fix. Booleans must be numeric (true parses as 0), and a non-numeric value raises an InitWarning. |
-mlkemportable |
Hidden, debug category, all chains. Forces portable C: the field escape hatch if native code misbehaves on some CPU family. |
-test=pq_fail_first_packet |
Regtest only. Corrupts this node's ML-KEM shared secret on every hybrid handshake, so the peer's confirmation check fails. |
-test=mlkem_portable |
Regtest only. Forces portable C. |
WITH_MLKEM_NATIVE=AUTO|ON|OFF |
CMake. OFF builds portable only; ON makes missing native support a configure error. |
The startup line always names the active backends:
v2 pq: enabled arith=<x86_64-avx2|aarch64-neon|portable> keccak=<x86_64-avx2|aarch64|portable>
v2 pq: disabled (-v2pqtransport=0) arith=… keccak=…
v2 pq: disabled (-v2transport=0) arith=… keccak=…
RPC (part 6)
-
getpeerinfogains:transport_pq: true once the peer's confirmation verified;transport_pq_status: one ofpending,hybrid,legacy_peer,fallback,offorv1.
transport_protocol_typekeeps its values.session_idis the hybrid session id whentransport_pqis true. -
getnetworkinfogainsconnections_pq, counted over the same peersgetpeerinfolists. -
New
getpqtransportinfo. All fields are always present, and empty collections are[]:
type Endpoint = { kind: "address" | "name_proxy";
network: "ipv4" | "ipv6" | "onion" | "i2p" | "cjdns" | "name_proxy";
address: string; // canonical address or normalized hostname, no port
port: uint16 };
type DirectionCounts = { switched: uint64; legacy_peer: uint64; malformed_record: uint64;
first_packet_failed: uint64; abandoned: uint64; internal_error: uint64 };
type Failure = { sequence: uint64; time: int64; endpoint: Endpoint;
direction: "inbound" | "outbound";
connection_type: string; // existing ConnectionTypeAsString tokens
peer_id: int64;
outcome: "legacy_peer" | "malformed_record" | "first_packet_failed" | "abandoned"
| "closed_after_switch" | "fallback" | "internal_error";
reason: string }; // fixed vocabulary below
type Ring = { last_sequence: uint64; dropped: uint64; entries: Failure[] }; // oldest first, max 256
type GetPQTransportInfo = {
enabled: boolean;
status: "enabled" | "disabled_v2pqtransport" | "disabled_v2transport";
instance_id: string; // 64 lowercase hex, random per process start
arith_backend: "x86_64-avx2" | "aarch64-neon" | "portable";
keccak_backend: "x86_64-avx2" | "aarch64" | "portable";
since: int64; // startup time; counters count from here
handshakes: {
inbound: DirectionCounts & { shed: uint64 };
outbound: DirectionCounts & { closed_after_switch: uint64; fallback: uint64 };
};
load_shedding: { active: boolean; threshold_per_s: uint64; since: int64 }; // since = 0 when inactive
fallback_set: { endpoint: Endpoint;
cause: "malformed_record" | "first_packet_failed" | "closed_after_switch";
reason: string; streak: uint32; entered: int64; expires: int64;
window_seconds: 3600 | 14400 | 86400 }[];
failure_streaks: { endpoint: Endpoint;
cause: "malformed_record" | "first_packet_failed" | "closed_after_switch";
reason: string; streak: uint32; // 1 or 2
last_failure: int64; next_window_seconds: 3600 | 14400 | 86400 }[];
recent_failures: { inbound: Ring; outbound: Ring }; // outbound includes manual connections
};Reason vocabulary (fixed):
legacy_peer: no_features | parse_error
malformed_record: ek_length | ek_modulus | ct_length
first_packet_failed: length | tag | not_decoy
closed_after_switch: eof | reset | timeout
abandoned: eof | reset | timeout | send_error | local | garbage_terminator | version_length | version_tag
fallback: malformed_record | first_packet_failed | closed_after_switch
internal_error: keygen | check_public_key | encaps | decaps | cipher_state
Counter semantics. Counters count events, not exclusive outcomes:
switchedcounts key installations, even if confirmation later fails;fallbackcounts entries into the set, not plain-v2 connections;abandonedcounts offers whose initiator sent no authenticated version before the connection closed;- each ring has its own sequence, and reports how many entries it
dropped.
-netinfo shows 2p for hybrid peers, and treats a server without transport_pq (v1.0.0) as not hybrid. The GUI peer details read "v2 (hybrid post-quantum)".
Logging
Each outcome logs one line. Every line has the prefix v2 pq:, and the outcome word is the counter key, so one search finds them all. Fields come from a fixed list and never contain bytes the peer controls: reason, cause, until, role, conn_type, peer, and peeraddr only with -logips. Failure lines also carry arith and keccak.
| Line | Level |
|---|---|
switched, legacy_peer, every inbound outcome, abandoned |
net debug |
Outbound malformed_record, first_packet_failed, closed_after_switch, internal_error |
info, each from its own call site |
load_shedding started / stopped |
info |
fallback, the local-fault warning |
warning |
Inbound and outbound lines come from separate call sites, because the logger rate-limits per call site; inbound noise can't silence outbound evidence. Exact counts and per-endpoint attribution come from getpqtransportinfo, not from logs.
Failure handling and secrets
-
Internal ML-KEM errors not caused by peer input never assert:
- a responder that can't generate a key sends no offer;
- an initiator that can't check the key or encapsulate continues as if its switch were off for that connection;
- a responder whose decapsulation fails internally closes the connection (
internal_error/decaps), because the initiator has already committed to the hybrid keys.
Each is counted as
internal_error. -
Entropy. Key generation draws two independent 32-byte
GetStrongRandBytesvalues, and encapsulation draws one:ProcRandasserts at most 32 bytes per call. -
Wiping. The decapsulation key, the retained ECDH secret, ML-KEM temporaries and derived keys are wiped with
memory_cleanseon switch, legacy outcome, disconnect and timeout, and in destructors. -
Memory. A pending inbound connection holds about 3.3 KB: the 3,168-byte expanded decapsulation key, the 32-byte ECDH secret and about 100 bytes of transcript state. That is about 420 KB at 125 connections, and only until the initiator's version packet or
-peertimeout. Key generation is lazy: it happens only after the initiator's full 64-byte key arrives.
Compatibility
- v1.0.0 and other legacy v2 nodes ignore version contents. v1.0.0 was verified to accept contents up to 4,000,013 bytes, with decoys first and after a 10 s delay, in both roles (part 2 pins this). Upgraded ↔ legacy connections keep ECDH-only keys, with no disconnect and no extra round trip.
- v1 peers, and the v1 retry, are unchanged.
- Switch off on either side is byte for byte today's behavior: no hold state, and empty version packets.
- Mixed-version tooling. A new
qbit-cli -netinfoagainst a v1.0.0 node shows2without errors. - The initiator's hold. A hybrid initiator sends its version packet only after the responder's arrives. That is the order BIP324's version-negotiation steps list; deployed BIP324 initiators instead use the option to send it right after their garbage terminator. BIP324's progress conditions still hold: the initiator still sends its terminator at once and enters version negotiation, and every responder, legacy or hybrid, sends its version packet without waiting for the initiator's. The spec makes that a MUST for responders. Only qbit initiators behave differently, never responders.
Testing and CI
| Layer | What | Where |
|---|---|---|
| KEM primitive | NIST ACVP and C2SP CCTV vectors, implicit rejection, backend equality, build policy | parts 2, 3 |
| Key recipe | JSON vectors from an independent Python reference; transcript binding; rekey boundaries | part 4 |
| Parser | grammar, first-wins, semantics, maximum contents; pq_records fuzz target |
part 4 |
| State machine | both roles, the legacy matrix, v1 detection, send hold, switch boundary, the three confirmation failures, corrupted ct, internal errors, rekeys |
part 4 |
| Telemetry and fallback | close causes, once-only counting, rings, endpoint identity, threshold, windows, success protection, eviction, local-fault warning, shedding | part 5 |
| Operator surface | options, warnings, startup line, exact RPC dictionaries, -netinfo, rpc fuzz safe list |
part 6 |
| End to end | Python hybrid peer both ways; misbehaving peers; fallback; the whole functional suite with PQ on | part 7 |
| Adversarial | mlkem, mlkem_backend_diff, pq_records, p2p_v2_pq_malicious_peer, the extended bip324_cipher_roundtrip and v2 transport targets |
parts 3, 4 |
| Interop | v1.0.0 in both roles; mixed-version CLI | parts 2, 6 |
| Performance | per-backend benchmarks; handshake benchmark (also in a VM); flood lab | parts 3, 8, 9 |
| Docs | quick-start test; doc string check | part 8 |
CI jobs.
ci-pq.ymlis one reusable workflow with a recorded source SHA and ajobsinput (part 2). Its jobs:aarch64-unit(part 2);s390x-unitandmacos-arm64-unit(part 3);pq-functional, the whole suite with--v2pqtransport(part 7).
- The aarch64 job is required for pull requests that touch the library or transport (part 3).
mainruns separate nightly callers for[email protected]and[email protected], each with its own status (part 2, onmain).- The v1.0.0 interop tests run in the existing previous-releases job.
- MSan builds use portable C only, because MSan can't see writes made by assembly.
Work plan
Parts
Nine sub-issues. Parts 1–8 are one pull request each, and part 9 is the release gate. Inside a part, work items keep short IDs (for example E3) as section headings and commits; cross-references use them.
| Part | Sub-issue | Work items | Merges after | Can start |
|---|---|---|---|---|
| 1 | #185 I2P post-quantum leasesets | A1 | — | now; ships on its own |
| 2 | #186 Foundations | B1, B2, B3, C1, C5, C4 | — | now |
| 3 | #190 ML-KEM library | D1, D2, C2, D3, D5, C3, D4 | part 2 | now; stack on part 2 until it merges |
| 4 | #199 Handshake core | E1, E2, E3, G4, H2 | part 3 | E1 and H2 now; E2 against part 3's API |
| 5 | #206 Telemetry and safety | F1, F2, F3, F4 | part 4 | F1 now |
| 6 | #209 Operator surface | F5, F6 | part 5 | F5 once part 4 merges |
| 7 | #212 End-to-end tests | G1, G2, G3 | part 6 | the Python hybrid peer once part 4 merges |
| 8 | #215 Flood tool and operator docs | H1, H3 | part 6 | v2flood once part 4 merges |
| 9 | #222 Release gate | R0–R7 | part 7, part 8 | R0 once part 2 merges; R4 once parts 3 and 4 are up |
flowchart LR
P1["1 · I2P post-quantum leasesets"]:::p
P2["2 · Foundations"]:::p
P3["3 · ML-KEM library"]:::p
P4["4 · Handshake core"]:::p
P5["5 · Telemetry and safety"]:::p
P6["6 · Operator surface"]:::p
P7["7 · End-to-end tests"]:::p
P8["8 · Flood tool and operator docs"]:::p
P9["9 · Release gate"]:::g
P2 --> P3
P3 --> P4
P4 --> P5
P5 --> P6
P6 --> P7
P6 --> P8
P7 --> P9
P8 --> P9
P2 -. "R0 baseline starts" .-> P9
P4 -. "R4 review starts" .-> P9
classDef p fill:#e0e7ff,stroke:#555,color:#111
classDef g fill:#dcfce7,stroke:#555,color:#111
Solid arrows are merge order, and each is a GitHub "blocked by" link. Dotted arrows are release-gate items that start early. Part 1 has no arrows: it ships on its own.
Critical path and parallel work
- Critical path: parts 2 → 3 → 4 → 5 → 6 → 7 → 9, where part 9 is the default-on PR, the 14-day canary and the release decision.
- At the start, up to five lanes: part 1; part 2; part 3 (stacked on part 2's branch until it merges); F1 from part 5; and E1 and H2 from part 4.
- During implementation: R0's 14-day baseline runs, and R4's outside review starts on the spec and the library.
- After part 4 merges: F5, the Python hybrid peer and v2flood can be drafted alongside part 5.
Conventions for implementers
- Branch from
1.x.x, and target1.x.x. The exception is part 2's nightly-scheduler PR (C4), which targetsmain. - One pull request per part. Its body says
Closes #<part>andPart of #184, and its commits follow the part's work items in the order listed there. - Each commit builds and passes the unit and functional tests (the per-commit CI check,
.github/ci-test-each-commit-exec.py). New tests land in the same commit as the behavior they test. - The Design section above is the contract. A pull request that needs to change it updates this issue first, then the affected parts.
- Node behavior doesn't change until part 6 adds the option (default off) and the default-on PR in part 9 turns it on, so every merge leaves
1.x.xreleasable. - Code references are to
1.x.xat45e9e72c2d. Line numbers drift, so search by symbol. - Option names, RPC fields and log strings are exact. Part 8's doc check enforces them.
- The 29 earlier fine-grained sub-issues were consolidated into these nine and closed; each closed issue points to its part.
Release gate and rollout
Every step below is a checklist item in part 9 (#222).
- Release candidate. Parts 1–8 are merged, the default-on PR (R1) turns the feature on just before the cut, and a Guix-built release candidate follows. The release notes say exactly what it protects and how to switch it off.
- Before the canary:
- the fuzz campaign (R2): seven targets × three sanitizer configurations × 24 CPU-hours;
- the flood measurement (R3);
- 14 days of baseline (R0);
- a check that the census and crawler tools handle non-empty version contents (R0).
- Canary (R5). Two team mainnet nodes, an archive node and a pool node pinned to it, run the release candidate for 14 days. A third team archive node stays on v1.0.0 as the control. Clean means:
- no crash;
- the pinned link is manual and hybrid in at least 99% of 5-minute samples;
- no
malformed_record,first_packet_failedor fallback entry between known-good endpoints; - inbound connections hold within ±20% of the control.
- Alongside the canary: the scoped outside review (R4) and the 7-day
testnet4soak across x86_64 with AVX2, x86-64 without AVX2, Raspberry Pi 4, Apple Silicon and Windows (R6). - Release cut (R7). If every gate item holds, release N ships on by default. If any is open or raised a concern, R1 is reverted, release N ships switched off, and a point release turns it on once the item is resolved. Every operator can switch it off with
-v2pqtransport=0, which never disconnects anyone. v1.0.0 nodes keep working with ECDH-only keys indefinitely.
A wire, key-recipe or state-machine change after the canary starts restarts the canary, the soak and the flood measurement on the changed code.
After release N: a weekly probe from a default-config, non-listening mainnet node records the share of its outbound full-relay connections with transport_pq=true.
Convergence policy
- Track bitcoin-dev, bitcoin/bips and upstream transport changes, such as bitcoin/bitcoin#36376 (rare BIP324 decoys). The rule against decoys before the initiator's version packet binds only qbit's offering responders, so upstream decoys from legacy peers stay compatible.
- If a Bitcoin standard for PQ transport ships, qbit implements it as a new header. At most two PQ recipes are supported at once.
- qbit's
0xF0recipe stays for at least two major releases after that standard ships. The release before its removal announces it in its release notes, and warns at startup while0xF0connections are still in use. - While two recipes exist,
getpeerinforeports which one each hybrid peer uses.
Definition of done
- Parts 1–8 are merged: into
1.1.0, done with Hybrid post-quantum v2 transport (#184) — integration #233 (db8dbe5); and part 2's scheduler PR (C4) intomain, not yet opened. - The spec, operator guide and release note are published, and the spec is posted to bitcoin-dev (part 4).
- Part 9's release decision (R7) is posted, and release N has shipped: on by default, or off with the point-release follow-up filed.
References
- BIP324, the v2 P2P transport, and its version-negotiation phase.
- FIPS 203, ML-KEM. RFC 5869, HKDF.
- mlkem-native v2.0.0, commit
d1b2fe782888bdb761a50336012923180be7f502. - bitcoin-dev, "Transport Feature Negotiation" (2026-09-17), and "A Post-Quantum Path for BIP 324".
- Bitcoin Core #35696, I2P post-quantum leasesets (part 1).
- Test vectors: NIST ACVP-Server and C2SP CCTV.
Activity
135 remaining items
bench: add a V2Transport handshake benchmark, legacy and hybrid, nati…
test: damage the key confirmation itself in the v2 peer's unit test
doc: add the hybrid v2 transport operator guide and release note
lint: check the interface names the PQ transport docs quote
test: run the operator guide's quick start
ci: run the PQ doc-token check on docs-only pull requests
bench: add a V2Transport handshake benchmark, legacy and hybrid, nati…
doc: add the hybrid v2 transport operator guide and release note
lint: check the interface names the PQ transport docs quote
test: run the operator guide's quick start
ci: run the PQ doc-token check on docs-only pull requests
doc, bench: operator guide, release note and handshake benchmark for …
ci: stop validating feature/pq-transport by name (#245)
Hybrid post-quantum v2 transport (#184) — integration (#233)
release: prepare v1.1.0-rc1 (#256)