Bitcoin Layer 2s are networks built on top of the Bitcoin chain that address Bitcoin’s scalability shortcomings like slow transaction speeds. Stacks is one of the most prominent Bitcoin L2s that helps developers to build new use cases on Bitcoin with smart contract functionalities.
The recent Stacks updates like the Nakamoto upgrade have further improved the network with much faster transaction confirmation times.
What Are Bitcoin L2s?
Bitcoin L2s are protocols that act as a secondary layer on top of the Bitcoin blockchain. The primary function of Bitcoin L2s is to take transactions off Bitcoin Layer 1, process, and settle them on the L1.
The idea behind Bitcoin L2s is to facilitate multiple transactions without the L1 processing all of them. The L1 only records one transaction that bundles several transactions on the L2, thereby increasing speed and enhancing scalability.
Why Are Bitcoin L2s Needed?
Since the beginning, Bitcoin has had several problems like slow transaction speeds, higher fees, and limited use cases. The rise of Bitcoin L2s have tried to solve these challenges and make Bitcoin more efficient and scalable in the following ways.
Faster Bitcoin transactions: L2s bundle transactions and settle them on the Bitcoin chain.
Lower transaction fees: L2s reduce congestion on the Bitcoin network and therefore reduce fees.
Diverse use cases: L2 developers can build protocols with multiple use cases like Bitcoin DeFi and NFT marketplaces.
L2 projects like Stacks are expanding the Bitcoin landscape by introducing new functionalities to Bitcoin.
What is Stacks?
Stacks is an open-source L2 blockchain that enables smart contract programmability on Bitcoin. The Stacks network has its own STX token, uses the Clarity programming language, and a unique consensus mechanism for transaction confirmations.
Clarity: a smart contract language
Developers write Stacks smart contracts in the Clarity coding language. Clarity-based smart contracts expands Bitcoin’s functionalities and can read Bitcoin state, making it compatible for all Bitcoin-based transactions.
Additionally, Clarity uses a preview function to minimize the number of bugs and other issues found within a smart contract. This gives developers a chance to test a code before launching a smart contract.
What is Proof-of-Transfer?
Stacks uses a Proof-of-Transfer (PoX) consensus mechanism, which is an extension of the Proof-of-Work and Proof-of-Burn models. In Proof-of-Transfer, miners transfer a portion of their cryptocurrency to other network participants.
The Stacks PoX mechanism consists of miners and Stackers. PoX uses Stacks’ native STX token and the layer1 Bitcoin’s BTC for running its operations.
The Stackers lock STX tokens in a process known as Stacking to participate in the Proof-of-Transfer mechanism and earn BTC rewards. Miners transfer BTC to Stackers to win block rewards as well as transaction fees.
Proof-of-Transfer is a sustainable and energy-efficient consensus procedure that recycles Bitcoin’s PoW energy. So Stacks miners spend the already mined BTC and send them to Stackers instead of burning them to earn rewards and validate transactions.
Stacking on Stacks
Stacks’ PoX participants, miners and Stackers, have respective roles during the consensus process.
The Stackers lock their STX through Stacking for one or more cycles of block production. Stackers can unlock the STX when the number of cycles they committed ends.
In PoX, Stackers can either lock their STX holdings independently or collectively with other Stackers. It depends on how much STX a Stacker will stack. There is a dynamic minimum quantity of STX tokens that Stackers must lock to participate in the procedure.
Moreover, Stackers must provide a BTC address to receive their rewards from miners which are proportional to the amount of STX they stacked.
The miners transfer BTC to Stackers to get a chance for Stacks block production in return for block rewards and transaction fees. A random function selects the winning miner and chances of winning is directly proportional to the amount of BTC transferred to Stackers.
The winning miner creates new blocks and receives newly minted STX tokens as block rewards
Where to Buy STX Tokens
You can buy STX tokens at multiple exchanges and buy it using various cryptocurrencies.
According to the STX webpage, some of the most popular exchanges for buying STX are Okcoin, Coinbase, Kraken, Blockchain.com, Binance, KuCoin, Coinlist, Upbit, Crypto.com, MoonPay, WazirX, OKX, Transak, Gate.io, Digifinex, and Wert.
You can find a more detailed list of exchanges and STX trading pairs on Coingecko.
Use Cases for Stacks
Stacks has the following use cases for Bitcoin-based assets:
Bitcoin DeFi: Stacks’ Clarity-based smart contracts and immediate transaction confirmations have empowered developers to build a vibrant Bitcoin DeFi ecosystem for trading and swapping assets.
Bitcoin NFTs and Ordinals: Stacks facilitates a growing Bitcoin NFT and Ordinals ecosystem as the L2 provides faster transaction settlements for NFT marketplaces and asset transfers.
What’s Being Built On Stacks?
Developers have built several projects within the Stacks DeFi ecosystem like ALEX, Asigna, LNSwap, Zest, and Arkadiko. These projects enable diverse services from asset swapping to trading, opening new avenues for the future of Bitcoin DeFi.
Marketplaces like Gamma.io have also cemented Stacks as a popular L2 for transacting with Bitcoin-based NFTs and Ordinals.
What is Stacks 2.1?
Stacks developers have been constantly working to improve the Stacks ecosystem. To this end, they launched Stacks 2.1 in 2023.
The Stacks 2.1 update brought the following improvements to Stacks:
PoX contract expiration date was removed.
Allowed continuous Stacking so that Stackers can stack any amount for their chosen timeframe.
Added Stacking and mining support for Native SegWit and Taproot addresses.
Clarity was upgraded so that developers could easily write improved Clarity-based smart contracts.
Enabled better bridges, oracles, and other services that send data to the Stacks chain.
Lowered entry barriers for Stacks mining.
Stacks miners can pay block rewards to any address of their choice including a cold wallet address or a contract address.
Directly send Stacks assets to Bitcoin addresses.
Stacks’ Future on Bitcoin L2
Another big change on Stacks is the Nakamoto upgrade and the upcoming launch of sBTC. Both have been in development since 2022, but reached key milestones in 2024.
Nakamoto Upgrade
The Nakamoto upgrade was released on testnet on March 25. Nakamoto followed two phases:
An instantiation phase began on April 15
Mainnet activated on October 29
The Nakamoto upgrade introduced the following changes to Stacks:
Faster block times
In pre-Nakamoto Stacks, the block production rate was tied to Bitcoin in a 1:1 ratio. The Nakamoto upgrade decouples Stacks and Bitcoin’s block production through a tenure-based system.
Each Bitcoin block begins a new tenure where a cryptography-based selection process chooses a new miner to validate transactions. In post-Nakamoto Stacks, a miner can mine several Stacks blocks within the tenure instead of just one block.
This upgrade will reduce transaction times and ensure faster block confirmation.
100% Bitcoin finality
The Nakamoto upgrade will ensure 100% Bitcoin finality or complete transaction confirmation which means on-chain transaction data becomes irreversible.
The post-Nakamoto Stacks will write transaction data to the Bitcoin blockchain using an indexed block hash. The indexed block hash is the first block hash or a unique digital identifier that a previous Stacks miner mined during their tenure.
Miners add the indexed block hash to the Bitcoin chain when writing transaction data to resolve minor connectivity issues and prevent forking.
Improvements to Stacking and mining
Stackers
In post-Nakamoto Stacks, the Stackers are more involved in the mining process. Stackers validate, store, sign, and propagate each miner-produced Stacks block.
The Stackers are responsible for changing the miner’s tenure. Thus, Stackers agree on the last-signed block from the current miner.
As Stackers only sign a miner’s block that descends from the last-signed block, Stackers prevents miners from mining forks. Further, it ensures miners begin their tenures by building a block from the chain tip to prevent forking.
Miners
After the Nakamoto upgrade, miners decide a block’s contents and Stackers decide if they want to include the block in the chain.
Moreover, miners have to spend sufficient BTC for validating blocks which ensures miners cannot censor Stacks transactions.
Miners create blocks every five seconds and send them to Stackers for validation. If 70% Stackers reach an agreement, they add the block to the network, enhancing scalability.
sBTC
sBTC is a non-custodial and programmable 1:1 Bitcoin-backed asset that facilitates trustless movement of BTC in and out of Layer2 networks. According to a Stacks Foundation blog, sBTC will go live by the end of 2024.
The launch of sBTC will unlock Bitcoin as a productive asset for various decentralized applications. sBTC’s decentralized nature will empower users to swap assets without intermediaries and build secure methods to lend and borrow BTC.