Akash CLI for Sandbox Use
Explore detailed steps and options of the Akash CLI. In this guide we will define each environment variable and use within each command.
Overview of Detailed Steps
- Akash CLI for Sandbox Use
- Install Akash CLI
- Import an Existing Account
- Create an Account
- Fund your Account
- Configure your Network
- Confirm your network variables are setup
- Check your Account Balance
- Create your Configuration
- Create your Certificate
- Create your Deployment
- View your Bids
- Create a Lease
- Send the Manifest
- Update the Deployment
- Close Deployment
Install Akash CLI
Select a tab below to view instructions for MacOS, Linux, or compiling from source.
The simplest way to install Akash is using Homebrew using:
If you do not have homebrew, follow the below steps for installing the Akash Binary.
Download Akash Binary
These commands will retrieve the latest, stable version of the Akash software, store the version in a local variable, and install that version.
Move the Akash Binary
Move the binary file into a directory included in your path
Verify Akash Installation
Verify the installation by using a simple command to check the Akash version
Expect/Example Output
The simplest way to install Akash is using Homebrew using:
If you do not have homebrew, follow the below steps for installing the Akash Binary.
Download Akash Binary
These commands will retrieve the latest, stable version of the Akash software, store the version in a local variable, and install that version.
Add Akash Install Location to User’s Path
Add the software’s install location to the user’s path for easy use of Akash commands.
NOTE: Below we provide the steps to add the Akash install directory to a user’s path on a Linux Ubuntu server. Please take a look at a guide for your operating system and how to add a directory to a user’s path.
Open the user’s path file in an editor:
View within text editor prior to the update:
Add the following directory, which is the Akash install location, to PATH
. In this example the active user is root. If logged in as another username, replace /root with your current/home directory.
View within the text editor following the update:
Make the Path Active in the Current Session
Verify Akash Install
Display the version of Akash software installed. This confirms the software installed and that the new user path addition worked.
Expected/Example Result
From Source
Installing Akash suite from source:
Akash is developed and tested with golang 1.16+. Building requires a working golang installation, a properly set GOPATH
, and $GOPATH/bin
present in $PATH
.
Once you have the dependencies properly setup, download and build akash
using make install
Import an Existing Account
If you have an existing account saved in the system path, you may import using:
Otherwise, head to the next section.
Create an Account
Configure the name of your key. The command below will set the name of your key to myWallet
, run the below command and replace myWallet
with a name of your choice:
Verify you have the shell variables set up . The below command should return the name you’ve used:
We now need to point Akash to where the keys are stored for your configuration. To do this we will set the AKASH_KEYRING_BACKEND environmental variable.
Copy and paste this command into Terminal to create an Akash account:
Read the output and save your mnemonic phrase is a safe place. Let’s set a Shell Variable in Terminal AKASH_ACCOUNT_ADDRESS
to save your account address for later.
Note that if you close your Terminal window this variable will not be saved.
Fund your Account
Use the Sandbox Faucet to fund your account. Enter the Akash account created in the prior step (I.e. akash1xxxxxxxxx
address) as prompted within the faucet.
We will verify that the faucet properly funded the account in an upcoming, later section.
NOTE - account and funds are only valid for sandbox network use.
Expected Result
- The following, example screen will appear if funding from the faucet was successful:
Configure your Network
First configure the base URL ($AKASH_NET
) for the Akash Network; copy and paste the command below:
Version
Next configure the version of the Akash Network AKASH_VERSION
; copy and paste the command below:
Chain ID
The akash CLI will recogonize AKASH_CHAIN_ID
environment variable when exported to the shell.
Network Node
You need to select a node on the network to connect to, using an RPC endpoint. To configure theAKASH_NODE
environment variable use this export command:
Confirm your network variables are setup
Your values may differ depending on the network you’re connecting to.
You should see something similar to:
Set Additional Environment Variables
Set the below set of environment variables to ensure smooth operations
Variable | Description | Recommended Value |
---|---|---|
AKASH_GAS | Gas limit to set per-transaction; set to “auto” to calculate sufficient gas automatically | auto |
AKASH_GAS_ADJUSTMENT | Adjustment factor to be multiplied against the estimate returned by the tx simulation | 1.15 |
AKASH_GAS_PRICES | Gas prices in decimal format to determine the transaction fee | 0.025uakt |
AKASH_SIGN_MODE | Signature mode | amino-json |
Check your Account Balance
Check your account has sufficient balance by running:
You should see a response similar to:
Please note the balance indicated is denominated in uAKT (AKT x 10^-6), in the above example, the account has a balance of 25 AKT. We’re now setup to deploy.
Your account must have a minimum balance of 0.5 AKT to create a deployment. This 0.5 AKT funds the escrow account associated with the deployment and is used to pay the provider for their services. It is recommended you have more than this minimum balance to pay for transaction fees. For more information on escrow accounts, see here
Create your Configuration
Create a deployment configuration deploy.yaml to deploy the ovrclk/lunie-light
for Lunie Light Node app container using SDL.
Modify your Configuration
You may use the sample deployment file as-is or modify it for your own needs as described in our SDL (Stack Definition Language) documentation. A typical modification would be to reference your own image instead of our demo app image.
EXAMPLE CONFIGURATION:
Create your Certificate
Akash requires an account to have a valid certificate associated with it to start participating in the deployment process. In this section of the guide, we will create a certificate locally, and then proceed to store this certificate on the Akash blockchain. To do this, ensure you have followed all the steps outlined in this guide up to this point. Additionally, these transactions must be executed from an Akash account in possession of some $AKT tokens.
Once an account has a certificate associated with it, it can begin deploying services on the Akash blockchain. A certificate needs to be created only once per account. After creation, it can be used across any number of deployments for as long as it remains valid.
Generate Cert
- Note: If it errors with
Error: certificate error: cannot overwrite certificate
, then add--overwrite
should you want to overwrite the cert. Normally you can ignore that error and proceed with publishing the cert (next step).
Publish Cert to the Blockchain
Create your Deployment
CPU Support
Only x86_64 processors are officially supported for Akash deployments. This may change in the future and when ARM processors are supported it will be announced and documented.
Akash Deployment
To deploy on Akash, run:
You should see a response similar to:
Find your Deployment #
Find the Deployment Sequence (DSEQ) in the deployment you just created. You will need to replace the AKASH_DSEQ with the number from your deployment to configure a shell variable.
Now set the Order Sequence (OSEQ) and Group Sequence (GSEQ). Note that if this is your first time deploying on Akash, OSEQ and GSEQ will be 1.
Verify we have the right values populated by running:
View your Bids
After a short time, you should see bids from providers for this deployment with the following command:
Choose a Provider
Note that there are bids from multiple different providers. In this case, both providers happen to be willing to accept a price of 1 uAKT. This means that the lease can be created using 1 uAKT or 0.000001 AKT per block to execute the container. You should see a response similar to:
For this example, we will choose akash10cl5rm0cqnpj45knzakpa4cnvn5amzwp4lhcal
Run this command to set the provider shell variable:
Verify we have the right value populated by running:
Create a Lease
Create a lease for the bid from the chosen provider above by running this command:
Confirm the Lease
You can check the status of your lease by running:
Note the bids will close automatically after 5 minutes, and you may get the response:
If this happens, close your deployment and open a new deployment again. To close your deployment run this command:
If your lease was successful you should see a response that ends with:
Please note that once the lease is created, the provider will begin debiting your deployment’s escrow account, even if you have not completed the deployment process by uploading the manifest in the following step.
Send the Manifest
Upload the manifest using the values from above step:
Confirm the URL
Now that the manifest is uploaded, your image is deployed. You can retrieve the access details by running the below:
You should see a response similar to:
You can access the application by visiting the hostnames mapped to your deployment. Look for a URL/URI and copy it to your web browser.
View your logs
You can view your application logs to debug issues or watch progress like so:
Update the Deployment
Update the Manifest
Update the deploy.yml manifest file with the desired change.
NOTE:** Not all attributes of the manifest file are eligible for deployment update. If the hardware specs of the manifest are updated (I.e. CPU count), a re-deployment of the workload is necessary. Other attributes, such as deployment image and funding, are eligible for updates.
Issue Transaction for On Chain Update
Send Updated Manifest to Provider
Close Deployment
Close the Deployment
Should you need to close the deployment follow this step.