Governance
- class pycardano.governance.CommitteeColdCredential(credential: Union[VerificationKeyHash, ScriptHash])
Bases:
StakeCredential
Represents a cold credential for a committee member.
- credential: Union[VerificationKeyHash, ScriptHash]
The actual credential, either a verification key hash or script hash
- class pycardano.governance.CommitteeColdCredentialEpochMap(*args, **kwargs)
Bases:
DictCBORSerializable
Represents a mapping of committee members to their expiration epochs.
- KEY_TYPE
alias of
CommitteeColdCredential
- VALUE_TYPE
alias of
int
- class pycardano.governance.ParameterChangeAction(gov_action_id: Optional[GovActionId], protocol_param_update: ProtocolParamUpdate, policy_hash: Optional[PolicyHash])
Bases:
CodedSerializable
Represents a governance action to change protocol parameters.
- gov_action_id: Optional[GovActionId]
Optional reference to a previous governance action
- protocol_param_update: ProtocolParamUpdate
Dictionary containing the protocol parameters to be updated
- policy_hash: Optional[PolicyHash]
Optional policy hash associated with this parameter change
- class pycardano.governance.HardForkInitiationAction(gov_action_id: Optional[GovActionId], protocol_version: Fraction)
Bases:
CodedSerializable
Represents a governance action to initiate a hard fork.
- gov_action_id: Optional[GovActionId]
Optional reference to a previous governance action
- protocol_version: Fraction
The target protocol version as (major, minor) version numbers
- class pycardano.governance.TreasuryWithdrawalsAction(withdrawals: TreasuryWithdrawal, policy_hash: Optional[PolicyHash])
Bases:
CodedSerializable
Represents a governance action to withdraw funds from the treasury.
- withdrawals: TreasuryWithdrawal
The withdrawal amounts and their destinations
- policy_hash: Optional[PolicyHash]
Optional policy hash associated with these withdrawals
- class pycardano.governance.NoConfidence(gov_action_id: Optional[GovActionId])
Bases:
CodedSerializable
Represents a governance action expressing no confidence.
- gov_action_id: Optional[GovActionId]
Optional reference to a previous governance action
- class pycardano.governance.UpdateCommittee(gov_action_id: Optional[GovActionId], committee_cold_credentials: OrderedSet[CommitteeColdCredential], committee_expiration: CommitteeColdCredentialEpochMap, quorum: Fraction)
Bases:
CodedSerializable
Represents a governance action to update the constitutional committee.
- gov_action_id: Optional[GovActionId]
Optional reference to a previous governance action
- committee_cold_credentials: OrderedSet[CommitteeColdCredential]
Set of cold credentials for committee members
- committee_expiration: CommitteeColdCredentialEpochMap
Mapping of committee members to their expiration epochs
- quorum: Fraction
The quorum threshold as a unit interval (numerator, denominator)
- class pycardano.governance.NewConstitution(gov_action_id: Optional[GovActionId], constitution: Tuple[Anchor, Optional[ScriptHash]])
Bases:
CodedSerializable
Represents a governance action to establish a new constitution.
- gov_action_id: Optional[GovActionId]
Optional reference to a previous governance action
- constitution: Tuple[Anchor, Optional[ScriptHash]]
The constitution data as (anchor, optional script hash)
- class pycardano.governance.InfoAction
Bases:
CodedSerializable
Represents an informational governance action with no direct effect.
- class pycardano.governance.GovActionId(transaction_id: TransactionId, gov_action_index: int)
Bases:
ArrayCBORSerializable
Represents a unique identifier for a governance action.
This identifier consists of a transaction ID and an index within that transaction.
- transaction_id: TransactionId
The transaction ID where this governance action was submitted
- gov_action_index: int
The index of this governance action within the transaction (0-65535)
- classmethod from_primitive(values: Union[list, tuple]) GovActionId
Restore a primitive value to its original class type.
- Parameters:
cls (ArrayBase) – The original class type.
values (List[Primitive]) – A list whose elements are CBOR primitives.
- Returns:
Restored object.
- Return type:
ArrayBase
- Raises:
DeserializeException – When the object could not be restored from primitives.
- class pycardano.governance.VotingProcedure(vote: Vote, anchor: Optional[Anchor])
Bases:
ArrayCBORSerializable
Represents a voting procedure for governance actions.
This defines how voting is conducted for a specific governance action.
- classmethod from_primitive(values: Union[list, tuple]) VotingProcedure
Restore a primitive value to its original class type.
- Parameters:
cls (ArrayBase) – The original class type.
values (List[Primitive]) – A list whose elements are CBOR primitives.
- Returns:
Restored object.
- Return type:
ArrayBase
- Raises:
DeserializeException – When the object could not be restored from primitives.
- to_shallow_primitive() Union[bytes, bytearray, str, int, float, Decimal, bool, None, tuple, list, IndefiniteList, dict, defaultdict, OrderedDict, datetime, Pattern, CBORSimpleValue, CBORTag, set, Fraction, frozenset, FrozenDict, FrozenList, IndefiniteFrozenList, ByteString]
- Returns:
A CBOR primitive.
- Return type:
Primitive
- Raises:
SerializeException – When the object could not be converted to CBOR primitive types.
- class pycardano.governance.VotingProcedures(*args, **kwargs)
Bases:
DictCBORSerializable
Represents a mapping of voters to their voting procedures.
- VALUE_TYPE
alias of
GovActionIdToVotingProcedure
- class pycardano.governance.VoterType(value)
Bases:
Enum
Represents the possible types of voters in the governance system.
- COMMITTEE_HOT = 'committee_hot'
- DREP = 'drep'
- STAKING_POOL = 'staking_pool'
- class pycardano.governance.Voter(credential: Union[VerificationKeyHash, ScriptHash], voter_type: VoterType)
Bases:
ArrayCBORSerializable
Represents a voter in the governance system.
Voters can be committee members, DReps, or stake pool operators.
- credential: Union[VerificationKeyHash, ScriptHash]
The credential identifying the voter
- to_shallow_primitive() Union[bytes, bytearray, str, int, float, Decimal, bool, None, tuple, list, IndefiniteList, dict, defaultdict, OrderedDict, datetime, Pattern, CBORSimpleValue, CBORTag, set, Fraction, frozenset, FrozenDict, FrozenList, IndefiniteFrozenList, ByteString]
- Returns:
A CBOR primitive.
- Return type:
Primitive
- Raises:
SerializeException – When the object could not be converted to CBOR primitive types.
- classmethod from_primitive(values: Union[list, tuple]) Voter
Restore a primitive value to its original class type.
- Parameters:
cls (ArrayBase) – The original class type.
values (List[Primitive]) – A list whose elements are CBOR primitives.
- Returns:
Restored object.
- Return type:
ArrayBase
- Raises:
DeserializeException – When the object could not be restored from primitives.
- class pycardano.governance.Vote(value)
Bases:
Enum
Represents possible voting choices in the governance system.
- NO = 0
- YES = 1
- ABSTAIN = 2
- class pycardano.governance.Anchor(url: str, data_hash: AnchorDataHash)
Bases:
ArrayCBORSerializable
Represents an anchor in the Cardano blockchain that contains a URL and associated data hash.
Anchors are used to provide additional metadata or reference external resources in certificates.
- url: str
The URL pointing to the anchor’s resource location
- data_hash: AnchorDataHash
The hash of the data associated with this anchor
- class pycardano.governance.GovActionIdToVotingProcedure(*args, **kwargs)
Bases:
DictCBORSerializable
Represents a mapping of governance action IDs to their voting procedures.
- KEY_TYPE
alias of
GovActionId
- VALUE_TYPE
alias of
VotingProcedure
- class pycardano.governance.ProposalProcedure(deposit: int, reward_account: bytes, gov_action: Union[ParameterChangeAction, HardForkInitiationAction, TreasuryWithdrawalsAction, NoConfidence, UpdateCommittee, NewConstitution, InfoAction], anchor: Anchor)
Bases:
ArrayCBORSerializable
Represents a proposal procedure for governance actions.
- deposit: int
The deposit required to submit a proposal
- reward_account: bytes
The reward account for the proposal
- gov_action: Union[ParameterChangeAction, HardForkInitiationAction, TreasuryWithdrawalsAction, NoConfidence, UpdateCommittee, NewConstitution, InfoAction]
The governance actions to be proposed
- class pycardano.governance.ProtocolParamUpdate(min_fee_a: Optional[int] = None, min_fee_b: Optional[int] = None, max_block_body_size: Optional[int] = None, max_transaction_size: Optional[int] = None, max_block_header_size: Optional[int] = None, key_deposit: Optional[int] = None, pool_deposit: Optional[int] = None, maximum_epoch: Optional[int] = None, n_opt: Optional[int] = None, pool_pledge_influence: Optional[Fraction] = None, expansion_rate: Optional[Fraction] = None, treasury_growth_rate: Optional[Fraction] = None, min_pool_cost: Optional[int] = None, ada_per_utxo_byte: Optional[int] = None, cost_models: Optional[Dict] = None, execution_costs: Optional[ExUnitPrices] = None, max_tx_ex_units: Optional[ExecutionUnits] = None, max_block_ex_units: Optional[ExecutionUnits] = None, max_value_size: Optional[int] = None, collateral_percentage: Optional[int] = None, max_collateral_inputs: Optional[int] = None, pool_voting_thresholds: Optional[PoolVotingThresholds] = None, drep_voting_thresholds: Optional[DRepVotingThresholds] = None, min_committee_size: Optional[int] = None, committee_term_limit: Optional[int] = None, governance_action_validity_period: Optional[int] = None, governance_action_deposit: Optional[int] = None, drep_deposit: Optional[int] = None, drep_inactivity_period: Optional[int] = None, min_fee_ref_script_cost: Optional[Fraction] = None)
Bases:
MapCBORSerializable
Represents a protocol parameter update.
- min_fee_a: Optional[int] = None
The ‘a’ parameter to calculate the minimum fee
- min_fee_b: Optional[int] = None
The ‘b’ parameter to calculate the minimum fee
- max_block_body_size: Optional[int] = None
Maximum block body size
- max_transaction_size: Optional[int] = None
Maximum transaction size
- max_block_header_size: Optional[int] = None
Maximum block header size
- key_deposit: Optional[int] = None
The deposit required for registering a stake key
- pool_deposit: Optional[int] = None
The deposit required for registering a stake pool
- maximum_epoch: Optional[int] = None
Maximum epoch interval (uint32)
- n_opt: Optional[int] = None
Desired number of stake pools
- pool_pledge_influence: Optional[Fraction] = None
Pool pledge influence as a nonnegative interval (numerator, denominator)
- expansion_rate: Optional[Fraction] = None
Monetary expansion rate as a unit interval (numerator, denominator)
- treasury_growth_rate: Optional[Fraction] = None
Treasury growth rate as a unit interval (numerator, denominator)
- min_pool_cost: Optional[int] = None
Minimum pool cost
- ada_per_utxo_byte: Optional[int] = None
Ada per UTxO byte
- cost_models: Optional[Dict] = None
Cost models for script languages
- execution_costs: Optional[ExUnitPrices] = None
Execution costs (prices) for ex units
- max_tx_ex_units: Optional[ExecutionUnits] = None
Maximum execution units per transaction
- max_block_ex_units: Optional[ExecutionUnits] = None
Maximum execution units per block
- max_value_size: Optional[int] = None
Maximum value size
- collateral_percentage: Optional[int] = None
Collateral percentage
- max_collateral_inputs: Optional[int] = None
Maximum number of collateral inputs
- pool_voting_thresholds: Optional[PoolVotingThresholds] = None
Pool voting thresholds
- drep_voting_thresholds: Optional[DRepVotingThresholds] = None
DRep voting thresholds
- min_committee_size: Optional[int] = None
Minimum committee size
- committee_term_limit: Optional[int] = None
Committee term limit in epochs (uint32)
- governance_action_validity_period: Optional[int] = None
Governance action validity period in epochs (uint32)
- governance_action_deposit: Optional[int] = None
Deposit required for governance actions
- drep_deposit: Optional[int] = None
Deposit required for DRep registration
- drep_inactivity_period: Optional[int] = None
DRep inactivity period in epochs (uint32)
- min_fee_ref_script_cost: Optional[Fraction] = None
Minimum fee for reference scripts as a nonnegative interval (numerator, denominator)
- class pycardano.governance.ExUnitPrices(mem_price: Fraction, step_price: Fraction)
Bases:
ArrayCBORSerializable
Represents execution unit prices for memory and CPU steps.
- mem_price: Fraction
Memory price as a nonnegative interval (numerator, denominator)
- step_price: Fraction
Step price as a nonnegative interval (numerator, denominator)
- class pycardano.governance.DRepVotingThresholds(motion_no_confidence: Fraction, committee_normal: Fraction, committee_no_confidence: Fraction, update_constitution: Fraction, hard_fork_initiation: Fraction, pp_network_group: Fraction, pp_economic_group: Fraction, pp_technical_group: Fraction, pp_governance_group: Fraction, treasury_withdrawal: Fraction)
Bases:
ArrayCBORSerializable
Represents DRep voting thresholds as an array of unit intervals.
- motion_no_confidence: Fraction
Threshold for no confidence motions
- committee_normal: Fraction
Threshold for normal committee updates
- committee_no_confidence: Fraction
Threshold for committee updates during no confidence
- update_constitution: Fraction
Threshold for constitution updates
- hard_fork_initiation: Fraction
Threshold for hard fork initiation
- pp_network_group: Fraction
Threshold for network group protocol parameter updates
- pp_economic_group: Fraction
Threshold for economic group protocol parameter updates
- pp_technical_group: Fraction
Threshold for technical group protocol parameter updates
- pp_governance_group: Fraction
Threshold for governance group protocol parameter updates
- treasury_withdrawal: Fraction
Threshold for treasury withdrawals
- class pycardano.governance.TreasuryWithdrawal(*args, **kwargs)
Bases:
DictCBORSerializable
Represents a treasury withdrawal amount and destination.
- KEY_TYPE
alias of
bytes
- VALUE_TYPE
alias of
int
- class pycardano.governance.PoolVotingThresholds(motion_no_confidence: Fraction, committee_normal: Fraction, committee_no_confidence: Fraction, hard_fork_initiation: Fraction, ppec_voting_threshold: Fraction)
Bases:
ArrayCBORSerializable
Represents pool voting thresholds as an array of unit intervals.
- motion_no_confidence: Fraction
Threshold for no confidence motions
- committee_normal: Fraction
Threshold for normal committee updates
- committee_no_confidence: Fraction
Threshold for committee updates during no confidence
- hard_fork_initiation: Fraction
Threshold for hard fork initiation
- ppec_voting_threshold: Fraction
Threshold for protocol parameter and economic group voting