Deploy and manage Akash applications using our official SDKs in Go or JavaScript/TypeScript.
Both SDKs are generated from the chain-sdk repository and provide the same core functionality.
Prerequisites
Before you begin, ensure you have:
- For TypeScript: Node.js 22.14.0+ and npm/yarn/pnpm
- For Go: Go 1.25.0+
- An Akash wallet with AKT tokens (get sandbox tokens from the faucet)
- Basic understanding of blockchain concepts
Installation
npm install @akashnetwork/chain-sdk @cosmjs/proto-signing @cosmjs/aminoQuick Start: Complete Deployment Workflow
Step 1: Initialize SDK and Wallet
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { createChainNodeSDK, SDL } from "@akashnetwork/chain-sdk";
// Initialize wallet from mnemonic
const mnemonic = "your mnemonic phrase here";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
prefix: "akash"
});
const accounts = await wallet.getAccounts();
console.log("Wallet address:", accounts[0].address);
// Initialize SDK
const sdk = createChainNodeSDK({
query: {
baseUrl: "https://grpc.sandbox-2.aksh.pw:443", // Sandbox gRPC
},
tx: {
baseUrl: "https://rpc.sandbox-2.aksh.pw:443", // Sandbox RPC
signer: wallet,
gasPrice: "0.025uakt"
}
});
console.log("SDK initialized");Step 2: Define Your SDL
version: "2.0"
services:
web:
image: nginx:1.25.3
expose:
- port: 80
as: 80
to:
- global: true
profiles:
compute:
web:
resources:
cpu:
units: 0.5
memory:
size: 512Mi
storage:
size: 512Mi
placement:
dcloud:
pricing:
web:
denom: uakt
amount: 1000
deployment:
web:
dcloud:
profile: web
count: 1Step 3: Parse SDL and Create Deployment
import { SDL } from "@akashnetwork/chain-sdk";
// Read SDL file (or use string directly)
const yamlContent = `
version: "2.0"
services:
web:
image: nginx:1.25.3
expose:
- port: 80
as: 80
to:
- global: true
profiles:
compute:
web:
resources:
cpu:
units: 0.5
memory:
size: 512Mi
storage:
size: 512Mi
placement:
dcloud:
pricing:
web:
denom: uakt
amount: 1000
deployment:
web:
dcloud:
profile: web
count: 1
`;
// Parse SDL
const sdl = SDL.fromString(yamlContent, "beta3", "sandbox");
const groups = sdl.groups();
console.log("SDL parsed successfully");
// Get current block height for dseq
const status = await sdk.cosmos.base.tendermint.v1beta1.getLatestBlock({});
const dseq = status.block.header.height;
console.log("Creating deployment with dseq:", dseq);
// Create deployment
const deployment = await sdk.akash.deployment.v1beta4.createDeployment({
id: {
owner: accounts[0].address,
dseq: dseq
},
groups: groups,
deposit: {
denom: "uakt",
amount: "5000000" // 5 AKT deposit
},
depositor: accounts[0].address
});
console.log("**Deployment created with dseq:", dseq);Step 4: Wait for Bids
After creating a deployment, providers will submit bids. Wait 30-60 seconds for bids to arrive.
// Wait for bids (in production, use events or polling)
console.log("Waiting for bids...");
await new Promise(resolve => setTimeout(resolve, 30000)); // Wait 30s
// Query bids
const bidsResult = await sdk.akash.market.v1beta5.getBids({
filters: {
owner: accounts[0].address,
dseq: dseq,
state: "open"
}
});
console.log(`Received ${bidsResult.bids.length} bids`);
// Display bid details
bidsResult.bids.forEach((bidInfo, index) => {
const bid = bidInfo.bid;
console.log(`Bid ${index + 1}:`);
console.log(` Provider: ${bid.bidId.provider}`);
console.log(` Price: ${bid.price.amount} ${bid.price.denom}`);
});Step 5: Accept a Bid (Create Lease)
if (bidsResult.bids.length === 0) {
console.error("No bids received. Check your SDL and try again.");
process.exit(1);
}
// Select the first bid (or implement your own selection logic)
const selectedBid = bidsResult.bids[0].bid;
console.log(`Accepting bid from provider: ${selectedBid.bidId.provider}`);
// Create lease (accept the bid)
const lease = await sdk.akash.market.v1beta5.createLease({
bidId: selectedBid.bidId
});
console.log("**Lease created!");
console.log(`Provider: ${selectedBid.bidId.provider}`);Step 6: Send Manifest to Provider
After creating a lease, you need to send the manifest to the provider using the Provider API.
import { JwtTokenManager } from "@akashnetwork/chain-sdk";
import { Secp256k1HdWallet } from "@cosmjs/amino";
// Initialize JWT token manager for provider authentication
const aminoWallet = await Secp256k1HdWallet.fromMnemonic(mnemonic, {
prefix: "akash"
});
const tokenManager = new JwtTokenManager(aminoWallet);
// Generate JWT token
const token = await tokenManager.generateToken({
iss: accounts[0].address,
exp: Math.floor(Date.now() / 1000) + 3600, // 1 hour
iat: Math.floor(Date.now() / 1000),
version: "v1",
leases: { access: "full" }
});
// Get manifest from SDL
const manifest = sdl.manifest();
// Send manifest to provider
const providerUrl = selectedBid.bidId.provider; // Get provider URL from chain
const response = await fetch(
`https://provider.example.com:8443/deployment/${dseq}/manifest`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
body: JSON.stringify(manifest)
}
);
if (response.ok) {
console.log("**Manifest sent successfully!");
console.log("Your deployment is now starting...");
} else {
console.error("Failed to send manifest:", await response.text());
}Verify Deployment Status
// Query lease status from provider
const statusResponse = await fetch(
`https://provider.example.com:8443/lease/${dseq}/1/1/status`,
{
headers: {
"Authorization": `Bearer ${token}`
}
}
);
const status = await statusResponse.json();
console.log("Deployment Status:");
console.log(" Services:", status.services);
console.log(" URIs:", status.forwarded_ports);Complete Example Script
For a complete, runnable example that ties all these steps together, see the Examples page.
Core Features
All SDKs support:
- Deployment Management - Create, update, close deployments
- Market Operations - View bids, create leases
- Provider Queries - Find and evaluate providers
- Query Operations - Query deployments, leases, balances
- Wallet Management - Sign transactions securely
- SDL Parsing - Parse and validate SDL files
- Certificate Management - Generate and manage certificates
- JWT Authentication - Authenticate with providers
Next Steps
- Examples - Real-world code examples for common tasks
- API Reference - Complete API documentation
- SDL Reference - Stack Definition Language documentation
Troubleshooting
Common Issues
”Insufficient funds” error:
- Ensure your wallet has enough AKT tokens
- Sandbox tokens: Get from faucet
No bids received:
- Check your SDL syntax is valid
- Ensure resource requirements are reasonable
- Wait longer (up to 2 minutes)
Provider connection failed:
- Verify provider URL is correct
- Check JWT token is valid and not expired
- Ensure provider is online and accepting deployments
Support
- Discord: Akash Network Discord
- GitHub: chain-sdk repository
- Documentation: Akash Docs