Skip to content

Commit 5725bff

Browse files
committed
add staking page
1 parent 506dc4c commit 5725bff

File tree

2 files changed

+97
-7
lines changed

2 files changed

+97
-7
lines changed

docs/documentation/staking.md

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,104 @@ slug: /staking
55
sidebar_label: Staking
66
---
77

8-
## 🚧 Under Construction 🚧
9-
:::caution 🚧 This page is under construction
108

11-
This section is still being worked on. Check back soon for updates!
9+
Operating a Bee full node and staking BZZ makes you eligible to participate in the redistribution game — a mechanism for earning additional BZZ through by sharing disk space with the Swarm network. This guide shows how to use `bee-js` to deposit stake and check your node's staking status.
1210

11+
12+
:::danger
13+
⚠️ **Important:** Staked BZZ is **non-refundable** — once deposited, it **cannot be withdrawn**.
14+
:::
15+
16+
17+
:::info
18+
Currently, `bee-js` supports depositing stake and checking staking status, but does **not yet support** advanced features like [partial stake withdrawals](https://docs.ethswarm.org/docs/bee/working-with-bee/staking#partial-stake-withdrawals) or [reserve doubling](https://docs.ethswarm.org/docs/bee/working-with-bee/staking#reserve-doubling).
19+
20+
21+
For a complete guide to the requirements and configuration for staking, refer to the [Bee documentation](https://docs.ethswarm.org/docs/bee/working-with-bee/staking).
1322
:::
1423

1524

16-
* Get staked xBZZ
17-
* Stake xBZZ
18-
* Get redistribution state
25+
26+
27+
28+
## Stake BZZ
29+
30+
To stake, use the `depositStake` method provided by `bee-js`. It accepts a value in PLUR, the smallest unit of BZZ (like wei in Ethereum). The `BZZ` utility class simplifies conversion from decimal string to PLUR.
31+
32+
```js
33+
import { Bee, BZZ } from '@ethersphere/bee-js'
34+
35+
const bee = new Bee('http://localhost:1633')
36+
37+
async function main() {
38+
39+
// Convert 10 BZZ to PLUR
40+
const amount = BZZ.fromDecimalString('10')
41+
42+
const txHash = await bee.depositStake(amount)
43+
console.log('Stake deposited. Transaction hash:', txHash.toHex())
44+
}
45+
46+
main().catch(console.error)
47+
```
48+
49+
Example output:
50+
51+
```bash
52+
Stake deposited. Transaction hash: e1b86eebc54b465d84ab278da94a387e9786076557ab8f3fe04ba1b52dc065c8
53+
```
54+
A successful staking transaction will return the transaction hash which you can look up on a blockchain explorer like [Gnosisscan](https://gnosisscan.io/tx/0xe1b86eebc54b465d84ab278da94a387e9786076557ab8f3fe04ba1b52dc065c8).
55+
56+
## Check Staking Status
57+
58+
After staking, you can confirm the deposited amount and monitor your node’s participation in the redistribution game:
59+
60+
```js
61+
import { Bee } from '@ethersphere/bee-js'
62+
63+
const bee = new Bee('http://localhost:1633')
64+
65+
async function main() {
66+
const stake = await bee.getStake()
67+
const redistributionState = await bee.getRedistributionState()
68+
69+
console.log('Current staked amount:', stake.toDecimalString(), 'BZZ')
70+
console.log('\nRedistribution State:')
71+
console.log(JSON.stringify(redistributionState, null, 2))
72+
}
73+
74+
main().catch(console.error)
75+
```
76+
77+
Example output:
78+
79+
```bash
80+
Current staked amount: 10.0000000000000001 BZZ
81+
82+
Redistribution State:
83+
{
84+
"minimumGasFunds": {
85+
"state": "274506772500000"
86+
},
87+
"hasSufficientFunds": true,
88+
"isFrozen": false,
89+
"isFullySynced": true,
90+
"phase": "claim",
91+
"round": 261311,
92+
"lastWonRound": 0,
93+
"lastPlayedRound": 0,
94+
"lastFrozenRound": 0,
95+
"lastSelectedRound": 0,
96+
"lastSampleDurationSeconds": 0,
97+
"block": 39719372,
98+
"reward": {
99+
"state": "0"
100+
},
101+
"fees": {
102+
"state": "0"
103+
},
104+
"isHealthy": true
105+
}
106+
```
107+
108+
For details on interpreting these values, refer to the [staking status section](https://docs.ethswarm.org/docs/bee/working-with-bee/staking#check-status) of the Bee documentation.

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
'documentation/upload-download',
1414
'documentation/tracking-uploads',
1515
'documentation/pinning',
16-
// 'documentation/staking',
16+
'documentation/staking',
1717
// 'documentation/manifests',
1818
// 'documentation/soc-and-feeds',
1919
// 'documentation/pss',

0 commit comments

Comments
 (0)