1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-12-23 23:18:42 +00:00

Made changes to ch03.asciidoc

This commit is contained in:
myarbrough@oreilly.com 2014-11-18 06:17:18 -08:00
parent 29a51612ae
commit e1521b2363

View File

@ -282,7 +282,7 @@ Opened LevelDB successfully
=== Using Bitcoin Core's JSON-RPC API from the Command Line === Using Bitcoin Core's JSON-RPC API from the Command Line
((("Bitcoin Core client","JSON-RPC API for", id="ix_ch03-asciidoc5", range="startofrange")))((("Bitcoin Core client","using from command line", id="ix_ch03-asciidoc6", range="startofrange")))((("bitcoin-cli command line helper", id="ix_ch03-asciidoc7", range="startofrange")))((("bitcoind client","using", id="ix_ch03-asciidoc8", range="startofrange")))The Bitcoin Core client implements a JSON-RPC interface that can also be accessed using the command-line helper +bitcoin-cli+. The command line allows us to experiment interactively with the capabilities that are also available programmatically via the API. To start, we can invoke the +help+ command to see a list of the available bitcoin RPC commands: ((("Bitcoin Core client","JSON-RPC API for", id="ix_ch03-asciidoc5", range="startofrange")))((("Bitcoin Core client","using from command line", id="ix_ch03-asciidoc6", range="startofrange")))((("bitcoin-cli command line helper", id="ix_ch03-asciidoc7", range="startofrange")))((("bitcoind client","using", id="ix_ch03-asciidoc8", range="startofrange")))The Bitcoin Core client implements a JSON-RPC interface that can also be accessed using the command-line helper +bitcoin-cli+. The command line allows us to experiment interactively with the capabilities that are also available programmatically via the API. To start, invoke the +help+ command to see a list of the available bitcoin RPC commands:
[[bitcoind_commands]] [[bitcoind_commands]]
@ -369,7 +369,7 @@ walletpassphrasechange "oldpassphrase" "newpassphrase"
Commands: +getinfo+ Commands: +getinfo+
((("Bitcoin Core client","client status, getting")))((("bitcoin-cli command line helper","getinfo command")))((("client status, getting")))((("getinfo command (bitcoin-cli)")))Bitcoin's +getinfo+ RPC command shows us basic information about the status of the bitcoin network node, the wallet, and the blockchain database. We use +bitcoin-cli+ to run it: ((("Bitcoin Core client","client status, getting")))((("bitcoin-cli command line helper","getinfo command")))((("client status, getting")))((("getinfo command (bitcoin-cli)")))Bitcoin's +getinfo+ RPC command displays basic information about the status of the bitcoin network node, the wallet, and the block chain database. Use +bitcoin-cli+ to run it:
[source,bash] [source,bash]
---- ----
@ -399,14 +399,14 @@ The data is returned in((("JavaScript Object Notation (JSON)"))) JavaScript Obje
[TIP] [TIP]
==== ====
It will take some time, perhaps more than a day, for the bitcoind client to "catch up" to the current blockchain height as it downloads blocks from other bitcoin clients. You can check its current progress using +getinfo+ to see the number of known blocks. It will take some time, perhaps more than a day, for the bitcoind client to "catch up" to the current block chain height as it downloads blocks from other bitcoin clients. You can check its progress using +getinfo+ to see the number of known blocks.
==== ====
==== Wallet Setup and Encryption ==== Wallet Setup and Encryption
Commands: +encryptwallet+, +walletpassphrase+ Commands: +encryptwallet+, +walletpassphrase+
((("bitcoin-cli command line helper","wallet setup with")))((("bitcoin-cli command line helper","walletpassphrase command")))((("encryptwallet command (bitcoin-cli)")))((("walletpassphrase command (bitcoin-cli)")))((("wallets","setup from command line")))Before we proceed with creating keys and other commands, we will first encrypt the wallet with a password. For this example, we use the +encryptwallet+ command with the password "foo". Obviously, replace "foo" with a strong and complex password! ((("bitcoin-cli command line helper","wallet setup with")))((("bitcoin-cli command line helper","walletpassphrase command")))((("encryptwallet command (bitcoin-cli)")))((("walletpassphrase command (bitcoin-cli)")))((("wallets","setup from command line")))Before you proceed with creating keys and other commands, you should first encrypt the wallet with a password. For this example, you will use the +encryptwallet+ command with the password "foo". Obviously, replace "foo" with a strong and complex password!
---- ----
$ bitcoin-cli encryptwallet foo $ bitcoin-cli encryptwallet foo
@ -414,7 +414,7 @@ wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet.
$ $
---- ----
We can verify the wallet has been encrypted by running +getinfo+ again. This time you will notice a new entry called +unlocked_until+ that is a counter showing how long the wallet decryption password will be stored in memory, keeping the wallet unlocked. At first this will be set to zero, meaning the wallet is locked: You can verify the wallet has been encrypted by running +getinfo+ again. This time you will notice a new entry called +unlocked_until+. This is a counter showing how long the wallet decryption password will be stored in memory, keeping the wallet unlocked. At first this will be set to zero, meaning the wallet is locked:
[source,bash] [source,bash]
---- ----