Skip to content

Basic usage

Simple examples showing wallet creation, client connection, and basic operations.

Create and import wallets

Generate new wallet

from akash import AkashWallet

# Generate new wallet
wallet = AkashWallet.generate()
print(f"Address: {wallet.address}")
print(f"Mnemonic: {wallet.mnemonic}")

Import from mnemonic

from akash import AkashWallet

# Import from existing mnemonic
mnemonic = "poverty torch street hybrid estate message increase play negative vibrant transfer six police tiny garment congress survey tired used audit dolphin focus abstract appear"
wallet = AkashWallet.from_mnemonic(mnemonic)
print(f"Imported address: {wallet.address}")
# Output: akash1qnnhhgzxj24f2kld5yhy4v4h4s9r295ak5gjw4

API reference

See Wallet API for complete wallet management operations

Connect to Akash network

Basic connection

from akash import AkashClient

client = AkashClient("https://akash-rpc.polkachu.com:443")
if client.health_check():
    print("Connected to Akash network")
else:
    print("Connection failed")

API reference

See Client API for connection management and network operations

Get network information

from akash import AkashClient

client = AkashClient("https://akash-rpc.polkachu.com:443")

status = client.get_network_status()
print(f"Network: {status['network']}")
print(f"Block height: {status['latest_block_height']}")

validators = client.get_validators()
print(f"Active validators: {len(validators)}")

Query account information

Check balance

from akash import AkashClient
from akash import AkashWallet

client = AkashClient("https://akash-rpc.polkachu.com:443")
wallet = AkashWallet.from_mnemonic("your mnemonic here")

balance = client.get_balance(wallet.address)
balance_akt = int(balance) / 1_000_000
print(f"Balance: {balance_akt:.6f} AKT")

balances = client.get_balances(wallet.address)
for denom, amount in balances.items():
    print(f"{denom}: {amount}")

API reference

See Bank API for balance queries and token operations

Check account details

from akash import AkashClient, AkashWallet

client = AkashClient("https://akash-rpc.polkachu.com:443")
wallet = AkashWallet.from_mnemonic("your mnemonic here")

account_info = client.get_account_info(wallet.address)
print(f"Account number: {account_info.get('account_number', 0)}")
print(f"Sequence: {account_info.get('sequence', 0)}")

delegations = client.get_delegations(wallet.address)
print(f"Active delegations: {len(delegations)}")

API reference

See Staking API for delegation and validator operations

Send tokens

Basic transfer

from akash import AkashClient
from akash import AkashWallet

client = AkashClient("https://akash-rpc.polkachu.com:443")
wallet = AkashWallet.from_mnemonic("your mnemonic here")

result = client.bank.send(
    wallet=wallet,
    to_address="akash1recipient...",
    amount="1000000",
    memo=""
)

if result.success:
    print(f"Transfer successful: {result.tx_hash}")
else:
    print(f"Transfer failed: {result.error}")

API reference

See Bank API for token transfer methods and transaction parameters

Sign messages

Basic message signing

from akash import AkashWallet

wallet = AkashWallet.generate()

message = "Hello Akash Network"
signature = wallet.sign_message(message)
print(f"Signature: {signature}")

is_valid = wallet.verify_signature(message, signature)
print(f"Signature valid: {is_valid}")

Working with providers

List providers

from akash import AkashClient

client = AkashClient("https://akash-rpc.polkachu.com:443")

providers = client.provider.get_providers(limit=5)
print(f"Found {len(providers)} providers")

for provider in providers:
    print(f"Provider: {provider['owner']}")
    print(f"Host URI: {provider.get('host_uri', 'N/A')}")

API reference

See Provider API for provider discovery and management operations

Get provider endpoint

from akash import AkashClient

client = AkashClient("https://rpc.akashnet.net:443")

provider_address = "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
endpoint = client.get_provider_endpoint(provider_address)
print(f"Provider gRPC endpoint: {endpoint}")

Context manager usage

from akash import AkashClient
from akash import AkashWallet

with AkashClient("https://akash-rpc.polkachu.com:443") as client:
    wallet = AkashWallet.generate()

    balance = client.get_balance(wallet.address)
    validators = client.get_validators()

    print(f"Balance: {balance}")
    print(f"Validators: {len(validators)}")

Using testnet

from akash import AkashClient

client = AkashClient(
    rpc_endpoint="https://rpc.sandbox-01.aksh.pw:443",
    chain_id="sandbox-01"
)

status = client.get_network_status()
print(f"Testnet network: {status['network']}")