Creating A Free Kovan Testnet Node On Azure — Step-by-Step Guide

Attores Pte Ltd
6 min readMay 15, 2017

--

Kovan is a new testnet for Ethereum using Parity’s Proof of Authority (PoA) consensus engine, with benefits over Ropsten:

  • Immune to spam attacks (as Ether supply is controlled by trusted parties)
  • Consistent 4 second block time

Kovan, a public Proof-of-Authority testnet, uses parity to provide a stable, secure testnet environment for Ethereum developers, due to the instability of the existing Ropsten testnet.

PoA is a replacement for PoW (Proof of Work), which can be used for both public and private chain setups. There is no mining involved to secure the network with PoA, and relies on trusted ‘Validators’ to ensure that valid transactions are added to blocks, processed and executed by the EVM faithfully.

Because mining does not occur on Kovan, malicious actors are prevented from acquiring testnet Ether, solving the spam attack that Ropsten faces.

You can use the Azure automated installation of Parity, however, that will cost almost $200 a month in total- above the free monthly resource level. So to get it for free, you will need to set it up manually.

Let’s create a Kovan testnet node on Azure.

Jump to:

A. Create a Ubuntu VM on Azure

B. Configure DNS

C. Setting up Kovan Testnet Node

Create Ubuntu VM on Azure

First, let’s create and set up new Ubuntu VM on Azure portal. If you don’t have a free Microsoft azure account, let’s create it. If you have an azure account, you can skip this section.

The application below will require a credit card and may be chargeable after the first month. Therefore, it’s recommended that you try to get a higher tier of usage using the Bizspark program or other developer signup pages such as:

https://azure.microsoft.com/en-us/offers/ms-azr-0064p/

Open Account on Azure:

  1. Go to https://azure.microsoft.com/free → Click on Start Free
Create free Azure account

2. Continue with account setup and provide the required info

Free trial sign up on Azure

3. Get your identity verified

Identity verification on azure

4. Once it’s done, agree to the terms and continue. Once the account is created, go to Portal in the menu.

Go to azure portal

You’ll be directed to Azure portal and dashboard.

Creating Ubuntu VM

  1. On dashboard, click on Create resources.
Create resources — azure

2. In search bar under New, search for ubuntu. You should see this:

Ubuntu 16.04 VM on azure

Choose Ubuntu Server 16.04 LTS

3. In ’Select a deployment model’ → Choose ‘Resource Manager’ and then Create.

4. Fill in the info:

Type in your password and make a note of it. We’ll need it later. Rest of the info can be the same as above.

5. Choose the size of the machine: Choose F1S machine with 1 core and 2 GB of memory which works well.

6. Configure optional settings: No need to change anything here. Azure configures it.

7. Done. The summary now is shown and our VM is created.

8. Our Ubuntu VM is created. Now Azure will deploy it for you.

Add firewall rules

We need to change the firewall rules for the setup.

We need to add 3 rules:

  • firewall rule for inbound 443 (SSL)
  • TCP listening port 30303
  • UDP port 30301
  1. On the portal, go to All Resources. You’ll see the list of resources currently in action.

Click on Add.

2. Search the marketplace for ‘Network Security Group’. Choose Network security group from the options.

3. Once it’s created, then go back to all resources again. Choose KovanTestnetSecurity. Under Settings → Inbound security rules.

4. There are no rules as of now. Click on ‘Add’.

Create first rule for SSL.

5. Create the similar rules for TCP listening port 30303 and UDP port 30301 (in advanced). Set the priorities as 100, 101, 102. Finally, add SSH to allow Any (default setting).

After adding all 4 rules, the Network Security Group — Inbound security rules should look like this:

6. We now need apply these rules to our Kovan network. In the same window of Network Security Group → go to Subnets.

Click on ‘Associate’.

Choose virtual network.

Choose the subnet.

Okay, good so far? Now let’s configure the DNS.

Configure DNS (optional, for RPC usage)

Use A name, pointing the subdomain to the IP address of the VM.

Go to your DNS manager on dashboard (The domain name you’ve bought from e.g. GoDaddy or Namecheap)

Create ‘A’ record. Point it to the IP address of the VM. Write the subdoamin you want in ‘Host’.

Running Parity — Setting up RPC Node

  1. Connect to VM via SSH
    For linux / Mac OSX, go to terminal and type:
    On windows, install PuTTy. (Download PuTTy). Put the Hostname (e.g. ssh <name>@<vm ip address> with port 22 which is the port for SSH)
ssh <name>@<vm ip address>

2. Install and start Parity:

bash <(curl https://get.parity.io -Lk)

a. It’ll ask to install parity → say ‘Yes’

b. It’ll ask to download and install netstats client → say ‘no’

tmuxparity --chain=kovan --jsonrpc-hosts=all

3. Exit tmux with [ctrl + b], then d.

To attach it again:
tmux attach -t 0

(not needed at the moment, just in case you want to watch the node running)

You are now running Parity on your Azure node!

Parity node on azure

— — -

For RPC Usage

— — -

Get SSL certificate

sudo apt-get install letsencrypt
sudo letsencrypt certonly --standalone -d <subdomain>.<domain>.com

Nginx Configs

sudo apt-get install nginx

Use the default /etc/nginx/nginx.conf

Edit /etc/nginx/sites-enabled/default

server {  listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/<subdomain>.<domain>.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<subdomain>.<domain>.com/privkey.pem;
server_name _; location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Content-Type application/json;
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Max-Age 600;
add_header Content-Type 'text/plain charset=UTF-8';
add_header Content-Length 0;
return 204;
}
proxy_pass http://localhost:8545;
}
}

Start nginx

sudo service nginx start # or `restart`

Get Kovan Testnet Ether (KETH)

That’s all. RPC node for Kovan is now set up on Azure Ubuntu VM.

--

--