Deploy NKN Full Node from AWS Marketplace

[2020 Update] this article is obsoleted by the latest tutorial on “Deploying NKN Commercial on AWS Marketplace”

*** Begin Obsolete info ***
Deploying and joining the NKN network is as simple as a few clicks.

To create a One-Click NKN Full Node:

  1. navigate to the AWS Marketplace listing for NKN Full Node and click “Continue to Subscribe”

  1. On the next page choose “Accept Terms”. Once the “Accept Terms” is complete you will see an effective date showing today’s date. Next, Choose “Continue to Configure”.

  1. On the next page you can select the region you would like to deploy the node from the drop down menu. Once the region is selected, choose “Continue to Launch”.

  1. On the next page choose “Launch from Website” from the Choose Action drop down menu, Choose “t2.micro” from the EC2 Instance Type drop down menu.

For Security Group settings, click on the button labeled, “Create New Based on Seller Settings”

Enter a name for the security group and description and then click the Save button.

Next, choose a key pair from the Key Pair Settings drop down menu or create a new key pair.

NOTE: You can use the key pair to help login to the instance later if needed. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html for more information.

To create a key pair, follow the link called, “Create a key pair in EC2” located shown just below the Select a key pair drop down menu. On the next page, click the button, “Create a Key Pair”.

A window will popup. Choose a name for your key pair and select Create.

The new key pair will now be listed as an available key pair and a file of the same name will automatically download.

For Apple Safari Users: The resulting file will initially come with .pem.txt extension, you can remove the .txt so it will end with a .pem extension. Y

For Google Chrome Users: The file downloaded with have the correct .pem extension.

You also need to change the attributes of the key file using the following command: chmod 400 KEY_PAIR_FILE

Example: chmod 400 nkn_node_keypair.pem

Now go back to the “Continue to Launch” page and make sure and select the new key pair you just created from the drop down menu.

  1. Click Launch

After Launch

After the instance is created, nknd (NKN daemon) will be launched automatically by supervisor under user nkn, and your instance will join the NKN relay network without any further configurations.

Once the node has been started you can check the status using any of these methods:

  • Use community built webtool Mainnet node check — You just need the public IP address of your VM in order to check its status.

  • Command line tool nknc from a remote computer. You can download the latest nknc release and use the command ./nknc — ip YOUR_NODE_IP_ADDRESS info -s to view the status of your node.

  • Command line tool nknc from within the VM. The tool nknc is already installed and located in the directory /home/nkn/go/src/github.com/nknorg/nkn . You can use the command ./nknc info -s to view the status of your node. For additional commands, type ./nknc — help

A NKN wallet and password will be generated automatically when the node is started the first time. Two files will be created under the directory /home/nkn/go/src/github.com/nknorg/nkn named wallet.json and wallet.pswd respectively. Please take care to protect and back up both of these files since they are needed to access and control your account.

Backup NKN Wallet

In order to backup your wallet.json and wallet.pswd files, you need to use the following steps:

1.) Using your chosen key pair, login to the NKN Full Node instance you have created on AWS. From your favorite terminal (PuTTy, OSX terminal, etc.) run the following command: ssh -i KEY_PAIR_FILE ubuntu@AWS_VM_PUBLIC_ADDRESS

KEY_PAIR_FILE is the key pair file downloaded when you created your key pair on AWS. If you uploaded your ssh’s default pubkey (e.g. ~/.ssh/id_rsa.pub), you can ignore the -i argument and simply use ssh ubuntu@AWS_VM_PUBLIC_ADDRESS

AWS_VM_PUBLIC_ADDRESS is the public address of the VM running NKN Full Node, which you can find from your EC2 console.

Example: ssh -i nkn_node_keypair.pem ubuntu@ec2–1–2–3–4.compute-1.amazonaws.com

2.) Once you are logged in as ubuntu, change directory to the nkn directory where wallet.json and wallet.pswd files are located:

cd /home/nkn/go/src/github.com/nknorg/nkn/

3.) Copy and paste the contents of wallet.json and wallet.pswd files to a txt file on your local computer as backup using the following commands:

sudo cat wallet.json
sudo cat wallet.pswd

Example:

ubuntu@ip-172–31–6–239:/home/nkn/go/src/github.com/nknorg/nkn$ sudo cat wallet.json

{“PasswordHash”:”473cf1faffbfbca01f23ca81f8a6b22c977088121cbe243755aa53fb26780e24",”IV”:”0953e70e6acebec746ac6321a52efb87",”MasterKey”:”08695141d3ea038abf62be56025e4021128048fdbc589fe956ad8f07b939305b”,”Version”:”0.0.1",”Address”:”NKNCNDETCtf6N3s4L94FtfJoNYJJmxFZtx”,”ProgramHash”:”65caca2efbcc9e820e63fc8745425ac4f22c5e92",”PrivateKeyEncrypted”:”ff5387b1ba322275123b7479c43449ff24b3e86bca5359a0dbbe472a1b3e422e”,”ContractData”:”232102d8a0488e21064b49a8bf67f4c2c0cad67f8e84c3f6c9295e38177437fbd3932fac010065caca2efbcc9e820e63fc8745425ac4f22c5e92"}ubuntu@ip-172–31–6–239:/home/nkn/go/src/github.com/nknorg/nkn$

ubuntu@ip-172–31–6–239:/home/nkn/go/src/github.com/nknorg/nkn$ sudo cat wallet.pswd

fqRTYLValQeYDZpz/HubONc3ipi2sE53

Using your favorite text editor, copy the entire contents of wallet.json starting from and including the open bracket “{“ to the closed bracket “}” to a txt file called wallet.json. You might need to remove unnecessary line breaks between lines, so everything is one continuous paragraph.

Next copy the entire contents of wallet.pswd to a text file called wallet.pswd on your local machine.

To test if they are correct, please use https://testnet.nkn.org/wallet/open to open backed-up wallet.json and password. You now have backed up both wallet.json and wallet.pswd from your NKN Full Node!.

Next Steps

For more information on NKN Full Node, please visit our Github. You can use the NKN network to transmit any data from peer to peer using nkn-client-js or other NKN client implementations. You can also transfer NKN tokens using either the NKN Official Wallet or nknx.

Please join the NKN Discord group or visit the NKN Forum for more technical support and discussions.

Advanced Users

For more advanced users that would like to launch a NKN Full Node on AWS using a pre-existing NKN wallet, visit Deploy NKN Full Node on AWS Advanced Option