View Source BitcoinLib.Script.Encoder (BitcoinLib v0.4.7)

Used to encode scripts in the bitstring format

Link to this section Summary

Functions

Encodes a list of opcodes into a bitstring

Link to this section Functions

@spec to_bitstring(list()) :: bitstring()

Encodes a list of opcodes into a bitstring

examples

Examples

iex> [
...>   %BitcoinLib.Script.Opcodes.Stack.Dup{},
...>   %BitcoinLib.Script.Opcodes.Crypto.Hash160{},
...>   %BitcoinLib.Script.Opcodes.Data{value: <<0x725EBAC06343111227573D0B5287954EF9B88AAE::160>>},
...>   %BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
...>   %BitcoinLib.Script.Opcodes.Crypto.CheckSig{}
...> ] |> BitcoinLib.Script.Encoder.to_bitstring()
<<0x76A914725EBAC06343111227573D0B5287954EF9B88AAE88AC::200>>