diff --git a/404.html b/404.html index acce0398..6db1f961 100644 --- a/404.html +++ b/404.html @@ -10,7 +10,7 @@ - +
diff --git a/api/index.html b/api/index.html index 6db038c4..bbbb6438 100644 --- a/api/index.html +++ b/api/index.html @@ -10,7 +10,7 @@ - + diff --git a/assets/js/5ee72a4b.faa65b99.js b/assets/js/5ee72a4b.9cc9c36a.js similarity index 50% rename from assets/js/5ee72a4b.faa65b99.js rename to assets/js/5ee72a4b.9cc9c36a.js index c3414f1d..0763407d 100644 --- a/assets/js/5ee72a4b.faa65b99.js +++ b/assets/js/5ee72a4b.9cc9c36a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbee_docs=self.webpackChunkbee_docs||[]).push([[1628],{17489:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>h});var t=s(74848),o=s(28453);const i={title:"Staking",id:"staking"},r=void 0,a={id:"bee/working-with-bee/staking",title:"Staking",description:"In order to participate in the redistribution of xBZZ from uploaders to storers, storers must first deposit a non-refundable xBZZ stake with a smart contract. Then, they are going to be chosen for payout with a probability proportional to their stake in their neighborhood, as long as they can log storing the part of the content that they are supposed to be storing according to protocol rules.",source:"@site/docs/bee/working-with-bee/staking.md",sourceDirName:"bee/working-with-bee",slug:"/bee/working-with-bee/staking",permalink:"/docs/bee/working-with-bee/staking",draft:!1,unlisted:!1,editUrl:"https://github.com/ethersphere/docs.github.io/blob/master/docs/bee/working-with-bee/staking.md",tags:[],version:"current",frontMatter:{title:"Staking",id:"staking"},sidebar:"bee",previous:{title:"Swarm CLI",permalink:"/docs/bee/working-with-bee/swarm-cli"},next:{title:"Cashing Out",permalink:"/docs/bee/working-with-bee/cashing-out"}},d={},h=[{value:"Add stake",id:"add-stake",level:2},{value:"Check redistribution status",id:"check-redistribution-status",level:2},{value:"Partial Stake Withdrawals",id:"partial-stake-withdrawals",level:2},{value:"Check for withdrawable stake",id:"check-for-withdrawable-stake",level:3},{value:"Withdraw available stake",id:"withdraw-available-stake",level:3},{value:"Reserve Doubling",id:"reserve-doubling",level:2},{value:"Step by Step Guide",id:"step-by-step-guide",level:3},{value:"Step 1: Stake at least 20 xBZZ",id:"step-1-stake-at-least-20-xbzz",level:4},{value:"Step 2: Setreserve-capacity-doubling
to 1
.",id:"step-2-set-reserve-capacity-doubling-to-1",level:4},{value:"Step 3: Restart node",id:"step-3-restart-node",level:4},{value:"Reserve Doubling Reversing & Withdrawable Stake",id:"reserve-doubling-reversing--withdrawable-stake",level:3},{value:"How to free up withdrawable stake from a node with >= 20 xBZZ stake that currently has zero withdrawable stake:",id:"how-to-free-up-withdrawable-stake-from-a-node-with--20-xbzz-stake-that-currently-has-zero-withdrawable-stake",level:4},{value:"Maximize rewards",id:"maximize-rewards",level:2},{value:"Neighborhood selection",id:"neighborhood-selection",level:3},{value:"Stake density",id:"stake-density",level:3},{value:"Neighborhood Hopping",id:"neighborhood-hopping",level:2},{value:"Checking neighborhood population",id:"checking-neighborhood-population",level:3},{value:"Troubleshooting",id:"troubleshooting",level:2},{value:"Frozen node",id:"frozen-node",level:3},{value:"Check frozen status",id:"check-frozen-status",level:4},{value:"Diagnosing freezing issues",id:"diagnosing-freezing-issues",level:4},{value:"Repairing corrupt reserve",id:"repairing-corrupt-reserve",level:3},{value:"Node occupies unusually large space on disk",id:"node-occupies-unusually-large-space-on-disk",level:3},{value:"Node not participating in redistribution",id:"node-not-participating-in-redistribution",level:3},{value:"Run sampler process to benchmark performance",id:"run-sampler-process-to-benchmark-performance",level:4}];function c(e){const n={a:"a",admonition:"admonition",annotation:"annotation",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",math:"math",mdxAdmonitionTitle:"mdxAdmonitionTitle",mn:"mn",mo:"mo",mrow:"mrow",msup:"msup",mtext:"mtext",ol:"ol",p:"p",pre:"pre",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.p,{children:"In order to participate in the redistribution of xBZZ from uploaders to storers, storers must first deposit a non-refundable xBZZ stake with a smart contract. Then, they are going to be chosen for payout with a probability proportional to their stake in their neighborhood, as long as they can log storing the part of the content that they are supposed to be storing according to protocol rules."}),"\n",(0,t.jsx)(n.p,{children:"In order to participate in redistribution, storers need to do the following:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Join the network and download all the data that the protocol assigns to them. They can only participate if they are fully synchronised with the network."}),"\n",(0,t.jsx)(n.li,{children:"Deposit a stake with the staking contract. There is a minimum staking requirement, presently 10 xBZZ. It can change in the future."}),"\n",(0,t.jsx)(n.li,{children:"Stay online and fully synced, so that when a redistribution round comes, their node can check whether their neighborhood (nodes that are assigned the same content to store) has been selected and if so, they can perform a certain calculation (a random sampling) on their content and submit the result to the redistribution contract. This happens in two phases (commit and reveal), so that the nodes cannot know the results of others\u2019 calculations when committing to their own."}),"\n",(0,t.jsx)(n.li,{children:"Round length is estimated around 15 minutes (152 blocks to be precise), though it can be extended."}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"Amongst the nodes that agree with the correct result, one is chosen \u2014 with a probability in proportion to their stake \u2014 as the winner. The winner must execute an on-chain transaction claiming their reward, which is the entire pot of storage rent paid since the previous round, or even more, if the previous pot has not been claimed at that time."}),"\n",(0,t.jsx)(n.h2,{id:"add-stake",children:"Add stake"}),"\n",(0,t.jsx)(n.p,{children:"Bee has builtin endpoints for depositing the stake. Currently the minimum staking requirement is 10 xBZZ, so make sure that there is enough tokens in the node's wallet and you must have some native token as well for paying the gas."}),"\n",(0,t.jsxs)(n.p,{children:["Then you can run the following command to stake 10 xBZZ. The amount is given in PLUR which is the smallest denomination of xBZZ and ",(0,t.jsx)(n.code,{children:"1 xBZZ == 1e16 PLUR"}),"."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl -X POST localhost:1633/stake/100000000000000000\n"})}),"\n",(0,t.jsx)(n.p,{children:"If the command executed successfully it returns a transaction hash that you can use to verify on a block explorer."}),"\n",(0,t.jsx)(n.p,{children:"It is possible to deposit more by repeatedly using the command above."}),"\n",(0,t.jsx)(n.p,{children:"You can also check the amount staked with the following command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl localhost:1633/stake\n"})}),"\n",(0,t.jsx)(n.h2,{id:"check-redistribution-status",children:"Check redistribution status"}),"\n",(0,t.jsxs)(n.p,{children:["Use the ",(0,t.jsx)("a",{href:"/api/#tag/RedistributionState",target:"_blank",rel:"noopener noreferrer",children:"RedistributionState"})," endpoint of the API to get more information about the redistribution status of the node."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl -X GET http://localhost:1633/redistributionstate | jq\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{ \n "minimumFunds": "18750000000000000",\n "hasSufficientFunds": true,\n "isFrozen": false,\n "isFullySynced": true,\n "phase": "commit",\n "round": 176319,\n "lastWonRound": 176024,\n "lastPlayedRound": 176182,\n "lastFrozenRound": 0,\n "block": 26800488,\n "reward": "10479124611072000",\n "fees": "30166618102500000"\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:'"minimumFunds": reserve-capacity-doubling
to 1
.",id:"step-2-set-reserve-capacity-doubling-to-1",level:4},{value:"Step 3: Restart node",id:"step-3-restart-node",level:4},{value:"Reserve Doubling Reversing & Withdrawable Stake",id:"reserve-doubling-reversing--withdrawable-stake",level:3},{value:"How to free up withdrawable stake from a node with >= 20 xBZZ stake that currently has zero withdrawable stake:",id:"how-to-free-up-withdrawable-stake-from-a-node-with--20-xbzz-stake-that-currently-has-zero-withdrawable-stake",level:4},{value:"Maximize rewards",id:"maximize-rewards",level:2},{value:"Neighborhood selection",id:"neighborhood-selection",level:3},{value:"Stake density",id:"stake-density",level:3},{value:"Neighborhood Hopping",id:"neighborhood-hopping",level:2},{value:"Checking neighborhood population",id:"checking-neighborhood-population",level:3},{value:"Troubleshooting",id:"troubleshooting",level:2},{value:"Frozen node",id:"frozen-node",level:3},{value:"Check frozen status",id:"check-frozen-status",level:4},{value:"Diagnosing freezing issues",id:"diagnosing-freezing-issues",level:4},{value:"Repairing corrupt reserve",id:"repairing-corrupt-reserve",level:3},{value:"Node occupies unusually large space on disk",id:"node-occupies-unusually-large-space-on-disk",level:3},{value:"Node not participating in redistribution",id:"node-not-participating-in-redistribution",level:3},{value:"Run sampler process to benchmark performance",id:"run-sampler-process-to-benchmark-performance",level:4}];function c(e){const n={a:"a",admonition:"admonition",annotation:"annotation",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",math:"math",mdxAdmonitionTitle:"mdxAdmonitionTitle",mn:"mn",mo:"mo",mrow:"mrow",msup:"msup",mtext:"mtext",ol:"ol",p:"p",pre:"pre",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.p,{children:"In order to participate in the redistribution of xBZZ from uploaders to storers, storers must first deposit a non-refundable xBZZ stake with a smart contract. Then, they are going to be chosen for payout with a probability proportional to their stake in their neighborhood, as long as they can log storing the part of the content that they are supposed to be storing according to protocol rules."}),"\n",(0,t.jsx)(n.p,{children:"In order to participate in redistribution, storers need to do the following:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Join the network and download all the data that the protocol assigns to them. They can only participate if they are fully synchronised with the network."}),"\n",(0,t.jsx)(n.li,{children:"Deposit a stake with the staking contract. There is a minimum staking requirement, presently 10 xBZZ. It can change in the future."}),"\n",(0,t.jsx)(n.li,{children:"Stay online and fully synced, so that when a redistribution round comes, their node can check whether their neighborhood (nodes that are assigned the same content to store) has been selected and if so, they can perform a certain calculation (a random sampling) on their content and submit the result to the redistribution contract. This happens in two phases (commit and reveal), so that the nodes cannot know the results of others\u2019 calculations when committing to their own."}),"\n",(0,t.jsx)(n.li,{children:"Round length is estimated around 15 minutes (152 blocks to be precise), though it can be extended."}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"Amongst the nodes that agree with the correct result, one is chosen \u2014 with a probability in proportion to their stake \u2014 as the winner. The winner must execute an on-chain transaction claiming their reward, which is the entire pot of storage rent paid since the previous round, or even more, if the previous pot has not been claimed at that time."}),"\n",(0,t.jsx)(n.h2,{id:"add-stake",children:"Add stake"}),"\n",(0,t.jsx)(n.p,{children:"Bee has builtin endpoints for depositing the stake. Currently the minimum staking requirement is 10 xBZZ, so make sure that there is enough tokens in the node's wallet and you must have some native token as well for paying the gas."}),"\n",(0,t.jsxs)(n.p,{children:["Then you can run the following command to stake 10 xBZZ. The amount is given in PLUR which is the smallest denomination of xBZZ and ",(0,t.jsx)(n.code,{children:"1 xBZZ == 1e16 PLUR"}),"."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl -X POST localhost:1633/stake/100000000000000000\n"})}),"\n",(0,t.jsx)(n.p,{children:"If the command executed successfully it returns a transaction hash that you can use to verify on a block explorer."}),"\n",(0,t.jsx)(n.p,{children:"It is possible to deposit more by repeatedly using the command above."}),"\n",(0,t.jsx)(n.p,{children:"You can also check the amount staked with the following command:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl localhost:1633/stake\n"})}),"\n",(0,t.jsx)(n.h2,{id:"check-redistribution-status",children:"Check redistribution status"}),"\n",(0,t.jsxs)(n.p,{children:["Use the ",(0,t.jsx)("a",{href:"/api/#tag/RedistributionState",target:"_blank",rel:"noopener noreferrer",children:"RedistributionState"})," endpoint of the API to get more information about the redistribution status of the node."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-bash",children:"curl -X GET http://localhost:1633/redistributionstate | jq\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{ \n "minimumFunds": "18750000000000000",\n "hasSufficientFunds": true,\n "isFrozen": false,\n "isFullySynced": true,\n "phase": "commit",\n "round": 176319,\n "lastWonRound": 176024,\n "lastPlayedRound": 176182,\n "lastFrozenRound": 0,\n "block": 26800488,\n "reward": "10479124611072000",\n "fees": "30166618102500000"\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:'"minimumFunds": Stake density determines the weighted chances of nodes within a neighborhood of winning rewards. The chance of winning within a neighborhood corresponds to stake density. Stake density can be increased by depositing more xBZZ as stake (note that stake withdrawals are not currently possible, so any staked xBZZ is not currently recoverable).
Generally speaking, the minimum required stake of 10 xBZZ is sufficient, and rewards can be better maximized by operating more nodes over a greater range of neighborhoods rather than increasing stake. However this may not be true for all node operators depending on how many different neighborhoods they operate nodes in, and it also may change as network dynamics continue to evolve (join the #node-operators
Discord channel to stay up to date with the latest discussions about staking and network dynamics).
While you may update your neighborhood freely as you wish, it takes significant time for to fully sync chunks and become eligible for playing in the redistribution game, so it is not advised to hop too frequently.
You can use the option target-neighborhood
to switch your node over to a new neighborhood. You may wish to use this option if your node's neighborhood becomes overpopulated.
There is a 2 round delay (with 152 Gnosis Chain blocks per redistribution game round) every time a node's neighborhood or stake is changed before it can participate in the redistribution game, moreover a node must fully sync the chunks from its new neighborhood before it can participate in the redistribution game, so hopping too frequently is not advised.
You can use the config option target-neighborhood
to switch your node over to a new neighborhood. You may wish to use this option if your node's neighborhood becomes overpopulated.
For a quick check of your node's neighborhood population, we can use the /status
endpoint:
curl -s http://localhost:1633/status | jq
{
"peer": "e7b5c1aac67693268fdec98d097a8ccee1aabcf58e26c4512ea888256d0e6dff",
"proximity": 0,
"beeMode": "full",
"reserveSize": 1055543,
"reserveSizeWithinRadius": 1039749,
"pullsyncRate": 42.67013868148148,
"storageRadius": 11,
"connectedPeers": 140,
"neighborhoodSize": 6,
"batchCommitment": 74463051776,
"isReachable": false
}
{"neighborhood":"01100011110"}
Use the binary number you just copied and set it as a string value for the target-neighborhood
option in your config.
## bee.yaml
target-neighborhood: "01100011110"
Depending on your setup, you may need change the target-neighborhood
option by updating your bee.yaml
file, adding the --target-neighborhood
command line flag, or edit a .env
file, among several possible common options.
In this section we cover several commonly seen issues encountered for staking nodes participating in the redistribution game. If you don't see your issue covered here or require additional guidance, check out the #node-operators
Discord channel where you will find support from other node operators and community members.