EIPs
EIP-1014 — CREATE2
CREATE2 derives a contract’s address deterministically from (deployer, salt, init_code) instead of from (deployer, nonce). The address is knowable before deployment, which is what makes counterfactual systems (EIP-6492, smart-account factories, deterministic CREATE patterns) work.
import { parse } from "valibot";
import { AddressSchema, Bytes32Schema } from "@ethernauta/core";
import { get_create2_address } from "@ethernauta/eip/1014";
const from = parse(AddressSchema, "0x4e59b44847b379578588920cA78FbF26c0B4956C");
const salt = parse(Bytes32Schema, "0x0000000000000000000000000000000000000000000000000000000000000001");
const bytecodeHash = parse(Bytes32Schema, "0x0000000000000000000000000000000000000000000000000000000000000002");
const address = get_create2_address({ from, salt, bytecodeHash });
void address; Surface
| Export | Type | Purpose |
|---|---|---|
get_create2_address | (args) => Address | CREATE2 address derivation. |
get_contract_address | (args) => Address | Pick CREATE or CREATE2 by argument shape. |
deploy_contract | Signable<Hash32> | Submit a deployment via eth_sendTransaction. |
| Valibot schemas for both above |
CREATE vs CREATE2
The two derivations live in separate exports — pick the one that matches the deployment opcode:
import { parse } from "valibot";
import { AddressSchema, Bytes32Schema, UintSchema } from "@ethernauta/core";
import { get_contract_address, get_create2_address } from "@ethernauta/eip/1014";
const from = parse(AddressSchema, "0x4e59b44847b379578588920cA78FbF26c0B4956C");
const nonce = parse(UintSchema, "0x0");
const salt = parse(Bytes32Schema, "0x0000000000000000000000000000000000000000000000000000000000000001");
const bytecodeHash = parse(Bytes32Schema, "0x0000000000000000000000000000000000000000000000000000000000000002");
const create_address = get_contract_address({ from, nonce }); // → CREATE
const create2_address = get_create2_address({ from, salt, bytecodeHash }); // → CREATE2
void create_address;
void create2_address; Useful when a deployment script handles both legacy CREATE and CREATE2 sites.
Where this gets used
- Smart accounts. Factories compute the user’s account address before deployment so the dapp can route funds there.
- EIP-6492 counterfactual signatures. The wrapped signature carries the factory + salt + init_code; the verifier recomputes the address and falls through to the EIP-1271 logic that the deployed account would have.
- Deterministic deployments. Same
(deployer, salt, init_code)everywhere → same address on every chain (assuming same chain ID semantics).