View Source BitcoinLib.Script.Opcodes.Stack.TwoSwap (BitcoinLib v0.4.7)
Based on https://en.bitcoin.it/wiki/Script
Word OP_2SWAP Opcode 114 Hex 0x72 Input x1 x2 x3 x4 Output x3 x4 x1 x2 Swaps the top two pairs of items.
Link to this section Summary
Link to this section Types
@type t() :: BitcoinLib.Script.Opcodes.Stack.TwoSwap
Link to this section Functions
Returns <<0x72>>
examples
Examples
iex> BitcoinLib.Script.Opcodes.Stack.TwoSwap.encode()
<<0x72>>
Swaps the top two pairs of items.
examples
Examples
iex> stack = [1, 2, 3, 4, 5]
...> %BitcoinLib.Script.Opcodes.Stack.TwoSwap{}
...> |> BitcoinLib.Script.Opcodes.Stack.TwoSwap.execute(stack)
{:ok, [3, 4, 1, 2, 5]}
@spec v() :: 114
Returns 0x72
examples
Examples
iex> BitcoinLib.Script.Opcodes.Stack.TwoSwap.v()
0x72