Stacks Nakamoto Upgrade: A Butterfly Poised to Emerge

Beginner5/27/2024, 7:05:53 PM
The Stacks project is undergoing a significant update called the "Nakamoto Upgrade" to enhance the performance and security of the Stacks chain, making it more like a Bitcoin Layer 2 (L2). The upgrade includes rapid block generation, transaction finality through Bitcoin, and improved MEV (Miner Extractable Value) resistance. Additionally, the introduction of sBTC will allow BTC to be used as a native asset on the Stacks chain, a crucial step towards establishing Stacks as a Bitcoin L2.

Unveiling New Possibilities on the Bitcoin Network

In early 2023, the introduction of “Ordinals” to the Bitcoin network sparked a new debate on how to handle network block space. In May of the same year, the surge in demand for BRC-20 tokens temporarily overwhelmed the Bitcoin network, forcing Binance, the world’s largest centralized exchange, to suspend Bitcoin withdrawals.

Ordinals, derived from the word “ordinal,” meaning “in sequential order,” is a protocol created by Casey Rodarmor in January 2023. It adapted Bitcoin scripts to attach arbitrary data to the smallest unit of Bitcoin, “satoshis” (sats). This capability led to the emergence of PFPs and NFTs on the Bitcoin blockchain, similar to those on Ethereum (more information).

)

As of April 24, three NFT projects on the Bitcoin network—NodeMonkes, Runestone, and Bitcoin Puppets—ranked among the top 10 NFT collections by market cap, showcasing Bitcoin’s potential as a smart contract platform (source:Coingecko).

Bitcoin L2 and Stacks

This development has spurred a surge in L2 projects on the Bitcoin network. According to DeFiLlama, as of April 15, 11 projects classified as “Bitcoin sidechains” collectively hold nearly $900 million in TVL. Despite debates over whether these projects truly use the Bitcoin network as L1, the growing TVL and project count reflect the increasing market interest in the Bitcoin narrative.

Among these projects, Stacks stands out with its recent advancements. Launched in 2017, Stacks has aimed to bring smart contracts to the Bitcoin network since 2021. Let’s delve into Stacks’ recent developments and the upcoming major “Nakamoto Upgrade.”

The Genesis of Stacks - Blockstack

Video of Munib Ali’s 2016 TED talk; source TEDx Talks

In 2017, Dr. Muneeb Ali completed his degree and published the whitepaper for Stacks (formerly Blockstack). The project raised $52 million through a token sale on CoinList. Before this, Ali and his early team built a protocol and application called Onename on Bitcoin L1, allowing decentralized identities and profile pages on the Bitcoin network. These experiences helped shape Stacks’ vision and inspired the creation of a more robust platform.

Blockstack noticed the over-reliance on centralized data storage and management on the existing internet. They aimed to create a decentralized network using blockchain technology, allowing users to own their data and developers to build dApps easily, similar to Ethereum.

In 2019, Stacks’ token (STX) was approved by the U.S. SEC under Regulation A+, raising $23 million. This was the first SEC-approved token sale, garnering significant market attention.

From 2018 to 2020, the Stacks team focused on building solid project infrastructure. Stacks is a cross-chain consensus blockchain seamlessly integrated with the Bitcoin network, designed to enhance Bitcoin’s programmability. The team also developed a custom programming language, Clarity. During this period, Stacks secured funding from notable investors like Union Square Ventures, Harvard Endowment, Winklevoss Capital, and Naval Ravikant.

Stacks 2.0

“I believe Bitcoin is the best, most decentralized monetary layer. Currently, 1% of all circulating Bitcoin is issued on Ethereum as wrapped Bitcoin (wBTC), indicating a demand for using Bitcoin in smart contracts. Instead of wrapping Bitcoin on another smart contract platform, why not bring smart contract functionality to the Bitcoin network?” — Muneeb Ali, from ‘Bitcoin DeFi? It’s a Thing, Says Stacks Founder Muneeb Ali, Decrypt.’

In January 2021, Blockstack launched the Stacks 2.0 mainnet, transforming into the Stacks network. As Ali suggested, Stacks 2.0 aims to bring smart contract functionality to Bitcoin without altering Bitcoin itself. The chain’s design inherits Bitcoin’s decentralization and security while adding smart contract capabilities to enhance network scalability.

Proof-of-Transfer(PoX)

Transfer certification process; source: stacks.co%20is,powers%20without%20modifying%20Bitcoin%20itself)

Stacks’ consensus mechanism, Proof-of-Transfer (PoX), extends Proof of Burn, crucial for inheriting Bitcoin network security.

Unlike PoB, where miners burn cryptocurrency, PoX involves miners sending Bitcoin to STX holders participating in Stacking. Miners participate in Stacks’ mining by running Stacks nodes, using Bitcoin as the anchor chain to generate and mine blocks. The PoX mechanism involves:

  • Registration: Miners send consensus data to register as candidate miners.
  • Commitment: Registered miners send Bitcoin to STX token holders to participate in mining.
  • Election: A Verifiable Random Function (VRF) selects miners to create new blocks on the Stack blockchain.
  • Assembly: Selected miners create blocks and receive STX tokens as rewards.

