Skip to content

bitbox02: taproot script-path signing still blocked despite BIP-388 policy plumbing (#792) #861

Open

Description

Title: bitbox02: taproot script-path signing still blocked despite BIP-388 policy plumbing (#792)

Summary

#792 (merged 2026-08-25, tracked in #785) added BIP-388 policy plumbing to the BitBox02
driver: register_descriptor, _maybe_register_script_config, and policy_script_config
construction in sign_tx (master hwilib/devices/bitbox02.py:612-639, 690-691). However,
taproot script-path spending is still unreachable through three remaining gaps:

  1. Leaf-hash raise fires regardless of policy. In sign_tx, for any input with
    tap_internal_key set, every tap_bip32_paths entry with leaf hashes still raises
    BadArgumentError("The BitBox02 does not support Taproot script path spending. ...")
    (master lines 791–795; same for change outputs at 857–861). A policy-registered
    script-path input carries leaf hashes by definition, so the exception fires before
    signing even when a policy_script_config was successfully built. The raise should be
    bypassed when the input will be signed via a registered tr() policy.
  2. Signature merge writes the wrong PSBT field. The result loop (lines ~928–938) writes
    every taproot input's signature to psbt_in.tap_key_sig (key-path field). For
    script-path inputs the Schnorr signature must go into psbt_in.tap_script_sigs[(xonly_pubkey, leaf_hash)] instead.
  3. can_sign_taproot() still returns False (line 1028) with the docstring "The BitBox02
    does not support Taproot yet" — which already understates the driver today (key-path
    signing works), and also blocks getkeypool --addr_type tap (commands.py:350, 388).

Proof of concept

We implemented taproot script-path signing for a BitBox02 Nova outside HWI using the
bitbox02 Python library (7.0.0) directly: register a BIP-388
tr(@0/**,{multi_a(3,...),and_v(v:multi_a(2,...),older(...))}) policy on the device
(on-device confirmation), then btc_sign() with the policy script config, and merge the
returned Schnorr signatures into the PSBT as PSBT_IN_TAP_SCRIPT_SIG. The result — a 3-of-4
multi_a spend combined with signatures from Ledger and two airgap signers — was broadcast
and confirmed on mainnet
(txid 4652e1c186845b2007c13bd97b85721128092cce17f376bb3dda44acf497150b). The PoC is ~230
lines and available if useful.

Dependency

One blocker lives upstream in Shift's Python library: is_taproot() doesn't recognize
tr() policy configs, so the library wrongly attempts the antiklepto protocol for Schnorr
inputs and the firmware rejects the input with Error::InvalidInput. Filed separately:
BitBoxSwiss/bitbox02-firmware#2145. Until a fixed bitbox02 release is out, HWI would need a
small workaround (or to gate on the library version once fixed).

Open questions for maintainers: minimum firmware gating (tr() policies require firmware
≥ 9.21.0), and how to expose non-default sighash types for taproot script-path (the
bitbox02 library currently signs SIGHASH_DEFAULT only).

Happy to attempt a PR building on #792's plumbing if there's interest.

Activity

  1. GracedEternalKingCabbageMan commented on Oct 13, 2026

    @GracedEternalKingCabbageMan
    Author

    For completeness: #827 asks about taproot script-path multisig from the Ledger side (ledger.py TODOs). This issue is the BitBox02-side counterpart — with #792's policy plumbing merged, the remaining BitBox02 gaps are the three listed above. A shared design for how script-path sigs + sighash types are exposed across drivers probably makes sense to discuss in #785.

  2. GracedEternalKingCabbageMan commented on Oct 13, 2026

    @GracedEternalKingCabbageMan
    Author

    Update on the dependency: the is_taproot/antiklepto blocker in Shift's Python library (BitBoxSwiss/bitbox02-firmware#2145) already has a fix PR — BitBoxSwiss/bitbox02-firmware#2146 — which I've verified end-to-end on a BitBox02 Nova: registered a BIP-388 tr() policy and produced a valid 64-byte SIGHASH_DEFAULT Schnorr signature for a multi_a script-path input, with no antiklepto host-nonce flow and no prevtx requirement. Once that lands in a bitbox02 release on PyPI, the library-side blocker for this HWI work is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions