<p>Because outputs of SHA-256 can be considered equally distributed for the whole space and this property passes for the first one byte of those outputs, you can calculate this number easily with a really good approximation. One in every 256 in the space you mentioned would be a valid minikey. This approximation would be very good, since the space is, as you noted, really large, so it follows the law of large numbers.</p>

<p>If you needed an exact number, however, your assumption would be correct, though, calculating this number would require to check every possible "candidate" minikey in the space, which would essentially be bruteforcing the whole space and won't be computationally feasible.</p>

CC BY-SA 4.0
2020-06-19T14:09:09.010Z
Ah, I see. Thank you kindly for the accept
Hubert Jasieniecki
CC BY-SA 4.0
2020-06-01T04:26:02.893Z
Fantastic, this appears to be the answer I was looking for
Rasikh Morani
CC BY-SA 4.0
2020-06-01T08:02:37.850Z
I'm happy to help, @RasikhMorani. Would you mind marking the answer as accepted and upvoting it?
Hubert Jasieniecki
CC BY-SA 4.0
2020-06-06T04:07:28.020Z
Accepted! Upvoted, but I don't have enough reputation for my upvote to show
Rasikh Morani
CC BY-SA 4.0
2020-05-26T10:50:26.103Z
2020-05-26T10:50:26.103Z
Hubert Jasieniecki
<p>I'm doing a small research project collecting information on minikeys. In that research process I've come across a couple of questions that I have been unable to answer in relation to the assumed keyspace of the version one minikey. The said mini key, was used primarily by Casascius Series 1 coins, and consisted of the following parameters</p>

<ul>
<li>Generated using Base58 encoding scheme</li>
<li>Consists of a total of 22 Characters, of which 21 are random, with the 1st character being a capital S prefix</li>
</ul>

<p>Has the following requirements to be considered well formatted:</p>

<ul>
<li>If the minikey appended by a ? at the end of the string hashed using SHA256 results in the first byte being 00, the string is a well formatted minikey</li>
</ul>

<p>Key Question: <strong>Is there any way to calculate the potential number of keys within the massive 58^21 keyspace that would be considered properly formatted?</strong> </p>

<p>My current suspicion is that it's not possible to do so because the validation involves hashing and the entire input of the entire minikey input would be needed to generate a proper hash (meaning potentially in order to calculate the possible number of valid keys, every potential key, of a impossibly large keyspace would need to be generated, which is currently impossible). <em>However I am asking this question with the hope that this suspicion is incorrect and that it is somehow possible to calculate the possible number of valid well formatted keys.</em></p>

<p>For reading on this subject I would recommend checking out: </p>

<p><a href="https://en.bitcoin.it/wiki/Mini_private_key_format" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Mini_private_key_format</a></p>

<p>Be warned, the python script needs minor modifications to run on Python2.7</p>

<p><strong>Bold is for key questions</strong>
<em>Italics if for important thoughts</em></p>

<p>Note: This post intentionally does not cover the more secure Casascius Series 2 Keys, however it is likely assuming that there exists an answer for Series 1 keys that the process can be used on Series 2 as well.</p>

<private-key><address-generation>
How can I calculate the possible number of correctly formatted version one minikeys?
Rasikh Morani
# How can I calculate the possible number of correctly formatted version one minikeys?

(Asked by: username_0 on 2020-05-26)

I'm doing a small research project collecting information on minikeys. In that research process I've come across a couple of questions that I have been unable to answer in relation to the assumed keyspace of the version one minikey. The said mini key, was used primarily by Casascius Series 1 coins, and consisted of the following parameters

* Generated using Base58 encoding scheme
* Consists of a total of 22 Characters, of which 21 are random, with the 1st character being a capital S prefix

Has the following requirements to be considered well formatted:

* If the minikey appended by a ? at the end of the string hashed using SHA256 results in the first byte being 00, the string is a well formatted minikey

Key Question: **Is there any way to calculate the potential number of keys within the massive 58^21 keyspace that would be considered properly formatted?**

My current suspicion is that it's not possible to do so because the validation involves hashing and the entire input of the entire minikey input would be needed to generate a proper hash (meaning potentially in order to calculate the possible number of valid keys, every potential key, of a impossibly large keyspace would need to be generated, which is currently impossible). *However I am asking this question with the hope that this suspicion is incorrect and that it is somehow possible to calculate the possible number of valid well formatted keys.*

For reading on this subject I would recommend checking out:

<https://en.bitcoin.it/wiki/Mini_private_key_format>

Be warned, the python script needs minor modifications to run on Python2.7

**Bold is for key questions**
*Italics if for important thoughts*

Note: This post intentionally does not cover the more secure Casascius Series 2 Keys, however it is likely assuming that there exists an answer for Series 1 keys that the process can be used on Series 2 as well.

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


---

## 1 answers

### Answer by username_1 on 2020-05-26. Score: 1 | Accepted answer

Because outputs of SHA-256 can be considered equally distributed for the whole space and this property passes for the first one byte of those outputs, you can calculate this number easily with a really good approximation. One in every 256 in the space you mentioned would be a valid minikey. This approximation would be very good, since the space is, as you noted, really large, so it follows the law of large numbers.

If you needed an exact number, however, your assumption would be correct, though, calculating this number would require to check every possible "candidate" minikey in the space, which would essentially be bruteforcing the whole space and won't be computationally feasible.

> **Comments:**
> **username_0**: Fantastic, this appears to be the answer I was looking for  
> **username_1**: I'm happy to help, @username_0. Would you mind marking the answer as accepted and upvoting it?  
> **username_0**: Accepted! Upvoted, but I don't have enough reputation for my upvote to show  
> **username_1**: Ah, I see. Thank you kindly for the accept  

---

