---
# System prepended metadata

title: Akash.Network Deployment Attempt on TestNet
tags: [AkashNetwork, Tutorials]

---

# Akash.Network Deployment Attempt on TestNet


###### tags: `AkashNetwork` `Tutorials`
**Aim:**  To go through the docs https://docs.akash.network/guides/version , understand and document simple steps to deploy an app to akash network.

The steps would be helpful to design the UI application for the bounty 
https://gitcoin.co/issue/ovrclk/awesome-akash/177/100025806

**Tools required:**
Linux based OS recommended 
A simple starter create-react-app or create-next-app
Basic CLI knowledge

**Attempt #1:**

Choosen Network:

```
#testnet
AKASH_NET="https://raw.githubusercontent.com/ovrclk/net/master/testnet"
```
Each network has a corresponding directory (linked to above) containing network information. Each directory includes, at a minimum:
(Source:https://github.com/ovrclk/net)


Version:

```
AKASH_VERSION="$(curl -s "$AKASH_NET/version.txt")"
```

ChainID:

```
export AKASH_CHAIN_ID="$(curl -s "$AKASH_NET/chain-id.txt")"
```

Genesis:

```
curl -s "$AKASH_NET/genesis.json" > genesis.json
```

Seed Nodes

```
curl -s "$AKASH_NET/seed-nodes.txt" | paste -d, -s
```

Peer Nodes

```
curl -s "$AKASH_NET/peer-nodes.txt" | paste -d, -s
```


RPC Node

Print a random RPC endpoint. The akash CLI will recognize AKASH_NODE environment variable when exported to the shell

```
export AKASH_NODE="$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)"

echo $AKASH_NODE
```

API Node

Print a random API endpoint


```
curl -s "$AKASH_NET/api-nodes.txt" | shuf -n 1
```


Terminal execution output:

```
torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_NET="https://raw.githubusercontent.com/ovrclk/net/master/testnet"
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_NET
https://raw.githubusercontent.com/ovrclk/net/master/testnet
torch@torch-ablazed:~/Desktop/akash.network$ echo env
env
torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_VERSION="$(curl -s "$AKASH_NET/version.txt")"
torch@torch-ablazed:~/Desktop/akash.network$ export export AKASH_CHAIN_ID="$(curl -s "$AKASH_NET/chain-id.txt")"
torch@torch-ablazed:~/Desktop/akash.network$ export curl -s "$AKASH_NET/genesis.json" > genesis.json
bash: export: `-s': not a valid identifier
bash: export: `https://raw.githubusercontent.com/ovrclk/net/master/testnet/genesis.json': not a valid identifier
torch@torch-ablazed:~/Desktop/akash.network$ curl -s "$AKASH_NET/genesis.json" > genesis.json
torch@torch-ablazed:~/Desktop/akash.network$ curl -s "$AKASH_NET/seed-nodes.txt" | paste -d, -s

torch@torch-ablazed:~/Desktop/akash.network$ curl -s "$AKASH_NET/peer-nodes.txt" | paste -d, -s
2b027ca96b51ab4f3c69ac54fd05b7ae082fa6a8@147.75.32.11:26656,036cbb0a1e11f9cafa54623b18761b094944d1ee@147.75.32.35:26656
torch@torch-ablazed:~/Desktop/akash.network$ curl -s "$AKASH_NET/seed-nodes.txt" | paste -d, -s

torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_NODE="$(curl -s "$AKASH_NET/rpc-nodes.txt" | shuf -n 1)"
torch@torch-ablazed:~/Desktop/akash.network$ 
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_NODE
http://147.75.32.11:26657
torch@torch-ablazed:~/Desktop/akash.network$ curl -s "$AKASH_NET/api-nodes.txt" | shuf -n 1
http://147.75.32.35:1317
torch@torch-ablazed:~/Desktop/akash.network$ 
```

## Install Akash 

Go to https://github.com/ovrclk/akash/releases
Look for the latest tag in releases section and download *akash0.12.1linuxamd64.deb* for debian based systems

check for installed package by typing *akash* in terminal , it should display command utility help which has usage and available commands 

## Wallet setup

*Deriving a New Key Locally*

Setup required environment variables , we are using default keyring backend

```
export AKASH_KEY_NAME="torch"
export AKASH_KEYRING_BACKEND="os"
```

Output on creating a wallet 

```
torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_KEY_NAME="torch"
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_KEY_NAME
torch
torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_KEYRING_BACKEND="os"
torch@torch-ablazed:~/Desktop/akash.network$ akash \
>   --keyring-backend "$AKASH_KEYRING_BACKEND" \
>   keys add "$AKASH_KEY_NAME"

- name: testwallet
  type: local
  address: akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc
  pubkey: akashpub1addwnpepqvvvqmcnuhpqhn2urd52y403zuwngx4n0x364cmxw0v5q6xz9e4tc4xs434
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

trumpet alert mammal bonus increase topple pioneer noble bone neutral creek tragic address replace weekend accuse beauty watch honor fake toast report laugh gold
```

Get your wallet address by running the command:

```
akash \
  --keyring-backend "$AKASH_KEYRING_BACKEND" \
  keys show "$AKASH_KEY_NAME" -a
```

Set the environment variable 

```
export AKASH_ACCOUNT_ADDRESS="akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"
```

Run the command , to get faucet address

```
curl "$AKASH_NET/faucet-url.txt"
```

Visit https://akash.vitwit.com/faucet
Enter account address to recieve tokens 

Check account balance ,

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

Output:

```
torch@torch-ablazed:~/Desktop/akash.network$ export AKASH_ACCOUNT_ADDRESS="akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"
torch@torch-ablazed:~/Desktop/akash.network$ curl "$AKASH_NET/faucet-url.txt"
https://akash.vitwit.com/faucet
torch@torch-ablazed:~/Desktop/akash.network$ ^C
torch@torch-ablazed:~/Desktop/akash.network$ akash \
>   --node "$AKASH_NODE" \
>   query bank balances "$AKASH_ACCOUNT_ADDRESS"
balances:
- amount: "100000000"
  denom: uakt
pagination:
  next_key: null
  total: "0"
```

## Deployment to akash.network

Verify your environment variables

```
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_NODE
http://147.75.32.11:26657
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_CHAIN_ID
akash-testnet-6
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_ACCOUNT_ADDRESS
akash1nrerxhf7le69cgypd00tf5ux2044efe0tjmfqa
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_KEYRING_BACKEND
os
torch@torch-ablazed:~/Desktop/akash.network$ echo $AKASH_KEY_NAME
testwallet
```

> You will need docker for this , 
> I am on linux mint and easiest way to install docker here is to install it from your software manager 
> 
> Search for docker.io and install it , verify it by running docker command on CLI

Docker reference : https://computingforgeeks.com/install-docker-and-docker-compose-on-linux-mint-19/


Run the following commands to make sure docker installation was succesful 
(Source: https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue )

```
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
```

Output:
```

torch@torch-ablazed:~$ sudo usermod -aG docker $USER
torch@torch-ablazed:~$ newgrp docker
torch@torch-ablazed:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
```

### Creating a docker image for NextJS app 

So , We have our docker installed , now lets create a docker image for our create-next-app

> Make sure you have create-next-app globally installed using node , NPM or YARN
> 
> or use `npx create-next-app my-app-name`

Run the following commands 

```
create-next-app akash-nexjs-docker
cd akash-nextjs-docker
```

Make a file named `Dockerfile` and copy the content below
Source: https://nextjs.org/docs/deployment#docker-image

```
# Install dependencies only when needed
FROM node:alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline

# Production image, copy all the files and run next
FROM node:alpine AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

# You only need to copy next.config.js if you are NOT using the default configuration
# COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

USER nextjs

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1

CMD ["yarn", "start"]
```

Run , 

sudo docker build -t akash-nextjs-docker .
sudo docker run -p 3000:3000 akash-nextjs-docker
sudo docker login
sudo docker tag akash-nextjs-docker torchablazed/akash-nextjs
sudo docker push torchabalzed/akash-nextjs

```
torch@torch-ablazed:~/Desktop/Docker image next /docker-akash-next$ sudo docker tag docker-akash-next torchablazed/test
torch@torch-ablazed:~/Desktop/Docker image next /docker-akash-next$ sudo docker push torchablazed/test
The push refers to repository [docker.io/torchablazed/test]
13fe2cb23f7c: Pushed 
306c77f481c5: Pushed 
ac62ec5a61cc: Pushed 
c40cbb2dcd2f: Pushed 
f36022a7e4e2: Pushed 
5b702d558a91: Pushed 
d1f5f77c9501: Pushed 
6ff94098dca3: Mounted from library/node 
d70a24f36618: Mounted from library/node 
ace9a27c01e5: Mounted from library/node 
b2d5eeeaba3a: Mounted from library/node 
latest: digest: sha256:8601bcfffcf52a0ba5c742125948c4b903fb213e3608c033c13e5495ef8e6dd2 size: 2618
```


Error resolve reference : https://stackoverflow.com/questions/41984399/denied-requested-access-to-the-resource-is-denied-docker


Modifying yaml file for depplyment

```
torch@torch-ablazed:~/Desktop/akash.network$ curl -s https://raw.githubusercontent.com/ovrclk/docs/master/guides/deploy/deploy.yml > deploy.yml
torch@torch-ablazed:~/Desktop/akash.network$ nano deploy.yml
torch@torch-ablazed:~/Desktop/akash.network$ cat deploy.yml
---
version: "2.0"

services:
  web:
    image: torchablazed/akash-nextjs
    expose:
      - port: 3000
        as: 80
        to:
          - global: true

profiles:
  compute:
    web:
      resources:
        cpu:
          units: 0.1
        memory:
          size: 512Mi
        storage:
          size: 512Mi
  placement:
    westcoast:
      attributes:
        host: akash
      signedBy:
        anyOf:
          - "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
      pricing:
        web: 
          denom: uakt
          amount: 1000

deployment:
  web:
    westcoast:
      profile: web
      count: 1
torch@torch-ablazed:~/Desktop/akash.network$ akash tx cert create client --chain-id $AKASH_CHAIN_ID --keyring-backend $AKASH_KEYRING_BACKEND --from $AKASH_KEY_NAME --node $AKASH_NODE --fees 5000uakt
no certificate found for address akash1nrerxhf7le69cgypd00tf5ux2044efe0tjmfqa. generating new...
{"body":{"messages":[{"@type":"/akash.cert.v1beta1.MsgCreateCertificate","owner":"akash1nrerxhf7le69cgypd00tf5ux2044efe0tjmfqa","cert":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJ2ekNDQVdXZ0F3SUJBZ0lJRm9XMkhITW8yZ013Q2dZSUtvWkl6ajBFQXdJd1NqRTFNRE1HQTFVRUF4TXMKWVd0aGMyZ3hibkpsY25ob1pqZHNaVFk1WTJkNWNHUXdNSFJtTlhWNE1qQTBOR1ZtWlRCMGFtMW1jV0V4RVRBUApCZ1ZuZ1FVQ0JoTUdkakF1TUM0eE1CNFhEVEl4TURZd05URTBNekV4TkZvWERUSXlNRFl3TlRFME16RXhORm93ClNqRTFNRE1HQTFVRUF4TXNZV3RoYzJneGJuSmxjbmhvWmpkc1pUWTVZMmQ1Y0dRd01IUm1OWFY0TWpBME5HVm0KWlRCMGFtMW1jV0V4RVRBUEJnVm5nUVVDQmhNR2RqQXVNQzR4TUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowRApBUWNEUWdBRURIOFdkSzE1blNwOEV5cVVZa2NUOEsvY21SbDErQWFZd0ZMZFdJamphb09CZi9nM094VzJraXlqCitXU1pZbCs3azNQS1VGNVcrMUpuN2pGeXRJamtzS00xTURNd0RnWURWUjBQQVFIL0JBUURBZ1F3TUJNR0ExVWQKSlFRTU1Bb0dDQ3NHQVFVRkJ3TUNNQXdHQTFVZEV3RUIvd1FDTUFBd0NnWUlLb1pJemowRUF3SURTQUF3UlFJZwpHRUtnRVhlREg4d2NpM0lPd0hpUFVoVFBjcFhGSi95cjVQcGFmT3g5aEk4Q0lRRFNBTithYUlLZkkxRlBCSDNoCm5TUnFtSmVXd0tRKzVScFdUR1V5bFNTTXd3PT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=","pubkey":"LS0tLS1CRUdJTiBFQyBQVUJMSUMgS0VZLS0tLS0KTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFREg4V2RLMTVuU3A4RXlxVVlrY1Q4Sy9jbVJsMQorQWFZd0ZMZFdJamphb09CZi9nM094VzJraXlqK1dTWllsKzdrM1BLVUY1VysxSm43akZ5dElqa3NBPT0KLS0tLS1FTkQgRUMgUFVCTElDIEtFWS0tLS0tCg=="}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"uakt","amount":"5000"}],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}

confirm transaction before signing and broadcasting [y/N]: y
{"height":"664389","txhash":"EAE4EBC2911E8CDC0A706CB9EAA9281E931396BE91838B0FBA6A6F03217FD997","codespace":"","code":0,"data":"0A190A17636572742D6372656174652D6365727469666963617465","raw_log":"[{\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"cert-create-certificate\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"akash17xpfvakm2amg962yls6f84z3kell8c5lazw8j8\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"amount\",\"value\":\"5000uakt\"}]}]}]","logs":[{"msg_index":0,"log":"","events":[{"type":"message","attributes":[{"key":"action","value":"cert-create-certificate"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"akash17xpfvakm2amg962yls6f84z3kell8c5lazw8j8"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"amount","value":"5000uakt"}]}]}],"info":"","gas_wanted":"200000","gas_used":"92932","tx":null,"timestamp":""}
torch@torch-ablazed:~/Desktop/akash.network$ akash tx deployment create deploy.yml --from $AKASH_KEY_NAME --node $AKASH_NODE --chain-id $AKASH_CHAIN_ID --fees 5000uakt -y
{"height":"664394","txhash":"6DC3828385131D5DF69E0F5A34B7A3C948B2BD431EEA7EC62763D0F0096AC40D","codespace":"","code":0,"data":"0A130A116372656174652D6465706C6F796D656E74","raw_log":"[{\"events\":[{\"type\":\"akash.v1\",\"attributes\":[{\"key\":\"module\",\"value\":\"deployment\"},{\"key\":\"action\",\"value\":\"deployment-created\"},{\"key\":\"version\",\"value\":\"eff03d46350ed2ce9af34bbd0d73091bf214b984e9e05cf4adcbf4046b9cbc4e\"},{\"key\":\"owner\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"dseq\",\"value\":\"664393\"},{\"key\":\"module\",\"value\":\"market\"},{\"key\":\"action\",\"value\":\"order-created\"},{\"key\":\"owner\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"dseq\",\"value\":\"664393\"},{\"key\":\"gseq\",\"value\":\"1\"},{\"key\":\"oseq\",\"value\":\"1\"}]},{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"create-deployment\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"akash17xpfvakm2amg962yls6f84z3kell8c5lazw8j8\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"amount\",\"value\":\"5000uakt\"},{\"key\":\"recipient\",\"value\":\"akash14pphss726thpwws3yc458hggufynm9x77l4l2u\"},{\"key\":\"sender\",\"value\":\"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc\"},{\"key\":\"amount\",\"value\":\"5000000uakt\"}]}]}]","logs":[{"msg_index":0,"log":"","events":[{"type":"akash.v1","attributes":[{"key":"module","value":"deployment"},{"key":"action","value":"deployment-created"},{"key":"version","value":"eff03d46350ed2ce9af34bbd0d73091bf214b984e9e05cf4adcbf4046b9cbc4e"},{"key":"owner","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"dseq","value":"664393"},{"key":"module","value":"market"},{"key":"action","value":"order-created"},{"key":"owner","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"dseq","value":"664393"},{"key":"gseq","value":"1"},{"key":"oseq","value":"1"}]},{"type":"message","attributes":[{"key":"action","value":"create-deployment"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"akash17xpfvakm2amg962yls6f84z3kell8c5lazw8j8"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"amount","value":"5000uakt"},{"key":"recipient","value":"akash14pphss726thpwws3yc458hggufynm9x77l4l2u"},{"key":"sender","value":"akash1nrerxhf7le69cgypd00tf5ux2044jkstdhjskc"},{"key":"amount","value":"5000000uakt"}]}]}],"info":"","gas_wanted":"200000","gas_used":"94608","tx":null,"timestamp":""}
torch@torch-ablazed:~/Desktop/akash.network$ 
```

**Set the environment variables**

```
export AKASH_DSEQ=<ID_FROM_TX> AKASH_OSEQ="1" AKASH_GSEQ="1" 
```


### As the deployment on testnet has no providers , upon verifying the depolyment it is invalid 

```
torch@torch-ablazed:~/Desktop/akash.network$ akash query deployment get --owner $AKASH_ACCOUNT_ADDRESS --node $AKASH_NODE --dseq $AKASH_DSEQ
Error: Deployment not found: invalid request
```