The elected miners record the hashes of all new Stacks transactions in Bitcoin blocks, aligning incentives for Bitcoin miners and Stacks maintainers. Stacking, akin to staking in PoS networks, involves locking STX to earn Bitcoin rewards. The roles of miners and Stackers are illustrated as follows:

The role of miners and stackers; source: stacks docs

[Miner]

  • Miners send BTC to Stackers to earn Stacks transaction fees and block rewards.
  • The amount of BTC a miner sends determines their chance of being selected through a verifiable random function (VRF).
  • Selected miners gain the right to create new blocks and stream microblocks on the Stacks chain.
  • Selected miners receive STX and transaction fees as rewards.

[Stacker]

  • Stackers lock their STX for a set period.
  • They can stack independently or pool their STX with other Stackers.
  • Stackers provide their BTC address to receive BTC rewards, with the chances of receiving rewards proportional to the amount of STX locked.
  • Locked STX is unlocked at the end of the predetermined period.

Is Stacks a Bitcoin Layer 2?

The Stacks 2.0 upgrade enables the Stacks chain to function as a smart contract platform on the Bitcoin network with the introduction of the mainnet and the Proof-of-Transfer mechanism. However, calling it a Bitcoin Layer 2 (L2) is controversial.

  • Stacks 2.0 has its token and an independent security budget, unlike the Bitcoin network.
  • A security budget refers to resources allocated for network integrity, including mining rewards, operational costs, and network fees.
  • In traditional L1 networks, assets are not moved or managed by validators for security purposes, unlike in Ethereum and other L2 ecosystems.

For these reasons, Stacks 2.0 doesn’t fit neatly into the traditional L2 category. However, Stacks also isn’t a sidechain because its transactions are ultimately settled on the Bitcoin network. This unique setup led Stacks co-founder Muneeb Ali to call it “Layer 1.5” in a 2021 Decrypt interview.

Since the Bitcoin network wasn’t originally designed for smart contracts, adding these features or improving scalability hasn’t been as straightforward as it has been for Ethereum and EVM chains. For a deeper understanding of Bitcoin L2 distinctions, refer to the Spartan Group’s December 2023 article “BITCOIN LAYERS - Tapestry of a Trustless Financial Era.”

The Bitcoin L2 Trilemma; Source: BITCOIN LAYERS — Tapestry of a Trustless Financial Era

As shown in the figure above, the Bitcoin L2 trilemma includes:

  • Open Network: Using an open network instead of a consortium model.
  • No New Token: Not introducing new tokens.
  • Full VM/Global State: Using a “Global State” instead of limited off-chain contracts.

Stacks is seen as a Bitcoin L2 solution that meets conditions 1 and 3 but not condition 2. In contrast, the Lightning Network meets conditions 1 and 2 but, because it uses a “local consensus” method, it records transactions on a peer-to-peer network separate from the main chain, thus failing to meet condition 3.

Towards Stacks 3.0: The Nakamoto Upgrade

Current Issues with Stacks

The unique structure of the Stacks chain that allows it to operate as a smart contract platform on the Bitcoin network also brings some challenges, including:

  • Security Model
  • The Stacks chain has its security budget, which is different from the Bitcoin network’s security budget and is defined by the BTC paid by Stacks miners.
  • This means the chain’s security is highly dependent on the Stacks miners’ budget, increasing potential security risks.
  • Performance and Scalability
  • The connection between the Stacks chain and the Bitcoin network (such as the Proof-of-Transfer mechanism) enhances decentralization and security but limits on-chain performance and scalability.
  • Specifically, the process of creating new blocks through miner elections ties the Stacks chain to the Bitcoin block generation cycle, causing high transaction confirmation delays.
  • This creates a user experience gap and poses a challenge for developing Stacks dApps.
  • MEV Problem
  • Bitcoin miners with a significant portion of the Bitcoin hash rate can censor commitment transactions sent by other Stacks miners (transactions sending BTC to participate in STX mining) within the Bitcoin blocks they mine, ensuring they receive Stacks rewards and transaction fees.

Major Goals and Design Changes

Main Goals

The Nakamoto version is a major upgrade planned for this year to address the issues of the Stacks chain, improving its performance and security.

  • Fast Blocks
  • The time for user transactions to be mined and confirmed in a block will be reduced from tens of minutes to just a few seconds.
  • After the Nakamoto upgrade, by separating the miner election process from block generation, miners will be able to generate multiple blocks before the next election process.
  • Transaction Security Through Bitcoin Finality
  • Transactions on the Stacks chain will be secured by the Bitcoin network’s hashing power.
  • This means transactions will be settled on the Bitcoin network, ensuring their immutability.
  • Enhancing MEV Resistance
  • Improvements have been made to the BTC bidding mechanism for obtaining STX rewards to address the MEV problem in the miner election process.
  • The miner election algorithm has been changed to prevent Bitcoin miners from having an advantage over Stacks miners.

Changes in Block Generation Mechanism and Stacker Role

Before the Nakamoto upgrade, the ratio of blocks generated on the Stacks chain to Bitcoin blocks was 1:1, resulting in slow block generation and transaction confirmation times.

