Skip to main content

EVM Opcodes

HexGasMnemonicStack Input (POP⬅️)Stack Output (PUSH➡️)ExpressionNoteVersion
000STOPSTOP()
013ADDa, ba + ba + b
025MULa, ba * ba * b
033SUBa, ba - ba - b
045DIVa, ba / ba / b
055SDIVa, ba / ba / b
065MODa, ba % ba % b
075SMODa, ba % ba % b
088ADDMODa, b, N(a + b) % N(a + b) % N
098MULMODa, b, N(a * b) % N(a * b) % N
0A10EXPa, ba ** ba ** b
0B5SIGNEXTENDb, xyy = SIGNEXTEND(x, b)
0C-0F
103LTa, ba < ba < b
113GTa, ba > ba > b
123SLTa, ba < ba < b
133SGTa, ba > ba > b
143EQa, ba == ba == b
153ISZEROaa == 0a == 0
163ANDa, ba & ba & b
173ORa, ba | ba | b
183XORa, ba ^ ba ^ b
193NOTa~a~a
1A3BYTEi, xyy = (x >> (248 - i * 8)) & 0xFF
1B3SHLi, xx << ix << i
1C3SHRi, xx >> ix >> i
1D3SARi, xx >> ix >> i
1E-1F
2030SHA3src, lengthhashhash = keccak256(memory[src:src+length])
302ADDRESSaddress(this)address(this)
31400BALANCEaddraddress(addr).balanceaddress(addr).balance
322ORIGINtx.origintx.origin
332CALLERmsg.callermsg.caller
342CALLVALUEmsg.valuemsg.value
353CALLDATALOADivaluevalue = uint256(msg.data[i:i+32])
362CALLDATASIZEmsg.data.sizemsg.data.size
373CALLDATACOPYdst, src, lengthmemory[dst:dst+length] = msg.data[src:src+length]
382CODESIZEaddress(this).code.sizeaddress(this).code.size
393CODECOPYdst, src, lengthmemory[dst:dst+length] = address(this).code[src:src+length]
3A2GASPRICEtx.gaspricetx.gasprice
3B700EXTCODESIZEaddraddress(addr).code.sizeaddress(addr).code.size
3C700EXTCODECOPYaddr, dst, src, lengthmemory[dst:dst+length] = address(addr).code[src:src+length]
3D2RETURNDATASIZERETURNDATASIZE()RETURNDATASIZE()
3E3RETURNDATACOPYdst, src, lengthmemory[dst:dst+length] = RETURNDATA[src:src+length]
3F400EXTCODEHASHaddrhashhash = address(addr).exists ? keccak256(address(addr).code) : 0
4020BLOCKHASHblockNumberhashhash = block.blockHash(blockNumber)
412COINBASEblock.coinbaseblock.coinbase
422TIMESTAMPblock.timestampblock.timestamp
432NUMBERblock.numberblock.number
442PREVRANDAOblock.prevrandaoblock.prevrandao
452GASLIMITblock.gaslimitblock.gaslimit
462CHAINIDblock.chainidblock.chainid
475SELFBALANCEaddress(this).balanceaddress(this).balance
482BASEFEEblock.basefeeblock.basefee
493BLOBHASHihashhash = blobhash(i)cancun
4A2BLOBBASEFEEblock.blobbasefeeblock.blobbasefeecancun
4B-4F
502POP_POP()
513MLOADivaluevalue = uint256(memory[i:i+32])
523MSTOREi, valuememory[i:i+32] = value
533MSTORE8i, valuememory[i] = value & 0xff
54200SLOADkeyvaluevalue = storage[key]
5520000SSTOREkey, valuestorage[key] = value
568JUMPdestinationPC = destination
5710JUMPIdestination, conditionPC = cond ? destination : PC + 1
582PCPCPC
592MSIZEsizesize = MSIZE()
5A2GASgasRemaininggasRemaining = GAS()
5B1JUMPDEST
5C100TLOADkeyvaluevalue=transient[key]cancun
5D100TSTOREkey, valuetransient[key]=valuecancun
5E3MCOPYdst, src, lengthmemory[dst:dst+length] = memory[src:src+length]cancun
5F2PUSH00PUSH(0)shanghai
603PUSH1uint8PUSH(uint8)
613PUSH2uint16PUSH(uint16)
623PUSH3uint24PUSH(uint24)
633PUSH4uint32PUSH(uint32)
643PUSH5uint40PUSH(uint40)
653PUSH6uint48PUSH(uint48)
663PUSH7uint56PUSH(uint56)
673PUSH8uint64PUSH(uint64)
683PUSH9uint72PUSH(uint72)
693PUSH10uint80PUSH(uint80)
6A3PUSH11uint88PUSH(uint88)
6B3PUSH12uint96PUSH(uint96)
6C3PUSH13uint104PUSH(uint104)
6D3PUSH14uint112PUSH(uint112)
6E3PUSH15uint120PUSH(uint120)
6F3PUSH16uint128PUSH(uint128)
703PUSH17uint136PUSH(uint136)
713PUSH18uint144PUSH(uint144)
723PUSH19uint152PUSH(uint152)
733PUSH20uint160PUSH(uint160)
743PUSH21uint168PUSH(uint168)
753PUSH22uint176PUSH(uint176)
763PUSH23uint184PUSH(uint184)
773PUSH24uint192PUSH(uint192)
783PUSH25uint200PUSH(uint200)
793PUSH26uint208PUSH(uint208)
7A3PUSH27uint216PUSH(uint216)
7B3PUSH28uint224PUSH(uint224)
7C3PUSH29uint232PUSH(uint232)
7D3PUSH30uint240PUSH(uint240)
7E3PUSH31uint248PUSH(uint248)
7F3PUSH32uint256PUSH(uint256)
803DUP1valuevalue, valuePUSH(value)
813DUP2_, valuevalue, _, valuePUSH(value)
823DUP3_, _, valuevalue, _, _, valuePUSH(value)
833DUP4_, _, _, valuevalue, _, _, _, valuePUSH(value)
843DUP5..., valuevalue, ..., valuePUSH(value)
853DUP6..., valuevalue, ..., valuePUSH(value)
863DUP7..., valuevalue, ..., valuePUSH(value)
873DUP8..., valuevalue, ..., valuePUSH(value)
883DUP9..., valuevalue, ..., valuePUSH(value)
893DUP10..., valuevalue, ..., valuePUSH(value)
8A3DUP11..., valuevalue, ..., valuePUSH(value)
8B3DUP12..., valuevalue, ..., valuePUSH(value)
8C3DUP13..., valuevalue, ..., valuePUSH(value)
8D3DUP14..., valuevalue, ..., valuePUSH(value)
8E3DUP15..., valuevalue, ..., valuePUSH(value)
8F3DUP16..., valuevalue, ..., valuePUSH(value)
903SWAP1a, bb, aa, b = b, a
913SWAP2a, _, bb, _, aa, b = b, a
923SWAP3a, _, _, bb, _, _, aa, b = b, a
933SWAP4a, _, _, _, bb, _, _, _, aa, b = b, a
943SWAP5a, ..., bb, ..., aa, b = b, a
953SWAP6a, ..., bb, ..., aa, b = b, a
963SWAP7a, ..., bb, ..., aa, b = b, a
973SWAP8a, ..., bb, ..., aa, b = b, a
983SWAP9a, ..., bb, ..., aa, b = b, a
993SWAP10a, ..., bb, ..., aa, b = b, a
9A3SWAP11a, ..., bb, ..., aa, b = b, a
9B3SWAP12a, ..., bb, ..., aa, b = b, a
9C3SWAP13a, ..., bb, ..., aa, b = b, a
9D3SWAP14a, ..., bb, ..., aa, b = b, a
9E3SWAP15a, ..., bb, ..., aa, b = b, a
9F3SWAP16a, ..., bb, ..., aa, b = b, a
A0375LOG0src, lengthLOG0(memory[src:src+length])
A1750LOG1src, length, topic0LOG1(memory[src:src+length], topic0)
A21125LOG2src, length, topic0, topic1LOG2(memory[src:src+length], topic0, topic1)
A31500LOG3src, length, topic0, topic1, topic2LOG3(memory[src:src+length], topic0, topic1, topic2)
A41875LOG4src, length, topic0, topic1, topic2, topic3LOG4(memory[src:src+length], topic0, topic1, topic2, topic3)
A5-EF
F032000CREATEvalue, src, lengthaddraddr = new{value:value}(memory[src:src+length])
F1700CALLgas, addr, value, src, srcLength, dst, dstLengthsuccesssuccess, memory[dst:dst+dstLength] = address(addr).call{gas:gas,value:value}(memory[src:src+srcLength])
F2700CALLCODEgas, addr, value, src, srcLength, dst, dstLengthsuccesssuccess, memory[dst:dst+dstLength] = address(addr).callcode{gas:gas,value:value}(memory[src:src+srcLength])subCall.code = address(addr).code
F30RETURNsrc, lengthreturn memory[src:src+length]
F4700DELEGATECALLgas, addr, src, srcLength, dst, dstLengthsuccess, memory[dst:dst+dstLength] = address(addr).delegatecall{gas:gas}(memory[src:src+srcLength])subCall.code = address(addr).code subCall.msg.sender = msg.sender
F532000CREATE2value, src, length, saltaddraddr = new{value:value,salt:salt}(memory[src:src+length])
F63200AUTHauthority, src, lengthsuccesssuccess = auth(authority,memory[src:src+length])authorized = authority
F7700AUTHCALLgas, addr, value, src, srcLength, dst, dstLengthsuccesssuccess, memory[dst:dst+dstLength] = address(addr).authcall{gas:gas,value:value}(memory[src:src+srcLength])subCall.tx.origin = authorized subCall.msg.sender = authorized
F8-F9
FA700STATICCALLgas, addr, src, srcLength, dst, dstLengthsuccesssuccess, memory[dst:dst+dstLength] = address(addr).staticcall{gas:gas}(memory[src:src+srcLength])
FB-FC
FD0REVERTsrc, lengthrevert(memory[src:src+length])
FEallINVALID
FF5000SELFDESTRUCTaddrselfdestruct(address(addr))

References