1
1
---
2
2
eip : 1052
3
3
title : EXTCODEHASH opcode
4
- author : Nick Johnson <arachnid@notdot.net>, Paweł Bylica <pawel@ethereum.org>
4
+ description : Returns the keccak256 hash of a contract's code
5
+ author : Nick Johnson (@arachnid), Paweł Bylica (@chfast)
5
6
discussions-to : https://ethereum-magicians.org/t/extcodehash-opcode/262
6
7
status : Final
7
8
type : Standards Track
19
20
20
21
Many contracts need to perform checks on a contract's bytecode, but do not
21
22
necessarily need the bytecode itself. For instance, a contract may want to check
22
- if another contract's bytecode is one of a set of permitted implementations, or
23
- it may perform analyses on code and whitelist any contract with matching
23
+ if another contract's bytecode is one of a set of permitted implementations,
24
+ or it may perform analyses on code and whitelist any contract with matching
24
25
bytecode if the analysis passes.
25
26
26
27
Contracts can presently do this using the ` EXTCODECOPY ` (` 0x3c ` ) opcode, but this
@@ -53,7 +54,7 @@ The gas cost is the same as the gas cost for the `BALANCE` opcode because the
53
54
execution of the ` EXTCODEHASH ` requires the same account lookup as in ` BALANCE ` .
54
55
55
56
Only the last 20 bytes of the argument are significant (the first 12 bytes are
56
- ignored), similarly to the semantics of the ` BALANCE ` (` 0x31 ` ), ` EXTCODESIZE `
57
+ ignored), similarly to the semantics of ` BALANCE ` (` 0x31 ` ), ` EXTCODESIZE `
57
58
(` 0x3b ` ), and ` EXTCODECOPY ` (` 0x3c ` ).
58
59
59
60
The ` EXTCODEHASH ` distinguishes accounts without code and non-existing accounts.
@@ -64,6 +65,13 @@ also allows smart contracts to check when an account exists.
64
65
65
66
There are no backwards compatibility concerns.
66
67
68
+ ## Security Considerations
69
+
70
+ This opcode does not introduce new security risks beyond those already
71
+ associated with the usage of code-hashing. However, it allows for more efficient
72
+ code checks, so developers should be aware that this may enable cheaper
73
+ verification of contracts, potentially influencing design decisions.
74
+
67
75
## Test Cases
68
76
69
77
1 . The ` EXTCODEHASH ` of the account without code is
@@ -84,11 +92,6 @@ There are no backwards compatibility concerns.
84
92
10 . The ` EXTCODEHASH ` of an empty account that will be cleared by
85
93
the state clearing rule.
86
94
87
- ## Implementation
95
+ ## Reference Implementation
88
96
89
97
TBD
90
-
91
- ## Copyright
92
-
93
- Copyright and related rights waived via
94
- [ CC0] ( ../LICENSE.md ) .
0 commit comments