Gas Costs from Yellow Paper -- EIP-150 Revision (1e18248 - 2017-04-12)
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

 
View only
 
 
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1
ValueMnemonicGas UsedSubset
Removed from stack
Added to stackNotesFormulaFormula Notes
2
0x00STOP0zero00Halts execution.
3
0x01ADD3verylow21Addition operation
4
0x02MUL5low21Multiplication operation.
5
0x03SUB3verylow21Subtraction operation.
6
0x04DIV5low21Integer division operation.
7
0x05SDIV5low21
Signed integer division operation (truncated).
8
0x06MOD5low21Modulo remainder operation
9
0x07SMOD5low21Signed modulo remainder operation.
10
0x08ADDMOD8mid31Modulo addition operation.
11
0x09MULMOD8mid31Modulo multiplication operation.
12
0x0aEXPFORMULA21Exponential operation.
(exp == 0) ? 10 : (10 + 10 * (1 + log256(exp)))
If exponent is 0, gas used is 10. If exponent is greater than 0, gas used is 10 plus 10 times a factor related to how large the log of the exponent is.
13
0x0bSIGNEXTEND5low21
Extend length of two’s complement signed integer.
14
0x10LT3verylow21Less-than comparison.
15
0x11GT3verylow21Greater-than comparison.
16
0x12SLT3verylow21Signed less-than comparison.
17
0x13SGT3verylow21Signed greater-than comparison.
18
0x14EQ3verylow21Equality comparison.
19
0x15ISZERO3verylow11Simple not operator.
20
0x16AND3verylow21Bitwise AND operation.
21
0x17OR3verylow21Bitwise OR operation
22
0x18XOR3verylow21Bitwise XOR operation.
23
0x19NOT3verylow11Bitwise NOT operation.
24
0x1aBYTE3verylow21Retrieve single byte from word
25
0x20SHA3FORMULA21Compute Keccak-256 hash.
30 + 6 * (size of input in words)
30 is the paid for the operation plus 6 paid for each word (rounded up) for the input data.
26
0x30ADDRESS2base01
Get address of currently executing account.
27
0x31BALANCE40011Get balance of the given account.
28
0x32ORIGIN2base01Get execution origination address.
29
0x33CALLER2base01Get caller address.
30
0x34CALLVALUE2base01
Get deposited value by the instruction/transaction responsible for this execution.
31
0x35
CALLDATALOAD
3verylow11Get input data of current environment.
32
0x36CALLDATASIZE2base01
Get size of input data in current environment.
33
0x37
CALLDATACOPY
FORMULA30
Copy input data in current environment to memory.
2 + 3 * (number of words copied, rounded up)
2 is paid for the operation plus 3 for each word copied (rounded up).
34
0x38CODESIZE2base01
Get size of code running in current environment.
35
0x39CODECOPYFORMULA30
Copy code running in current environment to memory.
2 + 3 * (number of words copied, rounded up)
2 is paid for the operation plus 3 for each word copied (rounded up).
36
0x3aGASPRICE2base01Get price of gas in current environment.
37
0x3bEXTCODESIZE700extcode11Get size of an account’s code.
38
0x3cEXTCODECOPYFORMULA40Copy an account’s code to memory.
700 + 3 * (number of words copied, rounded up)
700 is paid for the operation plus 3 for each word copied (rounded up).
39
0x40BLOCKHASH2011
Get the hash of one of the 256 most recent complete blocks.
40
0x41COINBASE2base01Get the block’s beneficiary address.
41
0x42TIMESTAMP2base01Get the block’s timestamp.
42
0x43NUMBER2base01Get the block’s number.
43
0x44DIFFICULTY2base01Get the block’s difficulty.
44
0x45GASLIMIT2base01Get the block’s gas limit.
45
0x50POP2base10Remove item from stack.
46
0x51MLOAD3verylow11Load word from memory.
47
0x52MSTORE3verylow20Save word to memory
48
0x53MSTORE83verylow20Save byte to memory.
49
0x54SLOAD20011Load word from storage
50
0x55SSTOREFORMULA11Save word to storage.
((value != 0) && (storage_location == 0)) ? 20000 : 5000
20000 is paid when storage value is set to non-zero from zero. 5000 is paid when the storage value's zeroness remains unchanged or is set to zero.
51
0x56JUMP8mid10Alter the program counter
52
0x57JUMPI10high20Conditionally alter the program counter.
53
0x58PC2base01
Get the value of the program counter prior to the increment corresponding to this instruction.
54
0x59MSIZE2base01Get the size of active memory in bytes.
55
0x5aGAS2base01
Get the amount of available gas, including the corresponding reduction for the cost of this instruction.
56
0x5bJUMPDEST100Mark a valid destination for jumps
57
0x60 -- 0x7fPUSH*3verylow01Place * byte item on stack. 0 < * <= 32
58
0x80 -- 0x8fDUP*3verylow** + 1Duplicate *th stack item. 0 < * <= 16
59
0x90 -- 0x9fSWAP*3verylow* + 1* + 1Exchange 1st and (* + 1)th stack items.
60
0xa0LOG0FORMULA20Append log record with no topics.
375 + 8 * (number of bytes in log data)
375 is paid for operation plus 8 for each byte in data to be logged.
61
0xa1LOG1FORMULA30Append log record with one topic.
375 + 8 * (number of bytes in log data) + 375
375 is paid for operation plus 8 for each byte in data to be logged plus 375 for the 1 topic to be logged.
62
0xa2LOG2FORMULA40Append log record with two topics.
375 + 8 * (number of bytes in log data) + 2 * 375
375 is paid for operation plus 8 for each byte in data to be logged plus 2 * 375 for the 2 topics to be logged.
63
0xa3LOG3FORMULA50Append log record with three topics.
375 + 8 * (number of bytes in log data) + 3 * 375
375 is paid for operation plus 8 for each byte in data to be logged plus 3 * 375 for the 3 topics to be logged.
64
0xa4LOG4FORMULA60Append log record with four topics.
375 + 8 * (number of bytes in log data) + 4 * 375
375 is paid for operation plus 8 for each byte in data to be logged plus 4 * 375 for the 4 topics to be logged.
65
0xf0CREATE3200031
Create a new account with associated code.
66
0xf1CALLFORMULA71Message-call into an account.
Complex -- see yellow paper Appendix H
67
0xf2CALLCODEFORMULA71
Message-call into this account with an alternative account’s code.
Complex -- see yellow paper Appendix H
68
0xf3RETURN0zero20Halt execution returning output data.
69
0xf4DELEGATECALLFORMULA61
Message-call into this account with an alternative account’s code, but persisting the current values for sender and value.
Complex -- see yellow paper Appendix H
70
0xfeINVALIDNANANADesignated invalid instruction.
71
0xffSELFDESTRUCTFORMULA10
Halt execution and register account for later deletion
5000 + ((create_new_account) ? 25000 : 0)
5000 for the operation plus 25000 if a new account is also created. A refund of 24000 gas is also added to the refund counter for self-destructing the account.
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Loading...
 
 
 
OPCODE Gas
 
 
Main menu