neo_addr

Module for Neo address encoding/decoding.

class NeoAddrDecoder

Bases: IAddrDecoder

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

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

Decode a Neo address to bytes.

Parameters:
  • addr (str) – Address string

  • ver (bytes) – Expected version

Returns:

Public key hash bytes

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class NeoAddrEncoder

Bases: IAddrEncoder

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

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

Encode a public key to Neo address.

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

  • ver (bytes) – Version

  • prefix (bytes) – Prefix

  • suffix (bytes) – Suffix

Returns:

Address string

Return type:

str

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

  • TypeError – If the public key is not nist256p1

NeoAddr

alias of NeoAddrEncoder