Skip to content

Governance module

The governance module provides governance functionality for the Akash Network, enabling democratic participation through proposal creation, voting, and deposits.

Transaction parameters

All transaction functions support flexible parameters. See Transaction parameters for details on available options like fee_amount, gas_limit, and gas_adjustment.

GovernanceClient Class

from akash import AkashClient

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

governance = client.governance

Transactions

submit_text_proposal()

Submits a text proposal for governance voting.

def submit_text_proposal(wallet, title: str, description: str,
                         deposit: str = "10000000", denom: str = "uakt",
                         memo: str = "", fee_amount: str = None,
                         gas_limit: int = None, gas_adjustment: float = 1.2,
                         use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (Wallet): Wallet to sign the transaction (proposer)
  • title (str): Proposal title
  • description (str): Proposal description

Optional parameters:

  • deposit (str): Initial deposit in base units (default: "10000000")
  • denom (str): Token denomination (default: "uakt")
  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in base units (default: None)
  • gas_limit (int): Gas limit override (default: None)
  • gas_adjustment (float): Multiplier for gas estimation (default: 1.2)
  • use_simulation (bool): Enable gas simulation (default: True)

Returns: BroadcastResult - Transaction result with the following fields:

  • tx_hash (str): Transaction hash
  • code (int): Response code (0 for success)
  • raw_log (str): Raw transaction log/error message
  • success (bool): Whether transaction succeeded
  • events (List[Dict]): Transaction events
    • type (str): Event type
    • attributes (List[Dict]): Event attributes
      • key (str): Attribute key
      • value (str): Attribute value

Example:

from akash import AkashClient, AkashWallet

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

# Submit text proposal
result = client.governance.submit_text_proposal(
    wallet=wallet,
    title="Akash Network Infrastructure Enhancement",
    description="Proposal to enhance the Akash Network infrastructure and improve decentralized compute capabilities.",
    deposit="64000000",
    denom="uakt"
)

print(f"TX hash: {result.tx_hash}")
print(f"Success: {result.success}")

submit_parameter_change_proposal()

Submits a parameter change proposal for governance voting.

def submit_parameter_change_proposal(wallet, title: str, description: str,
                                     changes: List[Dict[str, Any]],
                                     deposit: str = "64000000", denom: str = "uakt",
                                     memo: str = "",
                                     fee_amount: str = None, gas_limit: int = None,
                                     gas_adjustment: float = 1.2, use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (Wallet): Wallet to sign the transaction (proposer)
  • title (str): Proposal title
  • description (str): Proposal description
  • changes (List[Dict]): List of parameter changes with:
    • subspace (str): Parameter subspace
    • key (str): Parameter key
    • value (str): New parameter value

Optional parameters:

  • deposit (str): Initial deposit in base units (default: "64000000")
  • denom (str): Token denomination (default: "uakt")
  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in base units (default: None)
  • gas_limit (int): Gas limit override (default: None)
  • gas_adjustment (float): Multiplier for gas estimation (default: 1.2)
  • use_simulation (bool): Enable gas simulation (default: True)

Returns: BroadcastResult - Transaction result with the following fields:

  • tx_hash (str): Transaction hash
  • code (int): Response code (0 for success)
  • raw_log (str): Raw transaction log/error message
  • success (bool): Whether transaction succeeded
  • events (List[Dict]): Transaction events
    • type (str): Event type
    • attributes (List[Dict]): Event attributes
      • key (str): Attribute key
      • value (str): Attribute value

Example:

from akash import AkashClient, AkashWallet

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

changes = [{
    "subspace": "staking",
    "key": "MaxValidators",
    "value": "150"
}]

result = client.governance.submit_parameter_change_proposal(
    wallet=wallet,
    title="Increase Maximum Validators",
    description="Proposal to increase the maximum number of validators from 100 to 150.",
    changes=changes
)

print(f"TX hash: {result.tx_hash}")
print(f"Success: {result.success}")

submit_software_upgrade_proposal()

Submits a software upgrade proposal for governance voting.

def submit_software_upgrade_proposal(wallet, title: str, description: str,
                                     upgrade_name: str, upgrade_height: int,
                                     upgrade_info: str = "", deposit: str = "64000000", denom: str = "uakt",
                                     memo: str = "", fee_amount: str = None,
                                     gas_limit: int = None, gas_adjustment: float = 1.2,
                                     use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (Wallet): Wallet to sign the transaction (proposer)
  • title (str): Proposal title
  • description (str): Proposal description
  • upgrade_name (str): Name of the software upgrade
  • upgrade_height (int): Block height at which to perform upgrade

Optional parameters:

  • upgrade_info (str): Additional upgrade information (default: "")
  • deposit (str): Initial deposit in base units (default: "64000000")
  • denom (str): Token denomination (default: "uakt")
  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in base units (default: None)
  • gas_limit (int): Gas limit override (default: None)
  • gas_adjustment (float): Multiplier for gas estimation (default: 1.2)
  • use_simulation (bool): Enable gas simulation (default: True)

Returns: BroadcastResult - Transaction result with the following fields:

  • tx_hash (str): Transaction hash
  • code (int): Response code (0 for success)
  • raw_log (str): Raw transaction log/error message
  • success (bool): Whether transaction succeeded
  • events (List[Dict]): Transaction events
    • type (str): Event type
    • attributes (List[Dict]): Event attributes
      • key (str): Attribute key
      • value (str): Attribute value

Example:

from akash import AkashClient, AkashWallet

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

# Submit software upgrade proposal
result = client.governance.submit_software_upgrade_proposal(
    wallet=wallet,
    title="Akash Network v0.25.0 Upgrade",
    description="Upgrade to Akash Network v0.25.0 with improved performance and new features.",
    upgrade_name="v0.25.0",
    upgrade_height=12500000,
    upgrade_info="Binary available at https://github.com/akash-network/node/releases/tag/v0.25.0"
)

print(f"TX hash: {result.tx_hash}")
print(f"Success: {result.success}")

vote()

Votes on a governance proposal.

def vote(wallet, proposal_id: int, option: str,
         memo: str = "", fee_amount: str = None,
         gas_limit: int = None, gas_adjustment: float = 1.2,
         use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (Wallet): Wallet to sign the transaction (voter)
  • proposal_id (int): Proposal ID to vote on
  • option (str): Vote option (YES, NO, ABSTAIN, NO_WITH_VETO)

Optional parameters:

  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in base units (default: None)
  • gas_limit (int): Gas limit override (default: None)
  • gas_adjustment (float): Multiplier for gas estimation (default: 1.2)
  • use_simulation (bool): Enable gas simulation (default: True)

Returns: BroadcastResult - Transaction result with the following fields:

  • tx_hash (str): Transaction hash
  • code (int): Response code (0 for success)
  • raw_log (str): Raw transaction log/error message
  • success (bool): Whether transaction succeeded
  • events (List[Dict]): Transaction events
    • type (str): Event type
    • attributes (List[Dict]): Event attributes
      • key (str): Attribute key
      • value (str): Attribute value

Note: Vote options are case-insensitive and validated against valid options (YES, NO, ABSTAIN, NO_WITH_VETO).

Example:

from akash import AkashClient, AkashWallet

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

# Vote on proposal
result = client.governance.vote(
    wallet=wallet,
    proposal_id=42,
    option="YES"
)

print(f"TX hash: {result.tx_hash}")
print(f"Vote successful: {result.success}")

deposit()

Deposits tokens to a governance proposal to help it reach the minimum deposit threshold.

def deposit(wallet, proposal_id: int, amount: str = "10000000",
            denom: str = "uakt", memo: str = "",
            fee_amount: str = None, gas_limit: int = None,
            gas_adjustment: float = 1.2, use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (Wallet): Wallet to sign the transaction (depositor)
  • proposal_id (int): Proposal ID to deposit to

Optional parameters:

  • amount (str): Deposit amount in base units (default: "10000000")
  • denom (str): Token denomination (default: "uakt")
  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in base units (default: None)
  • gas_limit (int): Gas limit override (default: None)
  • gas_adjustment (float): Multiplier for gas estimation (default: 1.2)
  • use_simulation (bool): Enable gas simulation (default: True)

Returns: BroadcastResult - Transaction result with the following fields:

  • tx_hash (str): Transaction hash
  • code (int): Response code (0 for success)
  • raw_log (str): Raw transaction log/error message
  • success (bool): Whether transaction succeeded
  • events (List[Dict]): Transaction events
    • type (str): Event type
    • attributes (List[Dict]): Event attributes
      • key (str): Attribute key
      • value (str): Attribute value

Example:

from akash import AkashClient, AkashWallet

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

# Deposit to proposal
result = client.governance.deposit(
    wallet=wallet,
    proposal_id=42,
    amount="10000000",
    denom="uakt"
)

print(f"TX hash: {result.tx_hash}")
print(f"Deposit successful: {result.success}")

Queries

get_proposals()

Retrieves governance proposals from the network.

def get_proposals(status: Optional[str] = None, limit: int = 100, offset: int = 0, count_total: bool = False) -> List[Dict[str, Any]]

Optional parameters:

  • status (str): Filter by proposal status (default: None)
  • limit (int): Maximum number of results to return (default: 100)
  • offset (int): Number of results to skip (default: 0)
  • count_total (bool): Include total count in response (default: False)

Returns: List[Dict] - List of proposals, each containing:

  • proposal_id (int): Unique proposal identifier
  • content (Dict): Proposal content with title, description, and type
  • title (str): Proposal title
  • status (int): Proposal status code
  • final_tally_result (Dict): Vote tally with yes, no, abstain, no_with_veto counts
  • submit_time (str): Timestamp when proposal was submitted
  • deposit_end_time (str): Timestamp when deposit period ends
  • total_deposit (List[Dict]): List of deposited coins
    • denom (str): Token denomination
    • amount (str): Deposit amount
  • voting_start_time (str): Timestamp when voting period starts
  • voting_end_time (str): Timestamp when voting period ends

Example:

from akash import AkashClient

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

proposals = client.governance.get_proposals()

passed_proposals = client.governance.get_proposals(status="passed")

first_10 = client.governance.get_proposals(limit=10)
next_10 = client.governance.get_proposals(limit=10, offset=10)

voting_proposals = client.governance.get_proposals(
    status="voting_period", 
    limit=5
)

for proposal in proposals:
    print(f"Proposal {proposal['proposal_id']}: {proposal['title']}")
    print(f"Status: {proposal['status']}")
    print(f"Yes: {proposal['final_tally_result']['yes']}")
    print(f"No: {proposal['final_tally_result']['no']}")
    print("---")

get_proposal()

Retrieves detailed information about a specific governance proposal.

def get_proposal(proposal_id: int) -> Dict[str, Any]

Required parameters:

  • proposal_id (int): Proposal ID to query

Returns: Dict - Proposal information with the following fields:

  • proposal_id (int): Unique proposal identifier
  • status (int): Proposal status code
  • title (str): Proposal title
  • description (str): Proposal description
  • total_deposit (List[Dict]): List of deposited coins
    • denom (str): Token denomination
    • amount (str): Deposit amount
  • voting_start_time (str): Timestamp when voting period starts
  • voting_end_time (str): Timestamp when voting period ends

Note: Returns an empty dictionary if the proposal is not found.

Example:

from akash import AkashClient

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

proposal = client.governance.get_proposal(42)

if proposal:
    print(f"Proposal {proposal['proposal_id']}: {proposal['title']}")
    print(f"Description: {proposal['description']}")
    print(f"Status: {proposal['status']}")
    print(f"Voting ends: {proposal['voting_end_time']}")
else:
    print("Proposal not found")

get_proposal_votes()

Retrieves all votes for a specific proposal.

⚠️ Only works for proposals in voting stage.

def get_proposal_votes(proposal_id: int, limit: int = 100, offset: int = 0, count_total: bool = False) -> List[Dict[str, Any]]

Required parameters:

  • proposal_id (int): Proposal ID to query votes for

Optional parameters:

  • limit (int): Maximum number of results to return (default: 100)
  • offset (int): Number of results to skip (default: 0)
  • count_total (bool): Include total count in response (default: False)

Returns: List[Dict] - List of votes, each containing:

  • proposal_id (int): Proposal identifier
  • voter (str): Address of the voter
  • option (int): Vote option (1=YES, 2=ABSTAIN, 3=NO, 4=NO_WITH_VETO)
  • options (List[Dict]): List of weighted vote options (for weighted votes)
    • option (int): Vote option
    • weight (str): Vote weight

Example:

from akash import AkashClient

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

votes = client.governance.get_proposal_votes(42)

recent_votes = client.governance.get_proposal_votes(42, limit=10)

first_100 = client.governance.get_proposal_votes(42, limit=100)
next_100 = client.governance.get_proposal_votes(42, limit=100, offset=100)

vote_options = {1: "YES", 2: "ABSTAIN", 3: "NO", 4: "NO_WITH_VETO"}

for vote in votes:
    voter = vote['voter']
    option = vote_options.get(vote['option'], "UNKNOWN")
    print(f"{voter}: {option}")

print(f"Total votes: {len(votes)}")

get_vote()

Retrieves a specific vote from a voter on a proposal.

def get_vote(proposal_id: int, voter_address: str) -> Dict[str, Any]

Required parameters:

  • proposal_id (int): Proposal ID to query
  • voter_address (str): Address of the voter

Returns: Dict - Vote information with the following fields:

  • proposal_id (int): Proposal identifier
  • voter (str): Address of the voter
  • option (int): Vote option (1=YES, 2=ABSTAIN, 3=NO, 4=NO_WITH_VETO)
  • options (List[Dict]): List of weighted vote options (for weighted votes)
    • option (int): Vote option
    • weight (str): Vote weight

Note: Returns an empty dictionary if no vote is found from the specified voter.

Example:

from akash import AkashClient

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

vote = client.governance.get_vote(
    proposal_id=42,
    voter_address="akash1qnnhhgzxj24f2kld5yhy4v4h4s9r295ak5gjw4"
)

if vote:
    vote_options = {1: "YES", 2: "ABSTAIN", 3: "NO", 4: "NO_WITH_VETO"}
    option = vote_options.get(vote['option'], "UNKNOWN")
    print(f"Voted: {option}")
else:
    print("No vote found from this address")

get_proposal_deposits()

Retrieves all deposits for a specific proposal.

def get_proposal_deposits(proposal_id: int) -> List[Dict[str, Any]]

Required parameters:

  • proposal_id (int): Proposal ID to query deposits for

Returns: List[Dict] - List of deposits, each containing:

  • proposal_id (int): Proposal identifier
  • depositor (str): Address of the depositor
  • amount (List[Dict]): List of deposited coins
    • denom (str): Token denomination
    • amount (str): Deposit amount

Example:

from akash import AkashClient

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

deposits = client.governance.get_proposal_deposits(42)

total_deposited = 0
for deposit in deposits:
    depositor = deposit['depositor']
    for coin in deposit['amount']:
        amount = int(coin['amount'])
        denom = coin['denom']
        total_deposited += amount
        print(f"{depositor}: {amount / 1_000_000:.6f} {denom.upper()}")

print(f"Total deposited: {total_deposited / 1_000_000:.6f} AKT")

get_proposal_tally()

Retrieves the current vote tally for a proposal.

def get_proposal_tally(proposal_id: int) -> Dict[str, Any]

Required parameters:

  • proposal_id (int): Proposal ID to get tally for

Returns: Dict - Vote tally with the following fields:

  • yes (str): Total YES votes in base units
  • abstain (str): Total ABSTAIN votes in base units
  • no (str): Total NO votes in base units
  • no_with_veto (str): Total NO_WITH_VETO votes in base units

Example:

from akash import AkashClient

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

tally = client.governance.get_proposal_tally(42)

yes_votes = int(tally['yes']) / 1_000_000
no_votes = int(tally['no']) / 1_000_000
abstain_votes = int(tally['abstain']) / 1_000_000
no_with_veto_votes = int(tally['no_with_veto']) / 1_000_000

print(f"Vote tally for proposal #42:")
print(f"Yes: {yes_votes:,.0f} AKT")
print(f"No: {no_votes:,.0f} AKT")
print(f"Abstain: {abstain_votes:,.0f} AKT")
print(f"No with Veto: {no_with_veto_votes:,.0f} AKT")

total_votes = yes_votes + no_votes + abstain_votes + no_with_veto_votes
if total_votes > 0:
    print(f"Yes percentage: {(yes_votes / total_votes) * 100:.2f}%")

get_governance_params()

Retrieves governance module parameters for all parameter types.

def get_governance_params() -> Dict[str, Any]

Returns: Dict - Governance parameters with the following fields:

  • voting_period (str): Voting period duration
  • voting_period_seconds (int): Voting period in seconds
  • max_deposit_period (str): Maximum deposit period duration
  • max_deposit_period_seconds (int): Maximum deposit period in seconds
  • min_deposit (List[Dict]): Minimum deposit required with denom and amount
  • quorum (str): Quorum percentage required
  • threshold (str): Approval threshold percentage
  • veto_threshold (str): Veto threshold percentage

Example:

from akash import AkashClient

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

params = client.governance.get_governance_params()

print(f"Voting period: {params.get('voting_period_seconds', 0) / (24 * 60 * 60):.1f} days")
print(f"Quorum: {float(params.get('quorum', '0')) * 100:.2f}%")
print(f"Threshold: {float(params.get('threshold', '0')) * 100:.2f}%")
print(f"Veto threshold: {float(params.get('veto_threshold', '0')) * 100:.2f}%")

if 'min_deposit' in params:
    for coin in params['min_deposit']:
        amount = int(coin['amount']) / 1_000_000
        denom = coin['denom']
        print(f"Min deposit: {amount:,.0f} {denom.upper()}")