How to setup an AVA node in 5 simple steps on the Grid?

Dear Friends,

This post is intended for friends at AvaLabs :slightly_smiling_face:. AVA is an open-source platform for launching decentralized finance applications and enterprise blockchain deployments in one interoperable , highly scalable ecosystem.

Both ThreeFold and Ava share common values and there is an enormous potential that can be exploited together, especially when it comes to leveraging ThreeFold’s peer to peer cloud network .

We will quickly demonstrate how to setup a Ava node on the ThreeFold Grid . The purpose here is to get people started. The configuration can be tweaked to perfection with other experts in the community.

What we will do ?

  1. Setup your 3bot and install the 3sdk
  2. Log in and create your Network
  3. Get your wallet loaded :slightly_smiling_face: , don’t worry, we have FreeTFTs
  4. Deploy your AVA container
  5. Access your AVA container
  6. Verify your AVA deployment

Before you start, we have 2 networks publicly available

  1. Mainnet @ https://explorer.grid.tf
  2. Testnet @ https://explorer.testnet.grid.tf

Our Recommendation : *Start deploying on testnet as ThreeFold gives free nodes to deploy and play around with. Mainnet is production and paid for. Therefore, from settings in the 3sdk menu, switch to TESTNET *

Step 1 - Setup the 3sdk

The 3sdk is a tool that allows you to setup your 3bot and give you access to the ThreeFold Grid for your deployments (containers, virtual machines, S3 storage and so on). The wiki provides detailed instructions on how to set up the 3sdk .

If this part is done, rest should be extremely easy as management is done via web interface.

To access the 3sdk admin interface, in your browser use the following link,

http://YOUR_IP_HERE:7000 or https://YOUR_IP_HERE:4000

7000 is the http port and 4000 is the https port

If you installed locally on your machine, you can use http://localhost:7000

Step 2 - Log in and Create your Network for Deployment

From the previous step, http://YOUR_IP_HERE:7000

Log in here with your 3bot. Make sure you open the 3bot connect app first!

Once you log in, Go to Solutions and then go to Network . The interface is user-friendly and it should be easy. Few things to note,

  • Use IPv4 network unless you are sure you have IPv6. You can test IPv6 connectivity here
  • It is better to have the chat bot configure the network for you unless you have specific requirements
  • Ideally start with FreeTFT as your network currency

Note : The wizard will ask you to download your Wireguard configuration. This is important as you won’t be able to access your network without it. This serves as an entry point to your private network.

Step 3 : Get your wallet loaded - Get some FreeTFTs :slightly_smiling_face:

First things first, create a wallet from the Wallet Manager. It is pretty easy actually,

The next step is to get your wallet funded, there are 2 ways,

To get FreeTFTs for testnet, use this link => https://getfreetft.testnet.threefold.io

Login with your 3botID which you created in the 1st step and provide the wallet address. You get 1000 FreeTFTs per wallet. This should be adequate ! The stellar address is the simply the wallet address. Our transaction layer is on stellar.

To get FreeTFTs for Mainnet, use this request form => https://www.getfreetft.threefold.io

Step 4 - Create your AVA Container - Time to Rock’n Roll :fist:

Under Solutions , go to Generic flists , the wizard will guide you accordingly.

  1. Select the network name which you created . Your container is going to be deployed in this network.

  2. Enter the container name, size in terms of CPU and memory . Ideally start with 2 CPUs and 2048 MB memory.

  3. The flist link you have to use is => https://hub.grid.tf/arehman/v2-avalabs-0-2.flist NOTE : If the deployment fails with this , please use the flist here https://hub.grid.tf/arehman/v2-avalabs-0-1.flist

  4. Would you like access to your container through the web browser (coreX)? Select NO . You may want to use this for troubleshooting.

  5. Set the IP address from the drop down list you want to assign to your container.

  6. The container entry_point should be set to /start_ava.sh. You can even modify this script to pass your variables to start ava (IP address and Port , staking options). By default, it runs with the following command => /gecko/build/ava --public-ip=$WANIP --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false

  7. Under environment variables , use pub_key=your_public_key_here . This would allow to SSH into the container once it is deployed. The rest of the environment variables need to be passed also.

flists are like docker images used for containerizing applications. You can convert your docker images to flists here

Note : Container mount points for persistent storage are not available at the time of this writing. They would be available soon in the chat flow. The rootfs <= 250 MB, anything over should be mounted with a persistent volume/disk

Click Next, Now you get a list of farms to deploy on, let the freefarm be there

If all goes well, the wizard will give you a final screen before proceeding with the deployment,

The last screen is the payment screen which can be done with “FreeTFTs” in your wallet. Payment can be either via the 3bot App or the wallet you created. Just choose the wallet you funded in Step 3

That should be it ! You will be given a reservation ID of your deployment that you can use for future references.

Step 5 - Access your AVA Container

To access the container,

For Linux , wg-quick up path_to_wireguard_conf_file. For example, wg-quick up /my-wg/net-1.conf

For windows , Import the downloaded wireguard configuration from Step 2,

Once the wireguard tunnel is up, you can test connectivity by doing a ping test for your container IP address. Access the container with ssh using your private key.

ssh -i path_to_your_privatekey root@container_ip_address, For example ssh -i /opt/mysshkey root@172.20.10.5

The SSH public key should be provisioned during the container deployment.

Step 6 - Verify your Deployment

From the left side navigation panel, go to Deployed Solutions . You should see the name of your container

Inside the container, do a ps aux , you should see the ava process running,

/gecko# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  15848   860 ?        Ss   08:56   0:00 /usr/sbin/sshd -D
root       409  0.0  0.0 2941444 34072 pts/3   Sl+  09:22   0:02 /tfava-data/gecko/build/ava --public-ip=86.98.9.190 --snow-sample-size=1 --snow-quorum-size=1 --staking-tls-enabled=false
root       440  0.0  0.0   2384    68 pts/3    S+   09:23   0:00 sh -c build/plugins/evm

/gecko# netstat -lntpe
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode      PID/Program name
tcp        0      0 0.0.0.0:9651            0.0.0.0:*               LISTEN      0          28028485   409/ava
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      0          27986061   1/sshd
tcp6       0      0 :::9650                 :::*                    LISTEN      0          28018423   409/ava
tcp6       0      0 :::22                   :::*                    LISTEN      0          27986068   1/sshd

AVA will listen on 965X ports where X = 0 to 9. As stated above, you can pass the ports / IP address and other options as environment variables to the startup script !

How to test ?

Few commands from AVA that could help you verify if AVA is working properly,

curl -X POST --data '{
    "jsonrpc":"2.0",
    "id"     :2,
    "method" :"avm.getBalance",
    "params" :{
        "address":"X-6cesTteH62Y5mLoDBUASaBvCXuL2AthL",
        "assetID":"AVA"
    }
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/X

Resposne herein,

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

That should be it :slightly_smiling_face: ! You can configure AVA and add persistent storage to the container as per your requirements. They do have nice documentation, please refer to it below !

Sources for AVA

https://docs.ava.network/v1.0/en/quickstart/ava-getting-started

4 Likes

Super work Abdul, way to go!

1 Like