ETH Logo

EthVanity

Custom Address Generator

Buy us a coffee

Our free tools run entirely on donations. Your support pays for the servers and GPU power that make every generation possible. If we helped you today, a small donation helps keep this service free for everyone.

ETH · Ethereum network
0xcf5777b71c31146bd396cece6d3128e42d0ad9f7

Thank you for keeping us running! ❤️

Developer guide

Leading-Zero Ethereum Addresses: How They Save Gas

Why addresses with leading zero bytes cost less calldata gas (4 vs 16 gas per byte, EIP-2028), with Seaport and Uniswap v4 hook examples.

By Updated 7 min readRead as Markdown

Zeros and transaction data. Address text: Two hex zeroes represent one zero byte; Calldata: Zero and nonzero bytes have different base costs; Total fee: Depends on the full transaction and network rules.
Zeros and transaction data. Address text: Two hex zeroes represent one zero byte; Calldata: Zero and nonzero bytes have different base costs; Total fee: Depends on the full transaction and network rules.Open full-size diagram (SVG)Download diagram (PNG)About these visual guides
Short answer: Calldata costs 4 gas per zero byte and 16 gas per non-zero byte under EIP-2028, so every leading zero byte in an address saves 12 gas each time that address is passed as calldata. Protocols such as Seaport mine CREATE2 salts to get addresses like 0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC, which starts with 7 zero bytes.

How Ethereum prices calldata bytes

Every transaction pays intrinsic gas for its data field before any code runs. EIP-2028, activated in the Istanbul upgrade in December 2019, cut the price of a non-zero calldata byte from 68 to 16 gas and left zero bytes at 4 gas. A zero byte is therefore four times cheaper than a non-zero byte, a difference of 12 gas per byte.

EIP-7623, included in the Pectra upgrade in 2025, added a floor price for data-heavy transactions. It counts a zero byte as 1 token and a non-zero byte as 4 tokens, and charges at least 10 gas per token when a transaction does little computation. Under that floor a zero byte costs 10 gas and a non-zero byte 40 gas, so the relative advantage of zero bytes is unchanged and the absolute saving grows to 30 gas per byte for floor-priced transactions.

These prices apply to transaction calldata only. Data copied inside the EVM or stored in contract storage follows different rules, so leading zeros matter only where an address travels inside a transaction's input.

Byte typeStandard cost (EIP-2028)EIP-7623 floor
Zero byte (0x00)4 gas10 gas
Non-zero byte16 gas40 gas
Saving per zero byte12 gas30 gas

Where a leading-zero address actually saves gas

The ABI encodes an address argument as a 32-byte word: 12 zero bytes of padding followed by the 20 address bytes. If the address itself begins with k zero bytes, the word contains 12 + k zero bytes, and the transaction saves 12k gas every time that word appears in calldata. Seaport 1.5's address has k = 7, saving 84 gas per occurrence compared with a typical address.

The saving applies only where the address is data. The to field of a transaction is not priced per byte, so simply calling a leading-zero contract saves nothing. The benefit appears when other transactions pass the address as an argument, for example a marketplace or conduit address included in signed orders, a router in a swap path, or a token address in approvals. For contracts referenced in very many transactions, a few dozen gas per call adds up across users.

A second, smaller effect is in bytecode. A contract that hard-codes a leading-zero address as a constant can push it with a shorter PUSH instruction, for example PUSH13 instead of PUSH20 for 7 leading zero bytes. Contract code costs 200 gas per byte to deposit at deployment, so 7 fewer bytes save 1,400 deployment gas per occurrence.

Real examples of mined contract addresses

Several widely used contracts were deployed with mined CREATE2 salts. Each address below comes from the project's documentation or repository.

ContractAddressLeading zero bytes
Seaport 1.5 (OpenSea)0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC7
Seaport 1.1 (OpenSea)0x00000000006c3852cbEf3e08E8dF289169EdE5815
Deterministic deployment proxy0x4e59b44847b379578588920cA78FbF26c0B4956C0 (keyless deployment, not mined)
CreateX factory0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed0 (vanity ba5Ed prefix and suffix)

Uniswap v4 hooks: addresses that encode permissions

Uniswap v4 uses address bits for a different purpose. According to the v4 documentation and the Hooks.sol library, a hook contract's permissions are encoded in the least significant 14 bits of its address. Bit 13 is beforeInitialize, bit 7 is beforeSwap, bit 6 is afterSwap, and bits 3 to 0 are the four return-delta permissions. The PoolManager reads these bits to decide which hook functions to call.

