This is a Next.js application demonstrating Bitcoin wallet functionality using the Dynamic Labs SDK. It showcases various Bitcoin operations including wallet creation, message signing, PSBT transactions, and private key management.
- Install dependencies:
npm install-
Set up your Dynamic Labs environment ID:
- Create a
.env.localfile in the root directory - Add your Dynamic Labs environment ID:
NEXT_PUBLIC_DYNAMIC_ENVIRONMENT_ID=your_environment_id_here - The app uses the pre-production API by default:
https://app.dynamic-preprod.xyz/api/v0
- Create a
-
Run the development server:
npm run dev- Open http://localhost:3004 in your browser.
The application provides a comprehensive Bitcoin wallet demo with the following tabs:
- Create Bitcoin wallets with different address types (Native SegWit, Taproot)
- View existing Bitcoin wallets in a table format
- Display wallet addresses, types, and network information
- Sign messages using Bitcoin wallets
- BIP-322 signature verification
- Support for multiple Bitcoin wallets
This tab includes multiple sections:
- Send Bitcoin directly with automatic PSBT creation, signing, and broadcasting
- Configure fee priority (low, medium, high)
- Input amounts in BTC (automatically converted to satoshis)
- Create Partially Signed Bitcoin Transactions (PSBTs)
- Specify recipient address and amount
- Configure fee priority
- Automatically populates the Sign PSBT section
- Sign existing PSBTs (from Build PSBT or external sources)
- View signed PSBT output
- Finalize signed PSBTs to prepare for broadcasting
- Broadcast finalized transactions to the Bitcoin network
- Accepts finalized transaction hex (auto-populated or manually entered)
- View transaction IDs after successful broadcast
- Export private keys from Bitcoin wallets
- Secure container-based export interface
- Support for multiple wallets
- Import existing private keys to create wallets
- Support for Native SegWit and Taproot address types
- Add imported wallets to your account
@dynamic-labs/bitcoin- Bitcoin wallet functionality@dynamic-labs/sdk-react-core- Dynamic Labs SDK corebitcoinjs-lib- Bitcoin transaction and PSBT handlingbip322-js- BIP-322 message signing verification
The app requires Content Security Policy (CSP) headers to allow connections to:
- Dynamic Labs API endpoints
- Mempool.space (for Bitcoin UTXO data)
These are configured in next.config.js.
BitcoinWalletDemo.tsx- Main component with tab navigationCreateWalletsTab.tsx- Wallet creation and listingSignMessagesTab.tsx- Message signing functionalityTransactionsTab.tsx- All transaction-related operationsExportPrivateKeyTab.tsx- Private key exportImportPrivateKeyTab.tsx- Private key import
The application runs on port 3004 by default (not 3000). This is configured in package.json.
Bitcoin wallets can be created automatically during sign-up if enabled in the Dynamic Dashboard. The demo also supports manual wallet creation.
npm run dev- Start development server on port 3004npm run build- Build for productionnpm run start- Start production server on port 3004npm run lint- Run ESLint
The app uses Next.js 14 with React 18 and TypeScript. Make sure you have Node.js 18+ installed.
This is a demo application for testing Dynamic Labs Bitcoin wallet functionality.