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

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:

<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?


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

How? Thank you!



– correct code formating

– Summary of useful links:








– Notes:

Electrum console:


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


hello my name is amir; i love bitcoin and dogecoin 🎯

Related Articles


  1. Check out bdk-cli. You can write a descriptor with the timelock, give it to bdk-cli and get a kittle command line wallet

  2. Checkout the bitcoin sdk for a language of your preference and try, this can help build the transaction. Javascript for example: ( disclaimer: i never used it, only is a example )

    Create this type of transactions from scratch like you are try is complex and risky

    Before any real attempt, try in testnet or use small amounts!

  3. The most important thing is to test your solution with a small amount first. Bitcoin is unforgiving. There is no one that you can call to reverse your mistakes. I guess you could call me, but I’ll just say that “I told you so”.

  4. If anyone’s interested in a less technically sophisticated way to do this, check out and their competitors.

    1. generate a 12-word seed, and fund it with whatever you want to postpone spending.

    2. **cut**+paste 3 of the words into a ‘future’ email, with your chosen arrival date, like 1 year into the future.

    3. save the other 9 words somewhere safe and wait for the email to arrive.

    Once you get the email in 1 year, you can combine those 3 words with the 9 you kept safe, and get your bitcoins. The emailing service can’t get your bitcoins, because they only ever see 3 out of the 12 words. And if that service disappears or doesn’t work, worst-case scenario, you only have to bruteforce 2048^3 combinations. Not such a big deal.

    (If you ever try this, one of the most important things to make sure, is that the amount of data you send to the service is bruteforceable within a reasonable time-frame if they disappear, but not too easily bruteforceable that you can easily cheat and get your bitcoins early)

  5. You could just exercise impulse control, a basic skill all adults need to have. Messing around with this stuff could lock your btc for 100 years by accident. Future upgrades and changes could render your lockups unspendable too.

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

    instead of doing that, learn more about self-control

  7. Checkout they have a couple of nice UIs for timelock this is a good way to do it as you can generate the key pair offline and only needs the public key. But the usual caveats of working with individual keys is hard. And timelock has no back door except time travel.

Leave a Reply

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

Back to top button