Staking a Node

From xx network wiki
Revision as of 17:06, 15 October 2021 by Anne (talk | contribs) (Protected "Staking a Node" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Jump to navigation Jump to search
This is a team contributed page

These instructions detail how to stake your Node.

Follow these instructions on your xx chain validator. In most cases, this is your Node machine.

Before Starting

Before installing the software, make sure that:

  1. You have followed the Node Set Up instructions
  2. Your Node machine is on, connected to the internet, and accessible.

Checking if the Node is Ready

Before you can stake your Node, you need to make sure the xx chain software is syncing and that the cMix software is waiting for consensus.

  1. First, check that the xx chain software is syncing by checking the log file chain.log. Use grep to find the correct line.

    If xx chain is syncing, you will see an output that looks similar to the following example.

    If nothing is printed, then xx chain is not yet syncing. Wait for it to begin syncing and try the command above again.

  2. Next, check that the cMix Wrapper Script is waiting for consensus by checking the log file cmix-wrapper.log.

    If cMix is waiting for consensus, then you will see an output similar to the following example.

    If nothing is printed, then the Wrapper Script is not ready yet. Wait for the Wrapper Script to run for a few seconds and try the command above again.

Set Session Keys

When staking your Node in later steps, you need to tell the chain your Session keys by signing and submitting an extrinsic. This is what associates your validator node with your controller account on the Praxxis Network.

Once ensuring that you have connected to your Node, the easiest way to set session keys for your Node is by calling the author_rotateKeys RPC request to create new keys in your validator's keystore.

  1. First, use curl to call the RPC request. This will save the output of the call to /opt/xxnetwork/cred/session-keys.json.

  2. The output will be a JSON file with a "result" field with the concatenation of the hex encoding of four public keys, similar to the example below.

    You can use cat /opt/xxnetwork/cred/session-keys.json to see the file.

Generate Accounts

If you are transitioning from BetaNeta to MainNet, then use the wallet you already generated and sent to the team in the MainNet Transition Application or the ProtoNet Application as the stash wallet.

Before staking your Node, you need to generate stash and controller accounts. It is highly recommended that you make your stash and controller accounts be two separate accounts. This should be done on your personal computer with access to a web browser. Please note that you will only need an internet connection to download the binaries. We recommend disabling your computer's internet connection before generating any wallets.

For each account, you will generate a wallet mnemonic phrase, a non-quantum secure wallet mnemonic phrase.

  1. Follow the Using the Wallet Generator instructions.

  2. You should now have a sleeve wallet mnemonic phrase, a non-quantum secure wallet mnemonic phrase, and a wallet address. Save these in a safe and secure place. This is your stash account.

  3. Relaunch the tool to generate a sleeve wallet mnemonic phrase, a non-quantum secure wallet mnemonic phrase, and a wallet address for the controller account.

Make sure to save the sleeve wallet mnemonic phrase, non-quantum secure wallet mnemonic phrase, and wallet address for both accounts in a safe and secure place.

Bond and Validate

The instructions below describe how to stake your Node and become a validator using the xx network Explorer. These instructions require a web browser, so you will most likely do this on a separate machine from your Node. Note, you will need to copy the session keys retrieved in Set Session Keys, so it is recommended that you SSH into your Node or copy the session key file session-keys.json to a flash drive.

Add Accounts

Below, you will be adding the accounts you have previously created using the Sleeve Wallet Generator Tool. Make sure each of them has at least enough funds to pay the fees for making transactions. Keep most of your funds in the stash account since it is meant to be the custodian of your staking funds.

  1. Follow the instructions to Add Account to Explorer and do so for your stash account.

  2. Repeat the instructions to Add Account to Explorer but do so with you controller account.

  3. Once both accounts are created, you should see them in the my accounts page.

    Newly create stash and controller account on the my account page.

Get Session Keys and cMix ID

To set up a validator, you need two pieces of information from your Node machine: the session key generated above and the cMix ID generated when setting up cMix. There are several methods to copy these values to your personal computer; however, the easiest way is to SSH into the Node.

  1. Open the terminal on your personal computer.

  2. From the terminal on your personal machine, connect to the Node machine. For details on connecting, refer to Get SSH Connection Info.

    Terminal
  3. Print the session keys JSON file.

    Terminal

    The value associated with the "result" field is the session key.

    Terminal
  4. Next, print the cMix ID to the console.

    Terminal

    The cMix ID needed is the "hexNodeID".

    Terminal
  5. Either copy both values to a location on your computer or leave the console open so you can copy these values when setting up a validator.

Transfer Coins to Controller

This step is only required if you are transitioning from BetaNet to MainNet. Skip to Set Up Validator if you are joining MainNet for the first time.
  1. From the xx network portal, click on Accounts in the top menu and then click Transfer.

    Transfer button on menu.
  2. The send funds window will appear.

    1. Select your stash account. This is the account that will send the coins.

    2. Select your controller account. This is the account that will receive the coins.

    3. Set the amount to transfer. For now, put 100.

    4. This is the number of coins that an account needs to have to exist.

    5. Select the Make Transfer button.

    Send funds window.
  3. The next window will authorize the transaction.

    1. Click here to see transaction details like the destination and amount.

    2. These are the fees that will be applied to the submission.

    3. Double check the wallet address to make sure it is correct. The transaction must be sent from your stash account.

    4. Unlock the account with your password so the transaction can be signed.

    5. By default, Do not include tip for the block author is selected. You can add a tip to raise the transaction priority.

    6. This transaction's call hash.

    7. Make sure the Sign and Submit toggle Explorer Sign and Submit toggle.svg is selected.

    8. Click on the Sign and Submit button Explorer Sign and Submit button.svg.

    The authorize transaction window when sending coins.
  4. Your controller account should now have 100 coins.

Set Up Validator

  1. In the navigation menu, go to Network and click on Staking. Or navigate to https://explorer.xx.network/#/staking.

    Staking button in navigation.
  2. Next, click on Account actions in the submenu. Then click the Validator button Validator button on the Account actions page..

    Click on account actions and then add validator.
  3. The setup validator window will open.

    1. Select your stash account from the dropdown menu. Make sure that the address shown to the right matches your stash account wallet address.

    2. Select your controller account from the dropdown menu. Make sure that the address shown to the right matches your controller account wallet address.

    3. Enter a bond amount. It must be at least 5000.

    4. Then, click the Next button Next Button.svg.

    Setup validator window.
  4. On the next page, you will enter the session key and cMix ID found above. You will also select the reward commission percentage.

    1. Copy and paste the session key found in Get Session Keys and cMix ID

    2. Choose a percentage reward commission percentage (value between 0 and 100). We recommend a value under 10 percent if you want users of the network to nominate your validator.

    3. Select whether to allow new nominations or not. We highly recommend you always allow users of the network to nominate your validator.

    4. Copy and paste the hex formatted cMix ID found in Get Session Keys and cMix ID.

    5. Then, click on the Bond & Validate button Explorer Bond & Validate button.svg.

    Setup Validator page 2 of 2.
  5. The next page is for authorizing the transaction.

    1. These are the fees that will be applied to the submission.

    2. Double check the wallet address to make sure it is correct. The transaction must be sent from your stash account.

    3. Unlock the account with your password so the transaction can be signed.

    4. By default, Do not include tip for the block author is selected. You can add a tip to raise the transaction priority.

    5. This transaction's call hash.

    6. Make sure the Sign and Submit toggle Explorer Sign and Submit toggle.svg is selected.

    7. Click on the Sign and Submit button Explorer Sign and Submit button.svg.

    Authorize transaction window.
  6. You should see these notifications in the top right corner indicating the action was successful.

    Notifications for transaction action.

Wait to Be Elected

  1. In the navigation submenu, click on the Waiting button or navigate to https://explorer.xx.network/#/staking/waiting.

    Waiting navigation submenu.
  2. You should see your stash account in the waiting validators list.

    List of waiting validators.
  3. In the navigation submenu, click on the Overview button or navigate to https://explorer.xx.network/#/staking.

    Overview button on the navigation submenu.
  4. In the top right corner is a timer showing the length of an era and the age of the current era.

    Timer that tells the age of the era.
  5. Once the era ends, your validator should be chosen and show up in the validator list.

    List of validators in the explorer.
  6. You can check the xx chain log file chain.log to see if your Node is synced.

    Your Node is synced if you see lines that say Imported #... and Idle... as shown below

    Press Ctrl+C to exit tail.