feat: Add Bitcoin development infrastructure (Phase 0 - Team C)#600
Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Open
feat: Add Bitcoin development infrastructure (Phase 0 - Team C)#600devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
Add development environments and testnet infrastructure for Bitcoin native support development. This includes: Configuration: - Bitcoin network configuration (testnet, signet, regtest) - API endpoint definitions for Blockstream and Mempool.space - Environment variable definitions and defaults - CAIP-2 chain ID alignment with existing multichain framework Development Scripts: - check-bitcoin-deps.sh: Verify Bitcoin dev dependencies - test-bitcoin-api.sh: Test Bitcoin API connectivity - generate-test-addresses.sh: Generate test address fixtures - request-testnet-btc.sh: Helper for testnet faucets Testing Infrastructure: - Mock Bitcoin RPC/API responses (Blockstream + Mempool.space) - Mock UTXOs (single, multiple, empty, dust scenarios) - Mock transactions (confirmed + unconfirmed) - Test address fixtures (testnet, signet, regtest) - Helper utilities (UTXO factories, conversion functions) - Unit tests for config and test utilities Documentation: - bitcoin-dev-setup.md: Setup guide, env config, architecture - bitcoin-testing-guide.md: Testing patterns and conventions No existing app functionality is modified. Co-Authored-By: Phil Bedford <phil.bedford@cognition.ai>
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:
|
Devin Review
|
- Fix signet monitor URL: use mempool.space instead of non-existent Blockstream signet endpoint in request-testnet-btc.sh - Fix testnet P2PKH prefix: both 'm' and 'n' are valid encodings of version byte 0x6F; changed p2pkh to array for testnet/signet/regtest - Update isValidAddressFormat to handle array prefixes Co-Authored-By: Phil Bedford <phil.bedford@cognition.ai>
Change 'testnet3' to 'testnet' for consistency with BITCOIN_ENV_DEFAULTS and user-facing convention. All other network type values (signet, regtest) already matched between the enum and environment defaults. 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
Sets up development environments and testnet infrastructure for Bitcoin native support development (Phase 0, Team C - Infrastructure).
No existing app functionality is modified — this PR only adds new Bitcoin-specific infrastructure files.
What's included:
Configuration (
app/core/Bitcoin/config/)networks.ts— Bitcoin network types, API endpoint definitions (Blockstream + Mempool.space), CAIP-2 chain ID alignment with existingBtcScope, address prefixes (with bothmandnP2PKH prefixes for testnet), confirmation thresholds, satoshi constantsenvironment.ts— Environment variable definitions (MM_BITCOIN_API_URL,MM_BITCOIN_NETWORK, etc.) with defaultsindex.ts— Barrel exportsDevelopment Scripts (
scripts/bitcoin/)check-bitcoin-deps.sh— Verify Bitcoin dev dependencies (npm packages, API connectivity, tools)test-bitcoin-api.sh— Test connectivity to Blockstream/Mempool.space testnet+signet APIsgenerate-test-addresses.sh— Generate well-known BIP-84/86 test vector addressesrequest-testnet-btc.sh— Helper to request testnet/signet BTC from faucets (with network-aware monitor URLs)Testing Infrastructure (
app/core/Bitcoin/__tests__/)Documentation (
docs/)bitcoin-dev-setup.md— Prerequisites, quick start, env config, API endpoints, testnet wallet setup, architecture overview, troubleshootingbitcoin-testing-guide.md— Unit testing patterns, fixture docs, mock data factories, conventionsDesign decisions:
@metamask/keyring-apiBtcScopeand multichain patterns inapp/core/Multichain/__tests__/fixtures/,__tests__/helpers/)Review & Testing Checklist for Human
docs/bitcoin-dev-setup.mdfor accuracy against your local dev environment./scripts/bitcoin/check-bitcoin-deps.shto confirm dependency checks work on your machine./scripts/bitcoin/test-bitcoin-api.sh testnetto verify API connectivitynode_modulesare available, runyarn test app/core/Bitcoin/__tests__/to verify all unit tests passNotes
yarn installfails becausereact-native-tcpGitHub tarball returns HTTP 404 (https://codeload.github.com/aprock/react-native-tcp/tar.gz/98fbc801f0586297f16730b2f4c75eef15dfabcd). This is not introduced by this PR — noyarn.lockorpackage.jsonmodifications were made. This affects all CI jobs requiringnode_modules(lint, unit tests, depcheck, etc.)tsc --noResolve --skipLibCheck(full type checking requiresnode_modules)m/nboth valid)Link to Devin session: https://app.devin.ai/sessions/b697057640604eccb771c85e25a00757
Requested by: @dr-phil