Contents:
The autogen.
The most important of these is the configure script that offers a number of different options to customize the build process. In this chapter, we will build the bitcoind client with all the default features. Next, run the configure script to automatically discover all the necessary libraries and create a customized build script for your system:.
If all goes well, the configure command will end by creating the customized build scripts that will allow us to compile bitcoind. If there are any missing libraries or errors, the configure command will terminate with an error instead of creating the build scripts.
Signature data has been estimated to account for up to 65 percent of data processed in each block, so this is not an insignificant technological shift. The overwhelming majority of bitcoin transactions take place on a cryptocurrency exchange , rather than being used in transactions with merchants. San Francisco Chronicle. Segwit was intended to support the Lightning Network as well as improve scalability. Because the transaction sending this bitcoin was only sent in the last few seconds, it has still not confirmed and therefore we will see it list a zero balance:.
If an error occurs, it is most likely because of a missing or incompatible library. Review the build documentation again and make sure you install the missing prerequisites. Then run configure again and see if that fixes the error. Next, you will compile the source code, a process that can take up to an hour to complete. During the compilation process you should see output every few seconds or every few minutes, or an error if something goes wrong.
The compilation process can be resumed at any time if interrupted. Type make to start compiling:. If all goes well, bitcoind is now compiled. The final step is to install the bitcoind executable into the system path using the make command:.
You can confirm that bitcoin is correctly installed by asking the system for the path of the two executables, as follows:. Run bitcoind by typing bitcoind into the terminal:. Edit the configuration file in your preferred editor and set the parameters, replacing the password with a strong password as recommended by bitcoind. Do not use the password shown here. Create a file inside the. For a full listing of the available options, type bitcoind --help. Now, run the Bitcoin Core client.
The first time you run it, it will rebuild the bitcoin blockchain by downloading all the blocks. This is a multigigabyte file and will take an average of two days to download in full. You can shorten the blockchain initialization time by downloading a partial copy of the blockchain using a BitTorrent client from SourceForge. Run bitcoind in the background with the option -daemon :. 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:.
Use bitcoin-cli to run it:. Among this data we see the version numbers for the bitcoin software client , protocol , and wallet 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 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.
You can check its progress using getinfo to see the number of known blocks. Commands: encryptwallet , walletpassphrase. Before you proceed with creating keys and other commands, you should first encrypt the wallet with a password. You can verify the wallet has been encrypted by running getinfo again. 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:.
To unlock the wallet, issue the walletpassphrase command, which takes two parameters—the password and a number of seconds until the wallet is locked again automatically a time counter :. You can confirm the wallet is unlocked and see the timeout by running getinfo again:. 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 back up, providing the filename as the parameter.
Here we back up the wallet to the file wallet. 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:. The dumpwallet command can be used to dump the wallet into a text file that is human-readable:. Commands: getnewaddress, getreceivedbyaddress, listtransactions, getaddressesbyaccount, getbalance. The bitcoin reference client maintains a pool of addresses, the size of which is displayed by keypoolsize when you use the command getinfo. These addresses are generated automatically and can then be used as public receiving addresses or change addresses.
To get one of these addresses, use the getnewaddress command:. 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. 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 :. If we omit the zero from the end of this command, we will only see the amounts that have at least minconf confirmations, where minconf is the setting for the minimum number of confirmations before a transaction is listed in the balance. The minconf setting is specified in the bitcoind configuration file. Because the transaction sending this bitcoin was only sent in the last few seconds, it has still not confirmed and therefore we will see it list a zero balance:.
The transactions received by the entire wallet can also be displayed using the listtransactions command:. We can list all addresses in the entire wallet using the getaddressesbyaccount command:. Finally, the command getbalance will show the total balance of the wallet, adding up all transactions confirmed with at least minconf confirmations:. If the transaction has not yet confirmed, the balance returned by getbalance will be zero.
Commands: gettransaction , getrawtransaction , decoderawtransaction. We can retrieve a transaction by its transaction hash, shown at txid earlier, with the gettransaction command:. Transaction IDs are not authoritative until a transaction has been confirmed. Absence of a transaction hash in the blockchain does not mean the transaction was not processed. Absolute TimelocknLockTimePart of the original Bitcoin implementation, nLockTime is a field that specifies the earliest time a transaction may be added to a valid block. A later Bitcoin soft fork allowed nLockTime to.
Enter your email address to subscribe to this blog and receive notifications of new posts by email. Subscribe to Bitcoin Developer Network weekly newsletter Enter your email address to subscribe to this blog and receive notifications of new posts by email. Next Bitcoin wire protocol January 27, Bitcoin Core right now may be the most popular or "reference" full node implementation, but that status depends on the economic majority continuing to use it [11].
Should one day come where another implementation overtakes it economically, that implementation would become the reference implementation. The point here is that Bitcoin Core does not control bitcoin and the naming "Core" is misleading in that respect.