Trust Machines Logo
Contact
Infrastructure

Actually, Bitcoin Has Smart Contracts, Too!

Smart contracts have been at a center of helping blockchains scale. But how do they work on Bitcoin? We use the Stacks layer as an example of what smart contracts can achieve for Bitcoin.
Written by undefined @
Read Time 8 min
Smart Contracts Depicted in 3d Space on a Blockchain
Table of Contents
Share This Article

It’s 2023 and despite the strides that have been made in Bitcoin’s development (including the launch of Ordinals), many still disregard Bitcoin in many Web3 conversations.

In fact, these early years of Bitcoin and crypto can be likened to the beginning of that old story, “The Tortoise and the Hare” - Bitcoin being the slow and steady tortoise and the rest of the crypto space being the fast and confident hare.

Smart contracts have become a staple in this ever-evolving crypto space as people explore the possibilities of this new blockchain technology. Bitcoin blockchain smart contracts, however, are often left out of these discussions, mainly due to the Bitcoin blockchain’s known design limitations.

While Bitcoin was the first blockchain ever created, its initial design was focused on being a censorship-resistant, peer-to-peer electronic cash system, emphasizing security and decentralization. As newer crypto competitors, like Ethereum and Solana, rose in popularity and began implementing new web3 functionality, many users and developers turned away from Bitcoin.

Luckily, in recent years, Bitcoin’s ecosystem has grown to include newer solutions that are closing this gap in scalability and functionality, while maintaining its core design’s integrity.

Let’s take a look at how Bitcoin found smart contracts and got its groove back.

What was 'wrong' with Bitcoin?

Bitcoin was made with one primary goal in mind: creating a truly decentralized currency. With this goal, Satoshi Nakamoto, Bitcoin’s creator, got to work fleshing out a new type of digital system to fit this mold.

Satoshi designed Bitcoin with a limited scripting language. While this did hinder its ability to be effectively used for more complex processes, it increased the network’s security by decreasing the possibility of attack or exploitation by bad actors.

And this was more than enough to achieve Satoshi’s goal. Thus, the world’s first blockchain network was created.

As time passed and the technology continued growing and evolving, newer projects were introduced that expanded on the core concepts introduced by Bitcoin. Projects like Ethereum, built with more complex languages, now had the flexibility to expand on Bitcoin’s core use cases and introduced new decentralized applications (dApps) and experiences to the world of decentralized networks.

So with the explosion of this new functionality in crypto, these newer networks offered things that Bitcoin couldn’t - things like DeFi, NFTs and smart contracts. Seeing these new possibilities offered by the competition, users and developers flocked to them, relegating Bitcoin to simply a good money system that doesn’t do much else.

So, what's a smart contract?

Putting it simply, a smart contract is a digital agreement built into a blockchain. Smart contracts allow a blockchain-based program to autonomously execute commands whenever a predefined action or event occurs.

Smart contracts are also written into the code itself, eliminating the need for any third-party/central authority involvement in its implementation. Once this code is launched on the blockchain, the contract’s terms are permanently stored there, eliminating any possibility of altering or tampering with them.

With networks like Ethereum’s, smart contract development was already possible because it was built to facilitate such complex functions. Through these functions, users were able to explore new ways to use blockchains, leading to the creation of new market demand in this new era of blockchain smart contracts.

Bridging the Bitcoin gap

“Why not just upgrade or change Bitcoin itself?”

It’s absolutely possible to do this, but that would mean changing the core design that gives Bitcoin its incomparable security and decentralization. And with a consensus being needed to implement any of these proposed changes, getting the majority of the network’s support for a drastic shift from Bitcoin’s core values is highly difficult.

For that reason, Bitcoin core development is generally perceived to be “slower” than the development you see with many other chains.

This didn’t eliminate hope for smart contract functionality for Bitcoin, though. An alternative solution was proposed: build another blockchain that works in tandem with Bitcoin.

Enter Stacks.

Stacks was created to serve as Bitcoin’s smart contract layer. While other Bitcoin solutions, like Lightning Network, were built as a second layer on top of the Bitcoin network itself, Stacks is intertwined with Bitcoin through its Proof of Transfer consensus mechanism (PoX) which allows every Stacks transaction to settle on Bitcoin’s base layer.

Source: Stacks

PoX builds off of the Proof of Work (PoW) consensus that we see with Bitcoin. With PoW, consensus is reached on the blockchain when miners, in a race to be first, consume electricity/energy to solve complex computational problems, thus mining a new BTC block. Scaling this consensus model proved to be rather inefficient, though, as an increase in energy consumption was needed.

PoX takes an alternate, more sustainable route to scaling, having miners bid on a chance to mine the next Stacks block. These bids are placed by sending bitcoin to contract addresses, with higher amounts of bitcoin increasing the chances of winning the bid. The randomly selected winner of this bid then mines the new Stacks block, receiving newly minted STX tokens as their reward. With Bitcoin as the anchor chain for this process, that batch of transactions is settled on Bitcoin’s base layer.

With PoX, Stacks is able to leverage the security of Bitcoin’s network while giving developers the freedom to build new dApps and experiences for Bitcoin through smart contracts.

Alongside this PoX consensus, Stacks was designed with:

  • Its own native gas token (STX) that facilitates safe and efficient transactions on the blockchain
  • A decidable programming language (Clarity) that allows devs to create transparent and secure smart contracts on Stacks with the ability read and react to Bitcoin transactions.

And the best part of it all: Bitcoin’s core design isn’t altered in any way. With all of the added functionality stemming from the Stacks blockchain itself, Bitcoin’s blockchain can maintain its consistent focus on security and decentralization.

Bitcoin smart contracts in the wild

With the new possibility of building smart contracts for Bitcoin’s growing ecosystem, developers wasted no time getting to work on the solutions that they’ve always wanted to see in Bitcoin.

Many solutions are already making a name for themselves in the Bitcoin community for the new services that they offer to the ecosystem - solutions like:

  • Hiro Wallet: A secure wallet designed for STX token management, dApp logins, and user asset protection.
  • Gamma: An NFT marketplace that facilitates the trading and sharing of Stacks-native NFTs.
  • Arkadiko: A platform that offers self-repaying, collateralized loans on Stacks.

Where will Bitcoin smart contracts lead?

At its core, Bitcoin is open-source, digital money with amazing security. The addition of Bitcoin-based projects surrounding this base layer, though, is changing Bitcoin’s ecosystem to an interconnected web of smart contracts and dApps, backed by the immutability of the most secure blockchain in the space. 

As it currently stands, Bitcoin’s network has over a $400 billion valuation, with the majority of users primarily either hodling or trading their bitcoin. Of that total valuation, only about $500 million is actively invested in external Bitcoin ecosystem applications like smart contracts. With Stacks’ added programmability, so much more of that latent capital can be tapped into by developers, users and investors alike. 

Not to mention, there is also the added cost efficiency to running Bitcoin smart contracts, as the fees typically associated with these are drastically lower than what we typically see with other chains like Ethereum, where fees are known to frequently skyrocket based on network demand.

This combination of untapped capital, unrivaled security and cost-efficient processes has the potential to draw a significantly larger chunk of the crypto market back into Bitcoin’s ecosystem. Builders and investors would be hard-pressed to find a better foundation than Bitcoin to launch their Web3 solutions.

Bitcoin has already forever changed the world of finance, and with the added functionality of smart contracts with Stacks, Bitcoin can extend its influence, claiming even more market share and pushing the crypto space even further ahead than it already has.

The future will be Bitcoin. After all, we all know how “The Tortoise and The Hare” ends.

Builder Tracking Pixel