fil_addr

Module for Filecoin address encoding/decoding.

class FillAddrTypes(value)

Bases: IntEnum

Enumerative for Filecoin address types.

SECP256K1 = 1
BLS = 3
class FilAddrConst

Bases: object

Class container for Filecoin address constants.

BASE32_ALPHABET: str = 'abcdefghijklmnopqrstuvwxyz234567'
class FilSecp256k1AddrDecoder

Bases: IAddrDecoder

Filecoin address decoder class, based on secp256k1 curve. It allows the Filecoin address decoding.

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

Decode a Filecoin address to bytes.

Parameters:
  • addr (str) – Address string

  • **kwargs – Not used

Returns:

Public key hash bytes

Return type:

bytes

Raises:

ValueError – If the address encoding is not valid

class FilSecp256k1AddrEncoder

Bases: IAddrEncoder

Filecoin address encoder class, based on secp256k1 curve. It allows the Filecoin address encoding.

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

Encode a public key to Filecoin address.

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

  • **kwargs – Not used

Returns:

Address string

Return type:

str

Raised:

ValueError: If the public key is not valid TypeError: If the public key is not secp256k1 or the address type is not valid

FilSecp256k1Addr

alias of FilSecp256k1AddrEncoder