create2_predict

Computes the EIP-1014 CREATE2 address from the executing deployer, exact salt, and complete init-code hash. This is deterministic local arithmetic and does not query or mutate chain state.

Example

Local

1
SELECT create2_predict(
2
'0x00000000000000000000000000000000deadbeef'::ADDRESS,
3
'0x00000000000000000000000000000000000000000000000000000000cafebabe'::BYTES32,
4
keccak256('0xdeadbeef'::BYTES)
5
)::VARCHAR AS address;
6
-- => [{"address":"0x60f3f640a8508fc6a86d45df051962668e1e8ac7"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

create2_predict(ADDRESS, BYTES32, BYTES32) # Create2 Prediction Exact Salt

Expects salt as exact BYTES32 and init_hash as keccak256(init_code).

Inputs

Name Type Use
deployer ADDRESS

Address that will execute CREATE2. For factory deployments, this is the factory address, not the future contract owner, transaction caller, or deployer key.

required positional
salt BYTES32

All 32 bytes are used exactly in the CREATE2 formula.

required positional
init_hash BYTES32

`keccak256(init_code)`, where complete init code is linked creation bytecode plus ABI-encoded constructor arguments. Runtime bytecode hashes are invalid substitutes.

required positional

Returns

Name Type
address ADDRESS

Predicted deployment address. Returns keccak256(0xff ++ deployer20 ++ salt32 ++ keccak256(init_code))[12:]. NULL or incorrectly sized raw blobs currently return NULL.

Guidance

EIP-1014 inputs

The exact formula is `keccak256(0xff ++ deployer20 ++ salt32 ++ keccak256(init_code))[12:]`.

  • The deployer is the account executing CREATE2, commonly a factory.
  • Hash complete init code after constructor ABI encoding and library linking.
  • Never substitute a runtime-bytecode hash.

Boundary

Prediction is pure address arithmetic. The SQL registration remains VOLATILE despite the deterministic implementation; this is a catalog metadata defect.

  • It does not inspect chain state, detect collisions, prove factory behavior, deploy code, or guarantee successful initialization.

Additional overloads

create2_predict(ADDRESS, BIGINT, BYTES32) # Create2 Prediction Bigint Salt

Converts the signed BIGINT to its lower unsigned 64 bits and left-pads those bytes to salt32. Negative values map modulo 2^64; use BYTES32 when exact or full-width salt bytes matter.

Inputs

Name Type Use
deployer ADDRESS

Address that will execute CREATE2. For factory deployments, this is the factory address, not the future contract owner, transaction caller, or deployer key.

required positional
salt BIGINT

Signed SQL BIGINT converted to its lower unsigned 64-bit representation and left-padded to 32 bytes. Negative values therefore map modulo 2^64; use BYTES32 for exact or full-width salts.

required positional
init_hash BYTES32

`keccak256(init_code)`, where complete init code is linked creation bytecode plus ABI-encoded constructor arguments. Runtime bytecode hashes are invalid substitutes.

required positional

Returns

Name Type
address ADDRESS

Predicted deployment address. Returns keccak256(0xff ++ deployer20 ++ salt32 ++ keccak256(init_code))[12:]. NULL or incorrectly sized raw blobs currently return NULL.

Overload examples

Local SQL

1
SELECT create2_predict(
2
'0x0000000000000000000000000000000000000000'::ADDRESS,
3
0::BIGINT,
4
keccak256('0x00'::BYTES)
5
)::VARCHAR AS address;
6
-- => [{"address":"0x4d1a2e2bb4f88f0250f26ffff098b0b30b26bf38"}]

Related functions

Category and tags

Tag
CREATE2