Skip to main content Module vanity Copy item path Source use alloy_primitives::Address ; π use alloy_primitives::hex; π use alloy_primitives::hex ; π use alloy_signer_local::PrivateKeySigner; π use clap::Parser; π use eyre::Result ; π use eyre::WrapErr ; π use foundry_cli::json::print_json_success ; π use foundry_common::fs::write_sensitive_json_file ; π use foundry_common::sh_println ; π use foundry_common::shell ; π use rayon::iter; π use rayon::iter::ParallelIterator; π use regex::Regex; π use serde::Deserialize ; π use serde::Deserialize ; π use serde::Serialize ; π use serde::Serialize ; π use serde_json::json ; π use std::fs ; π use std::path::Path ; π use std::path::PathBuf ; π use std::time::Instant ; π Matcher π Optional start and end patterns an address must satisfy. VanityArgs CLI arguments for cast wallet vanity. WalletData π WalletData contains address and private_key information for a wallet. Wallets π Wallets is a collection of WalletData. Pattern π A vanity pattern: an exact byte prefix/suffix, or a regex over the lowercase hex address. find_vanity π Generates random wallets in parallel until matcher matches the wallet address, or the
contract address it creates at nonce when one is given. parse_pattern π save_wallet_to_file π Saves the specified wallet to a βvanity_addresses.jsonβ file at the given save_path.
If the file exists, the wallet data is appended to the existing content;
otherwise, a new file is created.