create2_mine

Scans a bounded local CPU salt range for EIP-1014 CREATE2 addresses. It performs no network I/O, deployment, chain-state lookup, collision check, or vanity-address safety proof.

Table function CREATE2

Example

Runs locally

-- First salt in 0..255 whose address ends in 0x38
SELECT salt, address::VARCHAR AS address
FROM create2_mine(
  '0x0000000000000000000000000000000000000000'::ADDRESS,
  keccak256('0x00'::BYTES),
  0::BIGINT,
  256::BIGINT,
  '0x00000000000000000000000000000000000000ff'::ADDRESS,
  '0x0000000000000000000000000000000000000038'::ADDRESS,
  1::BIGINT
);
-- => [{"salt":"0","address":"0x4d1a2e2bb4f88f0250f26ffff098b0b30b26bf38"}]

API reference

create2_mine(ADDRESS, BYTES32, BIGINT, BIGINT, ADDRESS, ADDRESS, BIGINT) # Capped Masked Create2 Scan

Applies bytewise `(address & mask) = (target & mask)` filtering and a positive result cap. The cap does not promise the lowest matching salts in a parallel scan.

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
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
salt_start BIGINT

Inclusive non-negative uint64-compatible BIGINT start; NULL defaults to 0.

required positional
salt_count BIGINT

Non-negative uint64-compatible BIGINT count defining `[start, start + count)`; NULL defaults to 100.

required positional
mask ADDRESS

20-byte address mask selecting which output address bits must match.

required positional
target ADDRESS

20-byte target; comparison uses only bits selected by mask.

required positional
max_results BIGINT

Positive result cap; NULL leaves 100 and zero errors.

required positional

Result columns

Name Type
deployer ADDRESS

Deployer address used in the CREATE2 formula

salt UBIGINT

Integer salt in the scanned range, interpreted as a left-padded 32-byte salt

address ADDRESS

Predicted CREATE2 address for deployer, salt, and init_hash

CREATE2 address candidates. Returns deployer, UBIGINT salt, and predicted address sorted by salt. `salt_start` is inclusive and `salt_count` defines `[start, start + count)`. A zero count returns no rows.

create2_mine(ADDRESS, BYTES32, BIGINT, BIGINT) # Complete Create2 Range Scan

Scans a contiguous salt range and emits one row per salt in that window for post-processing in SQL.

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
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
salt_start BIGINT

Inclusive non-negative uint64-compatible BIGINT start; NULL defaults to 0.

required positional
salt_count BIGINT

Non-negative uint64-compatible BIGINT count defining `[start, start + count)`; NULL defaults to 100.

required positional

Result columns

Name Type
deployer ADDRESS

Deployer address used in the CREATE2 formula

salt UBIGINT

Integer salt in the scanned range, interpreted as a left-padded 32-byte salt

address ADDRESS

Predicted CREATE2 address for deployer, salt, and init_hash

CREATE2 address candidates. Returns deployer, UBIGINT salt, and predicted address sorted by salt. `salt_start` is inclusive and `salt_count` defines `[start, start + count)`. A zero count returns no rows.

Overload examples

Runs locally

-- CREATE2 address for each salt in a one-salt range
SELECT salt, address::VARCHAR AS address
FROM create2_mine(
  '0x0000000000000000000000000000000000000000'::ADDRESS,
  keccak256('0x00'::BYTES),
  0::BIGINT,
  1::BIGINT
);
-- => [{"salt":"0","address":"0x4d1a2e2bb4f88f0250f26ffff098b0b30b26bf38"}]

Guidance

Range and parallelism

BIGINT start/count must convert to non-negative uint64 values; negatives error. Scans below 10,000 salts use one worker, while larger scans may use host parallelism.

  • The basic overload emits every candidate.
  • The extended predicate is bytewise `(address & mask) = (target & mask)`.
  • `max_results` is a positive result cap, not a guarantee of the lowest matching salts.
  • When parallel scans have more matches than the cap, scheduling can affect which matches survive before final sorting.

NULL compatibility and boundary

Current compatibility behavior is intentionally retained: NULL deployer/init_hash errors; NULL `salt_start` defaults to 0; NULL `salt_count` defaults to 100. In the extended overload, a NULL mask or target disables filtering and also bypasses the supplied cap, leaving the default cap 100; NULL `max_results` also leaves cap 100.

  • Mining is local CPU work only.
  • It does not deploy, query chain state, test address collisions, or prove vanity-address safety.