Skip to content

psbt: experimental interactive anti-exfil for BIP86 inputs - #1

Open
Sjors wants to merge 2 commits into
new_edgefrom
2026/10/taproot-anti-exfil
Open

Sjors wants to merge 2 commits into
new_edgefrom
2026/10/taproot-anti-exfil

Conversation

@Sjors

@Sjors Sjors commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Coldcard Edge can perform the two-round draft BIP-EXFIL protocol through its existing PSBT upload/download interface. The first invocation returns a public nonce without signing. The second checks the host reveal and recorded nonce, then returns an ordinary Taproot key signature. HWI verifies the proof before releasing the response to its caller.

Base, increments and dependencies

Based on upstream Coldcard/firmware:new_edge, including its PSBTv2, Miniscript and MuSig nonce-cache hardening.

Commit subject Increment
crypto: use libngu with interactive Schnorr anti-exfil Select the libngu fork through its submodule URL and gitlink.
psbt: implement interactive anti-exfil for BIP86 inputs Validate proprietary PSBT fields, implement both signing rounds, and add parser tests and documentation.

The crypto increment depends on libngu, specifically secp256k1: add interactive single-signer Schnorr anti-exfil. It provides anti_exfil_commit, anti_exfil_sign, shared vectors and embedded tests. It uses existing public APIs in libngu's nested secp256k1; this firmware has no compile-time dependency on the separate libsecp256k1 anti-exfil API.

The BIP draft defines the protocol and shared vectors. Its BIP-EXFIL domains and PSBT allocation are provisional; assigning a BIP number requires coordinated vector regeneration.

HWI supplies host validation, the Edge driver and real simulator tests. Its temporary CI increment builds this firmware and the Bitcoin Core host. The build dependency is libngu → Coldcard firmware → HWI; Core drives HWI and verifies its responses.

Supported behavior

This implementation supports single-signer BIP86 key-path inputs, PSBT versions 0 and 2, absent or explicit SIGHASH_DEFAULT, and SIGHASH_ALL. It rejects this protocol for registered Miniscript wallets, script-tree commitments, script paths and MuSig2. Classic Coldcard lacks ordinary Taproot support and has an explicit unsupported-device rejection test in HWI.

The provisional fields are input-only proprietary keys fc026165 || subtype || output_key32: subtype 0 contains the 32-byte host commitment, subtype 1 the original compressed 33-byte public nonce, and subtype 2 the 32-byte host scalar. Round one accepts subtype 0 only; round two requires all three. The final signature uses the normal Taproot key-signature field.

The firmware checks the actual tweaked signing key against the target UTXO, ownership and ordinary transaction/change authorization. It preserves the sighash declaration exactly and signs only targeted inputs. It rejects mixed rounds, incomplete/noncanonical fields, duplicates, global/output transcript fields, wrong keys, existing target signatures/finalization and unsupported sighashes.

Anti-exfil preflight runs before MuSig session allocation or cache access. The inner signing function receives the validated round explicitly, retaining upstream nonce-cache binding, failure cleanup and WIF input handling. In round two, native code checks the rederived nonce and opening, performs scalar arithmetic, and verifies the resulting signature.

The nonce is deterministic in the key, message and host commitment, so reconnects need no retained secret state. The UI asks for approval in both invocations. The host must retain its original transcript and verify the nonce relation: restarting with fresh randomness after an interruption can restore a selective-abort channel. Transcript fields remain until host verification and must then be removed before exporting the completed PSBT.

Validation

The native simulator was built with GCC 13, HWI's simulator fixture, the MicroPython compiler compatibility patch and the libngu Bech32 patch. HWI carries the fallback compiler patch needed by this development branch.

  • All eight independent BIP crypto vectors and negative native transcripts passed, together with existing libngu key/tweak/Schnorr/MuSig tests.
  • Firmware parser tests exercised valid rounds and rejected malformed fields, duplicates, incomplete transcripts, mixed keys and wrong field locations.
  • Real HWI signing passed over library, CLI and stdin, covering PSBTv0/v2, absent/explicit DEFAULT and ALL, round-one absence of signatures, reconnects yielding the same nonce, and firmware rejection of changed reveals and original nonces. Negative device tests bypass HWI preflight.
  • Positive transactions finalized, entered the regtest mempool, were broadcast and confirmed with Bitcoin Core.
  • Non-device tests, changed-file flake8 and scoped Coldcard mypy passed.
  • The complete ordinary Edge suite passed, including signing, large transactions, descriptor registration and address display. The dependency-only increment also passed the ordinary suite independently.

The HWI multi-policy test uses distinct accounts across cases because current firmware refuses registering the same policy again under another name. It still covers two registered policies and an inferred wallet.

Only the native simulator was tested; no physical hardware was flashed. The construction and implementation need cryptographic review before deployment.

Updating the stack

Publish libngu before updating the first firmware increment's gitlink. If signing or rebasing changes the libngu revision, update that gitlink before publishing Coldcard; the PSBT increment can then be replayed. Once libngu is accepted upstream, restore its upstream URL and select the accepted revision. Keep HWI's temporary firmware checkout aligned, then remove its fork pins when upstream support is available.

Sjors added 2 commits October 25, 2026 05:43
Build on experimental libngu commit 933adde, based on upstream master
ff4db2c. The fork URL is needed until that dependency lands upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant