Skip to content

Add Bitcoin Cash Ledger wallet support - #3847

Open
konstantinullrich wants to merge 2 commits into
devfrom
CW-693-Add-Ledger-BitcoinCash-Support
Open

konstantinullrich wants to merge 2 commits into
devfrom
CW-693-Add-Ledger-BitcoinCash-Support

Conversation

@konstantinullrich

@konstantinullrich konstantinullrich commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces: #1615

Description

Adds Bitcoin Cash support for Ledger hardware wallets.

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods
  • Manual tests in accessibility mode (TalkBack on Android) passed

Note

High Risk
Introduces hardware-backed signing and derivation paths for a new asset class; mistakes could affect funds or signatures, though the design mirrors existing BTC/LTC Ledger integration.

Overview
Adds Ledger support for Bitcoin Cash, including restore-from-hardware, on-device transaction signing, and message signing, wired through the same Ledger flows used for Bitcoin and Litecoin.

Bitcoin Cash: New BitcoinCashLedgerService (account discovery on m/44'/145'/…', BCH-specific signing via LitecoinLedgerApp with cashaddr / bip143). The BCH wallet accepts optional xpub instead of a mnemonic, implements buildHardwareWalletTransaction, and routes signMessage to the hardware service when applicable. BitcoinCashWalletService.restoreFromHardwareWallet is implemented (replacing the previous stub) using shared BitcoinRestoreWalletFromHardware credentials.

App wiring: Ledger is marked supported for WalletType.bitcoinCash; ledger and hardware-restore view models initialize BCH wallets and return BitcoinCashLedgerService for BCH.

Related fixes: ElectrumWallet._accountDerivationPathForRecord uses the stored hardware derivation path when present. Litecoin Ledger gains signMessage, with matching hardware branching in LitecoinWallet.signMessage. Ledger Flutter plugin refs are bumped in overrides (including message-sign support).

Reviewed by Cursor Bugbot for commit 18295dc. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

changes in dependencies

changed git refs:
  ledger_bitcoin
    url   https://github.com/cake-tech/ledger-flutter-plus-plugins -> https://github.com/cake-tech/ledger-flutter-plus-plugins
    ref   75bba8632c529debf30ee2b1858530009fa6440b -> bd86993c6c41085f9b2aa0b723f734bc4f6bf508
    path  ./packages/ledger-bitcoin -> ./packages/ledger-bitcoin
  ledger_ethereum
    url   https://github.com/cake-tech/ledger-flutter-plus-plugins -> https://github.com/cake-tech/ledger-flutter-plus-plugins
    ref   f4761cd5171d4c1e2e42fd3298261650539fb2db -> bd86993c6c41085f9b2aa0b723f734bc4f6bf508
    path  ./packages/ledger-ethereum -> ./packages/ledger-ethereum
  ledger_litecoin
    url   https://github.com/cake-tech/ledger-flutter-plus-plugins -> https://github.com/cake-tech/ledger-flutter-plus-plugins
    ref   75bba8632c529debf30ee2b1858530009fa6440b -> bd86993c6c41085f9b2aa0b723f734bc4f6bf508
    path  ./packages/ledger-litecoin -> ./packages/ledger-litecoin
     .../lib/src/ledger_litecoin_application.dart       |  4 +-
     .../operations/litecoin_sign_msg_operation.dart    | 98 +++++++---------------
     .../lib/src/tx_utils/create_transaction.dart       |  6 +-
     .../lib/src/utils/message_signature.dart           | 30 +++++++
     4 files changed, 67 insertions(+), 71 deletions(-)

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 18295dc. Configure here.

Future<String> signMessage(String message, {String? address}) async {
final addressEntry = address != null
? walletAddresses.allAddresses.firstWhere((element) => element.address == address)
: null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BCH sign lookup now throws

Medium Severity

signMessage now calls firstWhere with no fallback, and the old try/catch is gone. The Sign page always passes the address field for Bitcoin Cash, so an empty or differently formatted address (for example cashaddr without the bitcoincash: prefix) throws Bad state: No element instead of signing. That also blocks the new hardware path from using its index-0 default.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 18295dc. Configure here.

This branch was successfully deployed

1 active (outdated) deployment
testflight — 987d31aa Deployed Nov 12, 2026 by konstantinullrich via changelog #287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant