Skip to content

Latest commit

 

History

History
183 lines (161 loc) · 7.82 KB

File metadata and controls

183 lines (161 loc) · 7.82 KB

Device Onboarding References

Use this page to collect the upstream projects and protocol documentation needed to add or maintain support for a hardware wallet in BHWI.

BHWI Model

  • README: explains the sans-I/O interpreter model used by device integrations.
  • VISION: gives the project context and the reason BHWI keeps protocol logic separate from transport I/O.
  • Common command interface: lists the device-agnostic commands, responses, recipients, and device-specific context.
  • Async transport crate: contains concrete HID, TCP, and emulator transports for the sans-I/O interpreters.
  • CLI crate: shows how discovery, command parsing, and async device execution are wired together.

Shared Bitcoin Standards

  • BIP 32: hierarchical deterministic keys and derivation paths.
  • BIP 44: account structure used by standard descriptors.
  • BIP 174: PSBT v0.
  • BIP 370: PSBT v2, required by the Ledger Bitcoin app.
  • BIP 380 and BIP 388: output descriptors and wallet policies.
  • Miniscript: policy language used for descriptor-backed wallet support.
  • Bitcoin Core HWI: reference behavior for common hardware wallet commands.
  • Async-HWI: earlier Wizardsardine Rust implementation that informed and inspired BHWI.

BitBox02

nix run .#bitbox
nix develop .#bitbox -c cargo test -p bhwi-e2e-bitbox -- --test-threads=1

Ledger

nix run .#ledger
nix develop .#ledger -c cargo test -p bhwi-e2e-ledger -- --test-threads=1

Coldcard

nix run .#coldcard
nix develop .#coldcard -c cargo test -p bhwi-e2e-coldcard -- --test-threads=1

Jade

nix run .#jade-pinserver
nix run .#jade
nix run .#jade-init
nix develop .#jade -c cargo test -p bhwi-e2e-jade -- --test-threads=1

Trezor

  • Local code:
  • Upstream references:
  • Onboarding notes:
    • Messages are protobuf framed as ##, a big-endian message type and length, then chunked into 64 byte reports prefixed with 0x3f. The framing is the same over HID, WebUSB and the UDP emulator, so one transport serves all three.
    • The generated bindings are vendored and regenerated from the pinned firmware revision, matching the revision the emulators are built from.
    • GetPublicKey sets ignore_xpub_magic so the device returns standard xpub/tpub rather than SLIP-132 prefixes.
    • The Trezor One and the Model T run different firmware codebases, so each model has its own emulator.
    • Use these commands for emulator-backed tests:
nix run .#trezor-one   # or nix run .#trezor-t
nix run .#trezor-init
nix develop .#trezor -c cargo test -p bhwi-e2e-trezor -- --test-threads=1

Adding a Device

  • Start from bhwi/src/common.rs and map each supported common command to the device protocol.
  • Keep protocol encoding, response parsing, authentication, and intermediate device callbacks inside the device interpreter.
  • Keep USB, serial, TCP, browser, and emulator I/O in transport crates or clients, not in the interpreter.
  • Add emulator or simulator notes under docs/ when an upstream test target is available.
  • Add focused unit tests for protocol encoding/parsing and e2e coverage for commands that need an emulator.