After the Nakamoto upgrade, a “Tenure-based block production” mechanism will be introduced to speed up block generation. Miners will be able to generate multiple Stacks blocks within their tenure (i.e., within the Bitcoin block generation cycle), reducing block generation and confirmation times to about 5 seconds, greatly improving Stacks’ scalability.

These Stacks blocks will be verified by Stackers. Before the Nakamoto upgrade, Stackers only locked STX tokens to contribute to the network’s economic security. After the upgrade, Stackers will act as signers, responsible for verifying, storing, signing, and propagating each Stacks block generated during the miner’s tenure. The interaction between miners and Stackers is illustrated below:

How miners and Stackers (or signers) interact after Nakamoto upgrades; source: stacks docs

  • Miners send BTC to Stackers to participate in the Stacks miner election process.
  • When a new miner is elected, a “tenure change” transaction occurs, granting the new miner a new tenure.
  • During block creation and verification, miners must collect signatures from Stackers.
  • Block verification requires at least 70% of Stackers to sign off on the block.

As shown in the diagram, miners need Stackers’ signatures to create the next block, and Stackers need to perform signing operations to receive rewards under the Proof-of-Transfer mechanism and unlock their stacked STX tokens.

Changing the Chain Structure for Bitcoin Finality

During a tenure change (or miner election), signers (Stackers) prevent miners from arbitrarily forking the Stacks chain by only signing the latest block. This means Stackers oversee miners, verify previously generated blocks, and ensure new blocks are based on the latest block.

Additionally, when submitting a transaction (tenure change transaction), miners must include an indexed block hash, which contains the hash of the first Stacks block recorded during the previous miner’s tenure and the hash of the block itself. This ensures the state of the Stacks blockchain is recorded in Bitcoin blocks, with each miner doing the same work, ensuring the history of the Stacks blockchain is continuously recorded on the Bitcoin network.

Diagram of the relationship between Bitcoin blocks, Stacks blocks, and inventory bitmaps; source: stacks docs

Thus, as shown in the diagram, the relationship between Stacks blocks and Bitcoin blocks is such that transactions submitted on the Stacks chain during period N are recorded in Bitcoin blocks in the next two periods, i.e., period N+2. This means it takes three tenure changes for Stacks transactions to become as difficult to reverse as Bitcoin blocks. From the user’s perspective, the chain structure is similar to what we know from L2, where transactions are confirmed in seconds, while Bitcoin settlement takes around 30 minutes.

This system also improves the Stacks chain’s security budget. The Stacks block verification mechanism, requiring signatures from at least 70% of Stackers, increases the security budget of Stacks to 70% of stacking assets, and once transactions achieve Bitcoin final settlement, this security budget can reach the equivalent of Bitcoin’s 51% mining power.

Summary of Stacks Mechanism After the Nakamoto Upgrade:

  • Miners must include an indexed block hash with the hash of the first block recorded during the previous tenure when submitting a tenure change transaction.
  • Signers enforce miners to generate the next block based on the last block signed during the previous tenure.
  • Transactions submitted during tenure N are recorded in Bitcoin blocks in tenure N+2, achieving Bitcoin finality.

After the Nakamoto upgrade, the transaction speed of the Stacks chain will significantly increase while also achieving Bitcoin finality, ensuring data immutability. For users, this means faster transaction confirmation times, and for the system, it means becoming closer to a true Bitcoin L2, inheriting Bitcoin’s security.

Solving the Bitcoin MEV Problem

Before the Nakamoto upgrade, the MEV problem in the Stacks chain mainly occurred as follows. Bitcoin miners with significant hash power, such as F2Pool, could censor the commitment transactions submitted by other staking miners within Bitcoin blocks to adjust their BTC bid amounts, ensuring they receive staking block rewards and transaction fees. This behaviour reduced the BTC rewards for Stackers and undermined trust in the mining process.

The Nakamoto upgrade introduces several new miner selection criteria to increase fairness in the block mining process.

  • Miners Participating in Recent Blocks
  • Miners must have participated in the past 10 blocks to be eligible for election during tenure changes.
  • This criterion promotes community stability and prevents attempts to steal blockchain rewards.
  • Median of Past Bids Method
  • The probability of miners being selected is calculated based on the median of all BTC bids recorded in the past 10 blocks.
  • This criterion prevents miners from submitting abnormal bids to receive block rewards.
  • Absolute Bid Total
  • The miner selection process is based on stable economic standards, considering the absolute total of bids, rather than bid variables based on the immediate mining environment.

By introducing these MEV prevention standards, the Nakamoto upgrade will increase transparency and trust in the Stacks blockchain mining process.

Planning the Nakamoto upgrade

Nakamoto upgrade roadmap; source: nakamoto.run

Since the release of the sBTC and Nakamoto white papers in late 2022, the Stacks Foundation and associated developers have been working on the Nakamoto upgrade for a long time. As shown above, Nakmoto’s functionality will be finalized and integrated into the testnet as of February 2024 (Called Nakamoto Milestone 0.3, codenamed Argon), Nakamoto upgrade updates have been in full swing. The first phase of the Nakamoto upgrade is now online on the mainnet, and upgrades will be rolled out one after another.

