Based on https://guide.kusama.network/docs/en/mirror-maintain-guides-how-to-validate-kusama Started in late April 2021
Mission: Hoping to get into the Kusama network so I can build enough credibility to run a Polkadot validator on bare metal. I believe Parity Labs will compound their efforts into something quite valuable and want to be a part of it, or the web3 foundation work. Rust/WASM is also killer combination and want to learn as much as I can about coding in those languages, so I’m studying Substrate as well.
Lab using a remote hosted machine running XenServer. I was running a Paper Minecraft node on this particular VM, which I shut down for this project. I was previously running a Filecoin node here but as configured was never going to earn FIL so I shut it down once I learned about that system (Lotus reference implementation).
Current VM configuration: 12 - 2.2GHz CPU’s; 12GB RAM; 512GB Storage (CPU’s are configured dual-core, I think).
I’m hoping I don’t have to reinstall the OS, as the docs recommend Ubuntu 18.0.4
$ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" $ rustup update $ mkdir kusama $ cd kusama ~/kusama$ la ~/kusama$ sudo apt install make clang pkg-config libssl-dev build-essential
No Errors. Now proceed with installation of the Polkadot binary.
Polkadot checkout: v0.8.30 ~/kusama/polkadot$ git checkout v0.8.30 ~/kusama/polkadot$ ./scripts/init.sh -- three warnings ~/kusama/polkadot$ cargo build --release [...snip] Compiling kusama-runtime v0.8.30 (/home/ken/kusama/polkadot/runtime/kusama) Compiling polkadot-service v0.8.30 (/home/ken/kusama/polkadot/node/service) error: could not compile `polkadot-service` Caused by: process didn't exit successfully: `rustc --crate-name polkadot_service [...big long command...]
Error compiling the final binaries! 1046/1049. Doh! Documentation recommends downgrading the rustup nightly’s to 2020-05-15 if you run into compile errors.
~/kusama/polkadot$ rustup install nightly-2020-05-15 ~/kusama/polkadot$ rustup override set nightly-2020-05-15 ~/kusama/polkadot$ rustup target add wasm32-unknown-unknown --toolchain nightly-2020-05-15 ~/kusama/polkadot$ cargo build --release -- four errors about 'while', 'if', and 'match' not allowed -- in a 'const fn' For more information about this error, try `rustc --explain E0658`.
Here’s the result from the recommendation regarding E0658:
If you're using a stable or a beta version of rustc, you won't be able to use any unstable features. In order to do so, please switch to a nightly version of rustc (by using rustup).
Hmm, seems like rolling back to the 5/15 nightly didn’t work. Removed the override with ‘~/kusama/polkadot$ rustup override unset’ and run again. Back to same error and unsure what is breaking. I’m reminded that my Ubuntu version does not match the documentation :-(
Did some googling first, looks like this might be the ticket:
https://ask.csdn.net/questions/4553184
weixin_39559895 4月前
This means that you probably not have enough main memory for compiling the project. Add some swap to make it compile.
Back to work. Found these instructions https://bogdancornianu.com/change-swap-size-in-ubuntu/ and using them. Have to shut down Paper Minecraft first, as it was sucking up a lot of swap and making the process really slow (possibly impossible).
Updated swap to 4GB to see if that works. Will try 6GB next. Recompiling. Works! Moving past polkadot_service:
~/kusama/polkadot$ cargo build --release Compiling polkadot-service v0.8.30 (/home/ken/kusama/polkadot/node/service) ... Finished release [optimized] target(s) in 23.08s
Now that I think about it I probably should have just shut down Minecraft first, because there is 12GB of RAM on this VM and we may not even need to use the swap if the compile process can all run in memory without swapping. Hmm, nevermind! This compile simply uses a ton of memory:
Anyway, sweet. Back to the docs. Where were we? Synchronize Chain Data. Taking the defaults and running in archive mode.
The docs move from here into Bond KSM. This is how you stake your validator.
Next, installed the polkadot-js chrome extension and went to https://polkadot.js.org/apps/#/staking/actions Then went to my extensions and opened polkadot-js which prompted me to create an account. I succeeded, and then changed the website to the Kusama network rather than Polkadot. Finally I set the extension account to only use the Kusama network rather than ANY network, reloaded, and got into the account page.
I am now ready to go the “Network —> Staking” section as the documents prescribe. A warning on the staking page tells me to use “account actions” to create a new validator/nominator stash and bond it. “Do not send funds directly via a transfer to a validator".” Opening Account actions, there are options to create stash, which is where I go. I created two new accounts: stash and controller. Think of Stash as cold-wallet.
At this point I was a bit confused and also joined the discussion group on Element. It’s not readily searchable, but I was able to dig up some information that kept me moving forward. Turns out many admins run multiple validators with different controllers, some pay out to a parent stash and some keep them separate for redundancy (depends what fault you’re protecting).
Turns out the KSM faucet is now turned off, so I had to purchase KSM on my crypto exchange and transfer it to the chrome polkadot-js extension (like using MetaMask). I sent small amounts to both accounts and bonded 100MilliKSM to the controller as per the docs. After doing all that, it looks like I’m positioned properly:
I am now up to block #241849 in the sync process. Update: #1230269 after 10 hours. Nearly 48 hours later, proceeding smoothly so far, finalized block count ~7.3M so better than half way there. Disk usage so far ~63GB.
Finally sync’d! Using 274GB.
Instructions say to stop the syncing and re-run the node as a validator now. Named it ##xxxxxx.
$ ./target/release/polkadot --validator --name "name on network" --chain kusama
Sync…sync…syncing
Completed, and activated! Working through SSH tunnel. Now need to spend some time activating systemctl so it stays online. Note: when I first entered this into systemd I failed to set the User:Group and the blockchain started resyncing from the genesis block! Fortunately I added these elements to the [Service] block, reloaded the daemon and restarted, and the system found the already synced chain.
Set Session Keys
This is how we link the on-chain account set up in the polkadot.js app with the validator node and begin staking our validator. These instructions are quite good and I’m using them basically verbatim to set up.
A couple of notes about the configuration. I currently have a commision of 0.00%. It’s related to nominations and how much commission I charge people who want to stake on my validator. Will adjust it to 1% ASAP, let’s not be too generous :-)
The polkadot-js chrome plug in takes up a lot of RAM and has crashed my browser in the past, so I’m going to leave it shut down until I check back in a day or so. Letting the validator run in the background, hoping it grabs a slot (currently 900/900 validator slots filled). Timestamp: 05/17/2021 AM.
From the Kusama docs:
Kusama/Polkadot built the network to increase the probability of strength, participation and stability using nominated proof of stake (NPoS) and the “multi-winner election” Phragmen Method, and applied it to validator elections in order to:
Seems pretty well thought out! And the learning curve continues at a steep angle :-)
Update on Kusama Node
Turns out the code updated quite a bit in the time since I started syncing. I found this helpful video, describing the process. After checking Polkadot Repo, here’s what I ran.
# NOTE: I left Kusama running for the update :-p
#
$ git fetch # update git repo
$ git log # check HEAD to see current version
$ git checkout -f v0.9.1
$ cargo build --release
# Ugh, had to shut down the node to compile and still did not work
# Choked on polkadot-service again, high water: 100% of RAM and swap!
# Going downrev, to v0.9.0, the last high priority upgrade
$ git checkout -f v0.9.0
# Nope didn't work. Increasing RAM to 16GB did though!
# Also shifted to 1x8core vCPU setup from 12 cores, as it better
# aligns with underlying 2x8 CPU hardware.
#
# Now trying most recent version again.
$ git checkout -f v0.9.1
$ cargo build --release
# success!!
$ sudo systemctl daemon-reload
$ sudo systemctl start kusama-validator.service
Okay, now running v0.9.1 with fully synced node. I should probably change the commission rate above 0% but I can always do that when I decide to stake 50KSM.
Following this update Dan sent a reminder on Element/Discord:
Ran the update with UFW, no problem. Enabling IPV6 as well just in case.
Parachains!
Moving to version 0.9.2 and then 0.9.3 in order to support Parachain auctions came after a squirrely bug involving the failure of Polkadot nodes and downrev for safety around May 23rd. Details here, excellent transparency: https://bit.ly/34oPhqG The announcement is now missing from the Kusama discord but regardless I decided to move quickly to the new version rather than risk it. The downrev was not recommended on Kusama.
Rather than go through the recompile trial again, I’m grabbing the binary for version 0.9.3, which should have all the proper flags set. I borrowed this sequence from a contributor on Element whose name I can’t recall just now.
# Go ahead and update the repository
$ git fetch
$ git checkout v0.9.3 # Not sure I needed this!
$ sudo systemctl stop kusama-validator.service
$ cd target/release/
$ mv polkadot polkadot.0.9.2
$ wget https://github.com/paritytech/polkadot/releases/download/v0.9.3/polkadot
$ chmod 775 polkadot
$ ll
$ sudo systemctl daemon-reload
$ systemctl start kusama-validator.service && journalctl -f -u kusama-validator.service
Sweet. Confirmed, running 0.9.3. Note: I switched telemetry to the W3 sponsored one at: https://telemetry.w3f.community/#/Kusama Looks right.
Ready for Auctions. I’m going to wrap up this work log here. Can’t wait to see how statemine and auctions proceed. Also looking forward to buying more DOT if I can. Still can’t transfer DOT through the chain however, expect price to move around quite a bit more after that gets unlocked.
In the meantime, I’ve staked some KSM using both through nominating from my stash and creating a separate Kusama account as a Nominator and staking there. All using the Polkadot{js} browser extension for signing, etc.
Extension Crash! 2021-06-13
Back to publish a little scare regarding temporarily losing my accounts when my browser extensions inexplicably disappeared. All of them! Anyway, here are the notes from the recovery.
I found this help document and I'm hoping it works: https://support.polkadot.network/support/solutions/articles/65000169952-how-to-restore-your-account-in-polkadot-js-and-the-polkadot-js-browser-plugin
I'm performing these updates connected to the Parity hosted Kusama network.
Okay, following these instructions my primary stash seems to have been reattached. The contoller is not coming back in, and I'm worried it was pruned because it didn't have enough stake. Oh wait, after re-loading the stash account, now when I go to the "Staking --> Account actions" I see my stash and it seems to have pulled back in my controller account, including its balance. I should probably increase this balance so it won't get vaporized, once DOT can be transferred. Proof of wallet.
Note: this would probably have been easier had I reinstalled my browser extension rather than going through the polkadot.js webapp rather than the mnemonic reconstruction step.