Configuration options for creating the CPFP transaction.
The base64-encoded PSBT of the CPFP (child) transaction.
If CPFP is not possible, if the transaction creation fails, or if the combined fee rate doesn't meet the target (in strict mode).
const cpfpTx = createCPFPTransaction({
originalTx: originalTxHex,
availableInputs: availableUTXOs,
spendableOutputIndex: 1,
parentUtxo: enrichedParentUtxo,
changeAddress: 'bc1q...',
network: Network.MAINNET,
dustThreshold: '546',
scriptType: 'P2WSH',
targetFeeRate: '15',
absoluteFee: '1000',
requiredSigners: 2,
totalSigners: 3,
strict: true
});
Creates a Child-Pays-for-Parent (CPFP) transaction to accelerate the confirmation of an unconfirmed parent transaction.
This function implements a simplified version of the CPFP strategy used in Bitcoin Core. It creates a new transaction (child) that spends an output from the original unconfirmed transaction (parent), including a higher fee to incentivize miners to confirm both transactions together.
The CPFP calculation process:
The combined fee rate is calculated as: (parentFee + childFee) / (parentVsize + childVsize)