Does Bitcoin Have Smart Contracts?
It is a common misconception that Bitcoin does not have smart contracts. Unbeknownst to many, smart contracts on the Bitcoin network are possible. The difference between Bitcoin and other blockchain networks marketed as smart contract platforms is that Bitcoin’s smart contracts take a more rudimentary form — yet they are still powerful. That’s because Bitcoin’s programming language, called Script, is not Turing-complete, while the programming languages used by Ethereum, Solana, and other smart contract platforms are Turing-complete.
A machine or programming language that is Turing-complete can “replicate a Turing Machine by running any program or solving any problem the Turing Machine could run or solve.” Computer scientist Alan Turing — we can call him the founder behind Turing-completeness — suggested in the 1930s that one day a machine capable of solving any problem would exist. This machine was named the Turing Machine and is today present in any computer as we know them.
Since Bitcoin’s programming language is Turing-incomplete, it’s programmable only to a limited degree. This keeps the Bitcoin network secure while minimizing possible sources of error. On the flip side, Bitcoin’s Turing-incompleteness makes it less flexible and less expressive. However, a less programmable blockchain can keep unwanted programming errors as low as possible. Therefore, Bitcoin trades off flexible programmability for robust security.
What Is a Bitcoin Smart Contract?
A Bitcoin smart contract is just like any other smart contract. It is a code that automatically executes when certain predefined conditions or criteria are met. Smart contracts can have single or multiple criteria.
The Script programming language is simple but powerful. It allows Bitcoin users to set conditions for the spending of their BTC. Bitcoin transactions can lock a specific amount of Bitcoin to a script and this amount can only be unlocked for spending when predefined criteria are met. Therefore, in a sense, all Bitcoin transactions are smart contracts.
The spending condition is known as locking script or scriptPubKey. On the other hand, the data and script that fulfills the criteria are called ScriptSig or ScriptWitness when using SegWit — a Bitcoin upgrade executed in August 2017.
Understand the Future of Everything
Join the Crypto Revolution
Start Your Free Membership Now
100% Free. Yep, You Heard Us
Different Types of Bitcoin Smart Contracts
The Bitcoin network supports a broad range of smart contracts. They include:
P2PKH script is one of the simplest Bitcoin smart contracts. It permits someone to send BTC to a Bitcoin address in a way that only the owner of the private key corresponding to the public key hash can spend the Bitcoin.
Multi-signature scripts are more complex than P2PKHs because they require multiple signatures instead of one. That means the Bitcoin used for a transaction can only be spent when the required number of signatures is provided — that is why it is called multi-signature. For instance, 2-of-3 is a common multi-sig setup that enables three parties with three public keys to hold BTC as a group. It requires two signatures for Bitcoin to be spent.
Time-Locked Bitcoin Transactions
Time-locked Bitcoin transactions are valid after a specified duration. Moreover, they can be used to alter the spending requirements of BTC. For example, a script may demand three signatures to spend BTC before a given time. After this duration, only one signature is needed. A type of such transaction is also used in Bitcoin’s Lightning Network.
The P2SH standard helps Bitcoin users send BTC to the hash of any script. This reduces the cost of sending Bitcoin to a complex smart contract while maintaining privacy. Thanks to the SegWit upgrade, the P2SH standard now includes Pay-to-Witness-Script-Hash (P2WSH).
Bitcoin Smart Contracts on Layer 2 Platforms
Bitcoin can also power smart contracts on protocols such as the Lightning Network (LN), which are built on top of the Bitcoin network. LN depends on multi-signature transactions known as Hashed Time-Locked Contracts (HTLCs) to allow low-cost and instant Bitcoin micropayments. HTLCs ensure that those who assist in the routing of payments between different parties are paid a small fee but cannot access any of the Bitcoin. Other Bitcoin layers like the Liquid Network or RSK rely on Bitcoin’s smart contract functionality to deliver more use cases.
The Evolution of Bitcoin Smart Contracts
Bitcoin smart contracts have evolved over time thanks to different upgrades the network has implemented. The most recent soft fork upgrade, Taproot, occurred in November 2021, giving users more flexibility when building complex smart contracts on Bitcoin’s blockchain. This increases Bitcoin’s payment function, but it doesn’t mean Bitcoin smart contracts can support decentralized applications (dApps) as we know them from blockchains like Ethereum, Solana, or BnB Chain.
“To be clear, Taproot will not enable the same fully expressive and recursive smart contracts that exist in alternative blockchain systems (Ethereum, Solana, etc.) […]. […] with Taproot, the programmability of Bitcoin transactions will increase to a higher level than what was previously possible,” as laid out in this report.
Taproot introduced a new script known as Pay-to-Taproot (P2TR), which merges the functionalities of P2PKH and P2SH. Due to the addition of Schnorr key aggregation, the Bitcoin public key used can itself be an aggregate key, thereby potentially representing a multisig setup. The Taproot upgrade also increased efficiency and privacy for Lightning channels — types of smart contracts that allow parties to transact with each other.
Although Bitcoin may never achieve fully expressive smart contracts on its base layer, it could attain this goal on other networks. For example, Stacks is an open-source Layer 1 blockchain that connects to the Bitcoin network, allowing users to build smart contracts and dApps. It connects to Bitcoin through the proof-of-transfer (PoX) consensus mechanism where Stacks miners pay Bitcoin to mint new Stacks coins (STX). Stacks leverages Bitcoin’s security and brings smart contracts to the Bitcoin network. The smart contracts are created using a programming language known as Clarity.
As we have seen, Bitcoin’s programmability trade-off is not a bad thing, and its smart contract functionality can be expanded on Layer 2 networks or separate blockchains connected to the Bitcoin network. Also, Bitcoin’s security has proved to be highly effective compared to other blockchains, a factor that may encourage more projects to leverage Bitcoin’s security while delivering fully expressive smart contracts on top of Bitcoin’s base layer chain.
It’s incredibly important that people understand what’s happening, the speed at which we’re moving, and where this could go.
We call it The Exponential Age and Real Vision is your guide to the future as it unfolds. That’s why you need to drop everything, sign up and watch the interview.
It’s that important.
Afterward, drop us a line at email@example.com and let us know where you are on Raoul’s Terror/Excitement Index.