So let me tell you a story, a long time ago when I sold my first bitcoins I sold them for 3k each, I was holding 2 of them and it was a great win for me because I was selling them to buy an apartment. Second time I invested almost all my savings and made a solid profit but exited too early, story of my life honestly. The thing is I am always able to buy the dip, I can sit with my USDT for a year or even 2 years and wait for the golden moment to buy, patience is not a problem for me but holding is a different game completely.
I was having 32 ETH when mining was about to shut down and I was doing mining as well, my plan was simple - stake them and just live from staking profits, sounds good right? But I have sold them too early and it's really annoying for me when I think about it now.
At some point 3-4 years ago I have sent 300$ to a BTC wallet and scheduled a message to myself in gmail to send me 12 words on my 30's birthday, it will probably come to me next month but probably not I am not sure how good gmail is with that stuff and I do not have access to that account anymore I have deleted it after I created the schedule. This was my first attempt to lock myself from my own money.
I do not trust much to exchanges or any services who can lock my money from me at any moment for whatever reason. Once I have put money for a year as locked deposits to the bank which were expiring one by one and it was amazing experience because I was not able to spend more compared to what was distributed to me by myself, that feeling of forced saving is something special.
I am working as developer and have seen some smart contracts on ETH and TRX networks where you can really do almost anything, maybe some of you remember ICO scams on those smart contracts lol, and I thought wow I can lock my funds in smart contract and network itself will guarantee my funds are safe. But I wanted to do it with Bitcoin not with altcoins because lets be honest if we are talking about locking something for decades it should be Bitcoin.
Then I started to research how can I do that and apparently with Bitcoin scripts you can lock money and make them impossible to spend before any block height or unix time and it will be completely your wallet and your address and everything will work on the network itself, no third party needed. When I was trying to do that few years ago there were no services which can do so and I tried to implement it myself and failed. I have published upwork job but people wanted 250-300$ for small chunk of work not even for the whole thing and I gave up.
I was thinking about creating a service where people can create vault addresses and put money there for their children maybe or like a gift for a friend - 50$ of bitcoin frozen for 20 years imagine that.
And now finally I have that great AI agent (I will not tell the name of it so it will not look like marketing) and I have asked him to help me and we actually did it.
So how does it work technically:The implementation uses Taproot addresses (those
bc1p... addresses) with something called
CHECKLOCKTIMEVERIFY or
CLTV. The beauty of this is that the timelock is enforced by the Bitcoin network itself, every single node validates it, there is no way to bypass it, the only way to spend funds early would require a hard fork or 51% attack which is not gonna happen lets be real.
The script descriptor looks like this:
tr(NUMS_POINT, and_v(v:pk(YOUR_KEY), after(LOCKTIME)))That NUMS_POINT thing is important - it's a special key that nobody knows the private key for, it's mathematically proven to be unspendable. This forces all spending through the script path where timelock is checked. You cannot accidentally bypass the lock.
When you try to spend before the locktime the network will reject your transaction with "non-final" error, it does not matter what wallet you use or what software, the network simply will not accept it.
The whole codebase uses embit Python library which is widely used as backend for cold wallets, so a lot of critical parts are not written by AI but imported from battle-tested library. For the web interface I used tapscript and noble-secp256k1 libraries.
Testing:I have set up local Bitcoin regtest network with Docker to test everything properly. Created locked address, sent some bitcoin there, tried to spend before locktime - got rejected as expected. Then mined enough blocks to pass the locktime and successfully spent the funds. The whole flow works.
It works on mainnet for me and I have tested it but here is my honest disclaimer -
I am not recommending you to freeze your money with this script without validating everything yourself because significant parts were written by AI and I am not following everything there line by line. Do your own research, verify the code, maybe run it on testnet first for few months.
What you can do with it:- Lock bitcoin until specific block height (you can calculate approximate date)
- Create gift addresses for children or friends that unlock in 10-20 years
- Force yourself to HODL and not sell during the dips
- Inheritance planning with time-based access
My main goal here is to maybe inspire someone to lock their funds and truly hold for decades. Not financial advice, just sharing what I built and how. The code is there if you want to learn how Bitcoin scripts work or build something similar yourself.
URL to UI so you can play around in test net: grommash9.github.io/python_lock_btc/
URL to the repo itself:
https://github.com/Grommash9/python_lock_btcSometimes testnet4 producing wrong error message when you try to spend early, but I think it's just missconfiguration
Stay safe and HODL responsibly.