Slashing¶
The Slashing module provides validator slashing operations including unjailing validators and querying validator signing information for 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
.
Access slashing operations through the main client:
from akash import AkashClient
client = AkashClient("https://akash-rpc.polkachu.com:443")
slashing_operations = client.slashing
Transactions¶
unjail()¶
Unjail a validator that has been jailed for downtime.
def unjail(wallet, validator_address: str = None, memo: str = "",
fee_amount: str = "5000", gas_limit: int = None, gas_adjustment: float = 1.2,
use_simulation: bool = True) -> BroadcastResult
Required parameters:
wallet
(Wallet
): Validator's operator wallet
Optional parameters:
validator_address
(str
): Validator address to unjail (default: derives from wallet)memo
(str
): Transaction memo (default: "")fee_amount
(str
): Fee amount in uakt (default: "5000")gas_limit
(int
): Gas limit override (default: None)gas_adjustment
(float
): Gas estimation multiplier (default: 1.2)use_simulation
(bool
): Enable gas simulation (default: True)
Returns: BroadcastResult
- Transaction result with the following fields:
tx_hash
(str
): Transaction hashcode
(int
): Response code (0 for success)raw_log
(str
): Raw transaction log/error messagesuccess
(bool
): Whether transaction succeededevents
(List[Dict]
): Transaction eventstype
(str
): Event typeattributes
(List[Dict]
): Event attributeskey
(str
): Attribute keyvalue
(str
): Attribute value
Example:
from akash import AkashClient, AkashWallet
client = AkashClient("https://akash-rpc.polkachu.com:443")
wallet = AkashWallet.from_mnemonic("validator operator mnemonic")
result = client.slashing.unjail(
wallet=wallet,
memo=""
)
result = client.slashing.unjail(
wallet=wallet,
validator_address="akashvaloper1...",
memo=""
)
if result.success:
print(f"Validator unjailed: {result.tx_hash}")
else:
print(f"Unjail failed: {result.log}")
Queries¶
get_params()¶
Query slashing parameters.
Returns: Dict
- Slashing parameters with the following fields:
signed_blocks_window
(str
): Signed blocks window sizemin_signed_per_window
(str
): Minimum signed blocks per windowdowntime_jail_duration
(str
): Duration a validator is jailed for downtimeslash_fraction_double_sign
(str
): Slash fraction for double signingslash_fraction_downtime
(str
): Slash fraction for downtime
Example:
from akash import AkashClient
client = AkashClient("https://akash-rpc.polkachu.com:443")
params = client.slashing.get_params()
print(f"Signed blocks window: {params['signed_blocks_window']}")
print(f"Downtime jail duration: {params['downtime_jail_duration']}")
print(f"Downtime slash fraction: {params['slash_fraction_downtime']}")
get_signing_info()¶
Query signing info of a specific validator by consensus address.
Required parameters:
cons_address
(str
): Consensus address of the validator
Returns: Dict
- Validator signing info with the following fields:
address
(str
): Validator consensus addressstart_height
(str
): Height when validator started signingindex_offset
(str
): Index offset in signing windowjailed_until
(str
): Timestamp until which validator is jailedtombstoned
(bool
): Whether validator is tombstonedmissed_blocks_counter
(str
): Number of missed blocks
Example:
from akash import AkashClient
client = AkashClient("https://akash-rpc.polkachu.com:443")
info = client.slashing.get_signing_info("akashvalcons1...")
print(f"Validator: {info['address']}")
print(f"Start height: {info['start_height']}")
print(f"Missed blocks: {info['missed_blocks_counter']}")
print(f"Tombstoned: {info['tombstoned']}")
if info['jailed_until'] != "0.000000000Z":
print(f"Jailed until: {info['jailed_until']}")
get_signing_infos()¶
Query signing info of all validators.
Optional parameters:
limit
(int
): Maximum number of validators to return (default: None)offset
(int
): Number of validators to skip (default: None)
Returns: List[Dict]
- List of validator signing infos (same structure as get_signing_info)
Example:
from akash import AkashClient
client = AkashClient("https://akash-rpc.polkachu.com:443")
infos = client.slashing.get_signing_infos(limit=10)
print(f"Found {len(infos)} validators")
for info in infos:
missed_blocks = int(info['missed_blocks_counter'])
status = "Active" if missed_blocks < 100 else "Warning" if missed_blocks < 500 else "Risk"
print(f"{info['address']}: {missed_blocks} missed blocks - {status}")