1. Private key--"public key-" bit-currency address
The private key k is multiplied by the elliptic curve to obtain the public key K, and the public key K obtains the bitcoin address by hashing;
2. Private key randomly generated
A long sequence of random bytes is taken out of a cryptographic secure random source, and the SHA256 hash algorithm is used to generate a 256-digit number.
3. Public key generation
The Elliptic curve algorithm is used to generate one-way; {k = k * G}
The public key is a point on the elliptic curve, consisting of a pair of coordinates (X,Y). The public key is usually represented as a number with a prefix of 04 followed by two 256 bits. One of the 256-bit digits is the x-coordinate of the public key, and the other 256-bit number is the y-coordinate. Prefix 04 is used to differentiate between uncompressed public keys, and the compressed format public key is preceded by 02 or 03.
4. Bit-Currency address generation
The public key is obtained by a double hash, the SHA256 hash value is computed with the public key k as input, and the RIPEMD160 hash value is computed with this result, and a number with a length of 160 ratio (20 bytes) is obtained;
Finally see the address also carried out "Base58check" code, Base58 by excluding (0,o,l,i) of uppercase and lowercase letters and numbers, text form to facilitate reading, increase check code to verify;
5. Key format
WIF: Wallet Import format, that is, BASE58 encoding format; 5 opening;
Wif-compressed: Compressed wallet import format, K or l opening;
Compressed private key: The private key is followed by a 01 suffix, which eventually generates wif-compressed;
Non-compressed private key: Only the generated private key, without a suffix, will eventually generate wif;
Compressed public key: only x coordinates are saved, Y coordinates can be obtained by x, but x corresponds to the curve parity two y, so the prefix for compression needs to be 02 for odd, and 03 for even;
Non-compressed public key: with x and y coordinates, prefix 04 followed by two 256-bit digits;
The new wallet uses a compressed format and the old wallet uses a uncompressed format; If a Bitcoin purse implements a compressed-format public key, it will use the compression format to shrink the public key in all transactions. The private key in the wallet will be used to generate the compressed format public key, and the compressed format public key is then used to generate the bit-currency address in the transaction.
Reference: "Proficiency in Bitcoin, Andreas M Antonopoulos (O ' Reilly)." Copyright 2015 Andreas M Antonopoulos, 978-1-449-37404-4. "