Bitcoin Masterclasses #4: Thinking long-term with nLocktime and time-based contracts
What is the longest contract you can think of? Can you enter into an agreement that was not completed for decades (or longer), with many potential changing conditions, and still be confident that it will be completed in the future? Dr. Craig Wright explores some of these ideas in Season 4 of The Bitcoin Masterclasses in London, using a very interesting feature in Bitcoin known as nLocktime.
The first session is titled “Securely Create Time-Locked Transaction Paths.” The recording of The Bitcoin Masterclasses #4 Day One is available here, and all other The Bitcoin Masterclasses sessions are available on the CoinGeek YouTube channel.
Dr. Wright kicks things off by describing the differences between nLocktime transactions (part of Satoshi Nakamoto’s original Bitcoin protocol) and “CLTV” (CheckLockTimeVerify), which was added to the BTC protocol a few years later.
With nLocktime, a transaction you create will not be accepted by nodes – and therefore will not exist anywhere on the blockchain – until the specified time. With CLTV, the transaction is processed on-chain once it is created, but its UTXOs are blocked until the specified time elapses.
So what’s the difference? It’s visibility, for one. Flexibility is another. As Dr. Wright points out, a CLTV transaction cannot be undone. If we’re talking about payments that will be sent months or years into the future, you need the flexibility to change your mind. “Contracts can be renegotiated,” he says, but it may also be necessary to make a transaction where the exact full amount has not yet been finalized or may depend on a future event.
For the record, CLTV was created by developer Peter Todd in 2014 and implemented in BTC Core via the BIP-65 soft fork. The GitHub explainer explains that a CLTV transaction can technically be canceled if the initiator consumes the output before it commits.
Dr. Wright also gives a reminder that immutable protocols are superior if you create a locked transaction that you want to perform at some point in the future (eg: leave some bitcoins to your children or grandchildren). It would be best if you had peace of mind that the protocol would still work the same way.
“The key here is to not think about all the big bad things and try to make a perfect system. The perfect is the enemy of the good. And that’s one reason why BTC will never ever be good – it’s because they will never end up accepting well. When you start messing around, and you go back and forth over and over, saying, “I’m going to polish this,” something else will break. Then something else. And over time they’ll continue to break,” explains Dr. Wright.
Most of the examples in the first tutorial are based on business and financial contracts. There are other reasons why you might want to create a time-locked transaction, but without broadcasting the transfer of funds or making public any details of the transaction. Perhaps Satoshi Nakamoto was the first to consider some of these.
But back to contracts. With nLocktime, you can use Script to create conditions in a contract that must be met in order for the payment to finally be sent. The conditions themselves can be changed or added to.
“This is why we want off-chain options.” These are particularly uncertain times, but even in more predictable eras, there are still black swans and “unknown unknowns” lurking everywhere, waiting for conditions to change.
Dr. Wright draws a “conditional tree” diagram that branches in many directions, suggesting that an nLocktime contract can be incredibly complex. Parts of these can be automated or set up to accommodate changes automatically, and more.
“What we have to start thinking about is: how do we actually structure machines that aren’t going to completely automate this because we’re not looking at ‘code is law,’ we’re looking at how to simplify the lives of actual people,” he says.
This first session presented the what and why of nLocktime and time-locked transactions on Bitcoin. Subsequent sessions in this series will look more deeply at other possibilities and the technical how-tos. Stay tuned for more.
See: Bitcoin Masterclasses in Zurich on Benford Transactions
New to Bitcoin? Check out CoinGeeks Bitcoin for beginners section, the ultimate resource guide for learning more about Bitcoin – originally envisioned by Satoshi Nakamoto – and blockchain.