BSV.Contract.OpReturn (BSV v2.1.0) View Source

OP_RETURN outputs are frequently used for placing arbitrary data on-chain.

As this is generally used for creating unspendable outputs, no unlocking script is defined on this contract.

Lock parameters

  • :data - A single binary or list of binary values.

Examples

iex> contract = OpReturn.lock(0, %{data: "hello world"})
iex> Contract.to_script(contract)
%Script{chunks: [
  :OP_FALSE,
  :OP_RETURN,
  "hello world"
]}

iex> contract = OpReturn.lock(0, %{data: ["hello", "world"]})
iex> Contract.to_script(contract)
%Script{chunks: [
  :OP_FALSE,
  :OP_RETURN,
  "hello",
  "world"
]}

Link to this section Summary

Functions

Returns a locking script contract with the given parameters.

Returns an unlocking script contract with the given parameters.

Link to this section Functions

Link to this function

lock(satoshis, params, opts \\ [])

View Source

Specs

Returns a locking script contract with the given parameters.

Link to this function

unlock(utxo, params, opts \\ [])

View Source

Specs

unlock(BSV.UTXO.t(), map(), keyword()) :: BSV.Contract.t()

Returns an unlocking script contract with the given parameters.