English | 中文
Search Ethereum CREATE2 vanity addresses with TypeScript on the Bun runtime. vanityx also supports CreateX salt rules out of the box.
- You provide:
pattern+deployer+initcodeorinitcodeHash - You get: the matching
saltorguardedSaltand the resulting contract address
Looking for a ready-to-run tool? See @vanityx/cli.
- Iterator-first: exposes iterators so you can plug in your own parallelization, distribution, or stopping logic
- CreateX support: handles guarded salt for both permissioned and crosschain modes
- Simple patterns: uses Bun
Globto match0x…address strings - Small API: one
searchVanity()with an optional progress callback
This package uses Bun Glob at runtime for pattern matching, so it needs Bun to run.
If you want a tool with multi-threaded parallel search, download the prebuilt binaries from releases or use the CLI docs at @vanityx/cli.
pnpm add @vanityx/core
# or
bun add @vanityx/coreWhen deployer is the CreateX factory address and protections are enabled, vanityx follows CreateX rules and returns guardedSalt.
import { searchVanity } from '@vanityx/core'
import { CREATEX_FACTORY_ADDRESS } from '@vanityx/core/schema'
const result = searchVanity({
pattern: '0x1234*',
deployer: CREATEX_FACTORY_ADDRESS,
initcodeHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
createxOpts: {
crosschain: { chainId: 1 },
permissioned: { msgSender: '0x0000000000000000000000000000000000000000' },
},
})
console.log(result)import { searchVanity } from '@vanityx/core'
const result = searchVanity({
pattern: '0xcafe*',
deployer: '0x0000000000000000000000000000000000000000',
initcodeHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
}, {
progressInterval: 50_000,
onProgress: ({ attempts, timeMs }) => {
console.log(`Tried ${attempts} salts in ${timeMs}ms...`)
},
})
console.log(result)pattern matches target addresses based on Bun's supported Glob syntax. Common patterns:
0xcafe*: Prefix match.0x*beef: Suffix match.0x*bee?:?matches a single hexadecimal character.0x{aa,bb}*: Multiple prefix options.0x[0-4][c-e]*: Character set range match.
Caution
- Validity checks for
patternare limited. Ensure you input a correctglobpattern. - A valid but incorrect
patternmay fail to match expected addresses (e.g.,0xVVV*VVV). - Remember to append
*to avoid fixing the address length prematurely (e.g., use0x1234*instead of0x1234). **and!have no special meaning in address patterns and are untested.
- Input
patternmust start with0xdeployeris the CREATE2 deployer address used for address derivationinitcodeorinitcodeHashis requiredcreatexOptsenables CreateX protections. It only takes effect whendeployer === CREATEX_FACTORY_ADDRESS
- Output
- Returns
{ salt, address, guardedSalt? }when a match is found - Returns
nullwhenonProgressreturnsfalse
- Returns
If you want full control over the search loop, use iterators directly:
standardIterator()yields standard CREATE2 attemptscreateXIterator()yields CreateX attempts and includesguardedSalt
Searching is essentially random sampling: for a fixed
- Example: For
0x1234*, the expected attempts are$16^4 = 65,536$ . - For specific performance metrics, refer to the benchmark report or run the benchmark script.
Usually you don't need to use guardedSalt directly, it's mainly an informational field.
This concept primarily exists for CreateX internal scenarios and isn't very meaningful for most users. When deploying the contract, you can just use salt.
It uses Bun Glob at runtime, and Node does not provide that API.
- Use the CLI prebuilt binaries from releases
- Or consume the iterators and run your own matcher in Node
No. It is random sampling, and you only get an expected number of attempts. Longer prefixes or suffixes grow exponentially.
src/core library code, includingsearchVanity, iterators, and schematypes/exported TypeScript typespackages/cli/CLI tool built on top of the core librarypackages/createx_guard/CreateX guarded salt implementationpackages/createx_guard_hh/hardhat test project forcreatex_guardbench/benchmark scripts