What is a private key
Tags: blockchain, encryption, security
Published: 2024-02-10 23:17:06

**Sometime ago** I had a discussion or debate or argument with my brother over the safety behind the engineering of crypto/blockchain encryption. This was because I couldn't just shut up about blockchain.


His argument was simple “How do you know or how are you sure that these encryptions you say are secured and unbreakable is actually so, how do you know that they are actually unbreakable and that someone does not have the reverse engineering script hidden somewhere”, while i know a few things i want to share with my connections


Do not be like me,


Crypto keys can actually be decrypted but you will probably die doing it, what i mean is IT IS NOT WORTH IT and here’s why:


From a practical perspective, private keys are numbers within a specific range that allow funds to be spent (which is why keeping them secret is such an imperative).
From a mathematical perspective, a private key is just a random positive integer. 


Here is a more technical and accurate description:
The range given to a PRNG(pseudorandom number generators) to securely create a valid Ethereum or Bitcoin private key is 2²⁵⁶ — 1 which is 1.1579209 × 10^77 an is written out as:
115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,936, 

Due to the immense size of this range, the probabilities of generating two private keys are negligible, which is the reason why your private key is unlikely to be created by another user. To put this into perspective, imagine a combination lock with 78 digits. Each digit can be any number from 0 to 9. Now, if you calculate all the possible combinations, you would have 10 possibilities for each digit (0 through 9). So, the total number of combinations is 10^78.. The set of integers your key is selected from is a massive number — it is roughly the same size as the total amount of visible atoms in the universe. It's akin to picking the same exact combination on that 78-digit lock out of trillions upon trillions of possibilities.


let's me highlight some things:


PRNGs are commonly used in computer programs and cryptography. It is a method used to generate numbers that seem random but are actually determined by a starting value called a seed. 


In the context of cryptocurrencies like Ethereum and Bitcoin, a private key is a very important piece of information. It's essentially a secret code that allows you to access and manage your digital currency. Think of it like a super-secret password. 


I would like to single out Random numbers to talk a bit about this and give some clarity on how improbable the idea of reverse engineering a public key is 
Why is the private key derived from 2²⁵⁶ — 1, The range of 2²⁵⁶ — 1 has been adopted by both Bitcoin and Ethereum, and it works due to the mathematical strategies both blockchains use to create public keys. For instance, Ethereum uses elliptic curves (particularly SECP-256k1) for its public key generation.


In a binary system, the largest number that can be represented with 256 bits is when all bits are set to 1.

In computing, information is stored using binary digits, which can be either 0 or 1. It's a language computers use to represent and understand data. So 2²⁵⁶ is a mathematical way of saying "2 multiplied by itself 256 times." and in computer terms, it represents an incredibly large number because each multiplication by 2 doubles the value. 

When you have 256 binary digits, it means you have 256 slots where you can place either a 0 or a 1, if  all 256 slots  are filled with 1s, you get the largest possible number that can be represented with 256 binary digits. It's like having a digital counter with only 0 and 1, it only goes up to 1 in each slot.

When you subtract 1 from 256 slots filled with 1s (1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) , you're essentially making the last slot a 0 while keeping all other slots as 1.

The number you get after subtracting 1 is still an incredibly large number, but it's just one less than the largest possible number that can be represented with 256 binary digits. This gives you the largest possible number with 256 bits, making it the maximum value within the constraints of a 256-bit binary number system.

This is a fundamental concept in computer science and cryptography because it defines the upper limit of what can be represented with a certain number of bits.

Now that you understand 2²⁵⁶ and how it relates to computing let’s return back to where we were? , but wait in case you are wondering why use -1 why not just use 2²⁵⁶ well in cryptographic protocols, certain values might need to be randomized or chosen with specific properties to prevent attacks.

Now looping through the range of 2²⁵⁶ — 1 shows why Your private key is like a super rare, one-of-a-kind key to a treasure chest. The range of numbers it could possibly be is so enormous that it's practically impossible for someone else to stumble upon the exact same key by chance. It's like searching for a needle in a haystack the size of the universe!

PRNG can produce any value within this vast range when generating a private key. Each value within this range corresponds to a potential private key and is a large binary number, then this number is encoded to human-readable format for ease of use using Base64 or Base58. And so you have your private keys.

Your crypto public keys on the other hand are generated from your private keys.

This process is unidirectional, which means that you can use your private key to obtain an account, but not an account to obtain a private key.

This unidirectional process is done by cryptographic trapdoor functions. 

A trapdoor function is actually a one-way function that only derives its value from  a specific input, and it cannot be used to derive the original input from it.

Now Depending on the blockchain ecosystem, these one-way functions vary. 

Most popular blockchain systems use elliptic curve-based algebraic constructions to generate their public keys. Independently of these characteristics, the outcome is always deterministic;

Such that: A public key is unique to its corresponding private key, and the private key always generates the same public key.

So here you go, If you want to use a public address to generate a private key, brace yourself up and if you want to randomly get the private key of a bitcoin whale get a quantum computer and I will check on you in the year 2150.

Drop a comment, if this was helpful.