Crate chain_addr

source ·
Expand description

Address

It uses a simple serialization format which is made to be concise:

  • First byte contains the discrimination information (1 bit) and the kind of address (7 bits)
  • Remaining bytes contains a kind specific encoding describe after.

4 kinds of address are currently supported:

  • Single: Just a (spending) public key using the ED25519 algorithm
  • Group: Same as single, but with a added (staking/group) public key using the ED25519 algorithm.
  • Account: A account public key using the ED25519 algorithm
  • Multisig: a multisig account public key

Single key: DISCRIMINATION_BIT || SINGLE_KIND_TYPE (7 bits) || SPENDING_KEY

Group key: DISCRIMINATION_BIT || GROUP_KIND_TYPE (7 bits) || SPENDING_KEY || ACCOUNT_KEY

Account key: DISCRIMINATION_BIT || ACCOUNT_KIND_TYPE (7 bits) || ACCOUNT_KEY

Multisig key: DISCRIMINATION_BIT || MULTISIG_KIND_TYPE (7 bits) || MULTISIG_MERKLE_ROOT_PUBLIC_KEY

Script identifier: DISCRIMINATION_BIT || SCRIPT_KIND_TYPE (7 bits) || SCRIPT_IDENTIFIER

Address human format is bech32 encoded

Modules

Structs

  • An unstructured address including the discrimination and the kind of address
  • A valid address in a human readable format
  • error that can happen when parsing the Discrimination from a string

Enums

Constants

Functions