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

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

Word OP_2DUP Opcode 110 Hex 0x6e Input x1 x2 Output x1 x2 x1 x2 Duplicates the top two stack items.

Link to this section Summary

Functions

Returns <<0x6e>>

Duplicates the top stack item.

v()

Returns 0x6e

Link to this section Types

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

Link to this section Functions

Returns <<0x6e>>

examples

Examples

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

Duplicates the top stack item.

examples

Examples

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

Returns 0x6e

examples

Examples

iex> BitcoinLib.Script.Opcodes.Stack.TwoDup.v()
0x6e