As the name suggests, duplication operations are used to duplicate stack items. The range of values is from 0x80 to 0x8f. There are 16 DUP instructions available in the EVM. Items placed on the stack or removed from the stack also change incrementally with the mnemonic used; for example, DUP1 removes one item from the stack and places two items on the stack, whereas DUP16 removes 16 items from the stack and places 17 items.
Mnemonic |
Value |
POP |
PUSH |
Gas |
Description |
DUP1 . . . DUP16 |
0x80 ...0x8f |
X |
Y |
3 |
Used to duplicate the Nth stack item, where N is the number corresponding to the DUP instruction used. X and Y are the items removed and placed on the stack, respectively. |