A React Native demo application for Babylon Bitcoin Staking
This is a React Native demo application that demonstrates Bitcoin staking functionality using the Babylon Chain protocol. Built on top of the Ignite boilerplate by Infinite Red, it provides a complete implementation of Bitcoin staking operations including wallet setup, address generation, and staking execution.
- Built on Ignite: Leverages Infinite Red's proven React Native architecture and best practices
- Wallet Management: Import existing wallets using 12 or 24-word recovery phrases
- Multi-Chain Address Generation: Automatically generates Bitcoin (Signet) and Babylon addresses
- Bitcoin Staking: Complete Bitcoin staking workflow with Babylon Chain integration
- Real-time Validation: Mnemonic validation and address verification
- User-Friendly Interface: Modern React Native UI with comprehensive error handling
- Boilerplate: Ignite by Infinite Red
- Framework: React Native with Expo
- State Management: MobX State Tree
- Navigation: React Navigation v6
- Styling: Themed components with dark/light mode support
- Crypto Libraries:
@babylonlabs-io/[email protected]- Core Bitcoin staking functionalitybitcoinjs-lib- Bitcoin operations@scure/bip39- BIP39 mnemonic handling@scure/bip32- HD wallet derivation
This project uses patch-package to apply critical modifications to several libraries, especially the Babylon SDK. The following patches are essential for proper functionality:
@babylonlabs-io+btc-staking-ts+1.0.2.patch- Critical Babylon SDK modificationsbitcoinjs-lib+6.1.7.patch- Bitcoin library compatibility fixes@bitcoin-js+tiny-secp256k1-asmjs+2.2.4.patch- Secp256k1 compatibility@bufbuild+protobuf+2.2.5.patch- Protobuf fixes
- Node.js ^18.18.0 || >=20.0.0
- Yarn package manager
- Expo CLI
- React Native development environment
# Clone the repository
git clone <repository-url>
cd btc-simple-staking
# Install dependencies
yarn install
# Apply patches (automatically runs after install)
yarn patch
# Start the development server
yarn start# iOS Simulator
yarn build:ios:sim
# iOS Device (Development)
yarn build:ios:dev
# Android Simulator
yarn build:android:sim
# Android Device (Development)
yarn build:android:dev- Launch the application
- Tap "Setup Wallet" on the welcome screen
- Enter your 12 or 24-word recovery phrase
- Tap "Generate Addresses" to create Bitcoin and Babylon addresses
- Review the generated addresses and tap "Save Wallet"
- Navigate to the staking screen
- Enter the amount of Bitcoin you want to stake
- Review the finality provider and staking terms
- Confirm the staking transaction
The application is currently configured for Bitcoin Signet testnet. Key configurations:
- Bitcoin Network: Signet (testnet)
- Derivation Path:
m/86'/1'/0'/0/0(Signet) - Address Format: P2TR (Taproot)
- Babylon Network: Testnet
To switch to mainnet or other networks, modify the following files:
app/utils/chain-keys/index.ts- Update derivation paths and network parametersapp/config/network/- Update network configurationsapp/constants/staking.ts- Update staking parameters
This project follows the Ignite boilerplate structure with additional Bitcoin staking-specific modules:
app/
├── components/ # Reusable UI components (Ignite standard)
├── config/ # Network and environment configurations
├── constants/ # Application constants (Bitcoin staking specific)
├── hooks/ # Custom React hooks (staking functionality)
├── models/ # MobX State Tree models (Ignite standard)
├── navigators/ # Navigation configuration (Ignite standard)
├── provider/ # React context providers (Babylon RPC)
├── screens/ # Application screens (Ignite standard + staking screens)
├── types/ # TypeScript type definitions (Bitcoin/Babylon types)
├── utils/ # Utility functions and helpers (crypto utilities)
└── theme/ # Styling and theming (Ignite standard)
- Secure mnemonic storage
- Multi-chain address generation
- Wallet state management
- Bitcoin staking workflow
- Transaction signing and broadcasting
- Error handling and status tracking
- Babylon Chain RPC integration
- Bitcoin mempool API integration
- UTXO management
# Run unit tests
yarn test
# Run tests in watch mode
yarn test:watch
# Run end-to-end tests with Maestro
yarn test:maestro# Check for linting errors
yarn lint:check
# Fix linting errors
yarn lint
# Compile TypeScript
yarn compile- Recovery Phrases: Never share your recovery phrase with anyone
- Testnet Only: This application uses testnet addresses for development
- Private Keys: Private keys are handled securely within the application
- Network Security: Ensure you're using trusted RPC endpoints
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure all tests pass
- Submit a pull request
- Application is currently configured for Signet testnet only
- Some library patches are required for compatibility
- Network switching requires manual configuration changes
This project is private and proprietary.
For questions or support, please refer to the Babylon Chain documentation or create an issue in this repository.
Note: This is a demo application for educational and testing purposes. Always verify transactions and use appropriate network configurations for your intended use case.