<p>They work by brute force.</p>
<p>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.</p>
<p>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.</p>
<p>Difficulty is estimated by the amount of effort it would take to produce an address starting with a desired pattern.</p>
<p>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.</p>
<p>To create an address starting with 1A, you effectively have a 1 in 58 chance, as the address distribution is random, and <code>A</code> could be any one of 58 possible values.</p>
<p>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).</p>
<p>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.</p>
<p>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.</p>
<hr />
<p>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 <a href="https://bitcoin.stackexchange.com/q/18371/7272">this</a> question.</p>

CC BY-SA 4.0
2020-09-19T10:22:17.047Z
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?
J. Doe
CC BY-SA 4.0
2020-09-19T10:44:09.793Z
@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.
MCCCS
CC BY-SA 4.0
2020-09-19T19:28:55.580Z
Nit: The second character in Bitcoin addresses is not equally distributed, see e.g. https://bitcoin.stackexchange.com/q/18371/5406
Murch
CC BY-SA 4.0
2020-09-20T00:35:31.897Z
@Murch Fair point, although I doubt it significantly changes the odds - will update the answer!
Raghav Sood
CC BY-SA 4.0
2020-09-19T10:05:40.090Z
2020-09-20T00:37:47.060Z
2020-09-20T00:37:47.060Z
Raghav Sood
<p>How do Bitcoin vanity generator work and why is there a limit to nine &quot;specific&quot; chars?
I tried looking up the usage, but couldn't find good articles explaining the methodology behind it.</p>

<vanity-address><vanitygen>
How do bitcoin vanity generator work?
J. Doe
# How do bitcoin vanity generator work?

(Asked by: username_0 on 2020-09-19)

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.

**Tags:** vanity-address, vanitygen


---

## 1 answers

### Answer by username_1 on 2020-09-19. Score: 2

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 username_3, the second character does not allow all 58 characters with even probability - details on why and how can be found in [this](https://bitcoin.stackexchange.com/q/18371/7272) question.

> **Comments:**
> **username_0**: 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?  
> **username_2**: @username_0 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.  
> **username_3**: Nit: The second character in Bitcoin addresses is not equally distributed, see e.g. https://bitcoin.stackexchange.com/q/18371/5406  
> **username_1**: @username_3 Fair point, although I doubt it significantly changes the odds - will update the answer!  

---

