Governance
- class pycardano.governance.CommitteeColdCredential(credential: VerificationKeyHash | ScriptHash)
Bases:
StakeCredential
Represents a cold credential for a committee member.
- 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: GovActionId | None, protocol_param_update: ProtocolParamUpdate, policy_hash: PolicyHash | None)
Bases:
CodedSerializable
Represents a governance action to change protocol parameters.
- gov_action_id: GovActionId | None
Optional reference to a previous governance action
- protocol_param_update: ProtocolParamUpdate
Dictionary containing the protocol parameters to be updated
- policy_hash: PolicyHash | None
Optional policy hash associated with this parameter change
- class pycardano.governance.HardForkInitiationAction(gov_action_id: GovActionId | None, protocol_version: Fraction)
Bases:
CodedSerializable
Represents a governance action to initiate a hard fork.
- gov_action_id: GovActionId | None
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: PolicyHash | None)
Bases:
CodedSerializable
Represents a governance action to withdraw funds from the treasury.
- withdrawals: TreasuryWithdrawal
The withdrawal amounts and their destinations
- policy_hash: PolicyHash | None
Optional policy hash associated with these withdrawals
- class pycardano.governance.NoConfidence(gov_action_id: GovActionId | None)
Bases:
CodedSerializable
Represents a governance action expressing no confidence.
- gov_action_id: GovActionId | None
Optional reference to a previous governance action
- class pycardano.governance.UpdateCommittee(gov_action_id: GovActionId | None, committee_cold_credentials: OrderedSet[CommitteeColdCredential], committee_expiration: CommitteeColdCredentialEpochMap, quorum: Fraction)
Bases:
CodedSerializable
Represents a governance action to update the constitutional committee.
- gov_action_id: GovActionId | None
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: GovActionId | None, constitution: Tuple[Anchor, ScriptHash | None])
Bases:
CodedSerializable
Represents a governance action to establish a new constitution.
- gov_action_id: GovActionId | None
Optional reference to a previous governance action
- constitution: Tuple[Anchor, ScriptHash | None]
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: 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: Anchor | None)
Bases:
ArrayCBORSerializable
Represents a voting procedure for governance actions.
This defines how voting is conducted for a specific governance action.
- classmethod from_primitive(values: 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() 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, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
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: 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: VerificationKeyHash | ScriptHash
The credential identifying the voter
- to_shallow_primitive() 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: 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, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
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: 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: ParameterChangeAction | HardForkInitiationAction | TreasuryWithdrawalsAction | NoConfidence | UpdateCommittee | NewConstitution | InfoAction
The governance actions to be proposed
- class pycardano.governance.ProtocolParamUpdate(min_fee_a: int | None = None, min_fee_b: int | None = None, max_block_body_size: int | None = None, max_transaction_size: int | None = None, max_block_header_size: int | None = None, key_deposit: int | None = None, pool_deposit: int | None = None, maximum_epoch: int | None = None, n_opt: int | None = None, pool_pledge_influence: Fraction | None = None, expansion_rate: Fraction | None = None, treasury_growth_rate: Fraction | None = None, min_pool_cost: int | None = None, ada_per_utxo_byte: int | None = None, cost_models: Dict | None = None, execution_costs: ExUnitPrices | None = None, max_tx_ex_units: ExecutionUnits | None = None, max_block_ex_units: ExecutionUnits | None = None, max_value_size: int | None = None, collateral_percentage: int | None = None, max_collateral_inputs: int | None = None, pool_voting_thresholds: PoolVotingThresholds | None = None, drep_voting_thresholds: DRepVotingThresholds | None = None, min_committee_size: int | None = None, committee_term_limit: int | None = None, governance_action_validity_period: int | None = None, governance_action_deposit: int | None = None, drep_deposit: int | None = None, drep_inactivity_period: int | None = None, min_fee_ref_script_cost: Fraction | None = None)
Bases:
MapCBORSerializable
Represents a protocol parameter update.
- min_fee_a: int | None = None
The ‘a’ parameter to calculate the minimum fee
- min_fee_b: int | None = None
The ‘b’ parameter to calculate the minimum fee
- max_block_body_size: int | None = None
Maximum block body size
- max_transaction_size: int | None = None
Maximum transaction size
- max_block_header_size: int | None = None
Maximum block header size
- key_deposit: int | None = None
The deposit required for registering a stake key
- pool_deposit: int | None = None
The deposit required for registering a stake pool
- maximum_epoch: int | None = None
Maximum epoch interval (uint32)
- n_opt: int | None = None
Desired number of stake pools
- pool_pledge_influence: Fraction | None = None
Pool pledge influence as a nonnegative interval (numerator, denominator)
- expansion_rate: Fraction | None = None
Monetary expansion rate as a unit interval (numerator, denominator)
- treasury_growth_rate: Fraction | None = None
Treasury growth rate as a unit interval (numerator, denominator)
- min_pool_cost: int | None = None
Minimum pool cost
- ada_per_utxo_byte: int | None = None
Ada per UTxO byte
- cost_models: Dict | None = None
Cost models for script languages
- execution_costs: ExUnitPrices | None = None
Execution costs (prices) for ex units
- max_tx_ex_units: ExecutionUnits | None = None
Maximum execution units per transaction
- max_block_ex_units: ExecutionUnits | None = None
Maximum execution units per block
- max_value_size: int | None = None
Maximum value size
- collateral_percentage: int | None = None
Collateral percentage
- max_collateral_inputs: int | None = None
Maximum number of collateral inputs
- pool_voting_thresholds: PoolVotingThresholds | None = None
Pool voting thresholds
- drep_voting_thresholds: DRepVotingThresholds | None = None
DRep voting thresholds
- min_committee_size: int | None = None
Minimum committee size
- committee_term_limit: int | None = None
Committee term limit in epochs (uint32)
- governance_action_validity_period: int | None = None
Governance action validity period in epochs (uint32)
- governance_action_deposit: int | None = None
Deposit required for governance actions
- drep_deposit: int | None = None
Deposit required for DRep registration
- drep_inactivity_period: int | None = None
DRep inactivity period in epochs (uint32)
- min_fee_ref_script_cost: Fraction | None = 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