mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-11-23 00:28:14 +00:00
Made changes to ch03.asciidoc
This commit is contained in:
parent
3e9665c499
commit
7caf4c901f
@ -367,9 +367,9 @@ walletpassphrasechange "oldpassphrase" "newpassphrase"
|
||||
|
||||
==== Getting Information on the Bitcoin Core Client Status
|
||||
|
||||
Commands: getinfo
|
||||
Commands: +getinfo+
|
||||
|
||||
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'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:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@ -395,16 +395,16 @@ $ bitcoin-cli getinfo
|
||||
}
|
||||
----
|
||||
|
||||
The data is returned in JavaScript Object Notation (JSON), a format which can easily be "consumed" by all programming languages but is also quite human-readable. Among this data we see the version numbers for the bitcoin software client (90000), protocol (70002) and wallet (60000). We see the current balance contained in the wallet, which is zero. We see the current block height, showing us how many blocks are known to this client, 286216. We also see various statistics about the bitcoin network and the settings related to this client. We will explore these settings in more detail in the rest of this chapter.
|
||||
The data is returned in JavaScript Object Notation (JSON), a format that can easily be "consumed" by all programming languages but is also quite human-readable. Among this data we see the version numbers for the bitcoin software client (90000), protocol (70002), and wallet (60000). We see the current balance contained in the wallet, which is zero. We see the current block height, showing us how many blocks are known to this client (286216). We also see various statistics about the bitcoin network and the settings related to this client. We will explore these settings in more detail in the rest of this chapter.
|
||||
|
||||
[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 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.
|
||||
====
|
||||
|
||||
==== Wallet setup and encryption
|
||||
==== Wallet Setup and Encryption
|
||||
|
||||
Commands: encryptwallet, walletpassphrase
|
||||
Commands: +encryptwallet+, +walletpassphrase+
|
||||
|
||||
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!
|
||||
|
||||
@ -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 +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:
|
||||
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:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@ -433,14 +433,14 @@ $ bitcoin-cli getinfo
|
||||
$
|
||||
----
|
||||
|
||||
To unlock the wallet, we issue the +walletpassphrase+ command that takes two parameters, the password and a number of seconds until the wallet is locked again automatically (a time counter):
|
||||
To unlock the wallet, we issue the +walletpassphrase+ command that takes two parameters—the password and a number of seconds until the wallet is locked again automatically (a time counter):
|
||||
|
||||
----
|
||||
$ bitcoin-cli walletpassphrase foo 360
|
||||
$
|
||||
----
|
||||
|
||||
Confirm the wallet is unlocked and see the timeout by running +getinfo+ again:
|
||||
We confirm the wallet is unlocked and see the timeout by running +getinfo+ again:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@ -458,11 +458,11 @@ $ bitcoin-cli getinfo
|
||||
}
|
||||
----
|
||||
|
||||
==== Wallet backup, plain-text dump and restore
|
||||
==== Wallet Backup, Plain-text Dump and Restore
|
||||
|
||||
Commands: backupwallet, importwallet, dumpwallet
|
||||
Commands: +backupwallet+, +importwallet+, +dumpwallet+
|
||||
|
||||
Next, we will practice creating a wallet backup file and then restoring the wallet from the backup file. Use the +backupwallet+ command to backup, providing the file name as the parameter. Here we backup the wallet to the file +wallet.backup+:
|
||||
Next, we will practice creating a wallet backup file and then restoring the wallet from the backup file. Use the +backupwallet+ command to backup, providing the filename as the parameter. Here we back up the wallet to the file _wallet.backup_:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@ -470,7 +470,7 @@ $ bitcoin-cli backupwallet wallet.backup
|
||||
$
|
||||
----
|
||||
|
||||
Now, to restore the backup file, use the +importwallet+ command. If your wallet is locked, you will need to unlock it first (see +walletpassphrase+ above) in order to import the backup file:
|
||||
Now, to restore the backup file, use the +importwallet+ command. If your wallet is locked, you will need to unlock it first (see +walletpassphrase+ in the preceding section) in order to import the backup file:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@ -495,7 +495,7 @@ Kz3dVz7R6mUpXzdZy4gJEVZxXJwA15f198eVui4CUivXotzLBDKY 2013-07- 4dT04:30:27Z chang
|
||||
$
|
||||
----
|
||||
|
||||
==== Wallet addresses and receiving transactions
|
||||
==== Wallet Addresses and Receiving Transactions
|
||||
|
||||
Commands: getnewaddress, getreceivedbyaddress, listtransactions, getaddressesbyaccount, getbalance
|
||||
|
||||
@ -507,7 +507,7 @@ $ bitcoin-cli getnewaddress
|
||||
1hvzSofGwT8cjb8JU7nBsCSfEVQX5u9CL
|
||||
----
|
||||
|
||||
Now, we can use this address to send a small amount of bitcoin to our bitcoind wallet from an external wallet (assuming you have some bitcoin in an exchange, web wallet or other bitcoind wallet held elsewhere). For this example, we will send 50 milliBits (0.050 bitcoin) to the address returned above.
|
||||
Now, we can use this address to send a small amount of bitcoin to our bitcoind wallet from an external wallet (assuming you have some bitcoin in an exchange, web wallet, or other bitcoind wallet held elsewhere). For this example, we will send 50 millibits (0.050 bitcoin) to the preceding address.
|
||||
|
||||
We can now query the bitcoind client for the amount received by this address, and specify how many confirmations are required before an amount is counted in that balance. For this example, we will specify zero confirmations. A few seconds after sending the bitcoin from another wallet, we will see it reflected in the wallet. We use +getreceivedbyaddress+ with the address and the number of confirmations set to zero (0):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user