Caravan Documentation
    Preparing search index...

    Interface TxAnalysis

    Represents the comprehensive analysis of a Bitcoin transaction. This interface encapsulates various metrics and properties of a transaction, including size, fees, RBF and CPFP capabilities, and recommended fee bump strategy.

    TxAnalysis

    • The vsize and weight properties are important for fee calculation in segwit transactions.
    • isRBFSignaled is true if at least one input has a sequence number < 0xfffffffe.
    • canRBF considers both RBF signaling and the availability of inputs for replacement.
    • canCPFP is true if there's at least one unspent output that can be used for a child transaction.
    • The recommendedStrategy is based on the current transaction state and network conditions.
    • estimatedRBFFee and estimatedCPFPFee are calculated based on current network fee rates and minimum required increases.
    const txAnalyzer = new TransactionAnalyzer(options);
    const analysis: TxAnalysis = txAnalyzer.analyze();
    console.log(`Transaction ${analysis.txid} has a fee rate of ${analysis.feeRate} sat/vB`);
    if (analysis.canRBF) {
    console.log(`RBF is possible with an estimated fee of ${analysis.estimatedRBFFee} satoshis`);
    }
    interface TxAnalysis {
        canCPFP: boolean;
        canRBF: boolean;
        estimatedCPFPFee: string;
        estimatedRBFFee: string;
        fee: string;
        feeRate: number;
        inputs: BtcTxInputTemplate[];
        isRBFSignaled: boolean;
        outputs: BtcTxOutputTemplate[];
        recommendedStrategy: FeeBumpStrategy;
        txid: string;
        vsize: number;
        weight: number;
    }
    Index

    Properties

    canCPFP: boolean

    Indicates whether CPFP (Child-Pays-For-Parent) is possible for this transaction.

    canRBF: boolean

    Indicates whether RBF is possible for this transaction.

    estimatedCPFPFee: string

    The estimated fee required for a successful CPFP, in satoshis.

    estimatedRBFFee: string

    The estimated fee required for a successful RBF, in satoshis.

    fee: string

    The total fee of the transaction in satoshis.

    feeRate: number

    The fee rate of the transaction in satoshis per virtual byte.

    An array of the transaction's inputs.

    isRBFSignaled: boolean

    Indicates whether the transaction signals RBF (Replace-By-Fee).

    An array of the transaction's outputs.

    recommendedStrategy: FeeBumpStrategy

    The recommended fee bumping strategy for this transaction.

    txid: string

    The transaction ID (hash) of the analyzed transaction.

    vsize: number

    The virtual size of the transaction in virtual bytes (vBytes).

    weight: number

    The weight of the transaction in weight units (WU).