Locking scripts for addresses, and the Electrum "scripthash" used to look an address up on an Electrum or Fulcrum server.
iex> script = BitcoinElixir.Script.locking_script!("bitcoincash:qq8hepxlmyfelgyfy985tw80r8pe805gfv230d2ufw")
iex> Base.encode16(script, case: :lower)
"76a9140f7c84dfd9139fa089214f45b8ef19c393be884b88ac"
Summary
Functions
The locking script for a decoded address or address text.
Like locking_script/1 but raises.
The Electrum scripthash of an address (text or decoded): SHA-256 of its locking script, byte-reversed, as lower-case hex. A plain and a token-aware address for the same key share one scripthash.
Like scripthash/1 but raises.
The Electrum scripthash of a raw locking script.
Functions
@spec locking_script(BitcoinElixir.CashAddr.t() | String.t()) :: {:ok, binary()} | {:error, atom()}
The locking script for a decoded address or address text.
@spec locking_script!(BitcoinElixir.CashAddr.t() | String.t()) :: binary()
Like locking_script/1 but raises.
@spec scripthash(BitcoinElixir.CashAddr.t() | String.t()) :: {:ok, String.t()} | {:error, atom()}
The Electrum scripthash of an address (text or decoded): SHA-256 of its locking script, byte-reversed, as lower-case hex. A plain and a token-aware address for the same key share one scripthash.
@spec scripthash!(BitcoinElixir.CashAddr.t() | String.t()) :: String.t()
Like scripthash/1 but raises.
The Electrum scripthash of a raw locking script.