Skip to content
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

feat: add overview of staking #131

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: Check editorconfig
steps:
- uses: actions/checkout@v4
- run: pip install editorconfig-checker=="2.7.3"
- run: pip install editorconfig-checker=="2.7.3" --break-system-packages
- run: ec

markdownlint:
Expand Down
28 changes: 27 additions & 1 deletion docs/usage/stake.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# Stake and Unstake
# Staking

In Walrus, anyone can delegate stake to storage nodes and, by doing so, influence, which storage
nodes get selected for the committee in future epochs, and how many shards these nodes will hold.
Shards are assigned to storage nodes every epoch, roughly proportional to the amount of stake
that was delegated to them. By staking with a storage node, users also earn rewards, as they
will receive a share of the storage fees.

Since moving shards from one storage node to another requires transferring a lot of data and
storage nodes potentially need to expand their storage capacity, the selection of the committee
for the next epoch is done ahead of time, in the middle of the previous epoch. This provides
sufficient time to storage node operators to provision additional resources, if needed.

For stake to affect the shard distribution in epoch `e` and become "active", it must be staked
before the committee for this epoch has been selected, meaning that it has to be staked before
the midpoint of epoch `e - 1`. If it is staked after that point in time, it will only influence
the committee selection for epoch `e + 1` and thus only become active, and accrue rewards, in
that epoch.

Unstaking has a similar delay: because unstaking funds only has an effect on the committee in
the next committee selection, the stake will remain active until that committee takes over.
This means that, to unstake at the start of epoch `e`, the user needs to "request withdrawal"
before the midpoint of epoch `e - 1`. Otherwise, i.e., if the user unstakes after this point,
the stake will remain active, and continue to accrue rewards, throughout epoch `e`, and the
balance and rewards will be available to withdraw at the start of epoch `e + 1`.

## How to stake

<!-- TODO -->

Expand Down