====== EIP 1052: EXTCODEHASH opcode ======
[[dido:public:ra:xapend:xapend.b_stds:defact:ethereum:start| Return to Ethereum ERCs ]]
: **Note**: The following is an excerpt from the official Ethereum site. It is provided here as a convenience and is not authoritative. Refer to the original document as the authoritative reference.
Data sheet for EXTCODEHASH opcode
| Title | EXTCODEHASH opcode |
| EIP | 1052 |
| Author |
* Nick Johnson ,
* Paweł Bylica
|
| Status | Final |
| Created | 1018-05-02 |
| Description | [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1052.md]] |
| Specification | [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1052.md#Specification]] |
| Category | Core |
===== Abstract =====
This EIP specifies a new opcode, which returns the keccak256 hash of a contract's code.
===== Motivation =====
Many contracts need to perform checks on a contract's bytecode, but do not necessarily need the bytecode itself. For instance, a contract may want to check if another contract's bytecode is one of a set of permitted implementations, or it may perform analyses on code and whitelist any contract with matching bytecode if the analysis passes.
Contracts can presently do this using the **''EXTCODECOPY (0x3c)''** opcode, but this is expensive, especially for large contracts, in cases where only the hash is required. As a result, we propose a new opcode, **''EXTCODEHASH''**, which returns the keccak256 hash of a contract's bytecode.
/**=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/* To add a discussion page to this page, comment out the line that says
~~DISCUSSION:off~~
*/
~~DISCUSSION:on|Outstanding Issues~~
~~DISCUSSION:off~~