The Nakamoto upgrade consists of two phases, each involving a hard fork. The process is divided into “Instantiation” and “Activation” phases, allowing for a period of final adjustments, such as bug fixes, to avoid disruptions caused by changes in the on-chain environment before fully activating the functionality after the Nakamoto update.

Original plan

  • Phase One: Instantiation (starting April 22)
  • The POX-4 (upgraded Proof of Transfer mechanism) contract and most of the code included in the Nakamoto version will be applied, but the functionality will not be enabled.
  • At least two stacking cycles are reserved for signers and partners to register the POX-4 contract. During this period, it will be verified whether the signers registered with POX-4 correctly verify blocks and determine whether it is possible to enter the activation phase.
  • Phase Two: Activation (expected between May 15 and May 29)
  • This phase will apply the Nakamoto updates, including the signer-based system, fast blocks, and Bitcoin finality, and activate the Nakamoto rules.
  • Nakamoto rules refer to the overall logic distinguishing before and after the Nakamoto upgrade.

Nakamoto release plan; source: Nakamoto Launch: Testnet and Mainnet Rollout Overview

Plan Changes

The first phase of the upgrade (Instantiation) began on April 22. Assuming no major bugs were found and instantiation was completed, the second phase was planned to start in mid-May. However, after the start of the first phase, some deficiencies in the Signer Resiliency/Recovery system were discovered. Therefore, on May 1, the Stacks Foundation announced changes to the original plan. Key points are as follows:

  • The initial activation phase of the Nakamoto upgrade will include only a basic signer recovery system.
  • The plan to upgrade to the advanced signer recovery system was initially scheduled for deployment at the end of 2024 after the Nakamoto upgrade activation. However, after progress was made in the signer onboarding during the instantiation phase, it was determined that the advanced signer recovery system was needed.
  • Therefore, an additional 8 weeks of development time will be added before the Nakamoto upgrade activation phase. The signer recovery system code will be completed by July 15, and the Nakamoto upgrade version will be activated on August 28.
  • Work Content
  • Enhance miner recovery capabilities for signer timeouts and signer errors.
  • Strengthen processes for signer reaction and key loss scenarios.
  • Improve methods for creating and extending miner tenures.
  • Improve handling of network uncertainties and flash block processing.

Revised Nakamoto release timeline; source: stacks.org

According to the revised plan, code development will be completed by July 15, 8 weeks later, and the activation phase of the Nakamoto upgrade, originally scheduled for mid-May, will begin around 3 months later, on August 28. The good news is that the sBTC upgrade originally scheduled for Q3 will not be delayed and is expected to occur in the fourth week after the activation phase begins.

sBTC - The Final Piece to Achieving L2

The Nakamoto upgrade is expected to be fully activated in May, aiming to significantly improve the performance of the Stacks chain and achieve Bitcoin finality for Stacks blocks. However, to truly become a Bitcoin L2, the Nakamoto upgrade is only half the success.

Criteria for distinguishing Bitcoin L2; Source: light tweet

After the Nakamoto upgrade is released, Stacks will have an environment similar to Sovereign Rollup. However, it can only function as a true Bitcoin smart contract platform and L2 by bringing Bitcoin’s native asset BTC onto the chain and utilizing it. In the same tweet, Stacks founder Muneeb Ali said that moving BTC in and out of the Bitcoin layer is the hardest part and explained that sBTC is the closest solution to a trustless bridge, a decentralized group of public signers that can execute pegging mechanisms for BTC without modifying Bitcoin L1.

sBTC is Based on Two Main Attributes, Bridging BTC Assets Between the Bitcoin Network and the Stacks Chain

  • 1:1 Redeemability: sBTC and BTC can always be redeemed at a 1:1 ratio unless the Stacks chain ceases to operate.
  • Open Membership: Anyone can join the sBTC protocol, and no centralized entity can control BTC.

Previously, the Stacks chain had BTC-related assets like xBTC and aBTC, similar to Ethereum’s wBTC (wrapped BTC), but they were based on a centralized custody model requiring multi-signature bridging. In contrast, sBTC uses Stackers as a group of signers under the Proof of Transfer mechanism to achieve trustless BTC bridging.

How sBTC works (1); Source: stacks docs

How sBTC works (2); Source: sbtc.tech

The update and implementation of sBTC are planned for Q3 2024. The Nakamoto upgrade and sBTC update are key milestones in Stacks’ ambitious goal to become the preferred smart contract platform on the Bitcoin network. We can continue to watch Stacks to see if it can truly become a Bitcoin L2 and effectively utilize the dormant BTC.

source: BITCOIN LAYERS — Tapestry of a Trustless Financial Era

References

Disclaimer:

  1. This article is reposted from [techflow], and the copyright belongs to the original author [DeSpread]. If there are any objections to this repost, please contact the Gate Learn team, and the team will handle it as soon as possible according to the relevant procedures.

  2. Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.

  3. Other language versions of the article are translated by the Gate Learn team. The translated article may not be copied, disseminated, or plagiarized without mentioning Gate.io.

