Skip to content

Audit module

The audit module provides audit attestation functionality for provider reputation on the Akash Network.

Transaction parameters

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

AuditClient Class

from akash import AkashClient

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

audit = client.audit

Transactions

create_provider_attributes()

Create or update provider attributes as an auditor.

def create_provider_attributes(wallet, owner: str, attributes: List[Dict], memo: str = "", fee_amount: str = None, gas_limit: int = None, gas_adjustment: float = 1.2, use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (AkashWallet): Auditor wallet instance for signing
  • owner (str): Provider owner address to sign attributes for
  • attributes (List[Dict]): List of attributes to sign, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Optional parameters:

  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Transaction fee amount in base units (default: "20000")
  • gas_limit (int): Gas limit for transaction (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: Only auditors can sign provider attributes. The auditor address is automatically set from the wallet.

Example:

from akash import AkashClient, AkashWallet

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

auditor_wallet = AkashWallet.from_mnemonic("your auditor mnemonic")

result = client.audit.create_provider_attributes(
    wallet=auditor_wallet,
    owner="akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4",
    attributes=[
        {"key": "location-region", "value": "West Coast"},
        {"key": "country", "value": "United States"},
        {"key": "tier", "value": "premium"}
    ],
    fee_amount="25000"
)

if result.success:
    print(f"Attributes signed successfully: {result.tx_hash}")
else:
    print(f"Failed to sign attributes: {result.raw_log}")

delete_provider_attributes()

Delete provider attributes as an auditor.

def delete_provider_attributes(wallet, owner: str, keys: List[str], memo: str = "", fee_amount: str = None, gas_limit: int = None, gas_adjustment: float = 1.2, use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (AkashWallet): Auditor wallet instance for signing
  • owner (str): Provider owner address
  • keys (List[str]): List of attribute keys to delete

Optional parameters:

  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Transaction fee amount in base units (default: "20000")
  • gas_limit (int): Gas limit for transaction (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: Only auditors who originally signed the attributes can delete them.

Example:

from akash import AkashClient, AkashWallet

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

auditor_wallet = AkashWallet.from_mnemonic("your auditor mnemonic")

result = client.audit.delete_provider_attributes(
    wallet=auditor_wallet,
    owner="akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4",
    keys=["region", "tier"],
    fee_amount="25000"
)

if result.success:
    print(f"Attributes deleted successfully: {result.tx_hash}")
else:
    print(f"Failed to delete attributes: {result.raw_log}")

Queries

get_providers()

Query for all providers with audit attributes.

def get_providers(limit: Optional[int] = None, offset: Optional[int] = None, count_total: bool = False) -> List[Dict]

Optional parameters:

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

Returns: List[Dict] - List of provider attribute records with the following fields:

  • owner (str): Provider owner address
  • auditor (str): Auditor address who signed the attributes
  • attributes (List[Dict]): List of signed attributes, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Example:

from akash import AkashClient

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

providers = client.audit.get_providers(limit=10)

for provider in providers:
    print(f"Provider: {provider['owner']}")
    print(f"Auditor: {provider['auditor']}")
    for attr in provider['attributes']:
        print(f"{attr['key']}: {attr['value']}")

get_provider()

Query provider audit attributes by owner and auditor.

def get_provider(owner: str, auditor: str) -> Dict[str, Any]

Required parameters:

  • owner (str): Provider owner address
  • auditor (str): Auditor address

Returns: Dict[str, Any] - Provider audit attribute record with the following fields:

  • owner (str): Provider owner address
  • auditor (str): Auditor address who signed the attributes
  • attributes (List[Dict]): List of signed attributes, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Example:

from akash import AkashClient

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

provider = client.audit.get_provider(
    owner="akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4",
    auditor="akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63"
)

if provider:
    print(f"Found {len(provider['attributes'])} attributes")
    for attr in provider['attributes']:
        print(f"{attr['key']}: {attr['value']}")

get_provider_attributes()

Get attributes for a specific provider from all auditors.

def get_provider_attributes(owner: str, pagination: Dict = None) -> List[Dict]

Required parameters:

  • owner (str): Provider owner address

Optional parameters:

  • pagination (Dict): Pagination parameters with:
    • limit (int): Maximum number of results
    • offset (int): Number of results to skip
    • key (str): Pagination key for continuation

Returns: List[Dict] - List of provider attribute records with the following fields:

  • owner (str): Provider owner address
  • auditor (str): Auditor address who signed the attributes
  • attributes (List[Dict]): List of signed attributes, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Example:

from akash import AkashClient

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

attributes = client.audit.get_provider_attributes(
    owner="akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4",
    pagination={"limit": 50}
)

print(f"Provider has attributes from {len(attributes)} auditors")
for record in attributes:
    print(f"Auditor: {record['auditor']}")
    for attr in record['attributes']:
        print(f"{attr['key']}: {attr['value']}")

get_provider_auditor_attributes()

Get attributes for a specific provider from a specific auditor.

def get_provider_auditor_attributes(auditor: str, owner: str) -> List[Dict]

Required parameters:

  • auditor (str): Auditor address
  • owner (str): Provider owner address

Returns: List[Dict] - List of provider attribute records with the following fields:

  • owner (str): Provider owner address
  • auditor (str): Auditor address who signed the attributes
  • attributes (List[Dict]): List of signed attributes, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Example:

from akash import AkashClient

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

attributes = client.audit.get_provider_auditor_attributes(
    auditor="akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63",
    owner="akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4"
)

if attributes:
    record = attributes[0]
    print(f"Attributes: {len(record['attributes'])}")
    for attr in record['attributes']:
        print(f"{attr['key']}: {attr['value']}")

get_auditor_attributes()

Get all attributes signed by a specific auditor across all providers.

def get_auditor_attributes(auditor: str, pagination: Dict = None) -> List[Dict]

Required parameters:

  • auditor (str): Auditor address

Optional parameters:

  • pagination (Dict): Pagination parameters with:
    • limit (int): Maximum number of results
    • offset (int): Number of results to skip
    • key (str): Pagination key for continuation

Returns: List[Dict] - List of provider attribute records signed by auditor with the following fields:

  • owner (str): Provider owner address
  • auditor (str): Auditor address who signed the attributes
  • attributes (List[Dict]): List of signed attributes, each containing:
    • key (str): Attribute key
    • value (str): Attribute value

Example:

from akash import AkashClient

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

signed_attrs = client.audit.get_auditor_attributes(
    auditor="akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63",
    pagination={"limit": 100}
)

print(f"Auditor has signed attributes for {len(signed_attrs)} providers")
for record in signed_attrs:
    print(f"Provider: {record['owner']}")
    for attr in record['attributes']:
        print(f"{attr['key']}: {attr['value']}")

Utils

validate_provider_attributes()

Validate provider attribute structure for correctness.

def validate_provider_attributes(provider_data: Dict) -> bool

Required parameters:

  • provider_data (Dict): Provider attribute data to validate with expected fields:
    • owner (str): Provider owner address
    • auditor (str): Auditor address
    • attributes (List[Dict]): Attribute list

Returns: bool - True if structure is valid, False otherwise

Example:

from akash import AkashClient

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

provider_data = {
    "owner": "akash1ccktptfkvdc67msahlhmnzg5md3wh30u5h7vm4",
    "auditor": "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63",
    "attributes": [
        {"key": "location-region", "value": "West Coast"},
        {"key": "country", "value": "United States"}
    ]
}

is_valid = client.audit.validate_provider_attributes(provider_data)
print(f"Provider data is valid: {is_valid}")