ch4 changes

pull/2/head
Andreas M. Antonopoulos 10 years ago
parent 04ae25e9f2
commit b545adc3ed

@ -36,7 +36,7 @@ Do not try and design your own pseudo random number generator (PRNG). Use a cryp
Below, is a randomly generated private key shown in hexadecimal format (256 binary digits, or bits is shown as 64 hexadecimal digits, each 4-bits):
----
1E 99 42 3A 4E D2 76 08 A1 5A 26 16 A2 B0 E9 E5 2C ED 33 0A C5 30 ED CC 32 C8 FF C6 A5 26 AE DD
1E99423A4ED27608A15A2616A2B0E9E52CED330AC530EDCC32C8FFC6A526AEDD
----
The private key can be represented in a number of different formats, all of which correspond to the same 256-bit number. These formats include:
@ -67,9 +67,9 @@ To generate a new key with bitcoind, use the +getnewaddress+ command. For securi
----
$ bitcoind getnewaddress
16EVkC8zXLEJ1NHp1a7gPMS5b8SRyARrWi
$ bitcoind dumpprivkey 16EVkC8zXLEJ1NHp1a7gPMS5b8SRyARrWi
KxL8r7Y9KexgvToiEJfWu6brrQw797MtvKUdKJRRqnqRh2cFu9Md
1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy
$ bitcoind dumpprivkey 1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy
KxFC1jmwwCoACiCAWZ3eXa96mBM6tb3TYzGmf6YwgdGWZgawvrtJ
----
The +dumpprivkey+ command is opening the wallet and extracting the private key that was generated by the +getnewaddress+ command. It is not otherwise possible for bitcoind to know the private key from the public key, unless they are both stored in the wallet. In the example above, we see that the private key has a "K" prefix, indicating it is encoded as a WIF-compressed format. This means it that the key-pair is stored in the wallet with both keys compressed, saving 31 bytes of space. If the prefix had been "5", indicating the WIF format, we would know that the key-pair is uncompressed.
@ -79,25 +79,25 @@ You can also use +sx tools+ to generate keys and convert them between formats:
===== New key
----
$ sx newkey
5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
----
===== Decoded from the Base58Check encoding to Hex
----
$ sx base58check-decode 5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c4 128
$ sx base58check-decode 5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd 128
----
===== Encode from Hex back to Base58Check encoding, with the version prefix "128"
----
$ sx base58check-encode 068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c4 128
5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
$ sx base58check-encode 1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd 128
5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
----
===== Encode from Hex with a suffix of "01" to Base58Check encoding, with the version prefix "128"
----
$ sx base58check-encode 068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c401 128
KwSSD6LKk8nUQSkS2cDqBZ2AqGdGs2BMer2yMn9byxJydor5GWJX
$ sx base58check-encode 1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd01 128
KxFC1jmwwCoACiCAWZ3eXa96mBM6tb3TYzGmf6YwgdGWZgawvrtJ
----
==== From Private Key to Public Key

Loading…
Cancel
Save