mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-12-23 23:18:42 +00:00
ch4 changes
This commit is contained in:
parent
04ae25e9f2
commit
b545adc3ed
@ -67,9 +67,9 @@ To generate a new key with bitcoind, use the +getnewaddress+ command. For securi
|
|||||||
|
|
||||||
----
|
----
|
||||||
$ bitcoind getnewaddress
|
$ bitcoind getnewaddress
|
||||||
16EVkC8zXLEJ1NHp1a7gPMS5b8SRyARrWi
|
1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy
|
||||||
$ bitcoind dumpprivkey 16EVkC8zXLEJ1NHp1a7gPMS5b8SRyARrWi
|
$ bitcoind dumpprivkey 1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy
|
||||||
KxL8r7Y9KexgvToiEJfWu6brrQw797MtvKUdKJRRqnqRh2cFu9Md
|
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.
|
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
|
===== New key
|
||||||
----
|
----
|
||||||
$ sx newkey
|
$ sx newkey
|
||||||
5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
|
5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
|
||||||
----
|
----
|
||||||
|
|
||||||
===== Decoded from the Base58Check encoding to Hex
|
===== Decoded from the Base58Check encoding to Hex
|
||||||
----
|
----
|
||||||
$ sx base58check-decode 5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
|
$ sx base58check-decode 5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
|
||||||
068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c4 128
|
1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd 128
|
||||||
----
|
----
|
||||||
|
|
||||||
===== Encode from Hex back to Base58Check encoding, with the version prefix "128"
|
===== Encode from Hex back to Base58Check encoding, with the version prefix "128"
|
||||||
----
|
----
|
||||||
$ sx base58check-encode 068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c4 128
|
$ sx base58check-encode 1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd 128
|
||||||
5HsAnnceKqSFpTE1gnbB1aY5VcG1skmVF1gsNvjH5kLw4sqgf41
|
5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn
|
||||||
----
|
----
|
||||||
|
|
||||||
===== Encode from Hex with a suffix of "01" to Base58Check encoding, with the version prefix "128"
|
===== Encode from Hex with a suffix of "01" to Base58Check encoding, with the version prefix "128"
|
||||||
----
|
----
|
||||||
$ sx base58check-encode 068bc683aaf37e8078c65c396e33377194476cbf77000e2a454edc8afeca67c401 128
|
$ sx base58check-encode 1e99423a4ed27608a15a2616a2b0e9e52ced330ac530edcc32c8ffc6a526aedd01 128
|
||||||
KwSSD6LKk8nUQSkS2cDqBZ2AqGdGs2BMer2yMn9byxJydor5GWJX
|
KxFC1jmwwCoACiCAWZ3eXa96mBM6tb3TYzGmf6YwgdGWZgawvrtJ
|
||||||
----
|
----
|
||||||
|
|
||||||
==== From Private Key to Public Key
|
==== From Private Key to Public Key
|
||||||
|
Loading…
Reference in New Issue
Block a user