Join The Revolution

How to Become a Validator (Node Runner) on the SwapDEX Testnet

How to Become a Validator (Node Runner) on the SwapDEX Testnet

Network validators are the foundation of a decentralized proof-of-stake network because they are responsible for concluding on a consensus by creating new and validating already produced blocks. Running a validator can also be very rewarding, knowing that you contribute to the security of a decentralized network while growing your stash through rewards.

For technical information on our project, chain, slashing, tokenomics, etc please visit our website.

The following guide will teach you how to set up a Testnet Validator. Also known as ‘running a node’. The process of becoming a validator requires three steps:

  1. Create 2 substrate accounts and get funding into them.
  2. Set up a network node.
  3. Assign your node to your substrate account and apply for validator candidacy.

Running a validator on a live network is a lot of responsibility! You will be accountable for your stake and the stake of your current nominators. If you make a mistake or your validator has problems, you may be slashed. Slashing is a like a yellow card in football or a penalty in ice hockey. If you are slashed, your validator is unable to validate transactions and you do not receive rewards. Your money and your reputation will be at risk.

. . .

The Process to Become a Validator

Create Two Substrate Accounts

1. Download Pokadot.js browser extension for Chrome, Firefox or Brave.
2. Inside the extension, create an account — that you will use as a Stash account. You can name it whatever you like.

3. Create a second account that you will use as a Controller account. You can name it whatever you like. Stash and Controller accounts are not special account types. They are only differentiated by the way we will use them in substrate chain.


The purpose of keeping the Stash Account and Controller Account on separate addresses is security. Your Stash Account will have most of your tokens and the power to move them. Your Controller Account will have other useful powers, like nominating validators. But your Controller Account can’t move your tokens out of your Stash Account. You will rarely need to touch your Stash Account after you bonded and selected the Controller Account. Instead, frequently you will use your Controller Account. You then expose more the Controller Account and keep the Stash Account safe. If something happens to your Controller Account, you may change it from your Stash Account.

Benefits from using separated addresses for Stash Account and Controller Account

The most important benefit is that if someone uncovers your Controller Account’s seed, they can’t move your funds out of the Stash Account.

For example: Suppose you Staked 100 TSDX. You put the 100 TSDX on an address that you choose to be your Stash Account. On another address, for your Controller Account, you kept few TSDX to pay transaction fees. After you bonded and started staking, you now don’t need to touch your Stash Account frequently. Suppose now that you are on a trip far from your trusted computer/device that you used to stake. You then want to change your validators (maybe because they increased the rewards commission). For that, you may want to use a friend’s computer (or even the hotel’s computer). You can do this without inserting your Stash Account seed on it! You can change validators just using your Controller Account. Even if the computer has a virus, and your Controller Account seed is compromised, a hacker couldn’t steal your Stash Account funds. Therefore, the Stash Account and Controller Account work together as a feature for increasing security.

4. Request Funding. Place your Stash Account’s address in the #polkadot-wallet-addresses channel of our Discord server and we will send substrate test coins (TSDX) to use. When we launch on mainnet, you will be able to bridge your coins between the Ethereum Virtual Machine (EVM) and the Substrate (polkadot wallet) sides of the chain.

5. Verify that you have received the coins (why hello there Captain Moneyswagger!).

. . .

Prepare your Virtual Private Server (VPS)

There is no requirement to be a Validator through a VPS, however the vast majority if people will use a VPS for the Validators so our guide will focus on the process of setting up a Validator on a VPS.

Server Specs

The bare minimum specs recommended are 6GB ram, 60 GB Storage, 2 CPU, stable server uplink connection with a fixed IP.

Operating System should be Ubuntu 21.04 or higher.

As the chain gains mainstream popularity, these specs may not be sufficient in the long-term, especially the storage. Ideally, the better the specs, the better the performance of your Validator so we strongly recommend going with specs above the bare minimum.

Log in to your VPS and get ready to set up your node.

The Code

This is a list of all commands you need to type into your VPS terminal, setup the testnet node and start the sync process. Copy the commands starting at 1, as is. The last command has some text that you can update.

					sudo apt-get update
sudo apt-get install ntp
sudo apt install chrony
sudo systemctl enable chrony
curl -fsSL -o && sh
docker run -d -p 8545:8545 --restart always starkleytech/swapdex:0.0.1 swapdex --port "30333" --name "Swapdex 1" --validator --chain phoenix --rpc-port=8545 --rpc-cors all --rpc-methods unsafe --ws-external --rpc-external
. . .

Generate Session Keys

The session key (rotateKeys field) is required in the process of bonding (staking) your TSDX in your node in order to become a Validator.

Execute the following command in your VPS terminal:

					curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:8545

Copy the session key (rotateKey). It will look something like this:

Copy the session key from your terminal window and have it on your computer ready to use in the next step (or be like the writer of this article and access your VPS through a terminal that does not allow copying and pasting and have to record the 258 character session key manually!).

Session keys can be generated as often as you like without any downside for the system or the network. Just make sure that the latest generated session key matches with the session key you put into the substrate testnet explorer.

. . .

Optional Security Measures

You can skip this step, however we recommend installing a firewall and fail2ban to assist with the security of your node. To do this, enter the following commands:

					sudo ufw allow 22
sudo ufw allow 30333
sudo ufw allow 8545
sudo ufw enable
sudo apt install -y fail2ban && sudo systemctl enable fail2ban && sudo service fail2ban start
. . .

Apply on Testnet Explorer

1. Visit the subsrate testnet explorer

2. Transfer a small amount of TSDX from your Stash Account to your Controller Account
-> Go to the Network Tab -> Staking -> Account Actions

3. Hit the + Validator Button

4. Fill in the form 1/2

5. Value Bonded is the number of coins you wish to stake

6. For the moment, choose the stash account as payment destination. Once our chain is live, the other options will be good to select.

7. Choose next

For mainnet, we strongly recommend having a different stash account to your controller account for added security, but for testnet there should not be any issues using the same account for each.

Page 2/2

– Paste the session key in the Keys from rotateKeys field

– Enter the commission you intend to retain before the remainder of the rewards are split with nominators (stakers) on your node

  • Sign the transaction in your Polkadot wallet
  • Visit the Waiting Tab to see your validator waiting until the era finishes (up to 18 hours)
  • Start generating those sweet sweet rewards!
. . .

Troubleshooting Commands

The following commands can assist you to determine if all is running smoothly with your node.

Check if your Node Syncs

Get CONTAINER ID by inputting:

					docker ps
Example output from docker ps command

Check your logs by inputting:

					sudo docker logs [Container ID]
Example of logs once node has become an active Validator