Child Pays For Parent
I closed my Phoenix Lightning channel, as per their suggestion due to them removing the app from the US app store. “Drain the wallet” they said…
So I did as they say, I drain the wallet…. I wondered about the miner fees, especially as right now we are under attack from spamming spammers (runes, ordinals and related garbage) so I went to do a send first, just to check if you could set a fee. You could, do I proceeded to drain the channel. It literally has like 1 screen, you set the address and then press next and it then just does it. It does NOT ask anything about fees or really give you any info. I hadn’t really used it much, so can’t really say its good or bad, but this part is BAD for sure.
Anyway, my transaction is sitting in the mempool with 12sats/vB, when the bare minimum at the moment is about 24. I waited about 6 hours, but decided to take matters into my own hands. Enter CPFP.
What CPFP allows one to do is as long as they control any target address of any output of a transaction (UTXO) they can then spend that UTXO and increase the fee on that transaction to be enough to cover the cost of both transactions being higher than the average. As long as the UTXO that you control has enough sats in it to cover the next fee, and if it doesn’t, well, then, you wouldn’t care about leaving the current one there for a while… So on to how to do this.
I had spun up a new bitcoin core node and created a new wallet. And that is where I was draining my funds to.
Doing the CPFP is simple in theory, and in hind-site, but until you done it its not just a button to click! But basics is that you just use the bitcoin-cli or the console in bitcoin-qt and do 3 simple steps; create a raw transaction, sign the raw transaction with your wallet, and then send the raw transaction.
The slightly trickier part is to get the id of the transaction that is stuck and get the output index of the UTXO you have control over. You can go to mempool or blockstream.info or your other favorite block explorer (bitcoin bagel block explorer coming soon!) and look at the order of ouputs to get yours. mempool doesn’t actually say the order, but its in order.
So, get your transaction id and the “vout” (index) of your UTXO.
Step 1: Then in bitcoin-cli or console run:
createrawtransaction "[{\"txid\":\"TXID_HEX\",\"vout\":VOUT_INDEX}]" "[{\"RECIEVE_ADDRESS\":AMOUNT}]"
If using the console, you need to escape the double quotes in the json. AMOUNT should be in BTC with decimals, not sats.
A sample would be:
createrawtransaction "[{\"txid\":\"5ba968fef5aef3e1675899a95e434b2e5e80d93ce6323948db8dc357d8acea22\",\"vout\":1}]" "[{\"bc1pyel2a4cvp4pvut602vcp96wfcwh6j2ppuj5z22\":0.0021004}]"
- Optional step 2: You might need to unlock your wallet, with:
walletpassphrase "passphrase" timeout_seconds
eg.
walletpassphrase "your_passphrase" 200
Step 3: Then it will output a string of hex. Grab that hex and sign it:
signrawtransactionwithwallet "HEX_FROM_STEP_2"
Step 4: Then, with that output, send the transaction.
sendrawtransaction "HEX_FROM_STEP_3"
Thats about it. I ended up overpaying by 2x, but wanted to be sure it would go through. It was pretty lucky timing, it got put into the next block, which happened to be about 10 seconds after I published it, so yeah, CPFP is fucking cool!
Leave a Reply