Stacks Nakamoto Upgrade: A Butterfly Poised to Emerge

Beginner5/27/2024, 7:05:53 PM
The Stacks project is undergoing a significant update called the "Nakamoto Upgrade" to enhance the performance and security of the Stacks chain, making it more like a Bitcoin Layer 2 (L2). The upgrade includes rapid block generation, transaction finality through Bitcoin, and improved MEV (Miner Extractable Value) resistance. Additionally, the introduction of sBTC will allow BTC to be used as a native asset on the Stacks chain, a crucial step towards establishing Stacks as a Bitcoin L2.

Unveiling New Possibilities on the Bitcoin Network

In early 2023, the introduction of “Ordinals” to the Bitcoin network sparked a new debate on how to handle network block space. In May of the same year, the surge in demand for BRC-20 tokens temporarily overwhelmed the Bitcoin network, forcing Binance, the world’s largest centralized exchange, to suspend Bitcoin withdrawals.

Ordinals, derived from the word “ordinal,” meaning “in sequential order,” is a protocol created by Casey Rodarmor in January 2023. It adapted Bitcoin scripts to attach arbitrary data to the smallest unit of Bitcoin, “satoshis” (sats). This capability led to the emergence of PFPs and NFTs on the Bitcoin blockchain, similar to those on Ethereum (more information).

)

As of April 24, three NFT projects on the Bitcoin network—NodeMonkes, Runestone, and Bitcoin Puppets—ranked among the top 10 NFT collections by market cap, showcasing Bitcoin’s potential as a smart contract platform (source:Coingecko).

Bitcoin L2 and Stacks

This development has spurred a surge in L2 projects on the Bitcoin network. According to DeFiLlama, as of April 15, 11 projects classified as “Bitcoin sidechains” collectively hold nearly $900 million in TVL. Despite debates over whether these projects truly use the Bitcoin network as L1, the growing TVL and project count reflect the increasing market interest in the Bitcoin narrative.

Among these projects, Stacks stands out with its recent advancements. Launched in 2017, Stacks has aimed to bring smart contracts to the Bitcoin network since 2021. Let’s delve into Stacks’ recent developments and the upcoming major “Nakamoto Upgrade.”

The Genesis of Stacks - Blockstack

Video of Munib Ali’s 2016 TED talk; source TEDx Talks

In 2017, Dr. Muneeb Ali completed his degree and published the whitepaper for Stacks (formerly Blockstack). The project raised $52 million through a token sale on CoinList. Before this, Ali and his early team built a protocol and application called Onename on Bitcoin L1, allowing decentralized identities and profile pages on the Bitcoin network. These experiences helped shape Stacks’ vision and inspired the creation of a more robust platform.

Blockstack noticed the over-reliance on centralized data storage and management on the existing internet. They aimed to create a decentralized network using blockchain technology, allowing users to own their data and developers to build dApps easily, similar to Ethereum.

In 2019, Stacks’ token (STX) was approved by the U.S. SEC under Regulation A+, raising $23 million. This was the first SEC-approved token sale, garnering significant market attention.

From 2018 to 2020, the Stacks team focused on building solid project infrastructure. Stacks is a cross-chain consensus blockchain seamlessly integrated with the Bitcoin network, designed to enhance Bitcoin’s programmability. The team also developed a custom programming language, Clarity. During this period, Stacks secured funding from notable investors like Union Square Ventures, Harvard Endowment, Winklevoss Capital, and Naval Ravikant.

Stacks 2.0

“I believe Bitcoin is the best, most decentralized monetary layer. Currently, 1% of all circulating Bitcoin is issued on Ethereum as wrapped Bitcoin (wBTC), indicating a demand for using Bitcoin in smart contracts. Instead of wrapping Bitcoin on another smart contract platform, why not bring smart contract functionality to the Bitcoin network?” — Muneeb Ali, from ‘Bitcoin DeFi? It’s a Thing, Says Stacks Founder Muneeb Ali, Decrypt.’

In January 2021, Blockstack launched the Stacks 2.0 mainnet, transforming into the Stacks network. As Ali suggested, Stacks 2.0 aims to bring smart contract functionality to Bitcoin without altering Bitcoin itself. The chain’s design inherits Bitcoin’s decentralization and security while adding smart contract capabilities to enhance network scalability.

Proof-of-Transfer(PoX)

Transfer certification process; source: stacks.co%20is,powers%20without%20modifying%20Bitcoin%20itself)

Stacks’ consensus mechanism, Proof-of-Transfer (PoX), extends Proof of Burn, crucial for inheriting Bitcoin network security.

Unlike PoB, where miners burn cryptocurrency, PoX involves miners sending Bitcoin to STX holders participating in Stacking. Miners participate in Stacks’ mining by running Stacks nodes, using Bitcoin as the anchor chain to generate and mine blocks. The PoX mechanism involves:

  • Registration: Miners send consensus data to register as candidate miners.
  • Commitment: Registered miners send Bitcoin to STX token holders to participate in mining.
  • Election: A Verifiable Random Function (VRF) selects miners to create new blocks on the Stack blockchain.
  • Assembly: Selected miners create blocks and receive STX tokens as rewards.

