What are Stacks? What challenges might the BTC Layer 2 network Stacks face?

What are Stacks? What challenges might they face on the BTC Layer 2 network?

Author: @EatonAshton2, Beosin Security Researcher.

Since the launch of the Ordinals protocol in February 2023, the frenzy of BTC NFT minting and BRC20 token has led to high activity on the BTC network. This has resulted in a surge in BTC network fees and congestion. Additionally, the lack of smart contract capabilities on the BTC network has limited the development of more complex ecological businesses. The market has begun to focus on BTC layer 2 networks and applications in hopes of capturing the benefits of BTC ecological growth.

In this article, we will interpret Stacks, a BTC layer 2 network. We will discuss its architecture design, ecological components, and challenges it faces.

What is Stacks?

Stacks was created by Muneeb Ali based on his doctoral thesis, which carefully describes an internet framework built around BTC. The project was originally called Blockstack and was officially renamed Stacks in 2020. It defines itself as the smart contract layer of BTC.

Architecture Design:

Stacks executes smart contracts written in Clarity on its own blockchain and finalizes transactions on BTC. The two chains interact through the Proof of Transfer mechanism (details in the consensus mechanism introduction), thereby utilizing the security of the BTC network to ensure transaction security.

Source: Beosin

Since Stacks’ transaction data needs to be confirmed by the BTC network, and the BTC network produces a new block approximately every 10 minutes, how does Stacks scale and speed up?

First, Stacks has designed a special mechanism that allows multiple small blocks called microblock streams to be generated on the Stacks chain, allowing miners responsible for confirming the current Stacks block to fully utilize the time interval between the production of two blocks on the BTC network and process more transactions. When Bitcoin confirms the current block, these microblocks will also be finally confirmed, and the next Stacks block will be linked to the last microblock. As shown in the figure below:

Source: Dystopia Labs, Beosin

Mechanism Detail: https://github.com/stacksgov/sips/blob/main/sips/sip-001/sip-001-burn-election.md#operation-as-a-leader

Stacks sets the miners confirming the microblocks to receive 60% of the microblock fees, and the nodes generating these microblocks to receive 40% of the fees, in order to encourage miners to package microblocks and avoid their abuse.

Stacks has launched Hiro HyperChains, which can be understood as Stacks’ Layer2, providing developers with a high-performance blockchain development platform to meet low-latency, high-TPS application scenarios. Of course, other types of subnets will also be able to be built on Stacks to meet various needs. These subnets will first confirm transactions on the Stacks network and then confirm the final state on the BTC network.

Consensus mechanism: Proof of Transfer (PoX)

Stacks uses a consensus mechanism called Proof of Transfer (PoX). PoX is a consensus algorithm between two blockchains and can be thought of as Proof of Work + Proof of Burn. Like PoW, PoX requires miners to spend existing resources (BTC) to compete for the opportunity to cast the next Stacks block; similar to PoB, PoX requires miners to “burn” BTC to obtain STX token rewards.

One characteristic of PoX is that the BTC spent by miners will not be destroyed but instead will be transferred to STX token holders who have locked STX tokens. This is called Stacking. Through the PoX mechanism, miners spend BTC to compete for the right to generate Stacks blocks, and they receive STX token rewards and transaction fees for the block; STX holders receive BTC rewards by locking STX tokens, with an APY of approximately 9% currently.

Source: https://docs.stacks.co/docs/stacks-academy/proof-of-transfer

The Stacks network will use a verifiable random function (VRF) to randomly select block producers (the more BTC spent, the greater the probability of being selected). Once miners obtain the right to generate Stacks blocks, they begin to package new Stacks blocks. Each Stacks block contains a hash pointer to the previous Stacks block and a hash pointer to the corresponding BTC block, connecting the Stacks network and the BTC network.

What changes will the next major upgrade of Stacks, Nakamoto, bring?

Nakamoto is the next major upgrade of Stacks and is expected to be completed in Q4 2023. This upgrade will optimize the Clarity language, introduce subnets and sBTC. This upgrade will provide a relatively complete foundation for the next BTC ecosystem outbreak.

