Skip to content

Escrow module

The escrow module provides deployment escrow monitoring functionality for the Akash Network.

EscrowClient Class

from akash import AkashClient

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

escrow = client.escrow

Queries

get_blocks_remaining()

Compute the number of blocks remaining for a deployment's escrow account.

def get_blocks_remaining(owner: str, dseq: int) -> Dict[str, Any]

Required parameters:

  • owner (str): Deployment owner address
  • dseq (int): Deployment sequence number

Returns: Dict[str, Any] - Blocks remaining calculation info with the following fields:

  • blocks_remaining (int): Number of blocks the deployment can continue running
  • estimated_hours (float): Estimated time remaining in hours
  • estimated_time_remaining_seconds (int): Estimated time remaining in seconds
  • balance_remaining (float): Remaining balance after current block costs
  • escrow_balance_uakt (str): Current escrow balance in base units
  • total_lease_amount_per_block (str): Total lease cost per block in base units
  • daily_cost (str): Estimated daily cost in base units
  • current_height (int): Current blockchain height
  • settled_at (int): Block height when escrow was last settled

Note: Balance and cost values are returned in base units of the escrow denomination (uakt for testnet, IBC tokens for mainnet).

Example:

from akash import AkashClient

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

remaining = client.escrow.get_blocks_remaining("akash1owner...", 12345)

print(f"Blocks remaining: {remaining['blocks_remaining']:,}")
print(f"Estimated time: {remaining['estimated_hours']:.1f} hours")  
print(f"Daily cost: {remaining['daily_cost']} base units")
print(f"Current balance: {remaining['escrow_balance_uakt']} base units")

Usage examples

Monitor deployment runtime

from akash import AkashClient

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

def check_deployment_runtime(client, owner: str, dseq: int):
    try:
        remaining = client.escrow.get_blocks_remaining(owner, dseq)

        blocks_left = remaining['blocks_remaining']
        hours_left = remaining['estimated_hours']
        daily_cost = remaining['daily_cost']

        print(f"Deployment {dseq} status:")
        print(f"Blocks remaining: {blocks_left:,}")
        print(f"Time remaining: {hours_left:.1f} hours")
        print(f"Daily cost: {daily_cost} base units")

        if blocks_left < 1000:
            print(f"Low balance - top up soon!")

    except Exception as e:
        print(f"Failed to check escrow: {e}")

check_deployment_runtime(client, "akash1owner...", 12345)