Las type transactions Child Pays For Parent (CPFP) They are those in which a transaction with a higher mining rate is created, so that when this new transaction is sent to the network, it forces the confirmation of another previous transaction that has not yet been confirmed. This in order to encourage miners to perform the confirmation of these transactions much faster.
Although its concept seems very similar to fee replacement transactions (Replace By Free) they should not be confused with this one. Since CPFP transactions do not invalidate the previous transaction, but instead, it must be confirmed together with the new transaction created. Furthermore, in CPFP the secondary transaction is only created to motivate miners to process and confirm both transactions, and thus be able to receive the associated commission. Therefore, they are known as "the child pays for the father".
How do Child Pays For Parent transactions work?
When a transaction remains unconfirmed on the Bitcoin blockchain, while new blocks appear, it is mainly due to the payment of an insufficient fee. It is especially noticeable when the network is congested. In these times of congestion or high demand, miners prioritize only those transactions that have a high or minimally acceptable commission rate. So those transactions with a very low commission may be stagnant and unconfirmed in the bitcoin mempool for several days, and even weeks. Leaving its recipients waiting for the transferred funds for an indefinite time.
To solve this, the method is implemented Child Pays For Parent (CPFP), where the user of the unconfirmed transaction can create a new transaction, known as a child transaction. In it you will have to put a transaction fee much higher than the original transaction.
This new CPFP transaction will use this balance generated by the unconfirmed main transaction to create a new transaction that takes that balance to a new address. That is, if a user creates a transaction to send X amount of funds, and has in his wallet a little more than those funds, the wallet will automatically create 2 outputs. The first to send X amount of funds to the recipient, and the second to receive the returns or exchange of said transaction.
Recall that in Bitcoin transactions, all outputs must be spent. This is possible thanks to the fact that the first transaction generated a cryptocurrency sending transaction. But at the same time we returned a certain amount of unused cryptocurrency to a direction of change under our possession. This amount of unused cryptocurrencies is called an unspent transaction exit or UTXO. In short, a CPFP is used by our UTXO balance to generate a new transaction with a higher mining fee in order to speed up the confirmation of the initial transaction.
So, if that operation is unconfirmed, the user can create a child transaction (CPFP) associated with the parent transaction, where he will send those laps or change to another address of his own. The important thing is that this new transaction will have a very attractive commission rate for miners and that covers the commission necessary to process both transactions.
The moment miners see the secondary transaction, they will be drawn to confirm it to collect the associated commission fee. But they will not be able to confirm said transaction independently, without first confirming the main transaction first. So they will evaluate and verify the secondary transaction to see if it has the necessary fees to cover both transactions.
Once the miners verify this, they will choose to add the main transaction to the next mined block, so that they can also confirm the secondary transaction. To collect the commission fee included in this, and which is acceptable to process both transactions.