|
1 | 1 | # BitGo abstract-utxo |
| 2 | + |
| 3 | +This module provides the foundational `AbstractUtxoCoin` class and concrete implementations for Bitcoin and Bitcoin-like UTXO-based cryptocurrencies within the BitGo platform. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The `AbstractUtxoCoin` class serves as the base implementation for all UTXO-based coins, providing common functionality for transaction building, signing, verification, and recovery operations. Each supported cryptocurrency extends this class to provide coin-specific behavior while leveraging the shared UTXO infrastructure. |
| 8 | + |
| 9 | +## Supported Coins |
| 10 | + |
| 11 | +Concrete implementations are provided in the `src/impl/` directory: |
| 12 | + |
| 13 | +- **btc/** - Bitcoin (BTC) and Bitcoin testnet variants |
| 14 | +- **bch/** - Bitcoin Cash (BCH) |
| 15 | +- **bcha/** - Bitcoin Cash ABC (BCHA) |
| 16 | +- **bsv/** - Bitcoin SV (BSV) |
| 17 | +- **btg/** - Bitcoin Gold (BTG) |
| 18 | +- **ltc/** - Litecoin (LTC) |
| 19 | +- **dash/** - Dash (DASH) |
| 20 | +- **doge/** - Dogecoin (DOGE) |
| 21 | +- **zec/** - Zcash (ZEC) |
| 22 | + |
| 23 | +## Key Features |
| 24 | + |
| 25 | +### Transaction Operations |
| 26 | +- **Building & Signing**: Support for both legacy and PSBT transaction formats |
| 27 | +- **Multi-signature**: 2-of-3 multisig with various script types (P2SH, P2WSH, P2SH-P2WSH, P2TR-MuSig2) |
| 28 | +- **Verification**: Comprehensive transaction intent verification before signing |
| 29 | +- **Explanation**: Decode and explain transaction details (inputs, outputs, fees) |
| 30 | + |
| 31 | +### Wallet Types |
| 32 | +- **Fixed Script Wallets**: Traditional HD wallets with deterministic address generation |
| 33 | +- **Descriptor Wallets**: Modern wallet format using output script descriptors |
| 34 | +- **Distributed Custody**: Support for enterprise custody configurations |
| 35 | + |
| 36 | +### Address Management |
| 37 | +- Address validation and derivation verification |
| 38 | +- Support for multiple address formats (base58, bech32, cashaddr for BCH) |
| 39 | +- Chain/index-based address generation for fixed script wallets |
| 40 | + |
| 41 | +### Recovery Operations |
| 42 | +- **Backup Key Recovery**: Recover funds using backup key when BitGo is unavailable |
| 43 | +- **Cross-Chain Recovery**: Recover coins sent to wrong chain (e.g., BTC sent to LTC address) |
| 44 | +- **V1 Wallet Recovery**: Support for legacy V1 wallet recovery |
| 45 | + |
| 46 | +### Advanced Features |
| 47 | +- BIP322 message signing support |
| 48 | +- MuSig2 for Taproot multisig |
| 49 | +- Replay protection for chain splits |
| 50 | +- Custom change address handling |
| 51 | +- RBF (Replace-by-Fee) transaction support |
| 52 | + |
| 53 | +## Development Setup |
| 54 | + |
| 55 | +### VSCode Configuration |
| 56 | + |
| 57 | +For an optimal development experience in VSCode, configure the Mocha Test Explorer with the following settings in `.vscode/settings.json`: |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "mochaExplorer.files": "test/**/*.ts", |
| 62 | + "mochaExplorer.nodeArgv": ["--import", "tsx"], |
| 63 | + "mochaExplorer.logpanel": true |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +This configuration enables: |
| 68 | +- **Test Discovery**: Automatically finds all TypeScript test files in the `test/` directory |
| 69 | +- **TypeScript Support**: Uses `tsx` for running TypeScript tests without compilation |
| 70 | +- **Log Panel**: Displays test output for easier debugging |
| 71 | + |
| 72 | +### Running Tests |
| 73 | + |
| 74 | +With the Mocha Test Explorer configured, you can: |
| 75 | +- View and run individual tests or test suites from the VSCode Test Explorer panel |
| 76 | +- Set breakpoints and debug tests directly in the editor |
| 77 | +- Monitor test output in the integrated log panel |
0 commit comments