Bitcoin: CPFP and stuck transactions in the mempool

Modified on Wed, 06 Dec 2023 at 12:04 PM

TABLE OF CONTENTS


If your Bitcoin transaction is stuck, and you're the recipient, you can clear it using CPFP (child-pays-for-parent). This is an alternative to the sender's ability to do so with RBF when this has not been enabled in a transaction stuck in the mempool.


How does Child-Pays-for-Parent (CPFP) work?

The idea of CPFP is that you "own" the privateKey of a recipient address of a transaction that hasn't been confirmed in a block yet and you want to use that coin ASAP. To achieve this, you will include that unconfirmed transaction in a new transaction and you will pay a high-enough fee to encourage a miner to include both the original (parent) transaction and the new (child) transaction in a block. As a result, the parent and child transactions will clear simultaneously.


CPFP is just an incentivation scheme that can be used for transaction selection by miners. There might be reasons that the child can't be selected to be put into a block, and this will prevent the parent UTXO from ever being put into a block.



Spending unconfirmed UTXOs

  1. Check Transaction Status: Use a blockchain explorer or wallet software to monitor the status of your original transaction. Make sure it is still unconfirmed and stuck. See BTC mempool explorer.
  2. Find the voutof the unconfirmed transaction. Example:
    "vout": [
     {
       "value": 0.01000000,
       "n": 0,
       "scriptPubKey": {
         "asm": "OP_HASH160 f079f77f2ef0ef1187093379d128ec28d0b4bf76 OP_EQUAL",
         "hex": "a914f079f77f2ef0ef1187093379d128ec28d0b4bf7687",
         "reqSigs": 1,
         "type": "scripthash",
         "addresses": [
           "2NFAkGiwnp8wvCodRBx3smJwxncuG3hndn5"
         ]
       }
     },
  3. Find in the vout the object the one that matches your address. (Here, it's the only one.) The n value is your vout
  4. Create a raw transaction using your unconfirmed transaction as input.
  5. Double the transaction fees (or more).


More information about CPFP is available at the following link.



Good to know

To accelerate a CPFP transaction, you will have to estimate a fee high enough to get both parent and child transactions processed. The Tatum JS SDK has a public extension facilitating the estimate - CPFP Fee Estimator

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article