Guide: Launch your Denali node with AWS from A to Z

Hello everyone!

This tutorial shows you step-by-step how to launch a node on the AVA Denali network, using AWS.
You can use this guide for other VPS providers as well.

1 — Amazon Web Service

First of all, you will have to log in or create an account on AWS if you don’t have one. The registration is fast.

Once you’re logged in, you will see your “AWS Management Console” dashboard.
To create your VPS, click on the menu tab at the top left “Services->EC2”.

You are now on the EC2 Dashboard. You’ll need to create an instance; click “Instances”.

Click on “ Launch instance

Select the version “Ubuntu Server 18.04 LTS (HVM), SSD Volume Type”

The technical recommendations for a Denali node are :

Minimum hardware requirements:

  • CPU: 2 GHz
  • RAM: 3 GB
  • Storage: 250 MB free space

Recommended hardware:

  • CPU: > 2 GHz
  • RAM: > 3 GB
  • Storage: > 5 GB free space on SSD

Select type “t2.medium” for an optimal configuration. Then click on “Review and Launch”.

Double check the specifications of your instance:

  • CPU : 2 vCPU
  • RAM : 4 GB
  • Storage : 8 GB SSD

Now click on “Launch

For remote connection, it’s recommended to create a new “key pair”. Create one and download it. Only then, click on ‘launch instances’.

You created your instance, congrats!
The next step is to connect to it. For that, we suggest you to download “Putty”, an SSH and telnet client.

Click on the ID of your instance to access the dashboard of instances.

Once on the dashboard of instances, right click on the row of your instance → Connect

You have all the information on how to connect to your AWS instance here: https://docs.aws.amazon.com/console/ec2/instances/connect/putty

2 — Bootstrap

Once your putty is configured to connect to your Amazon instance via SSH, it looks like this.
Your default login is: ubuntu

You’ll need to update ubuntu to the latest version.

sudo apt-get update

You’ll now install Go.

wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz

Use tar to extract the archive to the /usr/local directory:

sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz

In order for the system to know where to find the Go executable binaries, you need to adjust the $PATH environment variable.
You can do this by appending the following line to the /etc/profile file (for a system-wide installation) or the $HOME/.profile file (for a current user installation):

export PATH=$PATH:/usr/local/go/bin

Save the file, and load the new PATH environment variable into the current shell session:

source ~/.profile

Verify the installation by printing the Go version

go version

You should see the following result

Go install

You can now install Gecko.
As this is a new installation, you’ll need to install the following libraries:

sudo apt-get install libssl-dev libuv1-dev cmake make curl g++

You’ll also need to install git:

sudo apt install git

And clone the Gecko repository:

go get -v -d github.com/ava-labs/gecko/...

You will see a screen that looks like this. Give it a few minutes to download all the necessary files from the Gecko directory.

Now you have to access the right directory:

cd go/src/github.com/ava-labs/gecko

The script below will load some files; it will take a few minutes to download and compile the required file.

./scripts/build.sh

If your installation was successful, you will see this:

You will now launch the node and connect it to AVA, so the node can run for the entire period of time needed for the testnet incentive.
You will use the “nohup” command to keep your node active after closing the Putty terminal at the end of this guide.

nohup ./build/ava &

You will see this:

To check that the bootstrap is running properly, you can read the process logs ./build/ava with the following command:

tail -f nohup.out

Here are the bootstrap logs of our node:

Wait a few minutes so your node will synchronize with the AVA network. Press Ctrl+C to exit bootstrap logs.

To make sure that the ./build/ava process is still running in the background, you can execute the following command:

ps -ef

You should find ./build/ava in the list of running processes.

For the following part the credit goes to Avalabs and Collin Cusce for their amazing work.

3 — Stake your AVA

In order to become a validator, a user must be created. The following API call will create a user with the username and password we specify.

curl -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "keystore.createUser",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore

