feat: Bitcoin native support — Phase 0 architecture & interface definitions#599
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
feat: Bitcoin native support — Phase 0 architecture & interface definitions#599devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
Phase 0 deliverables for Bitcoin native support: - Architecture document (docs/bitcoin-architecture.md) covering: - Component diagram showing Bitcoin modules in existing architecture - Interface definitions with TypeScript code - Data flow diagrams for balance check, send tx, receive, account creation - Integration points with existing MetaMask controllers - Migration/adoption strategy for gradually enabling Bitcoin support - TypeScript interface definitions (app/core/Bitcoin/types/): - account.ts: UTXO-based account model (BitcoinUtxo, BitcoinBalance, BitcoinAccountData) - address.ts: Address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR) - network.ts: Network configuration (mainnet, testnet, signet, regtest) - transaction.ts: Transaction model, coin selection, fee rates - keyring.ts: BIP44/49/84/86 derivation paths - controller.ts: Service contracts (AccountService, TransactionService, NetworkService) - Architecture diagrams as PNG images: - Component architecture diagram - Data flow layers diagram - Balance check flow diagram - Send transaction flow diagram Co-Authored-By: Phil Bedford <phil.bedford@cognition.ai>
Devin Review
|
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Remove P2WSH from single-key derivation mappings (BIP84 is P2WPKH-only; P2WSH uses BIP48 for multisig, which is out of scope for single-key wallets) - Add 'n' to P2PKH testnet prefix (version byte 0x6f produces both 'm' and 'n') - Introduce SingleKeyAddressType to enforce P2WSH exclusion at the type level Co-Authored-By: Phil Bedford <phil.bedford@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 0 (Team A — Architecture) deliverables for Bitcoin native support in MetaMask Mobile.
This PR adds no production code changes — it defines the interfaces, contracts, and architecture documentation needed to guide the implementation of native Bitcoin support.
Architecture Document (
docs/bitcoin-architecture.md)Comprehensive document covering:
TypeScript Interface Definitions (
app/core/Bitcoin/types/)account.tsBitcoinUtxo,BitcoinBalance,BitcoinAccountData,CreateBitcoinAccountParamsaddress.tsBitcoinAddressTypeenum (P2PKH, P2SH, P2WPKH, P2WSH, P2TR),BitcoinAddress, metadata registrynetwork.tsBitcoinNetworkIdenum (mainnet, testnet, signet, regtest),BitcoinNetworkConfigwith block explorer URLstransaction.tsBitcoinTransaction,BitcoinTransactionParams,BitcoinFeeRates,CoinSelectionResult,CoinSelectionStrategykeyring.tsBitcoinDerivationPath,BitcoinDerivationPurpose, derivation path formatting helperscontroller.tsBitcoinAccountService,BitcoinTransactionService,BitcoinNetworkServicecontractsindex.tsArchitecture Diagrams (rendered PNG images)
docs/assets/bitcoin-architecture-components.png— Full component architecturedocs/assets/bitcoin-architecture-layers.png— Data flow layer diagramdocs/assets/bitcoin-flow-balance.png— Balance check data flowdocs/assets/bitcoin-flow-send.png— Send transaction data flowReview & Testing Checklist for Human
Notes
@metamask/utils,@metamask/keyring-api) where applicableBtcAccountType.P2wpkh///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)consistent with existing multichain controllersLink to Devin session: https://app.devin.ai/sessions/321806b665844eb2b69a7487852de1b5
Requested by: @dr-phil