Files
hash-wallet/cw_bitcoin
Armin SabouriandGitHub 4d61345f30 Update RBF nsequence to 0xFFFFFFFD (#3077)
Technically `0x1` will signal opt-in RBF (since 0x1 ≤ 0xFFFFFFFD); however it also sets a relative timelock of 1 block. This seems like an unintended bug. It also fingerprints cake wallet since `0x1` is an abnormal value. This is especially harmful in collaborative settings e.g payjoin. Most wallets set `nsequence = 0xFFFFFFFD` to opt into RBF or just use full rbf which seems to be gaining more adoption.
2026-03-13 23:42:41 +01:00
..
2026-03-11 04:26:57 +02:00
2026-03-11 04:26:57 +02:00
2026-03-11 04:26:57 +02:00

cw_bitcoin

Bitcoin-family Electrum wallet implementation used by Cake Wallet (BTC, LTC and derivatives).

Features

  • Electrum client and wallet with address/UTXO management and snapshots.
  • Derivation via BIP‑39; receive/change chains with per-coin configs.
  • Create/sign/broadcast transactions; PSBT helpers and payjoin support.
  • Transaction history, priorities, and size-based fee calculations.
  • Hardware wallet support for BTC/LTC.

Getting started

Use the module via app services (see bitcoin_wallet_service.dart, litecoin_wallet_service.dart). Ensure Electrum nodes are configured for the target coin.

final wallet = await BitcoinWallet.create(
  mnemonic: '...',
  password: 'secret',
  walletInfo: walletInfo,
  unspentCoinsInfo: unspentCoinsBox,
  encryptionFileUtils: encryption,
);

Usage

Send BTC with medium priority:

final feeRate = wallet.feeRate(BitcoinTransactionPriority.medium);
final pending = await wallet.createTransaction(
  outputs: [BitcoinTransactionOutput(address: 'bc1...', amount: 50000)],
  feeRate: feeRate,
);
final txHash = await pending.commit();

See lib/ for wallet/services, PSBT, and payjoin utilities.