ByronAddress

class cometa.address.byron_address.ByronAddress(ptr)[source]

Bases: object

Represents a Byron-era Cardano address.

Byron addresses are the original address format from the Byron era of Cardano. They use Base58 encoding and contain attributes such as an encrypted derivation path and optional network magic for testnet identification.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

ByronAddress

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_credentials(root, attributes, address_type)[source]

Creates a Byron address from a root hash and attributes.

Parameters:
  • root (Blake2bHash) – The root hash of the address (typically a hash of the public key).

  • attributes (ByronAddressAttributes) – Address attributes including derivation path and network magic.

  • address_type (ByronAddressType) – The type of Byron address (PUBKEY, SCRIPT, or REDEEM).

Returns:

A new ByronAddress instance.

Raises:

CardanoError – If address creation fails.

Return type:

ByronAddress

Example

>>> root = Blake2bHash.from_hex("00" * 28)
>>> attrs = ByronAddressAttributes.mainnet()
>>> addr = ByronAddress.from_credentials(root, attrs, ByronAddressType.PUBKEY)
classmethod from_address(address)[source]

Creates a ByronAddress from a generic Address.

Parameters:

address (Address) – A generic Address that must be a Byron address.

Returns:

A new ByronAddress instance.

Raises:

CardanoError – If the address is not a Byron address.

Return type:

ByronAddress

classmethod from_base58(base58_string)[source]

Creates a ByronAddress from a Base58-encoded string.

Parameters:

base58_string (str) – The Base58-encoded address string (e.g., “Ae2td…”).

Returns:

A new ByronAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

ByronAddress

Example

>>> addr = ByronAddress.from_base58("Ae2tdPwUPEZ...")
classmethod from_bytes(data)[source]

Creates a ByronAddress from raw bytes.

Parameters:

data (bytes | bytearray) – The serialized address bytes.

Returns:

A new ByronAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

ByronAddress

property root: Blake2bHash

Returns the root hash of the address.

property attributes: ByronAddressAttributes

Returns the address attributes.

property address_type: ByronAddressType

Returns the Byron address type.

property network_id: NetworkId

Returns the network ID.

to_address()[source]

Converts this ByronAddress to a generic Address.

Returns:

A generic Address instance.

Return type:

Address

to_bytes()[source]

Returns the serialized byte representation.

Return type:

bytes

to_base58()[source]

Returns the Base58-encoded string representation.

Return type:

str

__str__()[source]

Returns the Base58 string representation.

Return type:

str

__bytes__()[source]

Returns the serialized bytes.

Return type:

bytes

__hash__()[source]

Returns a Python hash for use in sets and dicts.

Return type:

int

__eq__(other)[source]

Checks equality with another ByronAddress.

Parameters:

other (object)

Return type:

bool