Now that we have an account, we need to create an address on the X-Chain. This address will receive AVA from the faucet

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :2,
"method" :"avm.createAddress",
"params" :{
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X

This will return a response as follows, which contains the address we just created. We’ll need to jot down our X-Chain address as we’ll use it in later steps.

{
"jsonrpc": "2.0",
"result": {
"address": "YOUR X-CHAIN ADDRESS"
},
"id": 1
}

We also must create an account on the P-Chain using our user.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.createAccount",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

This returns the P-Chain account. We must jot this down as well, since we’ll use it in later steps.

{
"jsonrpc": "2.0",
"result": {
"address": "YOUR P-CHAIN ADDRESS"
},
"id": 1
}

Alright! Now we have some accounts, let’s put some funds in them. To start, we’re going to get some funds from the AVA Testnet Faucet. We put our X-Chain address into the form, confirm we’re human, and request 20,000 nAVA (nano-AVA).

https://faucet.ava.network/

These funds should arrive in under 2 seconds. To verify that the funds are in our address, call the following function, replacing “YOUR X-CHAIN ADDRESS HERE” with the X-Chain address provided to the faucet.

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :7,
"method" :"avm.getBalance",
"params" :{
"address":"YOUR X-CHAIN ADDRESS HERE",
"assetID" :"AVA"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X

We will see the following response, confirming that we have received our AVA.

{
"jsonrpc":"2.0",
"id" :2,
"result" :{
"balance":20000
}
}

We’re funded! Now time to do something with it. To do this, we’re going to put AVA from our X-Chain onto our P-Chain. The P-Chain controls all staker accounts and validator sets. It is where platform coordination occurs, and like the X-Chain, it is run by default across all nodes on the AVA platform.

The API call “exportAVA” begins a procedure on the local node to sign a transaction that can, in one step, transfer funds from the X-Chain to the P-Chain across the network. This is an atomic swap and every node will conduct it. Be sure to use the P-Chain address created in Step 1, not the X-Chain address. We’re going to send the Denali minimum staking amount — 10,000 nAVA — to the P-Chain so that we can validate on the network.

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.exportAVA",
"params" :{
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD",
"to":"YOUR PLATFORM ADDRESS HERE",
"amount": 10000
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X

This will return a TxID in the response. We do not need to retain this TxID and it can be ignored.

The next step is to accept this transfer on the P-Chain. To do this, we must pass our P-Chain address to the “importAVA” method on the P-Chain, indicating that we’re accepting any AVA sent to this address.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.importAVA",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD",
"to":"YOUR PLATFORM ADDRESS HERE",
"payerNonce":1
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

This will return a string representing a transaction.

{
"jsonrpc": "2.0",
"result": {
"tx": "1117xBwcr5fo1Ch4umyzjYgnuoFhSwBHdMCam2wRe8SxcJJvQRKSmufXM8aSqKaDmX4TjvzPaUbSn33TAQsbZDhzcHEGviuthncY5VQfUJogyMoFGXUtu3M8NbwNhrYtmSRkFdmN4w933janKvJYKNnsDMvMkmasxrFj8fQxE6Ej8eyU2Jqj2gnTxU2WD3NusFNKmPfgJs8DRCWgYyJVodnGvT43hovggVaWHHD8yYi9WJ64pLCvtCcEYkQeEeA5NE8eTxPtWJrwSMTciHHVdHMpxdVAY6Ptr2rMcYSacr8TZzw59XJfbQT4R6DCsHYQAPJAUfDNeX2JuiBk9xonfKmGcJcGXwdJZ3QrvHHHfHCeuxqS13AfU"
},
"id": 1
}

We will take the resulting transaction and issue it to the P-Chain from the API call “issueTx”.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.issueTx",
"params": {
"tx":"THE ISSUE TRANSFER TX HERE"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

That should be it! The P-Chain should have sufficient funds to stake and participate as a validator in the Denali testnet. To verify, we call “getAccount” on the P-Chain and verify the balance.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getAccount",
"params":{
"address":"YOUR PLATFORM ADDRESS HERE"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

4 — Validation

Success! Now that we have funds on the P-Chain, we’re ready to register to become a validator on the network. Each node has a “nodeID” which is used to uniquely identify the node on the network. In order to become a validator, we need to commit this nodeID to be the node that does the work. The first thing to do, is to get our nodeID and jot it down so we can use it later.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "admin.getNodeID",
"params":{},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin

The next step is to build a transaction that adds our nodeID to the network. In the below example, we’re putting a start time of 5 minutes from now, and we’re ending on June 15th at 11:59pm GMT.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.addDefaultSubnetValidator",
"params": {
"id":"YOUR NODEID HERE",
"payerNonce":2,
"destination":"YOUR PLATFORM ADDRESS HERE",
"startTime":'$(date --date="15 minutes" +%s)',
"endTime":1592265599,
"stakeAmount":10000
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

This will return an unsigned transaction string that will add our node to the list of validators for the Denali network.

{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"unsignedTx": "1115K3jV5Yxr145wi6kEYpN1nPz3GEBkzG8mpF2s2959VsR54YGenLJrgdg3UEE7vFPNDE5n3Cq9Vs71HEjUUoVSyrt9Z3X7M5sKLCX5WScTcQocxjnXfFowZxFe4uH8iJU7jnCZgeKK5bWsfnWy2b9PbCQMN2uNLvwyKRp4ZxcgRptkuXRMCKHfhbHVKBYmr5e2VbBBht19be57uFUP5yVdMxKnxecs"
}
}

We will copy this transaction into the “sign” function, which returns a signed transaction.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.sign",
"params": {
"username": "YOUR USERNAME HERE",
"password": "YOUR PASSWORD HERE",
"tx":"THE VALIDATION UNSIGNED TX HERE",
"signer":"YOUR PLATFORM ADDRESS HERE"
},
"id": 2
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

The response should look like this:

{
"jsonrpc": "2.0",
"result": {
"Tx": "111Bit5JNASbJyTLrd2kWkYRoc96swEWoWdmEhuGAFK3rCAyTnTzomuFwgx1SCUdUE71KbtXPnqj93KGr3CeftpPN37kVyqBaAQ5xaDjr7wVBTUYi9iV7kYJnHF61yovViJF74mJJy7WWQKeRMDRTiPuii5gsd11gtNahCCsKbm9seJtk2h1wAPZn9M1eL84CGVPnLUiLP"
},
"id": 1
}

Then we take that signed transaction and issue it to the P-Chain in order to become a validator in the Denali network.

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.issueTx",
"params": {
"tx":"YOUR VALIDATION SIGNED TX HERE"
},
"id": 3
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

And that should be that! We should see ourselves in the list of pending validators now, and in 5 minutes we’ll be in the list of current validators!

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getPendingValidators",
"params": {},
"id": 4
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getCurrentValidators",
"params": {},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

You can also check directly on the AVA explorer your node should appears in the pending or active list of nodes: https://explorer.ava.network/validators

AVA Explorer

Use the command below :

ps -eo etime,args | grep ava

The response should look like this:

Restart your node

Execute the following command:

curl -s  https://raw.githubusercontent.com/ablockio/Auto-AVA-Denali-node-deployment/master/reboot_node.sh | bash

You should get the result below :

Your node has been rebooted.

Update your node

To update your node to the latest version, execute the following command:

curl -s https://raw.githubusercontent.com/ablockio/Auto-AVA-Denali-node-deployment/master/reboot_node_update.sh | bash

Issue #1:

If you’re trying to export your P-Chain wallet private key and you’re getting this result :

Follow this steps :

systemctl status avanode

If you got the following result :

Type :

ps -ef

You will kill the ./build/ava process and reboot your node.

To kill the ava process run the following command :

kill -9 1914

and reboot :

curl -s  https://raw.githubusercontent.com/ablockio/Auto-AVA-Denali-node-deployment/master/reboot_node.sh | bash

You could now retry, and get you P-chain wallet private key.

ablock links :

ablock is a staking service provider with a focus on community engagement. We build software, tools, and other cool stuff.
Check us out!

Website : https://ablock.io

Telegram Group: https://t.me/ablockio

Twitter : https://twitter.com/ablock_io

About AVA Labs:

AVA Labs makes it simple to launch finance applications using blockchain technolog - with highly scalable and efficient networks, customizable public and private blockchains, the capability to create any digital asset, and more. We are empowering people to build an open, simple, and democratic internet of finance.

Website | Whitepapers | Twitter | Discord | GitHub | Documentation | Explorer | AVA-X Accelerator | Telegram | Facebook | LinkedIn | Reddit | YouTube

Staking validator for PoS blockchains | community tools | services for blockchain networks & validator nodes. Website: ablock.io