Function encodeBase58AddressFormat

  • Encode a payload using the Base58Address format (A.K.A. "Base58Check"), the original address format used by the Satoshi implementation.

    Note, this method does not enforce error handling via the type system. The returned string will not be a valid Base58Address if hash is not exactly 20 bytes. If needed, validate the length of hash before calling this method.

    To decode a Base58Address-like format, use decodeBase58AddressFormat.

    Type Parameters

    Parameters

    • version: VersionType

      the address version byte (see Base58AddressFormatVersion)

    • payload: Uint8Array

      the Uint8Array payload to encode

    • sha256: {
          hash: ((input) => Uint8Array) & ((input) => Uint8Array);
      } = internalSha256

      an implementation of sha256 (defaults to the internal WASM implementation)

      • hash: ((input) => Uint8Array) & ((input) => Uint8Array)

    Returns string

    Remarks

    A Base58Address includes a 1-byte prefix to indicate the address version, a variable-length payload, and a 4-byte checksum:

    [version: 1 byte] [payload: variable length] [checksum: 4 bytes]

    The checksum is the first 4 bytes of the double-SHA256 hash of the version byte followed by the payload.

Generated using TypeDoc