Skip to content

Evidence module

The evidence module provides functionality for submitting and querying evidence of validator misbehavior on the Akash Network.

Transaction parameters

All transaction functions support optional parameters like fee_amount, gas_limit, and gas_adjustment. See Transaction parameters for details.

EvidenceClient class

from akash import AkashClient

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

evidence = client.evidence

Transactions

submit_evidence()

Submit evidence of validator misbehavior.

def submit_evidence(wallet, evidence_data: Dict[str, Any], memo: str = "",
                    fee_amount: str = "5000", gas_limit: int = 200000, gas_adjustment: float = 1.2,
                    use_simulation: bool = True) -> BroadcastResult

Required parameters:

  • wallet (AkashWallet): Wallet to sign the transaction
  • evidence_data (Dict[str, Any]): Evidence data including type and details

Optional parameters:

  • memo (str): Transaction memo (default: "")
  • fee_amount (str): Fee amount in uakt (default: "5000")
  • gas_limit (int): Gas limit (default: 200000)
  • 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

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

evidence_data = {
    "type_url": "/cosmos.evidence.v1beta1.Equivocation",
    "content": b"actual_evidence_bytes_here"
}

validation = client.evidence.validate_evidence_format(evidence_data)
if not validation["valid"]:
    print(f"Invalid evidence: {validation['errors']}")
    exit()

result = client.evidence.submit_evidence(
    wallet=wallet,
    evidence_data=evidence_data,
    memo=""
)

if result.success:
    print(f"Evidence submitted successfully: {result.tx_hash}")
else:
    print(f"Evidence submission failed: {result.raw_log}")

Queries

get_evidence()

Query specific evidence by hash.

def get_evidence(evidence_hash: str) -> Dict[str, Any]

Required parameters:

  • evidence_hash (str): Hash of the evidence to query

Returns: Dict[str, Any] with the following fields:

  • evidence (Dict): Evidence information (if found)
    • type_url (str): Evidence type URL
    • height (int): Block height
    • time (str): Evidence timestamp
    • validator (str): Validator address
    • total_voting_power (int): Total voting power
    • validator_power (int): Validator power

Example:

from akash import AkashClient

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

evidence = client.evidence.get_evidence("ABC123DEF456...")

if evidence and "evidence" in evidence:
    print(f"Evidence type: {evidence['evidence']['type_url']}")
else:
    print("Evidence not found")

get_all_evidence()

Query all evidence records.

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

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[str, Any]] - List of evidence records with the following fields:

  • type_url (str): Evidence type URL
  • evidence_data (str): Evidence data in hex format

Example:

from akash import AkashClient

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

all_evidence = client.evidence.get_all_evidence(limit=50)

page_2_evidence = client.evidence.get_all_evidence(limit=20, offset=20)

print(f"Found {len(all_evidence)} evidence records:")
for i, evidence in enumerate(all_evidence):
    print(f"{i+1}. Type: {evidence['type_url']}")
    print(f"Data length: {len(evidence['evidence_data'])} hex chars")

Utils

validate_evidence_format()

Validate evidence data format.

def validate_evidence_format(evidence_data: Dict[str, Any]) -> Dict[str, Any]

Required parameters:

  • evidence_data (Dict[str, Any]): Evidence data to validate

Returns: Dict[str, Any] with the following fields:

  • valid (bool): Whether evidence format is valid
  • errors (List[str]): List of validation errors
  • warnings (List[str]): List of validation warnings

Example:

from akash import AkashClient

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

evidence_data = {
    "type_url": "/cosmos.evidence.v1beta1.Equivocation",
    "content": b"evidence_content_bytes"
}

validation = client.evidence.validate_evidence_format(evidence_data)

if validation["valid"]:
    print("Evidence format is valid")

    if validation["warnings"]:
        print("Warnings:")
        for warning in validation["warnings"]:
            print(f"- {warning}")
else:
    print("Evidence format is invalid:")
    for error in validation["errors"]:
        print(f"- {error}")

invalid_evidence = {"type_url": "/cosmos.evidence.v1beta1.Equivocation"}
validation = client.evidence.validate_evidence_format(invalid_evidence)
print(f"Valid: {validation['valid']}")
print(f"Errors: {validation['errors']}")