BSV.Contract.Raw (BSV v2.1.0) View Source
The Raw Script contract provides a mechanism through which pre-built scripts
can be used with the BSV.TxBuilder
module.
Examples
iex> builder = %TxBuilder{
...> outputs: [
...> Raw.lock(10_000, %{script: Script.from_binary!(@p2pkh_hex, encoding: :hex)})
...> ]
...> }
iex> TxBuilder.to_tx(builder)
%BSV.Tx{
inputs: [],
outputs: [
%BSV.TxOut{
satoshis: 10000,
script: %BSV.Script{
chunks: [
:OP_DUP,
:OP_HASH160,
<<16, 189, 203, 163, 4, 27, 94, 85, 23, 165, 143, 46, 64, 82, 147, 193, 74, 124, 112, 193>>,
:OP_EQUALVERIFY,
:OP_CHECKSIG
],
coinbase: nil
}
}
]
}
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
Specs
lock(non_neg_integer(), map(), keyword()) :: BSV.Contract.t()
Returns a locking script contract with the given parameters.
Specs
unlock(BSV.UTXO.t(), map(), keyword()) :: BSV.Contract.t()
Returns an unlocking script contract with the given parameters.