Caravan Documentation
    Preparing search index...

    Hierarchy

    • ClientBase
      • BlockchainClient
    Index

    Constructors

    Properties

    bitcoindParams: BitcoindParams
    host: string
    network?: Network

    Methods

    • Retrieves transaction history for one or more addresses (public clients only)

      This method is designed for public blockchain explorers (Mempool/Blockstream) that maintain address indexes, allowing efficient address-specific queries.

      Why this method is PUBLIC CLIENT ONLY:

      • Public APIs maintain address indexes for efficient lookups
      • Bitcoin Core doesn't support address-specific queries (see getWalletTransactionHistory)
      • Allows querying multiple addresses with Promise.all for efficiency

      For PRIVATE clients: Use getWalletTransactionHistory() which returns all wallet transactions

      Parameters

      • address: string | string[]

        Single address or array of addresses to query

      • count: number = 10

        Number of transactions to return per address (1-100)

      • skip: number = 0

        Number of transactions to skip for pagination

      Returns Promise<TransactionDetails[]>

      Combined array of transactions sorted by time (newest first)

      Error if called on private client

      // Single address
      const txs = await client.getAddressTransactionHistory("bc1q...");

      // Multiple addresses
      const txs = await client.getAddressTransactionHistory(["bc1q...", "bc1p..."]);

      getWalletTransactionHistory - For private clients

    • Retrieves the fee information for a pending (incoming) transaction .

      Standard methods like getTransaction do not provide fee details for transactions where the user is the recipient. However, this information is required for fee bumping strategies like CPFP (Child Pays For Parent).

      This method :

      • For private nodes: Uses getmempoolentry to fetch fee data from the node's mempool
      • For public APIs: Uses mempool.space transaction endpoint to get fee information
      • Returns null if the transaction is not pending (not in mempool)

      Parameters

      • txid: string

        Transaction ID to get fees

      Returns Promise<null | string>

      Tx fees in satoshis, or null if transaction is not pending

    • Retrieves transaction history for a Bitcoin Core wallet (private client only)

      This method returns only "send" (spent) transactions from the wallet. This design decision was made after extensive discussion about Bitcoin Core's limitations:

      1. Bitcoin Core doesn't maintain an address index for performance/privacy reasons
      2. The listtransactions RPC returns ALL wallet transactions with no address filtering
      3. Filtering by address after fetching would be O(n*m) complexity for multiple addresses

      Why this method is PRIVATE CLIENT ONLY:

      • Public APIs (Mempool/Blockstream) support direct address querying
      • Bitcoin Core requires different approach due to lack of address indexing
      • This inconsistency is intentional to optimize for each client type's capabilities

      Why only "send" transactions:

      • Unspent "receive" transactions are already available via fetchAddressUtxos()
      • Avoids duplication of data that's accessible through UTXO methods
      • Focuses on spent transactions which are needed for transaction history
      • Coordinator can combine this with UTXO data for complete history

      For PUBLIC clients: Use getAddressTransactionHistory() which supports address filtering

      Parameters

      • count: number = 100

        Number of transactions to return (1-1000)

      • skip: number = 0

        Number of transactions to skip for pagination

      • includeWatchOnly: boolean = true

        Include watch-only addresses in results

      Returns Promise<WalletTransactionDetails[]>

      Array of spent transactions from the wallet

      Error if called on public client or if wallet name is missing

      // For private client - get last 100 spent transactions
      const spentTxs = await client.getWalletTransactionHistory(100);

      // For public client - use getAddressTransactionHistory instead
      const addressTxs = await client.getAddressTransactionHistory(address);
      • getAddressTransactionHistory - For public clients
      • fetchAddressUtxos - For unspent transactions
    • Parameters

      • __namedParameters: { change: string; receive: string; rescan: boolean }

      Returns Promise<object>

    Post