Quick start¶
Get up and running with the Akash Python SDK in minutes.
Transaction parameters
All transaction functions support optional parameters like fee_amount
, gas_limit
, and gas_adjustment
. See Transaction parameters for details.
1. Installation¶
First, install the SDK:
2. Create a wallet¶
from akash.wallet import AkashWallet
# Generate a new wallet
wallet = AkashWallet.generate()
print(f"Address: {wallet.address}")
print(f"Mnemonic: {wallet.mnemonic}")
Security first
Never share your mnemonic phrase! Store it securely offline. Anyone with your mnemonic can access your funds.
3. Connect to network¶
from akash.client import AkashClient
client = AkashClient("https://rpc.akashnet.net:443") # chain_id defaults to "akashnet-2"
if client.health_check():
print("✅ Connected to Akash mainnet!")
status = client.get_network_status()
print(f"Network: {status.get('network', 'unknown')}")
print(f"latest block: {status.get('latest_block_height', '0')}")
print(f"node version: {status.get('node_version', 'unknown')}")
else:
print("❌ Connection failed")
4. Query balance¶
from akash.client import AkashClient
from akash.wallet import AkashWallet
wallet = AkashWallet.from_mnemonic("twelve word mnemonic phrase here")
client = AkashClient("https://rpc.akashnet.net:443")
balance = client.bank.get_balance(wallet.address, "uakt")
print(f"Balance: {int(balance) / 1_000_000:.6f} AKT")
balances = client.bank.get_all_balances(wallet.address)
print(f"Total denoms: {len(balances)}")
foundation_address = "akash17xpfvakm2amg962yls6f84z3kell8c5lserqta"
foundation_balance = client.bank.get_balance(foundation_address, "uakt")
print(f"Foundation balance: {int(foundation_balance) / 1_000_000:.6f} AKT")
5. Send tokens¶
Send AKT:
from akash import AkashClient, AkashWallet
wallet = AkashWallet.from_mnemonic("twelve word mnemonic phrase here")
recipient_wallet = AkashWallet.generate()
print(f"Sending tokens to: {recipient_wallet.address}")
client = AkashClient("https://rpc.akashnet.net:443")
result = client.bank.send(
wallet=wallet,
to_address=recipient_wallet.address,
amount="1000000", # 1 AKT
memo=""
)
if result.success:
print("✅ Transaction successful!")
print(f"transaction hash: {result.tx_hash}")
print(f"gas used: {result.gas_used}")
print(f"fee paid: {result.fee}")
else:
print(f"❌ Transaction failed: {result.raw_log}")
Advanced usage¶
result = client.bank.send(
wallet=wallet,
to_address=recipient_wallet.address,
amount="1000000",
fee_amount="15000",
use_simulation=True
)
result = client.bank.send(
wallet=wallet,
to_address=recipient_wallet.address,
amount="1000000",
gas_limit=120000,
use_simulation=False
)
result = client.bank.send(
wallet=wallet,
to_address=recipient_wallet.address,
amount="1000000",
fee_amount="10000",
gas_limit=100000,
gas_adjustment=1.5,
use_simulation=False
)
6. Governance and staking¶
Participate in Akash governance and earn staking rewards:
from akash.client import AkashClient
from akash.wallet import AkashWallet
wallet = AkashWallet.from_mnemonic("your mnemonic here")
client = AkashClient("https://rpc.akashnet.net:443", "akashnet-2")
print("Querying governance proposals...")
proposals = client.governance.get_proposals()
print(f"✅ Found {len(proposals)} proposals")
print("\nQuerying validators...")
validators = client.staking.get_validators()
print(f"✅ Found {len(validators)} validators")
print("\nChecking your delegations...")
delegations = client.staking.get_delegations(wallet.address)
print(f"✅ You have {len(delegations)} delegations")
print("\nQuerying staking parameters...")
staking_params = client.staking.get_params()
print("✅ Staking params retrieved")
print("\nQuerying governance parameters...")
gov_params = client.governance.get_governance_params()
print("✅ Governance params retrieved")
print("\nReady for staking and governance operations!")
print("▫️ Delegate to validators to earn rewards")
print("▫️ Vote on governance proposals")
print("▫️ Submit your own proposals")
API Design
The SDK provides both high-level convenience methods and low-level ABCI queries:
▫️ High-level: Methods like get_validators()
, get_proposals()
, get_balance()
▫️ Low-level: ABCI queries like abci_query("/cosmos.staking.v1beta1.Query/Validators")
7. Network status¶
Query real-time mainnet information:
from akash.client import AkashClient
client = AkashClient("https://rpc.akashnet.net:443")
print("Akash mainnet status:")
status = client.get_network_status()
print(f"Network: {status.get('network', 'unknown')}")
print(f"node version: {status.get('node_version', 'unknown')}")
print(f"latest block: {status.get('latest_block_height', '0'):,}")
print(f"latest block time: {status.get('latest_block_time', 'unknown')[:19]}")
catching_up = status.get('catching_up', True)
print(f"Syncing: {'Yes' if catching_up else 'No (fully synced)'}")
print("\nNetwork health:")
if client.health_check():
print(" ✅ RPC endpoint is healthy and responsive")
print(" ✅ Ready for all operations")
else:
print(" ❌ Network connection issues")
Examples¶
▫️ Basic usage - Working code samples
▫️ Wallet operations - Advanced wallet operations
▫️ Deploying applications - Complete deployment workflow
▫️ Working with providers - Finding the right providers
▫️ Market operations - Bidding and leases
API reference¶
audit • auth • authz • bank • cert • client • deployment • discovery • distribution • escrow • evidence • feegrant • governance • grpc_client • ibc • inflation • inventory • manifest • market • provider • slashing • staking • tx • wallet