PlutusV3Script

class cometa.scripts.plutus_scripts.plutus_v3_script.PlutusV3Script(ptr)[source]

Bases: object

Represents a Plutus V3 script.

Plutus scripts are pieces of code that implement pure functions with True or False outputs. These functions take several inputs such as Datum, Redeemer and the transaction context to decide whether an output can be spent or not.

V3 was introduced in the Conway hard fork. The main changes were to the ScriptContext which was extended to include: - A Map with all the votes that were included in the transaction - A list with Proposals that will be turned into GovernanceActions - Optional amount for the current treasury - Optional amount for donating to the current treasury

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

PlutusV3Script

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod new(script_bytes)[source]

Creates a new PlutusV3Script from raw bytes.

Parameters:

script_bytes (bytes) – The compiled Plutus script bytes.

Returns:

A new PlutusV3Script instance.

Raises:

CardanoError – If creation fails.

Return type:

PlutusV3Script

classmethod from_hex(hex_string)[source]

Creates a new PlutusV3Script from a hexadecimal string.

Parameters:

hex_string (str) – The compiled Plutus script as a hex string.

Returns:

A new PlutusV3Script instance.

Raises:

CardanoError – If creation fails.

Return type:

PlutusV3Script

classmethod from_cbor(reader)[source]

Deserializes a PlutusV3Script from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the script data.

Returns:

A new PlutusV3Script deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

PlutusV3Script

to_cbor(writer)[source]

Serializes the script to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

property hash: bytes

The hash of this script.

Returns:

The 28-byte Blake2b hash of the script.

property raw_bytes: bytes

The raw bytes of the compiled script.

Returns:

The raw script bytes.

__eq__(other)[source]

Checks equality with another PlutusV3Script.

Parameters:

other (object)

Return type:

bool

__hash__ = None