The power of 256 in Blockchain
How to pronounce 2²⁵⁶?
2²⁵⁶ is pronounced “two to the power of two hundred and fifty six”.
What does it represent?
Computers represent numbers in binary. Below is an example where we have 2 bits, and each bit can represent a ‘1’ or a ‘0’ allowing us to produce 4 possible combinations:
00 = 0
01 = 1
10 = 2
11 = 3
The formula “2 to the power of the number of bits” gives us the range of numbers that we can represent. So 2² equals 4, which is true from the table above where we have 4 possible values. (In computing, we start counting from ‘0’)
If we have 3 “bits” then we have 9 possible combinations (ie 2³=9):
000 = 0
001 = 1
010 = 2
011 = 3
100 = 4
101 = 5
110 = 6
101 = 7
111 = 8
If we have 256 ‘bits’, then we have 2²⁵⁶ possible combinations which allows us to represent a really large number!
What does 2²⁵⁶ look like in decimal?
1.158 x 10⁷⁷ (this is 1.1 with 77 zeros after it).
How do you pronounce 2²⁵⁶?
115 quattuorvigintillion 792 trevigintillion 89 duovigintillion 237 unvigintillion 316 vigintillion 195 novemdecillion 423 octodecillion 570 septendecillion 985 sexdecillion 8 quindecillion 687 quattuordecillion 907 tredecillion 853 duodecillion 269 undecillion 984 decillion 665 nonillion 640 octillion 564 septillion 39 sextillion 457 quintillion 584 quadrillion 7 trillion 913 billion 129 million 639 thousand 936
What can I compare 2²⁵⁶ with?
2²⁵⁶ = 1.158 x 10⁷⁷
- There is an estimated 7.5 x 10¹⁸ grains of sand on Earth
- There are estimations of anywhere from 30 x 10²¹ to 70 x 10²¹ and even 10 x 10²³ stars in the “observable” universe.
- There is an estimation of anywhere from 1 x 10⁷⁸ to 1 x 10⁸³ atoms in the known, observable universe.
So 2²⁵⁶ is between 3.5 times the stars in the universe or a few zeros less than the number of atoms in the observable universe.
Here is an interesting video on 2²⁵⁶ that a friend of mine brought to my attention (Thank Barry!)
Why is 2²⁵⁶ important?
2²⁵⁶ is important is because this is the ‘perceived’ range of all possible private keys values cryptography uses in blockchains
Does that mean there are 2²⁵⁶ possible private keys?
Not quite. Not all numbers in the 2²⁵⁶ range are on the mathematical curve used for finding a matching public key. Bitcoin and Ethereum (and many others) use the secp256k1 elliptic curve which defines the range slightly less than 2²⁵⁶. 432420386565659656852420866394968145599 less to be exact.
The range, ’n’ is actually from 0 to 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 (as defined in the SEC2 standard).
2²⁵⁶ = 115792089237316195423570985008687907853269984665640564039457584007913129639936
n = 115792089237316195423570985008687907852837564279074904382605163141518161494336
2²⁵⁶ — n = 432420386565659656852420866394968145599
but this is a minor point. This is like computing 1,000,000 minus 10 which can be still considered as one million.
Side note: The name secp256k1 can be broken down to SEC which is the Standards for Efficient Cryptography SEC2. p means that the curve coordinates are a prime field, 256 means the prime is 256 bits long, k means it is a variant on a so-called Koblitz curve, and 1 means it is the first (and only) curve of that type in the standard. (Source: https://bitcointalk.org/index.php?topic=2699.0)
But wait, there’s more!
A Bitcoin address is a RIPEMD160 of the public address. This means that the length of the address is 160 bits meaning the possible keyspace, or possible range of values, is now reduced to 2¹⁶⁰ which is still a very big number. Ethereum also reduces the key length to 160 bits. Represented in decimal it is: 2¹⁶⁰ = 1.46 x 10⁴⁸ or 1461501637330902918203684832716283019655932542976.
How big is this? The width of the observable universe is 8.8 x 10²⁶ meters or 8.8 x 10²⁹ millimetre. If a Bitcoin or Ethereum address represented a length of 1mm, it would span slightly under twice the length of the observable universe!
1.46 x 10⁴⁸ is actually the total amount of unique wallet addresses possible. Now here is the tricky part. We have 2²⁵⁶ possible private keys that maps to 2¹⁶⁰ possible public keys. Logic tells us that there will be more than 1 private key for every public key. In fact, all you have to do is find any one of the roughly 2⁹⁶ private keys whose corresponding public key hashes to that address. In other words, 2⁹⁶ represented how many potential PRIVATE keys would work for a single PUBLIC key. Good luck finding that though!
In summary, the range of possible values of private keys are very, very large. Although the possible range of private keys is slightly under 2²⁵⁶ as defined in the SEC2 standard. The private key is then hashed to 160 bits, so the possible range becomes 2¹⁶⁰ which is still a very large number, almost twice the length of the observable universe in fact! The point being that the possibility of two private keys being the same is super duper duper low.