<blockquote>
  <p>My first question is what the precise logical/theoretical reason is that there are only a fixed amount of possible bitcoin addresses. </p>
</blockquote>

<p>Because physics doesn't allow us to do anything that is infinite.</p>

<p>But even though there are a finite number of addresses, the number of possible addresses is so large that it might as well be infinite. There's no way that we could exhaust all possible addresses; there's just too many of them.</p>

<blockquote>
  <p>Secondly, I can generate a bitcoin address by using address(sha256("Passphrase")). If it is even possible to determine, what would be the "Passphrase" in order to calculate the first and last possible address?</p>
</blockquote>

<p>That's not how addresses work. It's not an ordered list and addresses aren't generated in any order. Addresses are not generated by hashing some password; nor would they be ordered by that password.</p>

<p>Addresses are generated by hashing a public key with SHA256, then that hash with RIPEMD160. The resulting hash is then encoded with Base58 Check encoding. These hash functions are irreversible so given their output, you cannot find their input. So no, it would not be possible to find out what public key an address is the hash of given just the address.</p>

<p>If you really wanted to order addresses, then the first address is the Base58 check encoding of <code>0000000000000000000000000000000000000000</code> and the last address is the Base58 check encoding of <code>ffffffffffffffffffffffffffffffffffffffff</code>. The range of possible addresses is just the range of all possible 160 bit (20 byte) values. That is because that is the range of all possible values that RIPEMD160 can output.</p>

CC BY-SA 4.0
2019-02-12T15:45:32.227Z
Thanks for the explanation! Kind of interesting that ffffffffffffffffffffffffffffffffffffffff & 0000000000000000000000000000000000000000 are in use.
alpenmilch411
CC BY-SA 4.0
2019-02-12T18:16:25.157Z
Not really. They are only "in use" because the range of RIPEMD160's output is all possible 160 bit values which are between those two numbers inclusive.
Ava Chow
CC BY-SA 4.0
2019-02-12T15:33:28.590Z
2019-02-12T15:33:28.590Z
Ava Chow
<p>The range of addresses is greater than the range of possible key pairs in elliptic curve <code>secp256k1</code> (because there are more than 1 address type). This range is any 256 bit number from <code>0x1</code> to <code>0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140</code>. In other words, there is a finite limit, but it is about 1E77 so it's enormous.</p>

<p>See <a href="https://en.bitcoin.it/wiki/Private_key" rel="nofollow noreferrer">Bitcoin Wiki - Private Key</a></p>

CC BY-SA 4.0
2019-02-12T20:24:48.443Z
There are more key pairs than addresses. A private key is a 256-bit number (yes, with limited range, but not very limited), while an address is a 160-bit number. Even if you consider there to be twice as many addresses because there are 2 types (P2PKH and P2SH), that's still only `2 * 2^160 = 2^161`.
Vecna
CC BY-SA 4.0
2019-02-12T20:34:01.313Z
That's true, good point
JBaczuk
CC BY-SA 4.0
2019-02-12T15:26:17.003Z
2019-02-12T15:26:17.003Z
JBaczuk
<p>My first question is what the precise logical/theoretical reason is that there are only a fixed amount of possible bitcoin addresses. Secondly, I can generate a bitcoin address by using address(sha256("Passphrase")). If it is even possible to determine, what would be the "Passphrase" in order to calculate the first and last possible address? Is for example address(sha256(0)) the first address?</p>

<p>I am trying to understand how the "range" of possible addresses works or how it is bounded.</p>

<bitcoin-core><private-key><address-generation>
Why is there a finite amount of bitcoin addresses and how is the range of possible addresses determined
alpenmilch411
# Why is there a finite amount of bitcoin addresses and how is the range of possible addresses determined

(Asked by: username_0 on 2019-02-12)

My first question is what the precise logical/theoretical reason is that there are only a fixed amount of possible bitcoin addresses. Secondly, I can generate a bitcoin address by using address(sha256("Passphrase")). If it is even possible to determine, what would be the "Passphrase" in order to calculate the first and last possible address? Is for example address(sha256(0)) the first address?

I am trying to understand how the "range" of possible addresses works or how it is bounded.

**Tags:** bitcoin-core, private-key, address-generation


---

## 2 answers

### Answer by username_1 on 2019-02-12. Score: 2 | Accepted answer

> My first question is what the precise logical/theoretical reason is that there are only a fixed amount of possible bitcoin addresses.

Because physics doesn't allow us to do anything that is infinite.

But even though there are a finite number of addresses, the number of possible addresses is so large that it might as well be infinite. There's no way that we could exhaust all possible addresses; there's just too many of them.

> Secondly, I can generate a bitcoin address by using address(sha256("Passphrase")). If it is even possible to determine, what would be the "Passphrase" in order to calculate the first and last possible address?

That's not how addresses work. It's not an ordered list and addresses aren't generated in any order. Addresses are not generated by hashing some password; nor would they be ordered by that password.

Addresses are generated by hashing a public key with SHA256, then that hash with RIPEMD160. The resulting hash is then encoded with Base58 Check encoding. These hash functions are irreversible so given their output, you cannot find their input. So no, it would not be possible to find out what public key an address is the hash of given just the address.

If you really wanted to order addresses, then the first address is the Base58 check encoding of `0000000000000000000000000000000000000000` and the last address is the Base58 check encoding of `ffffffffffffffffffffffffffffffffffffffff`. The range of possible addresses is just the range of all possible 160 bit (20 byte) values. That is because that is the range of all possible values that RIPEMD160 can output.

> **Comments:**
> **username_0**: Thanks for the explanation! Kind of interesting that ffffffffffffffffffffffffffffffffffffffff & 0000000000000000000000000000000000000000 are in use.  
> **username_1**: Not really. They are only "in use" because the range of RIPEMD160's output is all possible 160 bit values which are between those two numbers inclusive.  

---

### Answer by username_2 on 2019-02-12. Score: 1

The range of addresses is greater than the range of possible key pairs in elliptic curve `secp256k1` (because there are more than 1 address type). This range is any 256 bit number from `0x1` to `0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140`. In other words, there is a finite limit, but it is about 1E77 so it's enormous.

See [Bitcoin Wiki - Private Key](https://en.bitcoin.it/wiki/Private_key)

> **Comments:**
> **username_3**: There are more key pairs than addresses. A private key is a 256-bit number (yes, with limited range, but not very limited), while an address is a 160-bit number. Even if you consider there to be twice as many addresses because there are 2 types (P2PKH and P2SH), that's still only `2 * 2^160 = 2^161`.  
> **username_2**: That's true, good point  

---

