Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines EIP-1014, which introduces the CREATE2 opcode to make contract deployment addresses predictable.
This explanation translates, summarizes, and expands on the following specification.
For other proposals, see https://cardene.dev/proposals.
For an overview of this proposal, see the following document.
Specification
CREATE2 is an EVM opcode assigned to 0xf5. It takes four stack arguments.
- endowment: the initial ETH balance transferred to the new contract.
- memory_start: the memory offset of the initialization code.
- memory_length: the length of the initialization code.
- salt: an arbitrary 32-byte value used in address derivation.
CREATE2 behaves much like CREATE (0xf0), except for the way the contract address is derived.
keccak256( 0xff ++ address ++ salt ++ keccak256(init_code) )[12:]- 0xff is a fixed one-byte value.
- address is the 20-byte address creating the contract.
- salt is a 32-byte stack value.
- init_code is the initialization code executed during deployment.
The last 20 bytes of the hash form the new contract address. The preimage is always 85 bytes long.
Gas consumption follows CREATE, with an additional hashing cost for init_code.
GSHA3WORD × ceil(len(init_code) / 32)This additional cost is deducted together with memory expansion and CreateGas, before address evaluation and execution of init_code.
Motivation
CREATE2 supports use cases such as state channels, where participants need to interact reliably with contracts that do not yet exist on-chain. The future deployment address can be established before the code is actually deployed.
This enables off-chain agreements and counterfactual interactions. The ability to transact or sign in anticipation of deployment is especially useful for Layer 2 protocols, smart wallets, and meta-transactions.
Additional Considerations
Address Design
Distinguishing Address Derivation Schemes
Unlike the conventional keccak256(rlp([sender, nonce])) derivation, CREATE2 uses a leading 0xff byte to distinguish its preimage from the CREATE scheme. An RLP encoding starting with 0xff would imply an impractically large, petabyte-scale payload. This separates the input domains, although cryptographic hash collisions remain theoretically possible.
Fixed-length Hash Preimage
The preimage is always 85 bytes, supporting a predictable derivation process and efficient implementation.
Gas Cost Design
CREATE2 charges an extra cost proportional to init_code length because computing its keccak256 hash consumes resources. This mitigates denial-of-service risks from repeatedly hashing large initialization code.
The cost uses the same per-32-byte rate (GSHA3WORD) as the SHA3 opcode and is deducted upfront alongside memory expansion costs.
Explanation
Understanding init_code
init_code is the code executed first during contract deployment. Its returned bytes become the contract's runtime code stored in state. In high-level languages such as Solidity, this includes constructor processing.
Address Collisions
CREATE2 can attempt to create contracts at previously derived addresses. EIP-684 specifies collision behavior.
For EIP-684, see the following article.
EIP-684 Explained: Preventing Contract Creation Collisions
- If the destination has nonempty code or a nonzero nonce, CREATE2 fails immediately.
- The failure behaves as though the first byte of init_code were an invalid opcode.
- EIP-684 specifies this rule retroactively from genesis.
Relationship to EIP-161
EIP-161 increments the new account's nonce during contract creation. Consequently, immediately after CREATE or CREATE2, the nonce is nonzero, so recreation at the same address within the same transaction fails.
SELFDESTRUCT does not immediately clear the nonce or code, either. Destruction and recreation at the same address within one transaction are therefore not possible through this mechanism.
Address Derivation Examples
The following abbreviated examples show how CREATE2 addresses depend on the inputs. The original example blocks are retained verbatim; the Japanese label 結果 means result. Example 5 describes repeated deadbeef data of at least 64 bytes, and Example 6 uses empty initialization code.
-
Example 0
textaddress: 0x000...000 salt: 0x000...000 init_code: 0x00 → 結果: 0x4D1A...BF38 -
Example 1
textaddress: 0xdeadbeef... salt: 0x000...000 init_code: 0x00 → 結果: 0xB928...FDA3 -
Example 2
textaddress: 0xdeadbeef... salt: 0x000...feed... init_code: 0x00 → 結果: 0xD041...9833 -
Example 3
textaddress: 0x000...000 salt: 0x000...000 init_code: 0xdeadbeef → 結果: 0x70f2...cb5e -
Example 4
textaddress: 0x000...deadbeef salt: 0x000...cafebabe init_code: 0xdeadbeef → 結果: 0x60f3...8AC7 -
Example 5
textaddress: 0x000...deadbeef salt: 0x000...cafebabe init_code: 64バイト以上のdeadbeefの繰り返し → 結果: 0x1d8b...854C -
Example 6
textaddress: 0x000...000 salt: 0x000...000 init_code: 空(0x) → 結果: 0xE33C...d9e0
These examples illustrate how different salts or deployer addresses produce different derived addresses even with the same initialization code. The design makes it possible to establish the address in advance while separating the address derivation scheme from conventional CREATE.
Citation
Vitalik Buterin (@vbuterin), "EIP-1014: Skinny CREATE2," Ethereum Improvement Proposals, no. 1014, April 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1014.
Conclusion
EIP-1014 introduces CREATE2, allowing contract deployment addresses to be calculated in advance.
Further reading and author links:




