Staking a Node

From xx network wiki
Jump to navigation Jump to search
This is a team contributed page

These instructions detail how to stake your Node on the xx network (MainNet).

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 it is possible that syncing happened very quickly. 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.

    If neither of these commands print the expected output, then xx chain is not yet syncing. Wait for it to begin syncing and try the commands 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 process is what associates your validator node with your controller account.

Once 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 and 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.

    If you get an error message such as {"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":1}, then the xx chain is not correctly running.

Generate Wallets

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 a wallet to use as both your stash and controller accounts. Wallet generation should not be done on your Node. It can be done on your personal computer or a more secure system. Please note that you will only need an internet connection to download the binaries; however, we recommend disabling your computer's internet connection before generating any wallets. For extra security, you may wish to use an air-gapped computer.

When generating the wallet, you will generate a quantum-secure mnemonic phrase, a standard mnemonic phrase, and a wallet address.

You will see the quantum-secure mnemonic phrase and standard mnemonic phrase go by different names such as phrase, recovery phrase, and sleeve mnemonic. However, note that you will have two phrases, each made of 24 individual words; one is quantum-secure and the other is not.
  1. Follow the instructions for Using the Wallet Generator on this wiki or check out the MainNet Wallet Generator webpage for the newest updates.

  2. You should now have a quantum-secure mnemonic phrase, standard mnemonic phrase, and wallet address.

Make sure to save the quantum-secure mnemonic phrase and standard mnemonic phrase in a safe, secure, and private location. Loss of these phrases will render your wallet inaccessible. Save the wallet address in a safe place; however, this can be regenerated from the phrases.

Bond and Validate

The instructions below describe how to stake your Node and become a validator using the xx wallet. 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 and the Node's cMix ID, so it is recommended that you SSH into your Node or copy the session key file session-keys.json and the Node's ID file cmix-IDF.json to a flash drive.

Add Account

Below, you will be adding the account that you have previously created using the wallet generator tool. First, make sure the account has at least enough funds to pay the fees for making transactions.

  1. Follow the instructions to Add an Account to the xx Explorer.

  2. Once the account is created, you should see it on the my accounts page.

    My account page in the explorer.

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 getting SSH connection information, 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.

Set Up Validator

  1. In the navigation menu, go to Network and in the drop-down menu, click on Staking. Or navigate to https://wallet.xx.network/#/staking.

    Staking button in navigation.
  2. The Staking Overview page will open.

    1. Click on Account actions in the submenu.

    2. 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. For the stash account, select your account from the drop-down menu.

    2. For the controller account, select the same account from the drop-down menu.

    3. Enter a bond amount. It must be at least 14.0000 kxx.

      If you are in the MainNet Transition Program, then you must stake the apropreate amount to get your comission and multiplier. For example, to get a commission of ≈10% and be staked with ≈350k team coins, you will need a stake of 100,000 xx on your node. Also, please be aware that you cannot increase your team multiplier in the future, so make sure to set it correctly now.
    4. Copy and paste the hex formatted cMix ID found in Get Session Keys and cMix ID.

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

    Setup validator window.
  4. On the next page, you will enter the session key 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. 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.

    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://wallet.xx.network/#/staking/waiting.

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

    List of waiting validators.
  3. In the navigation submenu, click on the Overview button or navigate to https://wallet.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.