# How do bitcoin vanity generator work?

How do Bitcoin vanity generator work and why is there a limit to nine "specific" chars? I tried looking up the usage, but couldn't find good articles explaining the methodology behind it.

They work by brute force.

As a private key is essentially a very large random number, and the encoding process from a public key to an address goes through a couple of hashing steps, the relation between the characters an address starts with and the underlying key is basically random.

Vanity key generators work by simply generating many, many private keys until one leads to an address that just happens to start with the desired characters. It is very similar to the block mining process in this sense.

Difficulty is estimated by the amount of effort it would take to produce an address starting with a desired pattern.

Bitcoin addresses (non-bech32) are encoded in base58, which has 58 possible characters. As the first character of an address is fixed to a 1 or a 3, we can ignore that.

To create an address starting with 1A, you effectively have a 1 in 58 chance, as the address distribution is random, and `A` could be any one of 58 possible values.

For one starting with 1AA, you are looking at a 1 in 58^2, or a 1 in 3364 chance. This exponential growth is why there is a limit (although the limit varies by how much computing power you can throw at a single address).

For the nine characters indicated in your question, the odds of a random address matching the desired pattern are 1 in 58^9, or 1 in 7,427,658,739,644,928. While this is a big number, it is an achievable one given a large enough cluster working on that one address, especially if you're using GPUs - even a 2-3 year old (high end) laptop CPU can hit several 10 million attempts per second, so this is still an achievable number if you have the resources.

Commercial vanity gen services further optimize this by simultaneously working on multiple independent addresses. The odds of finding an address go up proportionally with the number of addresses you are looking for.

As mentioned by Murch, the second character does not allow all 58 characters with even probability - details on why and how can be found in this question.

• Those commercial vanity gen services probably store those generated addresses in a DB to directly output a few? Are there any known risks involved with using (commercial/or my own) vanity gen? Like backtracing the brute forced process? Commented Sep 19, 2020 at 10:22
• @J.Doe Using public key combination methods, there are ways to generate an address without its generator having access to your private key. However, the generator would be able to see your balance and transactions you make. They can also use your newly generated address's transactions to find your other addresses. Commented Sep 19, 2020 at 10:44
• Nit: The second character in Bitcoin addresses is not equally distributed, see e.g. bitcoin.stackexchange.com/q/18371/5406
– Murch
Commented Sep 19, 2020 at 19:28
• @Murch Fair point, although I doubt it significantly changes the odds - will update the answer! Commented Sep 20, 2020 at 0:35