How to deploy and run a node of Avalanch on Akash dApp

cyberG
5 min readSep 4, 2021

--

Hello, friends! This guide will help you to deploy and run a node of Avalanche on Akash dApp!

Before installing Akash, we need to define environment variables:

AKASH_NET="https://raw.githubusercontent.com/ovrclk/net/master/mainnet"
AKASH_VERSION="$(curl -s "$AKASH_NET/version.txt")"
export AKASH_CHAIN_ID="$(curl -s "$AKASH_NET/chain-id.txt")"
export AKASH_NODE="$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)"

Install Akash (Linux)

curl https://raw.githubusercontent.com/ovrclk/akash/master/godownloader.sh | sh -s -- "v$AKASH_VERSION"
cp ./bin/akash /usr/local/bin/

Create a wallet

default1” is an example. You can choose any name, that you want.

akash keys add default1

You will need to create and confirm passphrase.
Keep it safely! You will need it!

(!!!) You need to save the mnemonic phrase, and carefully keep it in secret! Never share your mnemonic phrase with nobody!
Wallet recovery will be impossible, without mnemonic phrase!

(!!) We will never use address with name “default1”, because we showed mnemonic phrase of it.
In the next steps we will use another address with the name “default”, not “default1”.
In your case, at the places of “default1” and “default”, must be the name that you’ve created by yourself.

(!) Copy your address, you will need it in the next step!

Defining variables with the name and address of the wallet

export AKASH_ACCOUNT_ADDRESS="$(akash keys show default -a)"
export AKASH_KEY_NAME="default"

If you haven’t any errors — everything is good!

Buy $AKT and send it to your address

You can buy $AKT at many different exchanges. List of the exchanges you can find on the main web-page of Akash Network: https://akash.network/token

Check the balance

akash --node "$AKASH_NODE" query bank balances "$AKASH_ACCOUNT_ADDRESS"

The amount of $AKT shown in uAKT
1,000,000 uAKT = 1 $AKT

Create a certificate

akash tx cert create client --from=$AKASH_KEY_NAME --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --fees 1000uakt -y

Enter your passphrase to sing the transaction

Congratulations!
At this point, the installation of Akash is complete!

Deploy the configuration file with the avalanchego image

Create a configuration file deploy.yml

Important!

  • The address “akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63” is the address of the escrow account. Don’t change it!
  • The variable PASSWORD must be assign as SSH-password of your node!
  • The CPU, memory and size parameters in example configuration are set close to the minimum. In real use it’s necessary to increase them!

The system requirements for Avalanchego are:
CPU: Equivalent of 8 AWS vCPU
RAM: 16 GB
Storage: 200 GB

cat > deploy.yml <<EOF
---
version: "2.0"services:
avalanchego:
image: bloqhub/avalanchego-ssh:0.1
expose:
- port: 9650
as: 9650
proto: tcp
to:
- global: true
- port: 2242
as: 2242
proto: tcp
to:
- global: true
- port: 9651
as: 9651
proto: tcp
to:
- global: true
env:
- PASSWORD=axijoozenlowr3wr_hSiprofiles:
compute:
avalanchego:
resources:
cpu:
units: 0.1
memory:
size: 512Mi
storage:
size: 512Mi
placement:
akash:
attributes:
host: akash
signedBy:
anyOf:
- "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
pricing:
avalanchego:
denom: uakt
amount: 100deployment:
avalanchego:
akash:
profile: avalanchego
count: 1
EOF

Deploying the configuration

akash tx deployment create deploy.yml --from $AKASH_KEY_NAME --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --fees 1000uakt -b sync -y

Enter your passphrase to sing the transaction

You will get the information about transaction.
Copy the hash of transaction (txhash) — you will need it in the next step.

In our exmple it’s:
FBB1521AD7DD232B9B77C404C38FC793B05F995DB74935C4D663C20306149B5D
You will have another txhash.

Checking the status of the installation

akash q tx FBB1521AD7DD232B9B77C404C38FC793B05F995DB74935C4D663C20306149B5D --node=$AKASH_NODE

In the output of this command, we are interested in the dseq value.
In our exmple it’s:
2498329
You will have another dseq

Defining variables

export AKASH_DSEQ=2498392
export AKASH_GSEQ=1
export AKASH_OSEQ=1

If you haven’t any errors — everything is good!

Checking the deployment status

akash query deployment get --owner $AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ

Determine the bids that can be used for our configuration

akash query market bid list --owner=$AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ

In the output of this command, we are interested in the provider value.
In our exmple it’s:
akash14c4ng96vdle6tae8r4hc2w4ujwrshdddtuudk0
You will have another provider

Assign the variable provider-address

export AKASH_PROVIDER=akash14c4ng96vdle6tae8r4hc2w4ujwrshdddtuudk0

If you haven’t any errors — everything is good!

Rent the selected provider

akash tx market lease create --chain-id $AKASH_CHAIN_ID --node $AKASH_NODE --owner $AKASH_ACCOUNT_ADDRESS --dseq $AKASH_DSEQ --gseq $AKASH_GSEQ --oseq $AKASH_OSEQ --provider $AKASH_PROVIDER --from $AKASH_KEY_NAME --fees 5000uakt -y

Enter your passphrase to sing the transaction

After a few seconds, check the status

akash query market lease list — owner $AKASH_ACCOUNT_ADDRESS — node $AKASH_NODE — dseq $AKASH_DSEQ

Loading the manifest for our image

akash provider send-manifest deploy.yml --node $AKASH_NODE --dseq $AKASH_DSEQ --provider $AKASH_PROVIDER --from $AKASH_KEY_NAME

Enter your passphrase to sing the transaction

Get access data

akash provider lease-status --node $AKASH_NODE --dseq $AKASH_DSEQ --from $AKASH_KEY_NAME --provider $AKASH_PROVIDER

Enter your passphrase to sing the transaction

We are interested in host and externalPort.
In this example, we are connecting to our node:

ssh root@cluster.provider-2.prod.ewr1.akash.pub -p 31749

The password is defined in the deploy.yml file

We can also view the logs of our node:

akash provider lease-logs --node "$AKASH_NODE" --dseq "$AKASH_DSEQ" --gseq "$AKASH_GSEQ" --oseq "$AKASH_OSEQ" --provider "$AKASH_PROVIDER" --from "$AKASH_KEY_NAME"

Enter your passphrase to sing the transaction

The node is configured according to the official documentation, skipping the installation stage:
https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node

That’s all, friends! Whish you a good deployment!

--

--