I've read your thread and it was great, I was a bit confused with your mix when referring to characters (as hex or ASCII) and bytes and bits but in the end I got the essence, if your intention is not necessarily to have a letter post then it'll be great for a beginner like me but with very simplified way of thinking to really have clusters / steps for the algorithm behind the private key, public key creation....snip..
Okay! Here's a relatively simpler explanation then. But
note: to make it easier to understand, I will be using simple words which maybe not be 100% technically correct. Also, I will give few links to the online tools which you can use to understand the process. However, I don't personally endorse those tools and won't recommend you to use them for creating addresses for real-use.
Now let's start:
Step 1: The first step involves generating a private key. Like @ranochigo said above, private key can be anything between 1 to (approx.) 1.15*10^77 which is then converted to hexadecimal. But since Bitcoin uses secp256k1 parameter of Elliptic Curve Cryptography to generate public key, private key needs to be 256-bits long. So suppose you pick 3 as your private key (which is a 2-bit number) then you need to add empty bits to make the length of private key equals to 256 bits. So your private key will look like this:
0000000000000000000000000000000000000000000000000000000000000003 (every hexadecimal character represents 4-bits so the length will be 64)
Step 2: Once you have private key, you then need to create public key from it. This is achieved by using Elliptic Curve Cryptography. Without going into much detail, ECC is a cryptography approach which gives you point on a curve based upon a private key provided. If you remember then we were taught in schools about graphs. A point on graph is plotted like this: (2,4) where 2 represents its X-value and 4 represents its Y-value. ECC will also give you a point (A,B) which is your public key.
Step 3: Now we need to create bitcoin address from the public key. Using 'compressed public key' for address generation has become the standard. Compressed means that we only take X-value of public key. Then we add 02 or 03 in-front of X-value depending upon whether Y is even or odd number. So if our public key is (A,B) and B is odd number then we take 03+A for further calculation.
Step 4: The next step involves creating SHA-256 hash of 03+A. In easy words, SHA-256 is a digital fingerprint of a message. Every message has a unique fingerprint of a fixed size (which is 64 in hexadecimal).
Step 5: Now we will create RIPEMD-160 hash of the hash obtained in previous step. RIPEMD-160 is another hashing function like SHA-256. It is primarily used in address generation to shorten the length of hash. SHA-256 produces hash which is of 32 bytes (1 byte = 8 bits). RIPEMD-160 then reduces it to 20 bytes (40 in hexadecimal).
Step 6: Then we add 00 in front of hash obtained in step 5. This 00 signifies that we are going to use this address on the main Bitcoin network.
Step 7: Okay, so far we have a value which is equal to = 00 + RIPEMD-160 hash of [SHA-256 hash of ( 03 + X-value of public key )]. Keep this value aside and let's generate checksum.
Step 8: The purpose of using checksum is to avoid the mistake in copying bitcoin address. If a user misses a character while copying or types wrong character in address then wallet will show it as invalid address because checksum won't match. To generate checksum, perform SHA-256 hashing on the value obtained in Step 7. Then perform SHA-256 hashing again on the hash received.
Step 9: The length of checksum is 4-bytes. Since, the length of SHA-256 is 32 bytes (64 in hexadecimal), we will only need first 4 bytes or 8 hexadecimal digits of the hash.
Step 10: Now add the checksum obtained in step 9 at the end of the value obtained in Step 7. So, now we have a value which is equal to = 00 + RIPEMD-160 hash of [SHA-256 hash of ( 03 + X-value of public key )] + checksum.
Step 11: Final step is to convert the value from Step 10 into Base58 string. Base58 is encoding format with 58 characters. It is used to shorten the length of address as much as possible by just using alpha-numeric characters after removing few characters to avoid confusion.
EXAMPLE:Step 1: Let's start by picking 256-bit number as private key. You can use -
This Tool, select 256-bit from menu, tick 'hex' checkbox. I generated one - 6D2FD98D6EBAA0D1A96A0B5B2482FCC813A855242CFF93D76B67C09FE0122E66 (you can use this one for further steps).
Step 2: Now let's generate public key from private key. I didn't find any tool for this online so I created one real fast -
https://webtricks.website/secp256k1/. By filling the above private key, we get:
[870dac978a24321b6a7dffe26bb19270d8c9bd4f074c510b80a115ce050eb652 , 959e77411b6ea35833d2006ddbd8a90aa9c8c1a3b310bf607ba6352e5b80e144] which is our public key.
Step 3: Now let's first take Y-value i.e. 959e77411b6ea35833d2006ddbd8a90aa9c8c1a3b310bf607ba6352e5b80e144 and determine whether it's even or odd value. You can use -
This Tool to convert from hexadecimal to decimal. In decimals, the number is 67674599338242423768515926925083934807011987438106446435693057967227469357380 which is even number so we will add 02 in front of X-value. Hence, we will take 02870dac978a24321b6a7dffe26bb19270d8c9bd4f074c510b80a115ce050eb652 for further calculation.
Step 4: Use -
This Tool to generate SHA-256 of the value from Step 3. Don't forget to check 'input type' as 'hex' on the page. SHA-256 of above value is def9edc5650c3e791c2de616ff81a671966fe60609b45598589853e13a1551ac.
Step 5: Use -
https://webtricks.website/ripemd160/ to calculate RIPEMD-160 hash of SHA-256 hash obtained in 4th step. The result is - 6ce830ddca6af06a6c8b3e7b351a25ab8ee94751.
Step 6: Adding 00 in front. The value becomes - 006ce830ddca6af06a6c8b3e7b351a25ab8ee94751.
Step 8: To generate checksum, we will generate SHA-256 of 006ce830ddca6af06a6c8b3e7b351a25ab8ee94751 using same tool from Step 4. The result is e90a5fa47b270435fea4251fc732838ae1ae77a16c90c776a2a2156aee93cd64. Then we will again generate hash of e90a5fa47b270435fea4251fc732838ae1ae77a16c90c776a2a2156aee93cd64 which is 646219ed043d40606c70f4cc9950264795faf81b8b171928caae82b066628050.
Step 9: Since checksum is only 4-byte, we will take first 8-digits of the hash generated in step 8 i.e. 646219ed.
Step 10: Adding the checksum at the end of value obtained in step 6 - 006ce830ddca6af06a6c8b3e7b351a25ab8ee94751646219ed
Step 11: Use
This Tool for creating Base58 string of the value obtained in Step 10. Don't forget to change 'Treat Input As' to 'HEX' on the page. The result will be 1Avr8d9HWAV86QtHmqBhco3W67DiKNA9Gp which is our bitcoin address.
You can verify that the address is correct by going to BitAddress.org and entering the private key from Step 1 on Wallet Details page.