The Bitcoin Masterclasses #4: Thinking long-term with nLocktime and time-based contracts
What’s the longest-term contract you can think of? Could you enter into a deal that didn’t complete for decades (or longer), with many potential changing conditions, and still know for sure it’ll be finalized 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 “Creating Time-Locked Transaction Paths Securely.” 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), something added to the BTC protocol a few years later.
With nLocktime, a transaction you create won’t be accepted by nodes—and therefore won’t exist anywhere on the blockchain—until the specified time. With CLTV, the transaction processes on-chain when it’s created, but its UTXOs are blocked until the specified time passes.
So what’s the difference? There’s visibility, for one. Flexibility is another. As Dr. Wright points out, a CLTV transaction can’t be undone. If we’re talking about payments to be sent months or years into the future, you need the flexibility to change your mind. “Contracts can be renegotiated,” he says, but it might also be necessary to make a transaction where the exact full amount isn’t finalized yet or could depend on some 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 explanation explains that a CLTV transaction could technically be canceled if the initiator spends the outputs before it executes.
Dr. Wright also gives a reminder that unchanging protocols are superior if you create a locked transaction that you wish to execute at some distant future point (e.g.: leaving some bitcoins for 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 not to think about all the big bad things and trying to make a perfect system. The perfect is the enemy of the good. And there’s a reason why BTC will never ever be good – it’s because they will never end up accepting good. When you start mucking around, and you go back and forwards again and again, going, ‘I’m going to tweak this,’ something else will break. Then something else. And over time, they will keep breaking,” Dr. Wright explains.
Most examples in the first tutorial are based on business and financial contracts. There are other reasons you might want to create a time-locked transaction, but without broadcasting the transfer of funds or making any details of that transaction public. 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 for the payment to finally be sent. Conditions themselves can be changed or added.
“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 to alter conditions.
Dr. Wright draws a “conditional tree” diagram that branches out in many directions, suggesting an nLocktime contract could 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 we actually structure machines that are not going to completely automate this because we’re not looking at ‘code is law,’ we’re looking at how we simplify the lives of actual people,” he states.
This first session presented the whats and whys of nLocktime and time-locked transactions on Bitcoin. Subsequent sessions in this series will look deeper into other possibilities and the technical hows. Stay tuned for more.
Watch: The Bitcoin Masterclasses in Zurich on Benford transactions
New to Bitcoin? Check out CoinGeek’s Bitcoin for Beginners section, the ultimate resource guide to learn more about Bitcoin—as originally envisioned by Satoshi Nakamoto—and blockchain.