Skip to content

Commit

Permalink
Wiki Reorg: Unify Maintain Nominate Pages (#5677)
Browse files Browse the repository at this point in the history
* transferred content

- to polkadot page
- to JS guides

* rm kusama maintain guide nominate

* fix broken link

* fix broken links

* migrated more content to JS guides

* final edits
  • Loading branch information
filippoweb3 authored Mar 13, 2024
1 parent 4a40f66 commit 984be22
Show file tree
Hide file tree
Showing 8 changed files with 216 additions and 374 deletions.
6 changes: 3 additions & 3 deletions docs/general/kusama/kusama-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ nominating), governance, parachain auctions, basic transfers and everything else

<div className="row">
<div className="col text--center">
<a href="../docs/maintain-guides-how-to-nominate-kusama/">
<a href="../docs/maintain-guides-how-to-nominate-polkadot/">
<img src="/img/kusama-guide/Nominate.png" width="350" style={{ borderRadius: 10, border: '1px solid slategrey' }} />
</a>
<p>
<a href="../docs/maintain-guides-how-to-nominate-kusama/">Become a Nominator</a>
<a href="../docs/maintain-guides-how-to-nominate-polkadot/">Become a Nominator</a>
</p>
</div>
<div className="col text--center">
Expand Down Expand Up @@ -212,5 +212,5 @@ Additional Resources:
- [endpoints](maintain-endpoints)
- [tokens](https://claim.kusama.network/)
- [validator](../../maintain/kusama/maintain-guides-how-to-validate-kusama.md)
- [nominator](../../maintain/kusama/maintain-guides-how-to-nominate-kusama.md)
- [nominator](../../maintain/maintain-guides-how-to-nominate-polkadot.md)
- [polkadot wiki](https://wiki.polkadot.network/)
196 changes: 196 additions & 0 deletions docs/learn/learn-guides-staking.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,117 @@ import RPC from "./../../components/RPC-Connection";

See [this page](./learn-staking.md) to learn about staking.

## Nominate Using Polkadot-JS

:::info Using Polkadot-JS UI as a Nominator

Here is the list of basic nominator actions that can be performed using the Polkadot-JS UI.

- [How to Bond Tokens and Nominate](https://support.polkadot.network/support/solutions/articles/65000168057-polkadot-js-ui-how-do-i-stake-nominate-on-polkadot-)
- [How to Select Validators](https://support.polkadot.network/support/solutions/articles/65000150130-how-do-i-know-which-validators-to-choose-)
- [How to Stop Nominating & Unbond Tokens](https://support.polkadot.network/support/solutions/articles/65000167902-how-can-i-unstake-my-tokens-again-)
- [How to Rebond Tokens](https://support.polkadot.network/support/solutions/articles/65000170241-polkadot-js-ui-how-to-rebond-tokens-during-the-unbonding-period)

:::

:::info Video Tutorials

- [How to Nominate/Stake](https://youtu.be/FCXC0CDhyS4?t=219)
- [Staking with a Ledger and Polkadot-JS](https://youtu.be/7VlTncHCGPc)
- [Staking with a Ledger and Ledger Live](https://www.youtube.com/watch?v=jL-N_IWiYVA)

:::

### Step 1: Bond your tokens

On the [Polkadot-JS UI](https://polkadot.js.org/apps) navigate to the "Staking" tab (within the
"Network" menu).

The "Staking Overview" subsection will show you all the active validators and their information -
their identities, the amount of KSM that are staking for them, amount that is their own provided
stake, how much they charge in commission, the era points they've earned in the current era, and the
last block number that they produced. If you click on the chart button it will take you to the
"Validator Stats" page for that validator that shows you more detailed and historical information
about the validator's stake, rewards and slashes.

The "Account actions" subsection ([link](https://polkadot.js.org/apps/#/staking/actions)) allows you
to stake and nominate.

The "Payouts" subsection ([link](https://polkadot.js.org/apps/#/staking/payouts)) allows you to
claim rewards from staking.

The "Targets" subsection ([link](https://polkadot.js.org/apps/#/staking/targets)) will help you
estimate your earnings and this is where it's good to start picking favorites.

The "Waiting" subsection ([link](https://polkadot.js.org/apps/#/staking/waiting)) lists all pending
validators that are awaiting more nominations to enter the active validator set. Validators will
stay in the waiting queue until they have enough KSM backing them (as allocated through the
[Phragmén election mechanism](./learn-phragmen.md)). It is possible validator can remain in the
queue for a very long time if they never get enough backing.

The "Validator Stats" subsection ([link](https://polkadot.js.org/apps/#/staking/query)) allows you
to query a validator's stash address and see historical charts on era points, elected stake,
rewards, and slashes.

Pick "Account actions" underneath "Network" > "Staking", then click the "+ Nominator" button.

You will see a modal window that looks like the below:

![nominator-update-1](../assets/kusama/kusama_nominator_popup.png)

Select a "value bonded" that is **less** than the total amount of KSM you have, so you have some
left over to pay transaction fees. Transaction fees are currently at least 0.01 KSM, but they are
dynamic based on a variety of factors including the load of recent blocks.

Also be mindful of the reaping threshold - the amount that must remain in an account lest it be
burned. That amount is 0.01 in Kusama, so it's recommended to keep at least 0.1 KSM in your account
to be on the safe side.

Choose whatever payment destination that makes sense to you. If you're unsure, you can choose "Stash
account (increase amount at stake)" to simply accrue the rewards into the amount you're staking and
earn compound interest.

![Payout account selection dropdown with the custom account option highlighted](../assets/payout/01.png)

:::note Explainer video on using the Polkadot-JS UI

These concepts have been further explained in Polkadot's
[UI Walkthrough Video](https://www.youtube.com/watch?v=mNStMPZjiHM&list=PLOyWqupZ-WGuAuS00rK-pebTMAOxW41W8)

:::

### Step 2: Nominate a validator

You are now bonded. Being bonded means your tokens are locked and could be
[slashed](./learn-staking.md#slashing) if the validators you nominate misbehave. All bonded funds
can now be distributed to up to {{ polkadot: 16 :polkadot }} {{ kusama: 24 :kusama }} validators. Be
careful about the validators you choose since you will be slashed if your validator commits an
offence.

Click on "Nominate" on an account you've bonded and you will be presented with another popup asking
you to select some validators.

![Nominating validators](../assets/kusama/kusama_nominator_selection.png)

Select them, confirm the transaction, and you're done - you are now nominating. Your nominations
will become active in the next era. Eras last six hours on Kusama - depending on when you do this,
your nominations may become active almost immediately, or you may have to wait almost the entire six
hours before your nominations are active. You can check how far along Kusama is in the current era
on the [Staking page](https://polkadot.js.org/apps/#/staking).

Assuming at least one of your nominations ends up in the active validator set, you will start to get
rewards allocated to you. In order to claim them (i.e., add them to your account), you must manually
claim them. To initiate a claim, you can do it yourself or have the validator that you staked for
initiate a claim. This is to help optimize the effectiveness and storage of payouts on Kusama. See
the [Claiming Rewards](./learn-staking.md#claiming-rewards) section of the Staking wiki page for
more details.

### Step 3: Stop nominating

At some point, you might decide to stop nominating one or more validators. You can always change who
you're nominating, but you cannot withdraw your tokens unless you unbond them. Detailed instructions
are available [here](../maintain/maintain-guides-how-to-nominate-polkadot.md).

## Claiming Rewards with Polkadot-JS

Anyone can trigger a payout for any validator, as long as they are willing to pay the transaction
Expand Down Expand Up @@ -48,3 +159,88 @@ Once you are done with payout, another screen will appear asking for you to sign
transaction.

![transaction-payouts](../assets/polkadotjs_payout_complete.png)

## Using Command-Line Interface (CLI)

Apart from using the Polkadot-JS UI to participate in the staking, you can do all these things in
CLI instead. The CLI approach allows you to interact with the
{{ polkadot: Polkadot :polkadot }}{{ kusama: Kusama :kusama }} network without using Polkadot-JS.

### Step 1: Install @polkadot/api-cli

We assume you have installed [NodeJS with npm](https://nodejs.org). Run the following command to
install the `@polkadot/api-cli` globally:

```bash
npm install -g @polkadot/api-cli
```

### Step 2. Bond Tokens

:::info Controller accounts are deprecated

Controller accounts are deprecated. For more information, see
[this discussion](https://forum.polkadot.network/t/staking-controller-deprecation-plan-staking-ui-leads-comms/2748).

:::

Executing the following command:

```bash
polkadot-js-api --seed "MNEMONIC_PHRASE" tx.staking.bond CONTROLLER_ADDRESS NUMBER_OF_TOKENS REWARD_DESTINATION --ws WEBSOCKET_ENDPOINT
```

`CONTROLLER_ADDRESS`: An address you would like to bond to the stash account. (Controller accounts
are now deprecated. Refer to
[this discussion](https://forum.polkadot.network/t/staking-controller-deprecation-plan-staking-ui-leads-comms/2748)
for additional context)

`NUMBER_OF_TOKENS`: The number of {{ polkadot: DOT :polkadot }}{{ kusama: KSM :kusama }} you would
like to stake to the network.
{{ polkadot: DOT has ten decimal places and is always represented as an integer with zeroes at the end. So 1 DOT = 10_000_000_000 Plancks. :polkadot }}{{ kusama: KSM has twelve decimal places and is always represented as an integer with zeroes at the end. So 1 KSM =
1_000_000_000_000 Plancks. :kusama }} For more information, see [this page](../learn/learn-DOT.md).

`REWARD_DESTINATION`:

- `Staked` - Pay into the stash account, increasing the amount at stake accordingly.
- `Stash` - Pay into the stash account, not increasing the amount at stake.
- `Account` - Pay into a custom account, like so:
{{ polkadot: `Account 1n8msHozaNxHicWFnRnNXzvqkYPWczkzUUkHhKw6o2BLBdo` :polkadot }}{{ kusama: `Account DMTHrNcmA8QbqRS4rBq8LXn8ipyczFoNMb1X4cY2WD9tdBX` :kusama }}.
- `Controller` - Pay into the controller account.

Example for Kusama:

```bash
polkadot-js-api --seed "xxxx xxxxx xxxx xxxxx" tx.staking.bond DMTHrNcmA8QbqRS4rBq8LXn8ipyczFoNMb1X4cY2WD9tdBX 1000000000000 Staked --ws wss://kusama-rpc.polkadot.io
```

For wss endpoints see [this page](../maintain/maintain-endpoints.md).

Result:

```bash
...
...
"status": {
"InBlock": "0x0ed1ec0ba69564e8f98958d69f826adef895b5617366a32a3aa384290e98514e"
}
```

You can check the transaction status by using the value of the `InBlock` in
[Subscan](https://www.subscan.io/). Also, you can verify the bonding state under the
[Staking](https://polkadot.js.org/apps/#/staking/actions) page on the Polkadot-JS UI.

### Step 3. Nominate a validator

To nominate a validator, you can execute the following command:

```bash
polkadot-js-api --seed "MNEMONIC_PHRASE" tx.staking.nominate '["VALIDATOR_ADDRESS"]' --ws WS_ENDPOINT
```

```bash
polkadot-js-api --seed "xxxx xxxxx xxxx xxxxx" tx.staking.nominate '["CmD9vaMYoiKe7HiFnfkftwvhKbxN9bhyjcDrfFRGbifJEG8","E457XaKbj2yTB2URy8N4UuzmyuFRkcdxYs67UvSgVr7HyFb"]' --ws wss://kusama-rpc.polkadot.io
```

After a few seconds, you should see the hash of the transaction, and if you would like to verify the
nomination status, you can check that on the Polkadot-JS UI as well.
5 changes: 3 additions & 2 deletions docs/learn/learn-staking.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,11 @@ is receiving rewards.

:::

:::info
:::info Bags List & Minimum Active Bond

You can find information about why you might not receive staking rewards on
[this support page](https://support.polkadot.network/support/solutions/articles/65000170805-why-am-i-not-getting-staking-rewards-).
[this support page](https://support.polkadot.network/support/solutions/articles/65000170805-why-am-i-not-getting-staking-rewards-)
and [this video tutorial](https://youtu.be/hIIZRJLrBZA).

:::

Expand Down
Loading

0 comments on commit 984be22

Please sign in to comment.