Because Hooks.sol validates that every flag matches the permissions the hook declares, all 14 bits are fixed, so a valid address needs on average 2^14 = 16,384 CREATE2 attempts. Uniswap's HookMiner library in v4-periphery performs this search for a given deployer, flag set, creation code and constructor arguments. If the address lacks a flag, the PoolManager never calls that function, and mismatched permissions make deployment fail.

// Uniswap v4: mine a hook address whose low bits encode the flags
uint160 flags = uint160(Hooks.AFTER_ADD_LIQUIDITY_FLAG | Hooks.AFTER_SWAP_FLAG);
bytes memory constructorArgs = abi.encode(POOLMANAGER);
(address hookAddress, bytes32 salt) =
    HookMiner.find(CREATE2_DEPLOYER, flags, type(PointsHook).creationCode, constructorArgs);
// deploy with `salt`, then assert the deployed address == hookAddress

Mining a leading-zero CREATE2 salt

Leading zeros are a prefix pattern, so the difficulty math from the vanity difficulty guide applies: k zero bytes means 2k fixed hex characters, or 256^k expected attempts. Four zero bytes average about 4.29 billion attempts; Seaport 1.5's seven zero bytes correspond to 2^56, about 7.2 x 10^16 attempts on average.

The best-known tool is create2crunch by 0age, a Rust program that takes the factory address, a caller address and the keccak-256 hash of the init code, then writes matching salts and addresses to efficient_addresses.txt. It has an experimental OpenCL GPU mode with thresholds for leading and total zero bytes. Because a CREATE2 salt search involves no private key, it is safe to run on rented hardware; the formula and its pitfalls are in EOA vs CREATE2 vanity.

  • Fix the factory and exact init code first; any change to bytecode or constructor arguments invalidates the mined salt.
  • Use a caller-restricted salt so the address cannot be taken by someone who sees your deployment transaction.
  • Deploy through a factory that exists on every target chain if you want the same address everywhere, as explained in same address on every EVM chain.

Estimating the payoff before you mine

Whether mining is worthwhile depends on how often the address will appear in calldata. Total saving = 12 x k x occurrences gas under standard pricing, where k is the number of leading zero bytes. With 4 zero bytes the saving is 48 gas per occurrence. If the address is passed in 1 million transactions over the contract's life, users save 48 million gas in total; at a hypothetical 10 gwei that equals 0.48 ETH spread across all of them.

Compare that with the search cost. Four zero bytes require about 4.29 billion expected CREATE2 attempts and each extra byte multiplies the work by 256, so going from 4 to 5 zero bytes adds only 12 gas per occurrence but costs 256 times more computation. For most projects, 4 or 5 leading zero bytes is a sensible ceiling, and contracts that are rarely passed as arguments gain nothing worth mining for.

A caution about leading-zero wallets

Leading zeros can also be mined for externally owned accounts, but that requires generating a private key, and the key must come from a secure random source. Wintermute's founder said the firm had used Profanity-type tools to create addresses for gas optimization before its September 2022 loss of about $160 million, which researchers linked to Profanity's weak seed. The Profanity vulnerability explainer covers what went wrong. For contracts, mining a public salt avoids this class of risk entirely.

Explore the related mechanism

Frequently asked questions

How much gas does a leading-zero address save?

12 gas per leading zero byte each time the address appears in calldata under standard pricing, or 30 gas per byte for transactions charged the EIP-7623 floor. Calling the contract through the to field saves nothing.

Is it worth mining a leading-zero address for my contract?

It pays off mainly for contracts whose address is passed as an argument in many transactions, such as marketplaces, routers or tokens. For a contract used a few times, the saving is negligible.

Why do Uniswap v4 hook addresses look random but still need mining?

Only the lowest 14 bits matter, and they must exactly match the hook's permissions. That needs about 16,384 attempts on average, which HookMiner does in seconds.

Does a leading-zero address cost less to store?

No. Storage costs depend on whether a slot is zero or non-zero as a whole, not on how many zero bytes a non-zero value contains.

How many leading zero bytes should I mine for?

Each extra zero byte saves 12 more gas per calldata occurrence but needs 256 times more attempts. Estimate how often the address will be passed as an argument and stop when the extra saving no longer justifies the search.

Sources and editorial method

The technical references below support the concepts discussed in this article. Examples and comparison worksheets are explanatory, not measured service benchmarks.

Read how these articles are prepared.