ss58
Module for SS58 decoding/encoding. Reference: https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)
- class SS58Const
Bases:
object
Class container for SS58 constants.
- SIMPLE_ACCOUNT_FORMAT_MAX_VAL: int = 63
- FORMAT_MAX_VAL: int = 16383
- RESERVED_FORMATS: Tuple[int, int] = (46, 47)
- DATA_BYTE_LEN: int = 32
- CHECKSUM_BYTE_LEN: int = 2
- CHECKSUM_PREFIX: bytes = b'SS58PRE'
- class SS58Encoder
Bases:
object
SS58 encoder class. It provides methods for encoding to SS58 format.
- static Encode(data_bytes: bytes, ss58_format: int) str
Encode bytes into a SS58 string.
- Parameters:
data_bytes (bytes) – Data bytes (32-byte length)
ss58_format (int) – SS58 format
- Returns:
SS58 encoded string
- Return type:
str
- Raises:
ValueError – If parameters are not valid
- class SS58Decoder
Bases:
object
SS58 decoder class. It provides methods for decoding SS58 format.
- static Decode(data_str: str) Tuple[int, bytes]
Decode bytes from a SS58 string.
- Parameters:
data_str (string) – Data string
- Returns:
SS58 format and data bytes
- Return type:
tuple[int, bytes]
- Raises:
SS58ChecksumError – If checksum is not valid
ValueError – If the string is not a valid SS58 format