ts-sdk

Wallet Integration

How the BSV TypeScript SDK connects with Bitcoin wallets and manages user authentication.

Wallet Connection Model

The SDK uses a standardized approach to connect with Bitcoin wallets:

import { WalletClient } from '@bsv/sdk'

// Connect to a wallet
const wallet = new WalletClient('https://wallet-url')

// Authenticate with the wallet
await wallet.authenticate()

BRC-100 Compliance

The SDK follows the BRC-100 standard for wallet communication:

Authentication Flow

  1. Connection: Establish connection to wallet service
  2. Identity: Wallet provides user identity information
  3. Capabilities: Discover what the wallet can do
  4. Authorization: User grants permission for specific operations

Transaction Creation

The wallet handles sensitive operations:

// Create a transaction action
const action = await wallet.createAction({
  description: 'Payment transaction',
  outputs: [{
    satoshis: 1000,
    lockingScript: recipientScript
  }]
})

// Wallet signs and broadcasts automatically

Key Benefits

Security

User Experience

Developer Simplicity

Wallet Types

The SDK works with various wallet implementations:

Error Handling

Common wallet integration scenarios:

Best Practices

Next Steps