In order to understand what Child Pays For Parent (CPFP) is, how it works, and what it is useful for, it is first important to discuss how exactly Bitcoin transactions work.
How Bitcoin Transactions Work: Confirmations, Transaction Fees, Mempool
When a Bitcoin transaction is sent it starts out as an unconfirmed transaction. On average an unconfirmed transaction receives a confirmation in 10 minutes if an appropriate miners fee is attached. That being said, 10 minutes is just an average confirmation time, and in reality, confirmations can take anywhere from a few seconds to several hours.
An important caveat that occurs when sending Bitcoin is that the appropriate miners’ fee is constantly fluctuating. Unconfirmed transactions reside in the Bitcoin mempool, and if this mempool becomes overloaded with unconfirmed transactions then the transaction fee rises. Essentially, Bitcoin users who do not want to wait for all of the other unconfirmed transactions to confirm, which could take hours, can set a higher transaction fee so that their transaction is given the highest priority and confirmed in the next block.
Another way to think about it is that Bitcoin transaction fees are a marketplace, with the supply being the amount of room available in blocks, and the demand being the number of unconfirmed transactions in the mempool. Supply on average remains constant, but demand can increase, forcing Bitcoin transaction fees upwards.
The most severe episode of mempool congestion occurred in December 2017, a time when Bitcoin hype, speculation, and trading activity was perhaps at its highest point in history so far. Bitcoin transaction fees skyrocketed above USD 50, or about 1,000 satoshis per byte. This was an anomalous event, and since then the highest transaction fees observed were USD 5-10 in late June 2019.
In general, it is quite common to see Bitcoin transaction fees rise above USD 1. Also, Bitcoin transaction fees are often lower than USD 1, sometimes dropping as low as a few cents, which is only a few satoshis per byte.
The problem is that Bitcoin transaction fees can rapidly fluctuate between a few satoshis per byte to hundreds of satoshis per byte. This transaction fee volatility has become even more amplified since the bull run started in March 2019.
The number of unconfirmed transactions in mempool between late June and late July 2019, with fees in satoshis/byte, colored. Chart courtesy of Johoe’s Bitcoin Mempool Statistics.
A Bitcoin user may attach the proper transaction fee at the time they send, but then maybe it takes a while for the Bitcoin network to find the next block, or a rally starts on the market causing a rapid increase in transaction activity.
In either case, the mempool essentially becomes flooded with unconfirmed transactions, and the Bitcoin user who had attached an appropriate transaction fee only minutes ago realizes that the transaction fee is now far too low.
This can result in an unconfirmed Bitcoin transaction getting stuck for hours or days, which can cause serious problems for Bitcoin ATM and cryptocurrency exchange users since they will not be able to access their money until the mempool clears out and transaction fees drop, which could take a long time.
One way of lessening the chance of sending a Bitcoin transaction that will get stuck is by keeping track of the Bitcoin mempool at Johoe’s Bitcoin Mempool Statistics. If you check this website before sending a Bitcoin transaction then you will know how much of a transaction fee you have to send to be safe.
Child Pays for Parent Rescues Stuck Bitcoin Transactions
If that doesn’t work, or you use a low transaction fee by accident, then Child Pays For Parent (CPFP) is a technique that can be used to push through the transaction, rather than waiting for the mempool to clear out.
A Bitcoin transaction consists of a set of inputs and outputs. For example, if someone has 1 Bitcoin in their wallet and they are trying to send 0.6 Bitcoin, then the 1 Bitcoin is the input, and the output is 0.6 Bitcoin to the receiver’s address, with 0.4 Bitcoin coming back as the change to the sender. CPFP utilizes the change in a Bitcoin transaction.
Basically, if a Bitcoin transaction is stuck, then another transaction can be sent with the change from the transaction. The original stuck Bitcoin transaction is called the parent, and the new transaction using the change is called the child.
Bitcoin mining software is not allowed to confirm a child transaction before the parent transaction, so the software aggregates the transactions and averages out the fees across them. Therefore, a much higher fee is added to the child transaction, raising the effective transaction fee for the stuck Bitcoin transaction, allowing the stuck Bitcoin transaction to be confirmed rather than waiting hours or days for the mempool to clear out.
— Stephen Pair (@spair) June 17, 2016
The Bitcoin Core wallet, which is the official Bitcoin wallet, offers the capability to do CPFP. Also, Electrum and the Samurai Wallet are compatible with CPFP.
Coinbase began offering CPFP to users in Fall 2018. If a Bitcoin transaction remains unconfirmed for 4 blocks then Coinbase will send out a child transaction with a high enough fee to push through the stuck parent transaction. This has apparently saved numerous customers from having to wait for hours or days, improving the customer experience at Coinbase.
Clearly, CPFP is a powerful technique that Bitcoiners should be aware of, since if a Bitcoin transaction ever gets stuck in unconfirmed status, then CPFP can be used to push the transaction through. This increases the efficiency of the Bitcoin economy and improves the Bitcoin experience as users who know how to utilize CPFP will not have to deal with their funds being tied up in an unconfirmed transaction for an extended period of time. Perhaps in the future CPFP will become an option in every Bitcoin wallet, which would create a smoother user experience for everyone and possibly increase Bitcoin adoption.
Image Courtesy: Pixabay