Overview

Receiving payments with Arkade is simple and efficient. Your wallet can generate addresses for both boarding and ark payments, allowing your users to send Bitcoin to you through either method.

Getting Your Wallet Address

To receive payments, you first need to generate an address:
const offchainAddress = await wallet.getAddress()
const boardingAddress = await wallet.getBoardingAddress()

// The off-chain Ark address for instant payments
console.log('Ark Address:', offchainAddress)

// The on-chain boarding address
console.log('Bitcoin Address:', boardingAddress)

Ark Addresses

Ark addresses start with ark1 on Bitcoin mainnet or tark1 on testnet and regtest.

Understanding Ark Addresses

Learn about the technical structure of Ark addresses, how they’re generated, and the security guarantees they provide.

Monitoring for Incoming Payments

To detect when payments are received, you can use Wallet.notifyIncomingFunds() for incoming transactions in real-time.

// Example function to process incoming funds
async function processIncomingFunds(notification: IncomingFunds) {
  // Update your application state
  switch (notification.type) {
    case 'vtxo':
      for (const vtxo of notification.vtxos) {
        console.log(`Received payment of ${vtxo.amount} sats`);
        
        // You might want to store the VTXO in your database
        await storeVtxoInDatabase(vtxo);
        
        // Notify the user
        showNotification(`Received ${vtxo.amount} sats!`);
        
        // Update the UI
        await refreshBalanceDisplay();
      }
      break;
    case 'utxo':
      for (const utxo of notification.utxos) {
        await storeBoardingUtxoInDatabase(utxo)

        // Notify the user
        showNotification(`Received ${utxo.amount} sats on boarding address!`);
        
        // Update the UI
        await refreshBalanceDisplay();
      }
      break;
  }
}

// Start the subscription
const stop = wallet.notifyIncomingFunds(processIncomingFunds)

// Stop the subscription
stop()

Best Practices

Next Steps