Contents:
It is also larger in size and requires more resources to download, install and run. Bitcoin Knots is the only other client besides Core, however, that is downloadable from Bitcoin.
Also, unlike Bitcoin Core, it comes without a native wallet for sending and receiving bitcoins. Wallet functionality is offered on separate applications by the same developers. Even though the BTCD client was released in , it is still in beta state. Its source code is accessible through its GitHub repository. Several major entities within the space use the Libbitcoin implementation. These include the decentralized marketplace Open Bazaar as well as the wallet services Airbitz and Dark Wallet.
On its official website , the founders declare that they started the project based on principles of privacy, scalability and integrity. The software is downloadable from the official project website as well as its GitHub repository. This client implementation is Java based and was coded and released by Mike Hearn in while he worked at Google as a software engineer.
It is run as an open-source project and many developers contribute to its maintenance. BitcoinJ supports simplified payment verification SPV , making it a lightweight client. This makes it possible to join the Bitcoin network using devices that are limited in resources. Because bitcoin is an open-source project that works on a peer-to-peer network, you could also choose to code your own Bitcoin client. Why would you want to do this, you might ask? If you have the necessary skills, time and resources, you could—like the developers mentioned above—design your own personalized and customized user interface with execution features that serve specific needs.
Also be aware that you may end up with more bugs in a self-developed client than you would in a peer-reviewed one. Bitcoin EU. Bitcoin Core First we need to understand how the original software version works. However, several Bitcoin Core alternatives exist.
Bitcoin Knots Core developer Luke Dashjr released this client in and he has remained its primary maintainer. 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. After confirmation, the txid is immutable and authoritative.
The transaction form shown with the command gettransaction is the simplified form. To retrieve the full transaction code and decode it, we will use two commands: getrawtransaction and decoderawtransaction.
To decode this hex string, use the decoderawtransaction command. Copy and paste the hex as the first parameter of decoderawtransaction to get the full contents interpreted as a JSON data structure for formatting reasons the hex string is shortened in the following example :. The transaction decode shows all the components of this transaction, including the transaction inputs and outputs.
In this case we see that the transaction that credited our new address with 50 millibits used one input and generated two outputs. The input to this transaction was the output from a previously confirmed transaction shown as the vin txid starting with d3c7.
The two outputs correspond to the 50 millibit credit and an output with change back to the sender. We can further explore the blockchain by examining the previous transaction referenced by its txid in this transaction using the same commands e. Jumping from transaction to transaction we can follow a chain of transactions back as the coins are transmitted from owner address to owner address. Once the transaction we received has been confirmed by inclusion in a block, the gettransaction command will return additional information, showing the block hash identifier in which the transaction was included:.
Here, we see the new information in the entries blockhash the hash of the block in which the transaction was included , and blockindex with value 18 indicating that our transaction was the 18th transaction in that block. If you want to be able to access any transaction with commands like gettransaction , you need to configure Bitcoin Core to build a complete transaction index, which can be achieved with the txindex option.
Once you change this parameter, you need to restart bitcoind and wait for it to rebuild the index. Now that we know which block our transaction was included in, we can query that block. We use the getblock command with the block hash as the parameter:.
The block contains transactions and as you can see, the 18th transaction listed 9ca8f9… is the txid of the one crediting 50 millibits to our address. The height entry tells us this is the th block in the blockchain. We can also retrieve a block by its block height using the getblockhash command, which takes the block height as the parameter and returns the block hash for that block:. Retrieving this block shows:.
The getblock , getblockhash , and gettransaction commands can be used to explore the blockchain database, programmatically. Commands: listunspent , gettxout , createrawtransaction , decoderawtransaction , signrawtransaction , sendrawtransaction. Our wallet has now received a transaction that assigned one such output to our address.
Once this is confirmed, we can spend that output. First, we use the listunspent command to show all the unspent confirmed outputs in our wallet:. We see that the transaction 9ca8f9… created an output with vout index 0 assigned to the address 1hvzSo… for the amount of 50 millibits, which at this point has received seven confirmations.
Transactions use previously created outputs as their inputs by referring to them by the previous txid and vout index. We will now create a transaction that will spend the 0th vout of the txid 9ca8f9… as its input and assign it to a new output that sends value to a new address. We use gettxout to get the details of this unspent output. Transaction outputs are always referenced by txid and vout, and these are the parameters we pass to gettxout :. What we see here is the output that assigned 50 millibits to our address 1hvz…. To spend this output we will create a new transaction.
We will send 25 millibits to the new address 1LnfTn… we just created in our wallet. In our new transaction, we will spend the 50 millibit output and send 25 millibits to this new address. Because we have to spend the whole output from the previous transaction, we must also generate some change. We will generate change back to the 1hvz… address, sending the change back to the address from which the value originated. Finally, we will also have to pay a fee for this transaction.