cardano_shelley

Module for Cardano Shelley keys derivation. Reference: https://cips.cardano.org/cips/cip11

class CardanoShelley(bip_obj: Bip44Base, bip_sk_obj: Bip44Base)

Bases: object

Cardano Shelley class. It allows keys derivation and addresses computation (including the staking one) in according to Cardano Shelley.

classmethod FromCip1852Object(bip_obj: Bip44Base) CardanoShelley

Create a CardanoShelley object from the specified Cip1852 object.

Parameters:

bip_obj (Bip44Base object) – Bip44Base object

Returns:

CardanoShelley object

Return type:

CardanoShelley object

Raises:
  • ValueError – If the seed is too short

  • Bip32KeyError – If the seed is not suitable for master key generation

m_bip_obj: Bip44Base
m_bip_sk_obj: Bip44Base
PublicKeys() CardanoShelleyPublicKeys

Return the public keys.

Returns:

CardanoShelleyPublicKeys object

Return type:

CardanoShelleyPublicKeys object

PrivateKeys() CardanoShelleyPrivateKeys

Return the private keys.

Returns:

CardanoShelleyPrivateKeys object

Return type:

CardanoShelleyPrivateKeys object

Raises:

Bip32KeyError – If the Bip32 object is public-only

RewardObject() Bip44Base

Alias for StakingObject.

Returns:

Bip44Base object

Return type:

Bip44Base object

StakingObject() Bip44Base

Return the staking object.

Returns:

Bip44Base object

Return type:

Bip44Base object

IsPublicOnly() bool

Get if it’s public-only.

Returns:

True if public-only, false otherwise

Return type:

bool

Change(change_type: Bip44Changes) CardanoShelley

Derive a child key from the specified change type and return a new CardanoShelley object.

Parameters:

change_type (Bip44Changes) – Change type, must a Bip44Changes enum

Returns:

CardanoShelley object

Return type:

CardanoShelley object

Raises:
  • TypeError – If change type is not a Bip44Changes enum

  • Bip44DepthError – If current depth is not suitable for deriving keys

  • Bip32KeyError – If the derivation results in an invalid key

AddressIndex(addr_idx: int) CardanoShelley

Derive a child key from the specified address index and return a new CardanoShelley object.

Parameters:

addr_idx (int) – Address index

Returns:

CardanoShelley object

Return type:

CardanoShelley object

Raises:
  • Cip1852DepthError – If current depth is not suitable for deriving keys

  • Bip32KeyError – If the derivation results in an invalid key