More fun with OP_HODL (CheckLockTimeVerify)

More fun with OP_HODL (CheckLockTimeVerify)

Last week I [wrote a post](https://www.reddit.com/r/Bitcoin/comments/jawpsk/fun_with_op_hodl_checklocktimeverify/) with [a script](https://github.com/brianddk/reddit/blob/f90765f0d30f92398b240ff04d24268b3da7d338/python/spend-p2wsh-hodl.py) to create a HODL address. A HODL address is a UTXO that cannot be spent until a certain epoch time or blocktime. It can be used to secure funds in a will or trust that has a designated maturity date. Or you may have some other reason to lock the funds, the point is that the UTXO can be physically verified to be funded, and under an unbreakable timelock.

I’ve liked the feature but have been frustrated that there is limited HW and SW wallet support for it presently. My previous post walked through how to make a segwit HODL UTXO, this post will detail how to make a BIP16 legacy P2SH HODL UTXO.

Similar to last week, I wrote [a `bitcoinlib` script](https://github.com/brianddk/reddit/blob/f8e6798d80d60181715fa6babcfd4a1637a7190e/python/spend-p2sh-txout-tz.py) to do it, but this week I also went through the steps to do it on the CoinBin wallet. CoinBin is a JavaScript wallet that can (and should) be run locally. CoinBin, or raw python (bitcoinlib) are the only ways I currently know of to spend a HODL address.

Here’s the basic rundown to create and fund your UTXO with CoinBin

1. Use either Electrum or Bitcoin Core to collect a Bitcoin public and private key.
2. Run the CoinBin app either [locally](https://github.com/OutCast3k/coinbin/) (best option) or through the [live site](https://coinb.in/)
3. Choose `New` -> `Time Locked Address`
4. Enter the public key (from #1) and either a block height or timestamp for your lock
5. Hit `Submit` and record the address and redeem script
6. Ensure you have accurately recorded everything in step #1 and step #5
7. Send funds to the address recorded in step 5 as you normally would.

Here’s the basic rundown on how to spend your UTXO with CoinBin

1. Use either Electrum or Bitcoin Core to collect an address to spend your UTXO to
2. Run the CoinBin app either [locally](https://github.com/OutCast3k/coinbin/) (best option) or through the [live site](https://coinb.in/)
3. Choose `New` -> `Transaction`
4. Enter the `Redeem Script` you copied in the creation process (step #5), then `Load`
5. After a few minutes it should automatically load your UTXO into the form
6. Enter the address you want to spend your UTXO to and adjust the output amount for fees
7. Hit the question mark next to `Transaction Fee` for the calculator
8. Hit `Submit` when satisfied and record the unsigned transaction data
9. Select `Sign` on the top nav bar to begin the signing operation
10. Enter your private key from the creation process (step #1) and the unsigned TXN
11. Select `Submit` to produce the signed TXN
12. Broadcast the signed TXN with either Electrum or Bitcoin Core

Note, if you try to broadcast before the UTXO’s timelock expires, you will get a terse `not final` error in either Electrum or Core.

For Extra Credit, CoinBin can also be [run against Testnet](https://www.reddit.com/r/Bitcoin/comments/jehmtn/more_fun_with_op_hodl_checklocktimeverify/g9fidvq/), but to do so you have to unhide the settings element, manually code the TXN input script and manually code the TXN `nLockTime` to sync with your HODL address.

Here are a Testnet and Mainnet HODL spend TXN I created in CoinBin
* [Mainnet: txid ea6a1…79d53](https://live.blockcypher.com/btc/tx/ea6a1f0a8c132b8aff513c4bb9219ad7a5eeca22d8cc76344a534b0d46579d53/)
* [Testnet: txid a8110…adc93](https://live.blockcypher.com/btc-testnet/tx/a8110bbdd40d65351f615897d98c33cbe33e4ebedb4ba2fc9e8c644423dadc93/)



View Reddit by brianddkView Source

Leave a Comment

Your email address will not be published. Required fields are marked *