Subnet:

Stacks will introduce subnets that support other programming languages and execution environments, such as the EVM subnet. This will make it easier for projects on Ethereum to migrate to the Stacks network, allowing Stacks to capture the funds and traffic of the EVM chain. At the same time, these smart contracts can use Bitcoin as their asset and settle on the Bitcoin network in the end.

A Subnet is a scalability solution for Stacks that improves network performance by sacrificing some decentralization. Subnets can choose high network bandwidth miner nodes or whitelist miner nodes belonging to the subnet to process subnet transactions to ensure high performance.

sBTC:

sBTC is a decentralized BTC anchoring solution introduced by Stacks in the Nakamoto upgrade. The introduction of sBTC will solve the problem of how to use BTC assets in BTC second-layer networks. Smart contracts on Stacks and Stacks subnets can use sBTC to carry out lending, exchange, stablecoin minting and other DeFi businesses, increasing the TVL of BTC ecology.

There are already many BTC-anchored assets on the market, such as Wrapped BTC (wBTC), RenBTC, and tBTC that bring BTC into Ethereum, and RBTC that brings BTC into BTC second-layer RSK network. The anchoring principle is roughly the same: first lock BTC on the BTC network, then mint the same number of anchored BTC on the target network; destroy the anchored BTC on the target network, and then unlock the same number of BTC on the BTC network. However, the key is the centralization of locking BTC assets, such as wBTC, which is held by cryptocurrency custody service providers to hold user-locked BTC and has a relatively high centralization risk. Previously, 3AC and Alameda were wBTC’s cooperative dealers, and their bankruptcy caused some users to not be able to smoothly exchange wBTC for BTC. RBTC uses multi-signature addresses of the BTC network to lock BTC, and uses the Powpeg mechanism to ensure that the information of BTC locking is correctly transmitted to the RSK network and executed for signing, further reducing centralization risks.

sBTC uses a threshold signature wallet to manage the locked BTC in the BTC network, and mints BTC through smart contracts in the Stacks network, thus realizing non-custodial, decentralized BTC anchoring. To execute the peg-out operation to unlock BTC, valid signatures must be obtained: at least 70% of stackers (users who lock STX tokens in PoX to obtain BTC rewards) must have the right to sign. This greatly reduces the centralization risk of asset custody.

Source: https://stx.is/sbtc-pdf

Stacks Advantages

Ecological Advantages:

Stacks is currently the most active BTC second-layer network. After the launch of the Ordinals protocol, the market’s interest in BTC NFT gradually increased, and NFT activities on Stacks also began to become active. According to Muneeb Ali, Stacks network has minted NFTs worth more than $650,000.

In addition, Alex, a DeFi project in the Stacks ecosystem, saw a 500% increase in TVL in the first half of this year, with current TVL reaching $24.61M. Alex is a leading DEX in Stacks, with a well-built product that offers trading, lending, IPOs, perpetual contracts, and other features. With the upgrade of Stacks and the growth of the BTC ecosystem, Alex has even greater development potential.

The Arkadiko project in the Stacks ecosystem is similar to MakerDAO and focuses on excess collateral asset-casting of decentralized stablecoin USDA to increase asset liquidity in the Stacks network. Although the protocol has not yet broken out, we can expect its performance after sBTC is introduced into the Stacks network.

Source: https://twitter.com/muneeb/status/1456007656305479684

Citycoin:

CityCoin is a protocol built on Stacks that allows communities to contribute to city finances by spending STX tokens to earn rewards in Citycoin. Participants spend STX tokens to become “miners” to mine Citycoin, with 30% of the spent STX tokens going to the city treasury and the remaining 70% as rewards for CityCoin Stackers. If you understand the PoX mechanism described above, the incentive design of Citycoin is almost the same.

Source: https://docs.citycoins.co/core-protocol/mining-citycoins

Miami was the first city to join the project and launched MiamiCoin (MIA). The total value of the Miami city treasury wallet has exceeded $20 million, accounting for about 2% of the Miami city public budget, and these funds will be used to give back to the local community. New York City subsequently joined the program and launched NYCCoin. This allows more people to be exposed to and use digital assets and wallets, raise funds for regional public services, and also helps Stacks establish a good brand image.

