View Source BitcoinLib.Script.Opcodes.Stack.Dup (BitcoinLib v0.4.1)

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

Word OP_DUP Opcode 118 Hex 0x76 Input x Output x x Description Duplicates the top stack item.

Link to this section Summary

Functions

Returns <<0x76>>

Duplicates the top stack item.

v()

Returns 0x76

Link to this section Functions

Returns <<0x76>>

examples

Examples

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

Duplicates the top stack item.

examples

Examples

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

Returns 0x76

examples

Examples

iex> BitcoinLib.Script.Opcodes.Stack.Dup.v()
0x76