The elected miners record the hashes of all new Stacks transactions in Bitcoin blocks, aligning incentives for Bitcoin miners and Stacks maintainers. Stacking, akin to staking in PoS networks, involves locking STX to earn Bitcoin rewards. The roles of miners and Stackers are illustrated as follows:

The role of miners and stackers; source: stacks docs

[Miner]

  • Miners send BTC to Stackers to earn Stacks transaction fees and block rewards.
  • The amount of BTC a miner sends determines their chance of being selected through a verifiable random function (VRF).
  • Selected miners gain the right to create new blocks and stream microblocks on the Stacks chain.
  • Selected miners receive STX and transaction fees as rewards.

[Stacker]

  • Stackers lock their STX for a set period.
  • They can stack independently or pool their STX with other Stackers.
  • Stackers provide their BTC address to receive BTC rewards, with the chances of receiving rewards proportional to the amount of STX locked.
  • Locked STX is unlocked at the end of the predetermined period.

Is Stacks a Bitcoin Layer 2?

The Stacks 2.0 upgrade enables the Stacks chain to function as a smart contract platform on the Bitcoin network with the introduction of the mainnet and the Proof-of-Transfer mechanism. However, calling it a Bitcoin Layer 2 (L2) is controversial.

  • Stacks 2.0 has its token and an independent security budget, unlike the Bitcoin network.
  • A security budget refers to resources allocated for network integrity, including mining rewards, operational costs, and network fees.
  • In traditional L1 networks, assets are not moved or managed by validators for security purposes, unlike in Ethereum and other L2 ecosystems.

For these reasons, Stacks 2.0 doesn’t fit neatly into the traditional L2 category. However, Stacks also isn’t a sidechain because its transactions are ultimately settled on the Bitcoin network. This unique setup led Stacks co-founder Muneeb Ali to call it “Layer 1.5” in a 2021 Decrypt interview.

Since the Bitcoin network wasn’t originally designed for smart contracts, adding these features or improving scalability hasn’t been as straightforward as it has been for Ethereum and EVM chains. For a deeper understanding of Bitcoin L2 distinctions, refer to the Spartan Group’s December 2023 article “BITCOIN LAYERS - Tapestry of a Trustless Financial Era.”

The Bitcoin L2 Trilemma; Source: BITCOIN LAYERS — Tapestry of a Trustless Financial Era

As shown in the figure above, the Bitcoin L2 trilemma includes:

  • Open Network: Using an open network instead of a consortium model.
  • No New Token: Not introducing new tokens.
  • Full VM/Global State: Using a “Global State” instead of limited off-chain contracts.

Stacks is seen as a Bitcoin L2 solution that meets conditions 1 and 3 but not condition 2. In contrast, the Lightning Network meets conditions 1 and 2 but, because it uses a “local consensus” method, it records transactions on a peer-to-peer network separate from the main chain, thus failing to meet condition 3.

Towards Stacks 3.0: The Nakamoto Upgrade

Current Issues with Stacks

The unique structure of the Stacks chain that allows it to operate as a smart contract platform on the Bitcoin network also brings some challenges, including:

  • Security Model
  • The Stacks chain has its security budget, which is different from the Bitcoin network’s security budget and is defined by the BTC paid by Stacks miners.
  • This means the chain’s security is highly dependent on the Stacks miners’ budget, increasing potential security risks.
  • Performance and Scalability
  • The connection between the Stacks chain and the Bitcoin network (such as the Proof-of-Transfer mechanism) enhances decentralization and security but limits on-chain performance and scalability.
  • Specifically, the process of creating new blocks through miner elections ties the Stacks chain to the Bitcoin block generation cycle, causing high transaction confirmation delays.
  • This creates a user experience gap and poses a challenge for developing Stacks dApps.
  • MEV Problem
  • Bitcoin miners with a significant portion of the Bitcoin hash rate can censor commitment transactions sent by other Stacks miners (transactions sending BTC to participate in STX mining) within the Bitcoin blocks they mine, ensuring they receive Stacks rewards and transaction fees.

Major Goals and Design Changes

Main Goals

The Nakamoto version is a major upgrade planned for this year to address the issues of the Stacks chain, improving its performance and security.

  • Fast Blocks
  • The time for user transactions to be mined and confirmed in a block will be reduced from tens of minutes to just a few seconds.
  • After the Nakamoto upgrade, by separating the miner election process from block generation, miners will be able to generate multiple blocks before the next election process.
  • Transaction Security Through Bitcoin Finality
  • Transactions on the Stacks chain will be secured by the Bitcoin network’s hashing power.
  • This means transactions will be settled on the Bitcoin network, ensuring their immutability.
  • Enhancing MEV Resistance
  • Improvements have been made to the BTC bidding mechanism for obtaining STX rewards to address the MEV problem in the miner election process.
  • The miner election algorithm has been changed to prevent Bitcoin miners from having an advantage over Stacks miners.

Changes in Block Generation Mechanism and Stacker Role

Before the Nakamoto upgrade, the ratio of blocks generated on the Stacks chain to Bitcoin blocks was 1:1, resulting in slow block generation and transaction confirmation times.

