ArticleEdit PageHistory

CPFP

Child Pays For Parent (CPFP) in Bitcoin: A Comprehensive Explanation

Introduction to CPFP:

Child Pays For Parent (CPFP) is a transaction fee management technique used in the Bitcoin network to expedite the confirmation of transactions that are stuck in the mempool due to low transaction fees. This method involves creating a new transaction ("child") that spends the outputs of an unconfirmed transaction ("parent"), thereby incentivizing miners to confirm both transactions by increasing the total fee.

How CPFP Works:

  1. Stuck Transaction (Parent):

    • A Bitcoin transaction with a fee too low to be prioritized by miners remains unconfirmed in the mempool. This can happen when the network is congested, and higher fee transactions are given precedence.
  2. Creating a Child Transaction:

    • The recipient or sender of the stuck transaction creates a new transaction. This transaction must:
      • Spend an unconfirmed UTXO (Unspent Transaction Output) from the parent transaction.
      • Include a significantly higher transaction fee than what was included in the parent transaction.
  3. Incentivizing Miners:

    • Miners select transactions for inclusion in blocks based on fee rates (satoshis per byte). By creating a child transaction with a high fee, the total fee for both parent and child transactions becomes more attractive to miners.
  4. Mining Both Transactions:

    • Since the child transaction can't be valid without the parent transaction being confirmed first (due to Bitcoin's UTXO model where outputs must be spent in order), miners are motivated to include both transactions in a block to collect the combined fee.

Step-by-Step Process:

  • Identify the Unconfirmed Transaction:

    • Use a blockchain explorer or wallet software to find the transaction ID (txid) and the output index (vout) of the stuck transaction.
  • Create a New Transaction:

    • This new transaction uses the output (UTXO) of the stuck transaction as one of its inputs.
    • Specify a higher fee, often calculated to be competitive with current network fees.
  • Broadcast the Child Transaction:

    • Once signed and created, this transaction is broadcast to the network.
  • Mempool and Miner Selection:

    • The child transaction enters the mempool. Miners, seeing the combined fee of both transactions, are incentivized to mine them together.

Key Considerations:

  • Who Can Use CPFP?

    • Recipient: If the transaction is stuck because of low fees, and you are the recipient, you can create a CPFP transaction to spur confirmation.
    • Sender: If there's change from the original transaction returning to the sender, they too can use CPFP.
  • Fee Estimation:

    • The fee for the child transaction should be high enough to make the total fee of both transactions competitive. Tools like mempool.space can help estimate appropriate fees.
  • Wallet Support:

    • Not all Bitcoin wallets support CPFP out of the box. Wallets like Electrum, Samourai, and some versions of Bitcoin Core have this feature.
  • Network Conditions:

    • During high congestion, even a CPFP might not guarantee immediate confirmation if the network fees are exceptionally high.

Advantages and Limitations:

  • Advantages:

    • Recipient Control: It allows the recipient to influence transaction speed without needing cooperation from the sender.
    • No Transaction Replacement: Unlike Replace-By-Fee (RBF), CPFP doesn't require replacing the original transaction, just adding to it.
  • Limitations:

    • Efficiency: CPFP involves creating another transaction, which means more data needs to be included in blocks, potentially at a higher cost than RBF for the same outcome.
    • Dependence on Parent: If the parent transaction remains unconfirmed for an extended period, the child transaction might also stay unconfirmed, although it increases the likelihood of both being confirmed.

Practical Example:

  • Imagine Alice sends Bob 1 BTC with a low fee, and the transaction remains unconfirmed. Bob, wanting his coins, creates a new transaction spending this incoming BTC (which is still unconfirmed) to another address, perhaps back to himself or to another address, but this time with a much higher fee. Miners, seeing the combined fee from both transactions, are now more likely to include both in a block.

Conclusion:

CPFP is a valuable tool in Bitcoin's toolkit for transaction management, particularly useful when transactions are stuck due to insufficient fees. It leverages the economic incentives built into Bitcoin's mining model to solve congestion issues from the recipient's side, offering an alternative or complement to other fee management strategies like RBF. Understanding and correctly implementing CPFP can significantly improve the user experience on the Bitcoin network during times of high demand or when transactions are inadvertently underfunded in terms of fees.