View Source BitcoinLib.Script.Opcodes.Stack.IfDup (BitcoinLib v0.4.7)

Based on https://en.bitcoin.it/wiki/Script

Word OP_IFDUP Opcode 115 Hex 0x73 Input x Output x / x x If the top stack value is not 0, duplicate it.

Link to this section Summary

Functions

Returns <<0x73>>

If the top stack value is not 0, duplicate it.

v()

Returns 0x73

Link to this section Types

@type t() :: BitcoinLib.Script.Opcodes.Stack.IfDup

Link to this section Functions

Returns <<0x73>>

examples

Examples

iex> BitcoinLib.Script.Opcodes.Stack.IfDup.encode()
<<0x73>>
@spec execute(t(), list()) :: {:ok, list()} | {:error, binary()}

If the top stack value is not 0, duplicate it.

examples

Examples

iex> stack = [4, 3]
...> %BitcoinLib.Script.Opcodes.Stack.IfDup{}
...> |> BitcoinLib.Script.Opcodes.Stack.IfDup.execute(stack)
{:ok, [4, 4, 3]}
@spec v() :: 115

Returns 0x73

examples

Examples

iex> BitcoinLib.Script.Opcodes.Stack.IfDup.v()
0x73