dev
md 40 lines 1.16 KB
Rendered Raw
1 # cw_bitcoin
2
3 Bitcoin-family Electrum wallet implementation used by Cake Wallet (BTC, LTC and derivatives).
4
5 ## Features
6
7 - Electrum client and wallet with address/UTXO management and snapshots.
8 - Derivation via BIP‑39; receive/change chains with per-coin configs.
9 - Create/sign/broadcast transactions; PSBT helpers and payjoin support.
10 - Transaction history, priorities, and size-based fee calculations.
11 - Hardware wallet support for BTC/LTC.
12
13 ## Getting started
14
15 Use the module via app services (see `bitcoin_wallet_service.dart`, `litecoin_wallet_service.dart`). Ensure Electrum nodes are configured for the target coin.
16
17 ```dart
18 final wallet = await BitcoinWallet.create(
19 mnemonic: '...',
20 password: 'secret',
21 walletInfo: walletInfo,
22 unspentCoinsInfo: unspentCoinsBox,
23 encryptionFileUtils: encryption,
24 );
25 ```
26
27 ## Usage
28
29 Send BTC with medium priority:
30
31 ```dart
32 final feeRate = wallet.feeRate(BitcoinTransactionPriority.medium);
33 final pending = await wallet.createTransaction(
34 outputs: [BitcoinTransactionOutput(address: 'bc1...', amount: 50000)],
35 feeRate: feeRate,
36 );
37 final txHash = await pending.commit();
38 ```
39
40 See `lib/` for wallet/services, PSBT, and payjoin utilities.