Need help with CLTV; I want to lock away bitcoins for 1 year

Need help with CLTV; I want to lock away bitcoins for 1 year
ybvb
0
0

Hi /r/bitcoin

How does one actually write and broadcast a transaction with an CLTV script.

Step by Step instructions would help me a lot.

My goal is to send x.y amount of bitcoin to my address but with a lock of 1 year.

This is what I have come up:

1704666900 CHECKLOCKTIMEVERIFY DROP DUP HASH160 
<ripemd160(my_address)> EQUALVERIFY CHECKSIG

The PowerShell line I use to calculate seconds since 1970:

((Get-Date).AddYears(1) - (Get-Date -Year 1970 -Month 1 -Day 1 -Hour 0 -Minute 0)).totalseconds

Where do I have to input my code if it were correct?If I have to compile it, how do I do that?When I have it compiled, where do I input the compiled code?

I didn't find any YouTube video to my surprise and the internet articles/wiki don't have step by step instructions on how to compile the code nor where to input the code.

Do I have to sign a message? Is there an app that allows me to do my usecase in an easy way?

TLDR:

I want to stop myself from spending a certain amount of bitcoin for 1 year on the blockchain.

How? Thank you!

EDIT:

- correct code formating

- Summary of useful links:

https://github.com/bitcoin-core/HWI#device-support

https://github.com/bitcoinjs/bitcoinjs-lib

https://www.reddit.com/r/Bitcoin/comments/kezc47/is_there_a_way_i_can_do_a_cltv_bitcoin/

https://www.reddit.com/r/Bitcoin/comments/dswuml/wallets_that_can_spend_a_cltv_address_after_the/

https://coinb.in/#newTimeLocked

https://medium.com/@thomasmccabe/hodling-bitcoins-with-op-checklocktimeverify-a-step-by-step-guide-to-manually-building-a-bitcoin-ce9476725de8

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc#check-lock-time-verify-cltv

- Notes:

Electrum console:

getpubkeys("3N....")

Important: The redeem script is needed as well. Even after the timelock expires a special transaction must be crafted to spend the bitcoins.