Challenges Stacks May Face

Design Risks of PoX:

PoX requires BTC miners to spend BTC to participate in the competition of Stacks block generation in order to obtain STX token rewards. Currently, there is relatively small competition among BTC miners with high returns (1000 STX/block, rewards halving every 4 years, eventually dropping to 125 STX/block), and miners have a strong incentive to participate in the competition of Stacks block generation. As can be seen from the data in the following figure, miners who participated in the competition for 7,278 times spent about 3.56 BTC and received 1,337,000 STX tokens (currently about 29.4 BTC).

Statistics: https://app.onstacks.com/

If the Stacks rewards decrease in the future and the number of miners participating in the competition increases, the STX token rewards that miners receive may be less than the BTC they spend. According to Onstacks’ data, there are currently only six active miners participating in PoX. If the number of miners increases by only ten times as Stacks continues to develop, and the STX reward is about to be halved to 500 STX/block in about a year, then the STX/BTC exchange rate needs to double again to ensure that miners are profitable and motivated to participate in PoX. Therefore, either the value of STX needs to continue to rise, or there is an upper limit to the number of miners participating in the competition to ensure that the Stacks network continues to operate. Can Stacks, like Bitcoin, recover even if miners shut down their equipment?

Contract Vulnerability in PoX:

On April 19, 2023, Stacks discovered that the stacks-increase function in its pox-2 contract had a vulnerability, which resulted in the bc1qpyjutel6d4gj50dscphjrqcp29ljtfjel7ccap address receiving more BTC rewards than theoretically calculated. This calculation error was due to the stacks-increase function mixing operations such as database modifications with logic that determines state changes, and then using reward-cycle-total-stacked as a global variable to save the state in continuous iterations. Currently, the Stacks team has temporarily switched Stacks to the PoB consensus, and will replace the pox-2 contract with the pox-3 contract in the future before Stacks resumes using the PoX consensus. Developers in the community are calling for the improvement of Clarity as a functional, expression-oriented development language to facilitate static analysis and formal verification to avoid similar vulnerabilities in the future on the mainnet.

Conclusion

Stacks is undoubtedly a leading project in the Bitcoin layer 2 network, with a growing ecosystem and a strong brand effect, and is about to undergo major upgrades: a reliable, trustless BTC bridge, sBTC, subnets, and optimization of the Clarity language, providing the basic conditions for the explosion of the BTC ecosystem. However, the complexity of the PoX mechanism has already brought some challenges to the Stacks team, and the introduction of subnets in the future will further increase the complexity of the entire network. Ensuring the correct operation of the Stacks network and completing the Nakamoto upgrade smoothly is the challenge that the Stacks team needs to solve.

The selection appears to be an empty paragraph tag in HTML format.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Paxos to Issue US Dollar-Backed Stablecoin in Singapore: A Rock-Solid Plan!

Paxos, the American stablecoin company, has been granted a preliminary license to launch a new Dollar-backed stableco...

Market

Bitfinex Securities: Tokenized Bonds to the Moon!

Next month, Bitfinex Securities will list an exciting new tokenized bond called ALT2611. Stay tuned for more details ...

Market

Ethereum Dencun Upgrade: A Game-Changing Boost for ETH 🚀

The highly anticipated Ethereum Dencun upgrade has successfully launched on the Goerli and Sepolia testnets and is no...

Bitcoin

Vanguard Rejects Bitcoin ETF Offering: Is the Company Missing Out on a Golden Opportunity? 🚫🔒💰

Despite some top financial giants pursuing Bitcoin ETFs, Vanguard chooses to take a different approach.

Blockchain

Anoma Foundation Joins Forces with Namada to Empower Community Builders

The Anoma Foundation, a Switzerland-based organization, has pledged 10 million NAM tokens to support the Namada Commu...

Blockchain

Reinventing Digital Payments: The Birth of UDPN

In a groundbreaking move, SC Ventures and Deutsche Bank have achieved CBDC and stablecoin interoperability through UDPN.