Does Bitcoin Have Smart Contracts?

The Bitcoin network supports a broad range of smart contracts. They include:

Pay-to-Public-Key-Hash (P2PKH)
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
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.

Pay-to-Script-Hash (P2SH)
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.