ProtocolVersion

class cometa.common.protocol_version.ProtocolVersion(ptr)[source]

Bases: object

Represents a version of the Cardano protocol.

The protocol can be thought of as the set of rules that nodes in the network agree to follow. This versioning system helps nodes to keep track of which set of rules they are adhering to and allows for the decentralized updating of the protocol parameters without requiring a hard fork.

classmethod new(major, minor)[source]

Creates and initializes a new instance of the Protocol Version.

Parameters:
  • major (int) – The major version number.

  • minor (int) – The minor version number.

Return type:

ProtocolVersion

classmethod from_cbor(reader)[source]

Creates a ProtocolVersion from a CBOR reader.

Parameters:

reader (CborReader) – The CBOR reader instance.

Return type:

ProtocolVersion

property major: int

The major version number.

property minor: int

The minor version number.

to_cbor(writer)[source]

Serializes protocol version into CBOR format using a CBOR writer.

Parameters:

writer (CborWriter) – The CBOR writer instance.

Return type:

None

to_json(writer)[source]

Serializes a protocol version to CIP-116 JSON.

Parameters:

writer (JsonWriter) – The JSON writer instance.

Return type:

None

property refcount: int

Returns the number of active references to the underlying C object.

property last_error: str

Returns the last error message recorded for this object.

__init__(ptr)[source]

Initializes the ProtocolVersion with a given C pointer.

Return type:

None

__enter__()[source]

Enters the runtime context related to this object.

Return type:

ProtocolVersion

__exit__(exc_type, exc_val, exc_tb)[source]

Exits the runtime context related to this object.

Return type:

None

__hash__ = None
__repr__()[source]

Returns a string representation of the ProtocolVersion.

Return type:

str

__eq__(other)[source]

Compares two ProtocolVersion instances for equality.

Parameters:

other (object)

Return type:

bool