monero_subaddr

Module for Monero subaddress computation.

class MoneroSubaddressConst

Bases: object

Class container for Monero subaddress constants.

SUBADDR_PREFIX: bytes = b'SubAddr\x00'
SUBADDR_MAX_IDX: int = 4294967295
SUBADDR_IDX_BYTE_LEN: int = 4
class MoneroSubaddress(priv_vkey: MoneroPrivateKey, pub_skey: MoneroPublicKey, pub_vkey: Optional[MoneroPublicKey] = None)

Bases: object

Monero subaddress class. It allows to compute Monero subaddresses.

m_priv_vkey: MoneroPrivateKey
m_pub_skey: MoneroPublicKey
m_pub_vkey: MoneroPublicKey
ComputeKeys(minor_idx: int, major_idx: int) Tuple[MoneroPublicKey, MoneroPublicKey]

Compute the public keys of the specified subaddress.

Parameters:
  • minor_idx (int) – Minor index (i.e. subaddress index)

  • major_idx (int) – Major index (i.e. account index)

Returns:

Computed public spend key (index 0) and public view key (index 1)

Return type:

tuple[MoneroPublicKey, MoneroPublicKey]

Raises:

ValueError – If one of the indexes is not valid

ComputeAndEncodeKeys(minor_idx: int, major_idx: int, net_ver: bytes) str

Compute the public keys of the specified subaddress and encode them.

Parameters:
  • minor_idx (int) – Minor index (i.e. subaddress index)

  • major_idx (int) – Major index (i.e. account index)

  • net_ver (bytes) – Net version

Returns:

Encoded subaddress string

Return type:

str

Raises:

ValueError – If one of the indexes is not valid