Staking a Node
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:
- You have followed the Node Set Up instructions
- 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.
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 #...
andIdle...
as shown belowPress 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.
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.
First, use
curl
to call the RPC request and save the output of the call to /opt/xxnetwork/cred/session-keys.json.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 usecat /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
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.
Follow the instructions for Using the Wallet Generator on this wiki or check out the MainNet Wallet Generator webpage for the newest updates.
You should now have a quantum-secure mnemonic phrase, standard mnemonic phrase, and wallet address.
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.
Follow the instructions to Add an Account to the xx Explorer.
Once the account is created, you should see it on the my accounts 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.
Open the terminal on your personal computer.
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.Print the session keys JSON file.
The value associated with the
"result"
field is the session key.Next, print the cMix ID to the console.
The cMix ID needed is the
"hexNodeID"
.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
In the navigation menu, go to Network and in the drop-down menu, click on Staking. Or navigate to https://wallet.xx.network/#/staking.
The Staking Overview page will open.
Click on Account actions in the submenu.
Then click the Validator button
.
The setup validator window will open.
For the stash account, select your account from the drop-down menu.
For the controller account, select the same account from the drop-down menu.
Enter a bond amount. It must be at least 1,000 xx.
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.Copy and paste the hex formatted cMix ID found in Get Session Keys and cMix ID.
Then, click the Next button
.
On the next page, you will enter the session key found above. You will also select the reward commission percentage.
Copy and paste the session key found in Get Session Keys and cMix ID
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.
Select whether to allow new nominations or not. We highly recommend you always allow users of the network to nominate your validator.
Then, click on the Bond & Validate button
.
The next page is for authorizing the transaction.
These are the fees that will be applied to the submission.
Double-check the wallet address to make sure it is correct.
Unlock the account with your password so the transaction can be signed.
By default, Do not include tip for the block author is selected. You can add a tip to raise the transaction priority.
This transaction's call hash.
Make sure the Sign and Submit toggle
is selected.
Click on the Sign and Submit button
.
You should see these notifications in the top right corner indicating the action was successful.
Wait to Be Elected
In the navigation submenu, click on the Waiting button or navigate to https://wallet.xx.network/#/staking/waiting.
You should see your account in the waiting validators list.
In the navigation submenu, click on the Overview button or navigate to https://wallet.xx.network/#/staking.
In the top right corner is a timer showing the length of an era and the age of the current era.
Once the era ends, your validator should be chosen and show up in the validator list.
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 #...
andIdle...
as shown belowPress Ctrl+C to exit tail.