BSV.Tokens.OwnerAddress (bsv_sdk v1.5.1)

Copy Markdown View Source

Owner address for token destinations — either a standard address (P2PKH) or a 20-byte MPKH (P2MPKH).

Both produce the same 20-byte hash in the locking script. The difference is in how the unlocking script is constructed at spend time.

Variants

{:address, String.t()}       Base58Check address string
{:mpkh, <<_::160>>}          20-byte HASH160 of multisig script

Summary

Functions

Create from a Base58Check address string.

Create from a 20-byte MPKH.

Create from a multisig script.

Get the 20-byte hash (PKH or MPKH).

Types

t()

@type t() :: {:address, String.t()} | {:mpkh, <<_::160>>}

Functions

from_address(addr)

@spec from_address(String.t()) :: t()

Create from a Base58Check address string.

from_mpkh(arg)

@spec from_mpkh(<<_::160>>) :: t()

Create from a 20-byte MPKH.

from_multisig(ms)

@spec from_multisig(BSV.Transaction.P2MPKH.multisig_script()) :: t()

Create from a multisig script.

hash(arg)

@spec hash(t()) :: {:ok, <<_::160>>} | {:error, term()}

Get the 20-byte hash (PKH or MPKH).