27 releases (stable)
new 2.0.1 | Jan 25, 2025 |
---|---|
1.4.1 | Jan 21, 2025 |
1.3.1 | Oct 13, 2024 |
1.0.3 | Aug 4, 2023 |
0.9.0 | Aug 3, 2023 |
#68 in Magic Beans
642 downloads per month
125KB
2K
SLoC
btc-vanity
A blazingly fast vanity address generator written with the Rust programming language. Supporting Bitcoin, Ethereum, and Solana.
With btc-vanity, you can generate wallets that has custom addresses with prefixes, suffixes, substrings, or even regex patterns. It's designed for speed, flexibility, and security.
You can easily run btc-vanity terminal application locally or use it as a library to create your vanity keypair securely.
Key Features
Multi-Chain Support: Generate vanity addresses for: Bitcoin
, Ethereum
, and Solana
.
Advanced Customization: Match prefixes, suffixes, substrings, or regex-based patterns with optional case insensitivity.
Blazingly Fast Performance: Fully utilize your hardware with customizable thread counts.
Batch File Support: Bulk generate addresses using input files with desired patterns.
Installation
[!CAUTION] btc-vanity has recently migrated to version 2. Please use it cautiously.
CLI
Install the binary using cargo
:
p
$ cargo install btc-vanity
Library
Or include it as a library in your Rust project:
[dependencies]
btc-vanity = "2.0.1"
Crate on crates.io
Documentation on docs.rs
CLI Usage
Basic CLI Syntax
The CLI tool provides several options to customize your address generation:
$ btc-vanity [OPTIONS] <PATTERN>
Blockchain Selection
--btc
: Generates Bitcoin keypairs and addresses. [default]
--eth
: Generates Ethereum keypairs and addresses.
--sol
: Generates Solana keypairs and addresses.
General Options
-i, --input-file <FILE>
: Reads patterns and it's flags from the specified file for vanity address generation, with one pattern per line.
-o, --output-file <FILE>
: Saves generated wallet details to the specified file, creating it if it doesn’t exist or appending if it does.
-t, --threads <N>
: Sets the number of threads for address generation.
-f, --force-flags
: Forces CLI flags to override any flags specified in the input file, ensuring consistent behavior across all patterns.
-d, --disable-fast
: Disables fast mode to allow longer patterns (5 for BTC and SOL, 16 for ETH), though it may increase search time.
Matching Options
-p, --prefix
: Matches the pattern as a prefix of the address. [default]
-s, --suffix
: Matches the pattern as a suffix of the address.
-a, --anywhere
: Matches the pattern anywhere in the address.
-r, --regex <REGEX>
: Matches addresses using a regex pattern, supporting advanced customization like anchors and wildcards.
-c, --case-sensitive
: Enables case-sensitive matching, making patterns distinguish between uppercase and lowercase characters.
Bitcoin CLI Examples
Generate a Bitcoin address with prefix 1Emiv
(case-insensitive):
$ btc-vanity Emiv
Generate a Bitcoin address containing the substring test
(case-sensitive):
$ btc-vanity -a -c test
Generate a Bitcoin address using a regex pattern ^1E.*T$
:
$ btc-vanity -r "^1E.*T$"
Generate multiple Bitcoin addresses and save to wallets.txt:
[!NOTE]
-f flag will override any pattern flags inside theinput-file.txt
. For example if there lineemiv -s --eth
will becomeemiv -p --btc -c
. The resulting wallet will be printed inwallets.txt
.
$ btc-vanity -f --btc -p -c -i input-file.txt -o wallets.txt
Generate an Ethereum address starting with 0xdead with 8 threads:
$ btc-vanity --eth -t 8 dead
Generate a Solana address ending with 123:
$ btc-vanity --sol -s 123
Library Usage
Here are some usage examples of btc-vanity
as a library.
Generate a Bitcoin Vanity Address
Find a Bitcoin address that contains the substring emiv
(case-insensitive) using 16 threads:
use btc_vanity::{BitcoinKeyPair, VanityAddr, VanityMode};
let vanity_address: BitcoinKeyPair = VanityAddr::generate(
"emiv", // Desired substring
16, // Number of threads
false, // Case-insensitive
true, // Enable fast mode
VanityMode::Anywhere // Match substring anywhere in the address
).unwrap();
println!("Vanity address:\n\
private_key (WIF): {}\n\
public_key (compressed): {}\n\
address (compressed): {}\n",
vanity_address.get_wif_private_key(),
vanity_address.get_comp_public_key(),
vanity_address.get_comp_address());
Generate an Ethereum Vanity Address
Match an Ethereum address with the prefix 0xdead
using 8 threads:
use btc_vanity::{EthereumKeyPair, KeyPairGenerator, VanityAddr, VanityMode};
let vanity_address: EthereumKeyPair = VanityAddr::generate(
"dead", // Desired prefix (without 0x)
8, // Number of threads
false, // Case-insensitive (Case sensitivity not supported on ETH generation)
true, // Enable fast mode
VanityMode::Prefix // Match substring at the start
).unwrap();
println!("Ethereum vanity address:\n\
private_key: {}\n\
public_key: {}\n\
address: {}\n",
vanity_address.get_private_key_as_hex(),
vanity_address.get_private_key_as_hex(),
vanity_address.get_address());
Generate a Solana Vanity Address
Create a Solana address with meow
anywhere in the address (case-sensitive) using 4 threads:
use btc_vanity::{SolanaKeyPair, KeyPairGenerator, VanityAddr, VanityMode};
let vanity_address: SolanaKeyPair = VanityAddr::generate(
"meow", // Desired substring
4, // Number of threads
true, // Case-sensitive
true, // Enable fast mode
VanityMode::Anywhere // Match substring anywhere in the address
).unwrap();
println!("Solana vanity address:\n\
private_key: {}\n\
public_key: {}\n\
address: {}\n",
vanity_address.get_private_key_as_base58(),
vanity_address.get_public_key_as_base58(),
vanity_address.get_address());
Regex Matching for Bitcoin Addresses
Find a Bitcoin address that matches a regex pattern ^1E.ET.*T$
with using 12 threads:
use btc_vanity::{BitcoinKeyPair, VanityAddr};
let vanity_address = VanityAddr::generate_regex::<BitcoinKeyPair>(
"^1E.*ET.*T$", // The regex pattern
12 // Number of threads
).unwrap();
println!("Bitcoin regex-matched vanity address:\n\
private_key (WIF): {}\n\
public_key (compressed): {}\n\
address (compressed): {}\n",
vanity_address.get_wif_private_key(),
vanity_address.get_comp_public_key(),
vanity_address.get_comp_address());
Contributing
Contributions are welcome! If you’d like to improve btc-vanity or add support for additional chains, feel free to open an issue or submit a pull request on GitHub.
Disclaimer
USE WITH CAUTION AND UNDERSTANDING
btc-vanity is a tool designed to assist users in generating customized vanity Bitcoin addresses using the Rust programming language. While btc-vanity aims to provide a secure and efficient method for generating vanity addresses, it is essential to exercise caution and follow the best security practices.
-
Security Awareness: Generating and using vanity addresses involves the creation of private keys and public addresses. Private keys grant control over the associated Bitcoin funds. It is crucial to understand the risks involved in managing private keys and to never share them with anyone. Keep your private keys stored securely and never expose them to potential threats.
-
Risk of Loss: Improper use of btc-vanity, mishandling of private keys, or failure to follow security guidelines may result in the loss of Bitcoin funds. Always double-check the addresses generated and verify their accuracy before using them for transactions.
-
Verification: Before utilizing any vanity address generated by btc-vanity, thoroughly verify the integrity of the software and the generated addresses. Only use versions of btc-vanity obtained from reputable sources, such as the official crates.io page.
-
Backup and Recovery: Maintain proper backups of your private keys and any relevant data. In the event of device failure, loss, or corruption, having secure backups will help prevent irreversible loss of funds.
-
Use at Your Own Risk: The btc-vanity software is provided "as is," without any warranties or guarantees. The author(s) and contributors of btc-vanity shall not be held responsible for any direct or indirect damages, losses, or liabilities resulting from the use or misuse of this software.
-
Educational Purposes: btc-vanity is intended for educational and personal use. It is your responsibility to ensure compliance with any legal, regulatory, or tax requirements in your jurisdiction related to Bitcoin and cryptocurrency usage.
By using btc-vanity, you acknowledge and accept the risks associated with generating vanity addresses and handling private keys. It is your responsibility to exercise diligence, follow security best practices, and be aware of potential risks.
Remember, the security of your Bitcoin holdings is paramount. Always prioritize the safety and security of your assets.
Dependencies
~27–40MB
~640K SLoC