Smart contracts were made famous by the Ethereum (ETH) network, which has Turing-complete smart contracts that can be used to make decentralized products and services. This made them more popular. That isn’t what most people know about, though. Bitcoin has smart contracts, too, but not everyone knows about it (BTC).
Check out the rest of this page to learn more about Bitcoin smart contracts and the projects that are trying to make smart contracts work on top of Bitcoin itself.
What can you do with Script?
A smart contract is a written agreement between two or more people that is automatically carried out when certain conditions are met.
It can say that when an agreed-upon task is done, a Bitcoin payment should be sent to the person who did it.
The Bitcoin network can run different types of smart contracts through Script, the scripting language that it uses.
With Script, users can set different rules for how their BTC is used. This isn’t the only thing that scripts can do. They can also lock certain amounts of BTC to specific bitcoin transactions, which means that users must meet certain standards before they can spend the BTC locked to that script.
Examples of smart contracts made with Bitcoin
It has been used in the Bitcoin protocol for more than a decade, and it has proven to be a useful scripting language for a wide range of smart contracts, from simple P2PKH transactions to more complex ones like multi-signature scripts, pay-to-script-hash (P2SH), and transactions that are time-locked.
There are many types of scripts used by Bitcoin. Let’s look at some of the most common.
PAID-TO-USE PUBLIC KEY HASH (P2PKH)
A P2PKH is a simple and popular script that lets people send BTC to a bitcoin address. It’s very easy to use and very popular. Bitcoin transactions are made in the most simple way possible.
Transactions that can’t be done at the same time as other transactions
A time-locked bitcoin transaction is a type of smart contract that doesn’t let people spend bitcoin until a certain time has passed. There are a lot of Bitcoin smart contracts that use time locks, and they are a lot of fun.
For example, a time-locked script can say that three signatures are needed to spend a certain amount of bitcoin before a certain time. After that time, only one signature will be needed. Time-locked transactions are great because they keep money from being lost.
A script that needs more than one person to sign.
If you want to run a P2PKH script, you only need one signature. But if you want to run a multi-signature or multisig script, you can get signatures from several people. There is an order to how multi-signature scripts work. In the script, N public keys are registered, and a number M must be written in order to unlock the funds.
Because this type of script locks a certain amount of bitcoin, it can’t be spent until M signatures are made and each of them must match one of the N public keys. This type of multi-signature is called M-of-N multi-signature. When N is used, it refers to the total number of public keys that are on the list. N is the number of signatures that must be on the transaction to be valid.
Pay to write hash (P2SH)
The Pay-to-Script Hash (P2SH) standard is said to have made it easier to write complex scripts. The P2SH script doesn’t work on its own. There is instead the P2WSH script, which came about after SegWit was added. The two scripts work together so that bitcoin can be sent to the hash of any script.
Bitcoin smart contracts: What can be done on top of bitcoin?
In order to make smart contracts for Bitcoin-powered apps more complex, Bitcoin developers have worked on new layers on top of the Bitcoin blockchain. This is because Bitcoin’s scripting language doesn’t allow for very complex smart contracts.
Rootstock, Liquid, Stacks, Lightning, and RBG are some of the most well-known layers for smart contracts built on top of the Bitcoin blockchain. Take a quick look at the five projects.
Rootstock (RSK) is a smart contract platform that has a virtual machine that can connect to the Bitcoin blockchain.
Nick Szabo, a computer scientist, came up with the idea of “Turing-complete smart contracts” in 1993. RSK makes them possible. If you want to make decentralized apps that are safe on the Bitcoin network, you don’t have to write them in Bitcoin’s scripting language. This is because RSK is a sidechain of the Bitcoin network.
Bitcoin DeFi apps are already running on RSK, thanks to RSK Smart Bitcoin (rBTC). To make rBTC, you send BTC to a multisig address, which is managed by the RSK PowPeg. Then, the PowPeg sends rBTC to the address (2-way peg protocol).
The Liquid Network
It was started by Blockstream, a big company that makes blockchain technology. Even though it has only been used a little since it was started, it has been able to meet the needs of brokers, exchanges, financial institutions, and market makers.
As a Bitcoin sidechain, the Liquid Network is meant for businesses and not everyone who wants to use Bitcoin. As a form of money, the Liquid Network also uses Liquid Bitcoin (L-BTC).
For example, it is used as a smart contract layer for Bitcoin. It allows users to give assets in the form of tokens like stablecoins to other people. Bitcoin NFTs can also be made on the Liquid Network.
There is a Layer 1 chain called Stacks. It is linked to Bitcoin by the consensus mechanism called proof of transfer, which is used to make sure that everyone agrees (PoX). There are smart contracts that can be made in Bitcoin with the help of Bitcoin’s economic power and security and stability.
Because the Bitcoin layer is always the last layer in apps built on Stacks because it is linked to the Bitcoin blockchain, the Bitcoin layer is always the last layer. The smart contract is built on the Stacks chain, though.
A layer called Stacks is like other layers in that it addresses the utility and scalability issues of the Bitcoin network. At the same time, it wants to build a decentralized digital economy that is secured by Bitcoin.
As far back as 2015, Joseph Poon and Thaddeus Dryja came up with the idea for the Lightning Network (LN). You can think of it as a second layer of technology. It uses payment channels to help the Bitcoin network be able to do transactions quickly and efficiently.
Using smart contracts called hashed time-locked contracts (HTLCs), the Lightning Network can move bitcoins at lightning speed with almost no fees.
When the Lightning Network was built, it was meant to help move transactions away from the main blockchain network (off-chain). This would help lower transaction fees and clear up the Bitcoin blockchain.
RGB is a group of protocols that make it possible to make smart contracts for Bitcoin and the Lightning Network. On the other hand, it’s client-side, and its smart contracts system runs on layers two and three of the Bitcoin system.
RGB, unlike other Bitcoin smart contracts, doesn’t need to make a token. Instead, it helps keep the smart contract issuer, the state evolution, and the state owners separate from each other. A smart contract system called RGB uses the blockchain to make sure things stay the same and the Bitcoin script to keep track of who owns what. Its smart contract changes based on off-chain schema.
While there aren’t as many decentralized apps in the Bitcoin ecosystem as there are in smart contract chains like Ethereum, a growing number of Bitcoin developers are working hard to build a decentralized economy on top of the most secure blockchain in the world.