After the Nakamoto upgrade, a “Tenure-based block production” mechanism will be introduced to speed up block generation. Miners will be able to generate multiple Stacks blocks within their tenure (i.e., within the Bitcoin block generation cycle), reducing block generation and confirmation times to about 5 seconds, greatly improving Stacks’ scalability.

These Stacks blocks will be verified by Stackers. Before the Nakamoto upgrade, Stackers only locked STX tokens to contribute to the network’s economic security. After the upgrade, Stackers will act as signers, responsible for verifying, storing, signing, and propagating each Stacks block generated during the miner’s tenure. The interaction between miners and Stackers is illustrated below:

How miners and Stackers (or signers) interact after Nakamoto upgrades; source: stacks docs

  • Miners send BTC to Stackers to participate in the Stacks miner election process.
  • When a new miner is elected, a “tenure change” transaction occurs, granting the new miner a new tenure.
  • During block creation and verification, miners must collect signatures from Stackers.
  • Block verification requires at least 70% of Stackers to sign off on the block.

As shown in the diagram, miners need Stackers’ signatures to create the next block, and Stackers need to perform signing operations to receive rewards under the Proof-of-Transfer mechanism and unlock their stacked STX tokens.

Changing the Chain Structure for Bitcoin Finality

During a tenure change (or miner election), signers (Stackers) prevent miners from arbitrarily forking the Stacks chain by only signing the latest block. This means Stackers oversee miners, verify previously generated blocks, and ensure new blocks are based on the latest block.

Additionally, when submitting a transaction (tenure change transaction), miners must include an indexed block hash, which contains the hash of the first Stacks block recorded during the previous miner’s tenure and the hash of the block itself. This ensures the state of the Stacks blockchain is recorded in Bitcoin blocks, with each miner doing the same work, ensuring the history of the Stacks blockchain is continuously recorded on the Bitcoin network.

Diagram of the relationship between Bitcoin blocks, Stacks blocks, and inventory bitmaps; source: stacks docs

Thus, as shown in the diagram, the relationship between Stacks blocks and Bitcoin blocks is such that transactions submitted on the Stacks chain during period N are recorded in Bitcoin blocks in the next two periods, i.e., period N+2. This means it takes three tenure changes for Stacks transactions to become as difficult to reverse as Bitcoin blocks. From the user’s perspective, the chain structure is similar to what we know from L2, where transactions are confirmed in seconds, while Bitcoin settlement takes around 30 minutes.

This system also improves the Stacks chain’s security budget. The Stacks block verification mechanism, requiring signatures from at least 70% of Stackers, increases the security budget of Stacks to 70% of stacking assets, and once transactions achieve Bitcoin final settlement, this security budget can reach the equivalent of Bitcoin’s 51% mining power.

Summary of Stacks Mechanism After the Nakamoto Upgrade:

  • Miners must include an indexed block hash with the hash of the first block recorded during the previous tenure when submitting a tenure change transaction.
  • Signers enforce miners to generate the next block based on the last block signed during the previous tenure.
  • Transactions submitted during tenure N are recorded in Bitcoin blocks in tenure N+2, achieving Bitcoin finality.

After the Nakamoto upgrade, the transaction speed of the Stacks chain will significantly increase while also achieving Bitcoin finality, ensuring data immutability. For users, this means faster transaction confirmation times, and for the system, it means becoming closer to a true Bitcoin L2, inheriting Bitcoin’s security.

Solving the Bitcoin MEV Problem

Before the Nakamoto upgrade, the MEV problem in the Stacks chain mainly occurred as follows. Bitcoin miners with significant hash power, such as F2Pool, could censor the commitment transactions submitted by other staking miners within Bitcoin blocks to adjust their BTC bid amounts, ensuring they receive staking block rewards and transaction fees. This behaviour reduced the BTC rewards for Stackers and undermined trust in the mining process.

The Nakamoto upgrade introduces several new miner selection criteria to increase fairness in the block mining process.

  • Miners Participating in Recent Blocks
  • Miners must have participated in the past 10 blocks to be eligible for election during tenure changes.
  • This criterion promotes community stability and prevents attempts to steal blockchain rewards.
  • Median of Past Bids Method
  • The probability of miners being selected is calculated based on the median of all BTC bids recorded in the past 10 blocks.
  • This criterion prevents miners from submitting abnormal bids to receive block rewards.
  • Absolute Bid Total
  • The miner selection process is based on stable economic standards, considering the absolute total of bids, rather than bid variables based on the immediate mining environment.

By introducing these MEV prevention standards, the Nakamoto upgrade will increase transparency and trust in the Stacks blockchain mining process.

Planning the Nakamoto upgrade

Nakamoto upgrade roadmap; source: nakamoto.run

Since the release of the sBTC and Nakamoto white papers in late 2022, the Stacks Foundation and associated developers have been working on the Nakamoto upgrade for a long time. As shown above, Nakmoto’s functionality will be finalized and integrated into the testnet as of February 2024 (Called Nakamoto Milestone 0.3, codenamed Argon), Nakamoto upgrade updates have been in full swing. The first phase of the Nakamoto upgrade is now online on the mainnet, and upgrades will be rolled out one after another.

