UNPKG

cdp-docs-cli

Version:

CLI tool to set up CDP (Coinbase Developer Platform) documentation and integration in your project

142 lines (106 loc) 4.4 kB
# 🔧 CDP Wallet Setup Guide Follow these steps to configure your Coinbase Developer Platform (CDP) wallet integration. ## Step 1: Get CDP API Credentials 1. **Visit the CDP Portal**: Go to [https://portal.cdp.coinbase.com/](https://portal.cdp.coinbase.com/) 2. **Sign in** with your Coinbase account or create a new one 3. **Create API Keys**: - Navigate to the "API Keys" section - Click "Create API Key" - Give your key a descriptive name (e.g., "My Wallet App") - Save both the **API Key ID** and **API Key Secret** - you'll need these later 4. **Generate Wallet Secret**: - This is used for signing transactions - Generate a secure random string or use the CDP portal's generator - Keep this secret safe - it's like your master password ## Step 2: Configure Environment Variables 1. **Create Environment File**: ```bash # In your project root, create .env.local touch .env.local ``` 2. **Add Your Credentials**: Open `.env.local` and add your CDP credentials: ```bash CDP_API_KEY_ID=your_actual_key_id_here CDP_API_KEY_SECRET=your_actual_key_secret_here CDP_WALLET_SECRET=your_actual_wallet_secret_here ``` **Replace the placeholder values** with your actual credentials from Step 1. 3. **Verify Security**: - Confirm `.env.local` is in your `.gitignore` file - Never commit this file to version control - Never share these credentials publicly ## Step 3: Test the Integration 1. **Start the Development Server**: ```bash npm run dev ``` 2. **Open Your Browser**: - Navigate to [http://localhost:3000](http://localhost:3000) - You should see the CDP Wallet Dashboard 3. **Create Your First Account**: - Enter a name for your account (e.g., "My First Wallet") - Click "Create Account" - You should see your new account appear in the list 4. **Request Test Funds**: - Select your account - Click "Request Test ETH" - Wait a few seconds for the transaction to complete - Your balance should update to show testnet ETH 5. **Send a Test Transaction**: - Enter a recipient address (you can use your own account address) - Enter a small amount (e.g., 0.001) - Click "Send Transaction" - View the transaction on the Base Sepolia explorer ## 🎉 Success Criteria Your integration is working correctly if: - ✅ Dashboard loads without errors - ✅ You can create new accounts - ✅ Faucet requests work and fund your accounts - ✅ You can send transactions successfully - ✅ Transaction links open on BaseScan explorer ## 🔒 Security Best Practices - **Never commit** `.env.local` to version control - **Use testnet only** for development and testing - **Keep your API keys secure** - treat them like passwords - **Use different keys** for development vs production - **Rotate keys regularly** if building production apps ## 🚨 Troubleshooting ### Environment Variable Issues - Ensure `.env.local` is in your project root directory - Restart your development server after changing environment variables - Double-check there are no extra spaces in your credential values ### API Connection Issues - Verify your API credentials are correct - Check your internet connection - Ensure you're using the correct CDP portal account ### Transaction Failures - Make sure your account has sufficient testnet ETH - Verify recipient addresses are valid Ethereum addresses - Check that you're using reasonable gas amounts ### Build Errors - Run `npm run build` to check for TypeScript errors - Ensure all dependencies are installed: `npm install` - Clear your `.next` cache: `rm -rf .next` then restart ## 📚 Next Steps Once your basic integration is working: 1. **Explore Advanced Features**: - Smart accounts with gas sponsorship - Batch transactions - Multi-network support (Ethereum, Solana) 2. **Build Custom Features**: - Custom transaction types - Transaction history - Address book functionality - Portfolio tracking 3. **Prepare for Production**: - Set up mainnet credentials - Implement proper error handling - Add comprehensive testing - Security audit your implementation ## 🆘 Need Help? - **CDP Documentation**: [https://docs.cdp.coinbase.com/](https://docs.cdp.coinbase.com/) - **Base Network**: [https://base.org/](https://base.org/) - **Support**: Contact Coinbase Developer Support --- **Happy Building! 🚀**