Skip to main content

Error Handling in Bigmi

This guide covers the most common errors you’ll encounter when building Bitcoin applications with Bigmi and how to handle them effectively.

Common Errors

Error Handling Patterns

Basic Try/Catch with Bigmi

Wallet Connection Error Handling

Transaction Retry Logic

Network Fallback Handling

Troubleshooting Guide

”Wallet extension not found”

Symptoms: ConnectorNotFoundError when trying to connect Solutions:
  • Check if wallet extension is installed and enabled
  • Try refreshing the page
  • Verify wallet supports Bitcoin network

”Transaction failed to broadcast”

Symptoms: RpcRequestError during transaction sending Solutions:
  • Check if transaction hex is valid
  • Verify sufficient balance for fees
  • Try different RPC provider

”Connection keeps timing out”

Symptoms: Frequent TimeoutError messages Solutions:
  • Increase timeout values in configuration
  • Check internet connection
  • Switch to different RPC providers

”Balance shows as 0 but wallet has funds”

Symptoms: getBalance returns 0 despite having Bitcoin Solutions:
  • Verify address format (legacy vs SegWit)
  • Check if using correct network (mainnet vs testnet)
  • Wait for provider synchronization

”React hooks not working”

Symptoms: BigmiProviderNotFoundError in React app Solutions:
  • Ensure <BigmiProvider> wraps your app
  • Check provider configuration is correct
  • Verify all hooks are used within provider context

Replace-By-Fee (RBF) handling

Symptoms: Transaction gets replaced unexpectedly Solutions:
  • Monitor waitForTransaction for replacement events
  • Handle onReplaced callback appropriately
  • Update UI when transaction is replaced

Best Practices

  1. Always wrap Bitcoin operations in try/catch blocks
  2. Use specific error types for targeted error handling
  3. Implement retry logic for network operations
  4. Provide clear user feedback for wallet errors
  5. Configure multiple RPC providers for reliability
  6. Validate addresses before using them
  7. Check balances before attempting transactions
  8. Handle RBF scenarios in transaction monitoring

Error Recovery Strategies

  • Automatic Retry: For network timeouts and temporary failures
  • User Retry: For wallet rejections and user errors
  • Fallback Providers: For RPC provider failures
  • Graceful Degradation: Show cached data when providers are down
  • Clear Messaging: Help users understand and resolve issues