Stacking

With Nakamoto approved and fast-approaching, these docs are being updated ro reflect changes in the network. Note that this document describes how stacking works post-Nakamoto, using the pox-4 contract.

Introduction

Stacking rewards Stacks (STX) token holders with bitcoin for providing a valuable service to the network by locking up their tokens for a certain time and participating as consensus-critical signers. If you aren't familiar with the concept of signers in Stacks, be sure to check out the Nakamoto Overview.

This document is presented as a conceptual overview of stacking and how it works. You can also view a detailed walkthrough of How to Stack as a Signer, a guide for stackers for those interested in delegating their STX (more on that below), and a deep dive into the contract.

Stacking vs Staking

While stacking on the Stacks network can be conceptually similar to staking, Stacks is not a PoS network and there are a couple key differences.

There are two primary differences between stacking in Stacks and staking in PoS networks.

Yield generated in burnchain token

In staking, users lock one token and earn their yield in the same token. In stacking, users lock one token (STX) and earn a yield in the "burnchain" token (BTC), rather than the same token that was locked. In PoX, the yield comes from a finite, external source (Bitcoin deposits from Stacks miners). In PoS, the yield comes from the currency's issuance schedule itself, which means it is programmatically unlimited (but theoretically limited, we'll get into this a bit more below).

That's the first main difference. Staking involves a yield of the same token being generated by the issuance mechanism set by the core protocol, where stacking yield requires an input of an external, separate token.

How are these issuance rates set? In Ethereum, issuance rates are determined by network usage. Ethereum's goal is to create a deflationary money supply, so the issuance rate is determined depending on the usage of the network. In order for an Ethereum transaction to be considered valid, it must include a base fee that is burned during transaction execution. The issuance rate is algorithmically determined block-by-block depending on how much ETH is being burned by these base fees plus normal gas fees.

Stacking doesn't have any of this complex functionality, since it does not generate a yield of the same token (and therefore doesn't need to issue new tokens, but rather transfer existing tokens from the base network) and it does not need to maintain an issuance rate. We are speaking here of the yield specifically, Stacks does have an issuance rate and does generate new STX tokens, but this process is completely separate from stacking and the yield generated from it.

The Bitcoin yield that stackers earn is determined by a combination of the Bitcoin being committed by miners and the number of STX tokens that are locked up in the network.

No slashing

Although stackers do fulfill a consensus critical role in Stacks by serving as signers (more info on this in the Nakamoto guide), there is no concept of slashing in PoX (Proof of Transfer).

Rather, if stackers do not perform their duties as signers, they simply cannot unlock their STX tokens and will not receive their BTC rewards.

Stacking is a built-in action, required by the "proof-of-transfer" (PoX) mechanism. The PoX mechanism is executed by every miner on the Stacks network.

Stacking functionality is implemented as a smart contract, using Clarity. Read more about the contract.

Stacking flow

The Stacking mechanism can be presented as a flow of actions:

  1. Make API calls to get details about the upcoming reward cycle

  2. For a specific Stacks account, confirm eligibility

  3. Confirm the BTC reward address and the lockup duration

  4. The transaction is broadcasted and the STX tokens are locked. This needs to happen before the prepare phase of the next reward cycle, the last 100 Bitcoin blocks of the ongoing reward phase

  5. The Stacking mechanism executes reward cycles and sends out rewards to the set BTC reward address

  6. During the lockup period, details about unlocking timing, rewards and more can be obtained

  7. Once the lockup period is passed, the tokens are released and accessible again

  8. Display reward history, including details like earnings for previous reward cycles

Keep in mind that the target duration for a reward cycles is ~2 weeks. This duration is based on the target block time of the Bitcoin network (10 minutes) and can be higher at times due to confirmation time variances of the bitcoin network.

Stacking delegation flow

There are two main ways you can stack:

  1. Solo stacking

  2. Delegated stacking

Solo stacking follows the flow outlined above, and is where stack your own STX tokens and run your own signer. In order to operate as a solo stacker, you need to have a minimum amount of STX tokens. This minimum is dynamic and can be found by viewing the pox endpoint of the API in the min_threshold_ustx field.

The Stacking flow is different for delegation use cases:

  • Before Stacking can be initiated for a token holder, the delegator needs to be granted permission to Stack on behalf of the account owner. The permission is restricted to the maximum amount the delegator is allowed to Stack. The maximum amount is not limited by the available funds and can be set much higher. An account can only be associated with one single delegator

  • The account has to define the delegation relationship. They can optionally restrict the Bitcoin reward address that must be used for payouts, and the expiration burn block height for the permission, thus limiting the time a delegator has permission to Stack

  • Delegators have to lock Stacks from different accounts ("pooling phase") until they reach the minimum amount of Stacks required to participate in Stacking

  • Once a delegator locks enough STX tokens, they can finalize and commit their participation in the next reward cycle

  • Certain delegation relationships may allow the STX holder to receive the payout directly from the miner (step 5/6)

  • The termination of the delegation relationship can either happen automatically based on set expiration rules or by actively revoking delegation rights

Token holder eligibility

Stacks (STX) token holders don't automatically receive stacking rewards. Instead, they must:

  • Commit to participation before a reward cycle begins

  • Commit the minimum amount of STX tokens to secure a reward slot, or pool with others to reach the minimum

  • Lock up STX tokens for a specified period

  • Provide a supported Bitcoin address to receive rewards

  • Maintain their signer software (if they are operating a signer)

The following diagram describes how the minimum STX tokens per slot is determined.

Token holders have a variety of providers and tools to support their participation in Stacking. The Stacks website contains a list of pools and stacking options.

Stacking in the PoX consensus algorithm

Stacking is a built-in capability of PoX and occurs through a set of actions on the Stacks blockchain. The full proof-of-transfer implementation details are in SIP-007. Below is a summary of the most relevant actions of the algorithm.

Note that SIP-007 describes stacking before Nakamoto. While much of the functionality remains the same, stackers now have the additional responsibility of operating as signers as outlined in SIP-021.

Stacking happens in reward cycles of 2100 Bitcoin blocks (roughly two weeks. Reward cycles are split up into two phases: the prepare phase and the reward phase.

The prepare phase lasts 100 Bitcoin blocks and is where the new stackers for the upcoming reward phase are selected by the PoX anchor block (see SIP-007 for details).

Because Stacks does not fork after the Nakamoto upgrade, the PoX anchor block is always known 100 Bitcoin blocks before the start of the next reward cycle. It is the last tenure-start block that precedes prepare phase.

The PoX anchor block identifies the next Stackers. They have 100 Bitcoin blocks to prepare for signing Stacks blocks. Within this amount of time, the new Stackers would complete a Distributed Key Generation round for signing blocks. The PoX contract will require Stackers to register their block-signing keys when they stack or delegate-stack STX, so the entire network knows enough information to validate their signatures on blocks.

This process is handled by running a signer and then subsequently conducting stacking operations as that signer.

How and Where to Stack

There are several options for stacking including solo stacking, participating in a pool, using an exchange, and liquid stacking.

The Stacks website has a stacking page dedicated to all these different options.

Stacking statistics

You can view all sorts of Stacking data and statistics and create your own dashboards on Ortege.

Last updated