The Nakamoto upgrade consists of two phases, each involving a hard fork. The process is divided into “Instantiation” and “Activation” phases, allowing for a period of final adjustments, such as bug fixes, to avoid disruptions caused by changes in the on-chain environment before fully activating the functionality after the Nakamoto update.

Original plan

  • Phase One: Instantiation (starting April 22)
  • The POX-4 (upgraded Proof of Transfer mechanism) contract and most of the code included in the Nakamoto version will be applied, but the functionality will not be enabled.
  • At least two stacking cycles are reserved for signers and partners to register the POX-4 contract. During this period, it will be verified whether the signers registered with POX-4 correctly verify blocks and determine whether it is possible to enter the activation phase.
  • Phase Two: Activation (expected between May 15 and May 29)
  • This phase will apply the Nakamoto updates, including the signer-based system, fast blocks, and Bitcoin finality, and activate the Nakamoto rules.
  • Nakamoto rules refer to the overall logic distinguishing before and after the Nakamoto upgrade.

Nakamoto release plan; source: Nakamoto Launch: Testnet and Mainnet Rollout Overview

Plan Changes

The first phase of the upgrade (Instantiation) began on April 22. Assuming no major bugs were found and instantiation was completed, the second phase was planned to start in mid-May. However, after the start of the first phase, some deficiencies in the Signer Resiliency/Recovery system were discovered. Therefore, on May 1, the Stacks Foundation announced changes to the original plan. Key points are as follows:

  • The initial activation phase of the Nakamoto upgrade will include only a basic signer recovery system.
  • The plan to upgrade to the advanced signer recovery system was initially scheduled for deployment at the end of 2024 after the Nakamoto upgrade activation. However, after progress was made in the signer onboarding during the instantiation phase, it was determined that the advanced signer recovery system was needed.
  • Therefore, an additional 8 weeks of development time will be added before the Nakamoto upgrade activation phase. The signer recovery system code will be completed by July 15, and the Nakamoto upgrade version will be activated on August 28.
  • Work Content
  • Enhance miner recovery capabilities for signer timeouts and signer errors.
  • Strengthen processes for signer reaction and key loss scenarios.
  • Improve methods for creating and extending miner tenures.
  • Improve handling of network uncertainties and flash block processing.

Revised Nakamoto release timeline; source: stacks.org

According to the revised plan, code development will be completed by July 15, 8 weeks later, and the activation phase of the Nakamoto upgrade, originally scheduled for mid-May, will begin around 3 months later, on August 28. The good news is that the sBTC upgrade originally scheduled for Q3 will not be delayed and is expected to occur in the fourth week after the activation phase begins.

sBTC - The Final Piece to Achieving L2

The Nakamoto upgrade is expected to be fully activated in May, aiming to significantly improve the performance of the Stacks chain and achieve Bitcoin finality for Stacks blocks. However, to truly become a Bitcoin L2, the Nakamoto upgrade is only half the success.

Criteria for distinguishing Bitcoin L2; Source: light tweet

After the Nakamoto upgrade is released, Stacks will have an environment similar to Sovereign Rollup. However, it can only function as a true Bitcoin smart contract platform and L2 by bringing Bitcoin’s native asset BTC onto the chain and utilizing it. In the same tweet, Stacks founder Muneeb Ali said that moving BTC in and out of the Bitcoin layer is the hardest part and explained that sBTC is the closest solution to a trustless bridge, a decentralized group of public signers that can execute pegging mechanisms for BTC without modifying Bitcoin L1.

sBTC is Based on Two Main Attributes, Bridging BTC Assets Between the Bitcoin Network and the Stacks Chain

  • 1:1 Redeemability: sBTC and BTC can always be redeemed at a 1:1 ratio unless the Stacks chain ceases to operate.
  • Open Membership: Anyone can join the sBTC protocol, and no centralized entity can control BTC.

Previously, the Stacks chain had BTC-related assets like xBTC and aBTC, similar to Ethereum’s wBTC (wrapped BTC), but they were based on a centralized custody model requiring multi-signature bridging. In contrast, sBTC uses Stackers as a group of signers under the Proof of Transfer mechanism to achieve trustless BTC bridging.

How sBTC works (1); Source: stacks docs

How sBTC works (2); Source: sbtc.tech

The update and implementation of sBTC are planned for Q3 2024. The Nakamoto upgrade and sBTC update are key milestones in Stacks’ ambitious goal to become the preferred smart contract platform on the Bitcoin network. We can continue to watch Stacks to see if it can truly become a Bitcoin L2 and effectively utilize the dormant BTC.

source: BITCOIN LAYERS — Tapestry of a Trustless Financial Era

References

Disclaimer:

  1. This article is reposted from [techflow], and the copyright belongs to the original author [DeSpread]. If there are any objections to this repost, please contact the Gate Learn team, and the team will handle it as soon as possible according to the relevant procedures.

  2. Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.

  3. Other language versions of the article are translated by the Gate Learn team. The translated article may not be copied, disseminated, or plagiarized without mentioning Gate.io.

Nu Starten
Meld Je Aan En Ontvang
$100
Voucher!