Thanks to aforementioned info I made a conclusion – I can generate my own private key using some constraints (to be sure my hand-made private key will not fail).
Here's what I have to do in order to generate a "right" private key:
I must generate a random number from 1 to 2^256
Convert a binary number to hexadecimal form using SHA256 (let's call it
Compare a converted number with an upper allowed boundary:
0 < number < (2^256 - 432,420,386,565,659,656,852,420,866,394,968,145,600)
How we get a decimal operand for aforementioned subtraction?
Fp is associated with a
secp256k1, specified by the sextuple T = (
Fp is defined by first Hex
p value (or 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1).
n of G is second Hex value.
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F // Hex p
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 // Hex n
432,420,386,565,659,656,852,420,866,394,968,145,600 // Decimal
In Bitcoin mainnet all private keys begin with
I must add 80 in Hex in the beginning of private key
Then I generate a checksum of a key, applying SHA256 one more time
8 leading Hex characters of a checksum and paste them to the end of my private key
And at last, I convert my hexadecimal private key to
Base 58 excludes:
0 – (zero)
I – (capital i)
l – (lower case L)
O – (capital o)
Base 58 includes:
25 lower case characters
24 capital characters
numbers 1 to 9
My hand-made private key is ready.