Data Manipulation OpCodes
OP_SPLIT
Splits byte sequence x at position n.
Example: 0x12345678 OP_2 OP_SPLIT // Split after 2 bytes
Step 1: Initial stack
Visual Stack
0x12345678
Step 2: OP_2 pushes 2 onto the stack (split position)
Visual Stack
0x12345678
2
Step 3: OP_SPLIT executes, splitting the byte sequence at position 2
Visual Stack
0x1234
0x5678
Note:
OP_SPLIT divides a byte sequence into two parts at a specified position. The top stack item (n) determines the split position: - The first n bytes go into the second-to-top stack item - The remaining bytes go into the top stack item It's useful for extracting specific portions of data, such as separating a public key from additional data in a single stack item.
Learn more about all the opcodes in our OpCode Explorer.