WitnessSet

class cometa.witness_set.witness_set.WitnessSet(ptr=None)[source]

Bases: object

Represents a transaction witness set.

A witness is a piece of information that allows you to efficiently verify the authenticity of a transaction (also known as proof).

In Cardano, transactions have multiple types of authentication proofs, these can range from signatures for spending UTXOs, to scripts (with their arguments, datums and redeemers) for smart contract execution.

The witness set contains: - VKey witnesses (public key + signature pairs) - Bootstrap witnesses (Byron era witnesses) - Native scripts - Plutus scripts (V1, V2, V3) - Plutus data (datums) - Redeemers

__init__(ptr=None)[source]
Return type:

None

__enter__()[source]
Return type:

WitnessSet

__exit__(exc_type, exc_val, exc_tb)[source]
Return type:

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_cbor(reader)[source]

Deserializes a WitnessSet from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the witness set data.

Returns:

A new WitnessSet deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

WitnessSet

to_cbor(writer)[source]

Serializes the witness set to CBOR format.

Parameters:

writer (CborWriter) – A CborWriter to write the serialized data to.

Raises:

CardanoError – If serialization fails.

Return type:

None

property vkeys: VkeyWitnessSet | None

The set of verification key witnesses.

Returns:

The VkeyWitnessSet if present, None otherwise.

property bootstrap: BootstrapWitnessSet | None

The set of bootstrap witnesses (Byron era).

Returns:

The BootstrapWitnessSet if present, None otherwise.

property native_scripts: NativeScriptSet | None

The set of native scripts.

Returns:

The NativeScriptSet if present, None otherwise.

property plutus_v1_scripts: PlutusV1ScriptSet | None

The set of Plutus V1 scripts.

Returns:

The PlutusV1ScriptSet if present, None otherwise.

property plutus_v2_scripts: PlutusV2ScriptSet | None

The set of Plutus V2 scripts.

Returns:

The PlutusV2ScriptSet if present, None otherwise.

property plutus_v3_scripts: PlutusV3ScriptSet | None

The set of Plutus V3 scripts.

Returns:

The PlutusV3ScriptSet if present, None otherwise.

property plutus_data: PlutusDataSet | None

The set of Plutus data (datums).

Returns:

The PlutusDataSet if present, None otherwise.

property redeemers: RedeemerList | None

The list of redeemers.

Returns:

The RedeemerList if present, None otherwise.

clear_cbor_cache()[source]

Clears the cached CBOR representation.

This is useful when you have modified the witness set after it was created from CBOR and you want to ensure that the next serialization reflects the current state rather than using the original cached CBOR.

Warning

Clearing the CBOR cache may change the binary representation when serialized, which can alter the witness set and invalidate any existing signatures.

Return type:

None

to_cip116_json(writer)[source]

Serializes this object to CIP-116 compliant JSON.

Parameters:

writer (JsonWriter) – The JsonWriter to write the JSON to.

Raises:

CardanoError – If serialization fails.

Return type:

None