Coinbase Explains How They Use “Child Pays For Parent” (CPFP) To Reduce Bitcoin Congestion Problems
One of the biggest problems facing bitcoin is the lack of a scaling solution. As bitcoin transaction volume grows, transaction fees rise and the network slows down. That’s a serious problem for major institutions like Coinbase – but fortunately, the San Francisco-based crypto exchange giant has created an innovative scaling solution using Child Pays For Parent (CPFP).
In a blog post earlier today, Coinbase explained how it uses Child Pays For Parent “to rescue thousands of transactions” on its network.
“Sending cryptocurrency today can be difficult; transaction fees are volatile and unpredictable, which can result in significant swings in the amount of time it takes for a transaction to confirm. As a result of this, we’ve had many days here at Coinbase where some users’ transactions would get stuck due to fee rate spikes and general Bitcoin network congestion.”
In December 2017, when BTC network congestion was at its peak and transaction fees were skyrocketing, Coinbase realized it had to come up with a better solution if it wanted to continue allowing clients easy, low-cost access to bitcoin:
“To address these challenges, we leaned on a well-known procedure which uses economic incentives enabled by the Bitcoin protocol for improving confirmation time of transactions: Child Pays for Parent (CPFP), and we’ve implemented this at Coinbase scale, sometimes using it to rescue thousands of transactions in a single day.”
How Does CPFP Work?
Child Pays For Parent sounds like a social welfare program, but it’s not: it’s a blockchain procedure that prevents previous transactions from sitting on the bitcoin network unconfirmed.
During periods of high congestion, bitcoin transactions can sit unconfirmed on the network while they wait for a miner to process the transaction. Transactions with higher fees will be processed more quickly than transactions with lower fees. This can leave low-fee transactions sitting on the bitcoin network for days at a time.
As JP Buntinx at NullTX.com explains,
“Bitcoin users will sooner or later come across one of their previous transactions that remains unconfirmed for an extended period of time. Alleviating this problem can be done through a procedure known as Child Pays For Parent or CPFP. Using this method will allow users to broadcast a similar transaction with a different fee, increasing its chances of getting picked up on the network.”
This has historically been done by users and miners who want to expedite a single transaction through the bitcoin marketplace. It’s been used by members of the bitcoin community for years.
Let’s say you send a bitcoin transaction at a time of low transaction volume on the bitcoin network. You send a bitcoin transaction at a time when the estimated fees at 5 satoshis per byte – a relatively low fee by today’s standards. However, seconds after submitting the transaction, the network is hit with a flood of transactions from people who are paying 25 satoshis per byte and higher.
The BTC network can only process 7 transactions per second. Miners invariably choose transactions with higher transaction fees first. That means your transaction at 5 satoshis per byte gets sent to the back of the line while transactions paying 25 satoshis per byte get processed first.
Your transaction will not be processed until it’s the most profitable transaction for miners, at which point it will be added to the next block. It can sometimes take hours – even days – for the flood to subside.
This is what happened to the BTC network in December 2017. BTC proved it cannot handle transactions at any type of scale, and that’s why BTC continues to be restricted to a transaction volume of just 7 transactions per second.
Coinbase, however, has developed a way to implement Child Pays For Parent at an institutional scale to prevent network congestion problems among Coinbase users.
How Does Coinbase Implement CPFP At Institutional Scale?
The “Child Pays For Parent” protocol involves two transactions: a child transaction and a parent transaction.
A bitcoin transaction is just a series of inputs and outputs. Inputs represent some value (in bitcoin) that is being spent by the sender. When a recipient wants to then spend the bitcoin that they received, one or more of the outputs that they control will become an input to a new transaction. This new transaction becomes a “child” of the previous “parent” transaction.
A typical bitcoin transaction includes a change output. This change output is typically sent back to the original sender, allowing them to use it in a future transaction.
To understand the change output, picture yourself buying a $5 coffee with a $10 bill. You receive $5 in change from the cashier. When you are spending inputs with a fixed amount (whether in bitcoin or dollars), there is generally change from that transaction. That’s called the change output.
The change output is what Coinbase utilizes to enable CPFP at an institutional scale.
Coinbase’s CPFP solution is based on the idea that miners always choose which transactions they want to place in each block based on relative rewards. Miners will always choose a transaction with a higher fee over a transaction with a lower fee.
Bitcoin is based on a blockchain. Later transactions depend on earlier transactions. That’s why the bitcoin protocol does not allow for a child transaction to be included in a block before its parent transactions have been added.
Here’s where things get innovative: If there are dependent transactions pending at the same time (parent and child transactions), then bitcoin mining software will view these transactions as a group. The bitcoin mining software will look at all of these transactions together and compute the corresponding fee across the entire set: instead of seeing one low transaction fee from one transaction and a high transaction fee from another, the software will see a normal transaction fee across the set on average.
By submitting a child transaction with a higher fee rate than its parents, the overall fee rate of the group increases. This is how CPFP works.
As Coinbase explains,
“Essentially we are making a more profitable transaction available to miners, but the structure of this transaction requires the miners to also pick up some less profitable transactions. To take advantage of this and give our customers a better experience, we built a feature that automates this process of bidding up a stuck transaction.”
Coinbase Includes This Feature Automatically
Coinbase has been rolling out this feature over the past few months. The feature is available to Coinbase clients automatically.
In other words, if you’re sending bitcoin with Coinbase and your transaction gets stuck, then the Child Pays For Parent protocol will be enabled automatically to allow your transaction to get unstuck.
“If a customer’s transaction happens to be stuck pending for at least 4 blocks, we’ll broadcast and pay for a child transaction at a sufficient fee rate in order to rescue the parent transaction (we actually batch these so that we can rescue multiple parents with one child).”
The end user doesn’t need to do anything to participate in this CPFP system.
Ultimately, Coinbase has created an innovative way to solve one of the crucial problems on the bitcoin network. You can view Coinbase’s full explanation of their Child Pays For Parent system on their blog.