View Source BitcoinLib.Script (BitcoinLib v0.4.7)
Script manipulation module
Link to this section Summary
Functions
Transforms a list of opcodes into a compact integer reprensenting the size of the script, and the script itself
Transforms a script in the bitstring form into a list of opcodes
Transforms a script in the bitstring form into a list of opcodes
Link to this section Functions
Transforms a list of opcodes into a compact integer reprensenting the size of the script, and the script itself
examples
Examples
iex> [
...> %BitcoinLib.Script.Opcodes.Stack.Dup{},
...> %BitcoinLib.Script.Opcodes.Crypto.Hash160{},
...> %BitcoinLib.Script.Opcodes.Data{
...> value: <<0xfde0a08625e327ba400644ad62d5c571d2eec3de::160>>
...> },
...> %BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
...> %BitcoinLib.Script.Opcodes.Crypto.CheckSig{}
...> ] |> BitcoinLib.Script.encode
{<<0x19>>, <<0x76a914fde0a08625e327ba400644ad62d5c571d2eec3de88ac::200>>}
Transforms a script in the bitstring form into a list of opcodes
examples
Examples
iex> <<0x76a914fde0a08625e327ba400644ad62d5c571d2eec3de88ac::200>>
...> |> BitcoinLib.Script.parse!()
[
%BitcoinLib.Script.Opcodes.Stack.Dup{},
%BitcoinLib.Script.Opcodes.Crypto.Hash160{},
%BitcoinLib.Script.Opcodes.Data{
value: <<0xfde0a08625e327ba400644ad62d5c571d2eec3de::160>>
},
%BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
%BitcoinLib.Script.Opcodes.Crypto.CheckSig{
script: <<0x76a914fde0a08625e327ba400644ad62d5c571d2eec3de88ac::200>>
}
]
Transforms a script in the bitstring form into a list of opcodes
examples
Examples
iex> <<0x76a914fde0a08625e327ba400644ad62d5c571d2eec3de88ac::200>>
...> |> BitcoinLib.Script.parse()
{
:ok,
[
%BitcoinLib.Script.Opcodes.Stack.Dup{},
%BitcoinLib.Script.Opcodes.Crypto.Hash160{},
%BitcoinLib.Script.Opcodes.Data{
value: <<0xfde0a08625e327ba400644ad62d5c571d2eec3de::160>>
},
%BitcoinLib.Script.Opcodes.BitwiseLogic.EqualVerify{},
%BitcoinLib.Script.Opcodes.Crypto.CheckSig{
script: <<0x76a914fde0a08625e327ba400644ad62d5c571d2eec3de88ac::200>>
}
]
}