Skip to main content
The Create2 Factory is a minimal proxy contract that enables deterministic contract deployment using the CREATE2 opcode. This allows developers to deploy contracts to addresses that can be computed in advance, regardless of the deployer’s nonce or transaction order. Contract Address: 0x4e59b44847b379578588920ca78fbf26c0b4956c Deployment Status: Default preinstall Gas Cost: Deployment cost + ~32,000 gas overhead

Key Features

  • Deterministic Addresses: Compute contract addresses before deployment
  • Cross-chain Consistency: Same address on all chains with the same bytecode and salt
  • Minimal Implementation: Only 45 bytes of optimized assembly code
  • No Storage or State: Pure function contract with no storage variables

How It Works

The CREATE2 opcode computes addresses using:
This formula ensures that the same inputs always produce the same address, enabling:
  • Pre-funding of contract addresses before deployment
  • Cross-chain address consistency
  • Gasless contract deployment patterns

Usage

Deploy a Contract

Compute Deployment Address

You can calculate the deployment address without actually deploying:

Common Use Cases

Deploy contracts to the same address across multiple chains:
Interact with contracts before they’re deployed:
  1. Compute the future address
  2. Send funds or tokens to that address
  3. Deploy the contract later when needed
Predictable upgrade addresses using versioned salts:
Build factory contracts with deterministic child addresses:

Implementation Details

The Create2 factory contract is extremely minimal:
This assembly code:
  1. Reads the salt (32 bytes) and bytecode from calldata
  2. Uses the CREATE2 opcode to deploy the contract
  3. Returns the deployed contract address

Best Practices

Security Considerations:
  • Always verify bytecode integrity before deployment
  • Be aware that anyone can deploy to a CREATE2 address if they have the bytecode and salt
  • Consider using access controls in your factory contracts

Salt Selection

Choose salts carefully for your use case:

Gas Optimization

  • The Create2 factory adds ~32,000 gas overhead
  • Batch deployments in a single transaction when possible
  • Pre-compute addresses to avoid on-chain calculations

Comparison with CREATE

Troubleshooting

Common issues and solutions:

Example: Multi-chain Token Deployment

Deploy an ERC20 token to the same address across multiple chains:

Further Reading