OP_PICK

(121 | 0x79)

Input

1 items

|

Output

1 items

OP_PICK is a selective stack manipulation opcode that duplicates the nth item from the top of the stack and pushes the duplicate onto the top of the stack. The index n is taken from the top of the stack, and it starts counting from 1, where 1 represents the top item. After the duplication, the original items remain unchanged on the stack.

OP_Code Walkthrough

Duplicates the nth item from the top of the stack and pushes it onto the top of the stack.

pop all the items from the stack

Find the value of the n + 1 item in the stack, where n = 2

copy the nth item in the stack

get the nth item in the stack

add the new items to the stack with the nth item first