Base58 Class

This class serves as an abstraction layer to deal with base58 encoded strings and their corresponding hex and binary representation throughout the library.

Examples:

format(Base58("02b52e04a0acfe611a4b6963462aca94b6ae02b24e321eda86507661901adb49"),"wif")
repr(Base58("5HqUkGuo62BfcJU5vNhTXKJRXuUi9QSE6jp8C3uBJ2BVHtB8WSd"))

Output::

"5HqUkGuo62BfcJU5vNhTXKJRXuUi9QSE6jp8C3uBJ2BVHtB8WSd"
"02b52e04a0acfe611a4b6963462aca94b6ae02b24e321eda86507661901adb49"

Definitions

class graphenebase.base58.Base58(data, prefix=None)

Base58 base class

This class serves as an abstraction layer to deal with base58 encoded strings and their corresponding hex and binary representation throughout the library.

Parameters:
  • data (hex, wif, bip38 encrypted wif, base58 string) – Data to initialize object, e.g. pubkey data, address data, …
  • prefix (str) – Prefix to use for Address/PubKey strings (defaults to GPH)
Returns:

Base58 object initialized with data

Return type:

Base58

Raises:

ValueError – if data cannot be decoded

  • bytes(Base58): Returns the raw data
  • str(Base58): Returns the readable Base58CheckEncoded data.
  • repr(Base58): Gives the hex representation of the data.
  • format(Base58,_format) Formats the instance according to
    _format: * "wif": prefixed with 0x00. Yields a valid wif key * "bts": prefixed with BTS * etc.