This appendix is based on the consolidation work done by the people of https://github.com/trailofbits/evm-opcodes as a reference for Ethereum VM (EVM) opcodes and instruction information licensed under the Apache License 2.0.
Opcode | Name | Description | Extra info | Gas |
---|---|---|---|---|
|
|
Halts execution |
- |
0 |
|
|
Addition operation |
- |
3 |
|
|
Multiplication operation |
- |
5 |
|
|
Subtraction operation |
- |
3 |
|
|
Integer division operation |
- |
5 |
|
|
Signed integer division operation (truncated) |
- |
5 |
|
|
Modulo remainder operation |
- |
5 |
|
|
Signed modulo remainder operation |
- |
5 |
|
|
Modulo addition operation |
- |
8 |
|
|
Modulo multiplication operation |
- |
8 |
|
|
Exponential operation |
- |
10*** |
|
|
Extend length of two’s complement signed integer |
- |
5 |
|
Unused |
Unused |
- |
|
|
|
Less-than comparison |
- |
3 |
|
|
Greater-than comparison |
- |
3 |
|
|
Signed less-than comparison |
- |
3 |
|
|
Signed greater-than comparison |
- |
3 |
|
|
Equality comparison |
- |
3 |
|
|
Simple NOT operator |
- |
3 |
|
|
Bitwise AND operation |
- |
3 |
|
|
Bitwise OR operation |
- |
3 |
|
|
Bitwise XOR operation |
- |
3 |
|
|
Bitwise NOT operation |
- |
3 |
|
|
Retrieve single byte from word |
- |
3 |
|
Unused |
Unused |
- |
|
|
|
Compute Keccak-256 hash |
- |
30 |
|
Unused |
Unused |
- |
|
|
|
Get address of currently executing account |
- |
2 |
|
|
Get balance of the given account |
- |
400 |
|
|
Get execution origination address |
- |
2 |
|
|
Get caller address |
- |
2 |
|
|
Get deposited value by the instruction/transaction responsible for this execution |
- |
2 |
|
|
Get input data of current environment |
- |
3 |
|
|
Get size of input data in current environment |
- |
2 |
|
|
Copy input data in current environment to memory |
- |
3 |
|
|
Get size of code running in current environment |
- |
2 |
|
|
Copy code running in current environment to memory |
- |
3 |
|
|
Get price of gas in current environment |
- |
2 |
|
|
Get size of an account’s code |
- |
700 |
|
|
Copy an account’s code to memory |
- |
700 |
|
|
Pushes the size of the return data buffer onto the stack |
2 |
|
|
|
Copies data from the return data buffer to memory |
3 |
|
|
Unused |
- |
- |
|
|
|
Get the hash of one of the 256 most recent complete blocks |
- |
20 |
|
|
Get the block’s beneficiary address |
- |
2 |
|
|
Get the block’s timestamp |
- |
2 |
|
|
Get the block’s number |
- |
2 |
|
|
Get the block’s difficulty |
- |
2 |
|
|
Get the block’s gas limit |
- |
2 |
|
Unused |
- |
- |
|
|
|
Remove word from stack |
- |
2 |
|
|
Load word from memory |
- |
3 |
|
|
Save word to memory |
- |
3* |
|
|
Save byte to memory |
- |
3 |
|
|
Load word from storage |
- |
200 |
|
|
Save word to storage |
- |
0* |
|
|
Alter the program counter |
- |
8 |
|
|
Conditionally alter the program counter |
- |
10 |
|
|
Get the value of the program counter prior to the increment |
- |
2 |
|
|
Get the size of active memory in bytes |
- |
2 |
|
|
Get the amount of available gas, including the corresponding reduction in the amount of available gas |
- |
2 |
|
|
Mark a valid destination for jumps |
- |
1 |
|
Unused |
- |
- |
|
|
|
Place 1-byte item on stack |
- |
3 |
|
|
Place 2-byte item on stack |
- |
3 |
|
|
Place 3-byte item on stack |
- |
3 |
|
|
Place 4-byte item on stack |
- |
3 |
|
|
Place 5-byte item on stack |
- |
3 |
|
|
Place 6-byte item on stack |
- |
3 |
|
|
Place 7-byte item on stack |
- |
3 |
|
|
Place 8-byte item on stack |
- |
3 |
|
|
Place 9-byte item on stack |
- |
3 |
|
|
Place 10-byte item on stack |
- |
3 |
|
|
Place 11-byte item on stack |
- |
3 |
|
|
Place 12-byte item on stack |
- |
3 |
|
|
Place 13-byte item on stack |
- |
3 |
|
|
Place 14-byte item on stack |
- |
3 |
|
|
Place 15-byte item on stack |
- |
3 |
|
|
Place 16-byte item on stack |
- |
3 |
|
|
Place 17-byte item on stack |
- |
3 |
|
|
Place 18-byte item on stack |
- |
3 |
|
|
Place 19-byte item on stack |
- |
3 |
|
|
Place 20-byte item on stack |
- |
3 |
|
|
Place 21-byte item on stack |
- |
3 |
|
|
Place 22-byte item on stack |
- |
3 |
|
|
Place 23-byte item on stack |
- |
3 |
|
|
Place 24-byte item on stack |
- |
3 |
|
|
Place 25-byte item on stack |
- |
3 |
|
|
Place 26-byte item on stack |
- |
3 |
|
|
Place 27-byte item on stack |
- |
3 |
|
|
Place 28-byte item on stack |
- |
3 |
|
|
Place 29-byte item on stack |
- |
3 |
|
|
Place 30-byte item on stack |
- |
3 |
|
|
Place 31-byte item on stack |
- |
3 |
|
|
Place 32-byte (full word) item on stack |
- |
3 |
|
|
Duplicate 1st stack item |
- |
3 |
|
|
Duplicate 2nd stack item |
- |
3 |
|
|
Duplicate 3rd stack item |
- |
3 |
|
|
Duplicate 4th stack item |
- |
3 |
|
|
Duplicate 5th stack item |
- |
3 |
|
|
Duplicate 6th stack item |
- |
3 |
|
|
Duplicate 7th stack item |
- |
3 |
|
|
Duplicate 8th stack item |
- |
3 |
|
|
Duplicate 9th stack item |
- |
3 |
|
|
Duplicate 10th stack item |
- |
3 |
|
|
Duplicate 11th stack item |
- |
3 |
|
|
Duplicate 12th stack item |
- |
3 |
|
|
Duplicate 13th stack item |
- |
3 |
|
|
Duplicate 14th stack item |
- |
3 |
|
|
Duplicate 15th stack item |
- |
3 |
|
|
Duplicate 16th stack item |
- |
3 |
|
|
Exchange 1st and 2nd stack items |
- |
3 |
|
|
Exchange 1st and 3rd stack items |
- |
3 |
|
|
Exchange 1st and 4th stack items |
- |
3 |
|
|
Exchange 1st and 5th stack items |
- |
3 |
|
|
Exchange 1st and 6th stack items |
- |
3 |
|
|
Exchange 1st and 7th stack items |
- |
3 |
|
|
Exchange 1st and 8th stack items |
- |
3 |
|
|
Exchange 1st and 9th stack items |
- |
3 |
|
|
Exchange 1st and 10th stack items |
- |
3 |
|
|
Exchange 1st and 11th stack items |
- |
3 |
|
|
Exchange 1st and 12th stack items |
- |
3 |
|
|
Exchange 1st and 13th stack items |
- |
3 |
|
|
Exchange 1st and 14th stack items |
- |
3 |
|
SWAP14 |
Exchange 1st and 15th stack items |
- |
3 |
|
|
Exchange 1st and 16th stack items |
- |
3 |
|
|
Exchange 1st and 17th stack items |
- |
3 |
|
|
Append log record with no topics |
- |
375 |
|
|
Append log record with one topic |
- |
750 |
|
|
Append log record with two topics |
- |
1125 |
|
|
Append log record with three topics |
- |
1500 |
|
|
Append log record with four topics |
- |
1875 |
|
Unused |
- |
- |
|
|
|
Tentative libevmasm has different numbers |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
|
Tentative |
||
|
Unused |
- |
- |
|
|
|
Only referenced in |
- |
- |
|
|
Only referenced in |
- |
- |
|
|
Only referenced in |
- |
- |
|
Unused |
- |
- |
|
|
|
Create a new account with associated code |
- |
32000 |
|
|
Message-call into an account |
- |
Complicated |
|
|
Message-call into this account with alternative account’s code |
- |
Complicated |
|
|
Halt execution returning output data |
- |
0 |
|
|
Message-call into this account with an alternative account’s code, but persisting into this account with an alternative account’s code |
- |
Complicated |
|
|
- |
- |
40 |
|
Unused |
- |
- |
|
|
|
Similar to |
- |
40 |
|
|
Create a new account and set creation address to |
- |
|
|
|
Not in yellow paper FIXME |
- |
- |
|
|
Stop execution and revert state changes, without consuming all provided gas and providing a reason |
- |
0 |
|
|
Designated invalid instruction |
- |
0 |
|
|
Halt execution and register account for later deletion |
- |
5000* |