SubAddr

class blsct.SubAddr(view_key: Scalar, spending_pub_key: PublicKey, sub_addr_id: SubAddrId)

Represents a sub-address.

>>> from blsct import ChildKey, DoublePublicKey, PublicKey, Scalar, SubAddr, SubAddrId
>>> seed = Scalar()
>>> view_key = ChildKey(seed).to_tx_key().to_view_key()
>>> spending_pub_key = PublicKey()
>>> sub_addr_id = SubAddrId(123, 456)
>>> SubAddr(view_key, spending_pub_key, sub_addr_id)
SubAddr(840cda7e5bc189f2b9a3e88a27182e387ac84c5cc3...)
>>> dpk = DoublePublicKey()
>>> x = SubAddr.from_double_public_key(dpk)
>>> ser = x.serialize()
>>> deser = SubAddr.deserialize(ser)
>>> ser == deser.serialize()
True
classmethod deserialize(hex: str) → Self

Deserialize the SubAddr from a hexadecimal string

classmethod from_double_public_key(dpk: DoublePublicKey) → Self

Derive a sub-address from a DoublePublicKey

serialize() → str

Serialize the SubAddr to a hexadecimal string

to_double_public_key() → DoublePublicKey

Convert the SubAddr to a DoublePublicKey