-
Notifications
You must be signed in to change notification settings - Fork 102
SIP-032: Improved stacking #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
friedger
wants to merge
24
commits into
stacksgov:main
Choose a base branch
from
friedger:feat/sip-improved-stacking
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
df646ac
feat: add sip to remove cool down cycle
friedger 7015353
chore: remove solo stacking
friedger 7546e84
fix: tpyes, corrections
friedger 4405324
feat: update sip to auto extend
friedger cbca81f
fix typos and grammar
friedger 3bbf442
improve mermaid graph
friedger 31e8c92
prevent DDoS attack through small stacking amounts
friedger 3ce2e0e
fix: typos, clarity
friedger 0891e53
Update sips/sip-x/sip-x-improved-stacking.md
friedger 895f3b7
chore: clarify the flow
friedger 5373b69
Merge pull request #2 from friedger/feat/sip-improved-stacking-july-25
friedger 8e15dc7
Update sips/sip-x/sip-x-improved-stacking.md
friedger 8a10e82
add section about locked amount and events
friedger a2e7bae
clarify voting power and decreased stacked stx amount
friedger 0ef1069
rename to sip 032
friedger d1a016d
rename folder
friedger 5c1159d
fix: address comments, update to 3.3
friedger 1cb837b
fix: clarify the events
friedger 02d5c73
fix: use signer-accept also as event name
friedger 876eaac
Update sips/sip-032/sip-032-improved-stacking.md
friedger aa83821
Update sips/sip-032/sip-032-improved-stacking.md
friedger 02a4910
fix: clarify use of maximum allowed amount to stack
friedger 0d587d2
Merge branch 'feat/sip-improved-stacking' of github.com:friedger/sips…
friedger b22221e
feat: add method signatures
friedger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| # Preamble | ||
|
|
||
| **SIP Number:** XXX | ||
|
|
||
| **Title:** Improved Stacking Protocol | ||
|
|
||
| **Authors:** | ||
|
|
||
| - Friedger Müffke ([friedger@ryder.id](mailto:friedger@ryder.id)) | ||
|
|
||
| **Consideration:** Technical | ||
|
|
||
| **Type:** Consensus | ||
|
|
||
| **Status:** Draft | ||
|
|
||
| **Created:** 2025-04-01 | ||
|
|
||
| **License:** BSD 2-Clause | ||
|
|
||
| **Sign-off:** | ||
|
|
||
| **Discussions-To:** | ||
|
|
||
| - [Stacks Forum Discussions](https://forum.stacks.org/t/remove-cool-down-cycle-in-stacking/17899) | ||
|
|
||
| # Abstract | ||
|
|
||
| This SIP proposes a change to the different phases of the stacking process so that stackers can change | ||
| their stacking settings without the so-called cooldown cycle. Furthermore, the relationship between stackers | ||
| and signers is strengthened and stacking overall is simplified. | ||
|
|
||
| The specification defines that | ||
|
|
||
| - the beginning of the prepare phase is moved by 90 blocks towards the end of hte cycle. | ||
| - the length of the prepare phase is reduced to 10 blocks. | ||
| - that locked Stacks token ready for unlocking are unlocked at 90 blocks before the beginning of the prepare phase. | ||
| - that delegated stacking tokens are locked immediately. | ||
| - that stacking rewards are received by the Bitcoin address specified by the signer. | ||
| - that solo stackers and delegating stackers have to follow the same flow. | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Introduction | ||
|
|
||
| ## Glossary | ||
|
|
||
| | Term | Definition | | ||
| | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | **Cooldown Cycle** | The period of 1 stacking cycle where stackers cannot stack their STX tokens because their tokens are unlocked only at the beginning of a stacking cycle. | | ||
| | **Signer** | | | ||
| | **Delegation** | | | ||
| | **PoX Contract** | | | ||
|
|
||
| ## Problem Statement | ||
|
|
||
| The current stacking process is has two different paths, one for solo stackers, one for delegated stackers, | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
| resulting in a more complex users experience and complex code. Furthermore, users cannot change their | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
| stacking settings (decrease amount, change PoX address, etc.) without an unlocked cycle where users cannot earn | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
| stacking rewards. | ||
|
|
||
| The process is defined by a prepare phase of 100 bitcoin blocks that is used to find an anchor block | ||
| for the next stacking cycle. Stackers must lock | ||
| their Stacks tokens before the | ||
| preapre phase, i.e. before the 2000th blocks of the current stacking cycle. Furthermore, Stacks | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
| tokens are locked for a locking period that always end at the beginning of a cycle, i.e. after the | ||
| prepare phase. Therefore, the current implementation of Stacking includes a period where Stacks | ||
| tokens are unlocked and cannot earn stacking rewards (Cooldown Cycle). | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
|
|
||
| The current PoX contract allows users to lock Stacks tokens during the prepare phase. This is too late for the next cycle | ||
| and the tokens are locked without earning stacking rewards for one cycle. | ||
|
|
||
| The cooldown cycle for unstacking from a pool presents a problem for network decentralization. | ||
| As a stacker, when I delegate to a signer and that signer does not perform and gets low yield, | ||
| I get penalized for switching. In today's model with cooldown cycles, users get double penalized | ||
| if a validator does not perform. Even if there are penalties for signers not performing / being down, | ||
| the switching costs are too high for users to switch (2 weeks worth of yield is a lot). | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Proposed Solution | ||
|
|
||
| A new PoX contract is proposed without | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
| the flow for solo stacking and moves responsibilities from pool operators to signers. It also | ||
| defines the end of the locking period to be before the start of the stacking cycle. | ||
|
|
||
| The user will be able to switch from one signer to another with a single contract call and without a cool down period. | ||
|
|
||
| # Specification | ||
|
|
||
| Applying these upgrades to the Stacks blockchain requires a consensus-breaking network upgrade, | ||
| in this case, a hard fork. Like other such changes, this will require a new Stacks epoch. | ||
| In this SIP, we will refer to this new epoch as Stacks 3.2. | ||
|
|
||
| ## Delegated Stacking only | ||
|
|
||
| The following PoX contract functions shall be removed | ||
|
|
||
| - stack-stx | ||
| - stack-increase | ||
| - stack-extend | ||
|
|
||
| ## Locking period | ||
|
|
||
| Stacking transactions shall result in locking periods that end 100 blocks before the beginning of a stacking period. This includes | ||
|
|
||
| - delegate-stack-stx | ||
| - delegate-stack-extend | ||
|
|
||
| The PoX contract has to be changed and return the unlock height as previous unlock height minus 100 blocks for mainnet. E.g. | ||
|
|
||
| ``` | ||
| (new-unlock-ht (- (reward-cycle-to-burn-height (+ u1 last-extend-cycle)) u100)) | ||
| ``` | ||
|
|
||
| The unlocking process of the stacks node needs to be adapted accordingly. | ||
|
|
||
| ## Prepare phase | ||
|
|
||
| The prepare phase shall start 10 blocks before the beginning of the stacking cycle and last for 10 blocks. | ||
|
|
||
| The prepare cycle length defined in PoX contract has be changed to | ||
|
|
||
| ``` | ||
| (define-constant PREPARE_CYCLE_LENGTH (if is-in-mainnet u10 u5)) | ||
| ``` | ||
|
|
||
| ## Relationship Between Stackers and Signers | ||
|
|
||
| The signature provided by a signers to a stackers shall use one of the following topics | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
|
|
||
| - delegate | ||
| - delegate-increase | ||
| - delegate-extend | ||
| - agg-commit | ||
| - agg-increase | ||
|
|
||
| ## Transition to PoX-5 | ||
|
|
||
| A new PoX contract requires that all stacked Stacks tokens are unlocked and Stackers need to lock their Stacks token again using the new PoX-5 contract. The process shall be similar to the previous upgrades of the PoX contract. PoX-4 contract shall be deactivated and PoX-5 contract shall be activated at the beginning of epoch 3.2 All locked Stacks tokens shall be unlocked automatically 1 block after the beginning of epoch 3.2. | ||
|
|
||
|
friedger marked this conversation as resolved.
Outdated
|
||
| # Related Work | ||
|
|
||
| The previous PoX process is described in [SIP 007](https://github.com/stacksgov/sips/blob/main/sips/sip-007/sip-007-stacking-consensus.md). | ||
|
|
||
| # Activation | ||
|
|
||
| This SIP requires are hard fork and shall be activated on Stacks 3.2 as defined by the SIP for epoch 3.2. | ||
|
friedger marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Appendix | ||
|
|
||
| [1] https://github.com/stacks-network/stacks-core/issues/4912 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.