OP_DEPTH

(116 | 0x74)

Input

0 items

|

Output

1 items

As a stack-based language, it's always useful to capture the current state of the stack. The OP_Depth op is used specifically to provide a count of all the items in the stack (without removing / popping any item) & pushing that count value (in hex) onto the stack. While not used in any of the common scripts, op_depth could be useful in a multsig scenario where a count is needed to check the number of m-of-n signatures.

OP_Code Walkthrough

Pushes the depth of the stack onto the stack.

Get the count value of the current stack (how many items)

Push result of count value.