xmr_addr

Module for Monero address encoding/decoding.

class XmrAddrConst

Bases: object

Class container for Monero address constants.

CHECKSUM_BYTE_LEN: int = 4
PAYMENT_ID_BYTE_LEN: int = 8
class XmrAddrDecoder

Bases: IAddrDecoder

Monero address decoder class. It allows the Monero address decoding.

static DecodeAddr(addr: str, **kwargs: Any) bytes

Decode a Monero address to bytes.

Parameters:
  • addr (str) – Address string

  • net_ver (bytes) – Expected net version

Returns:

Public spend (first) and view (second) keys joined together

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class XmrAddrEncoder

Bases: IAddrEncoder

Monero address encoder class. It allows the Monero address encoding.

static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str

Encode a public key to Monero format.

Parameters:
  • pub_key (bytes or IPublicKey) – Public spend key bytes or object

  • pub_vkey (bytes or IPublicKey) – Public view key bytes or object

  • net_ver (bytes) – Net version

  • payment_id (bytes, optional) – Payment ID (only for integrated addresses)

Returns:

Address string

Return type:

str

Raises:
  • ValueError – If the public key is not valid

  • TypeError – If the public key is not ed25519-monero

class XmrIntegratedAddrDecoder

Bases: IAddrDecoder

Monero integrated address decoder class. It allows the Monero integrated address decoding.

static DecodeAddr(addr: str, **kwargs: Any) bytes

Decode a Monero address to bytes.

Parameters:
  • addr (str) – Address string

  • net_ver (bytes) – Expected net version

  • payment_id (bytes) – Expected payment ID

Returns:

Public spend (first) and view (second) keys joined together

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class XmrIntegratedAddrEncoder

Bases: IAddrEncoder

Monero integrated address encoder class. It allows the Monero integrated address encoding.

static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str

Encode a public key to Monero integrated address.

Parameters:
  • pub_key (bytes or IPublicKey) – Public spend key bytes or object

  • pub_vkey (bytes or IPublicKey) – Public view key bytes or object

  • net_ver (bytes) – Net version

  • payment_id (bytes) – Payment ID

Returns:

Address string

Return type:

str

Raises:
  • ValueError – If the public key is not valid

  • TypeError – If the public key is not ed25519-monero

XmrAddr

alias of XmrAddrEncoder

XmrIntegratedAddr

alias of XmrIntegratedAddrEncoder