Bitcoind: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Wzyboy (talk | contribs)
Weex (talk | contribs)
minor edits plus added Troubleshooting section
Line 1: Line 1:
The first Bitcoin client in the network's history is '''bitcoind'''. It is available under the [http://www.opensource.org/licenses/mit-license.php MIT license] for Windows, 32 and 64-bit GNU/Linux-based OSes and Mac OS X.
Bitcoind is a program that implements the Bitcoin protocol for command line and remote procedure call (RPC) use. It is also the first Bitcoin client in the network's history. It is available under the [http://www.opensource.org/licenses/mit-license.php MIT license] in 32-bit and 64-bit versions for Windows, GNU/Linux-based OSes, and Mac OS X.


Prior to version 0.5, this service-provider client used a wxWidgets GUI as its default GUI. It is now instead bundled with [[Bitcoin-Qt]].
Prior to version 0.5, this service-provider client used a wxWidgets GUI as its default GUI. It is now instead bundled with [[Bitcoin-Qt]].
Line 7: Line 7:
See [[Running_bitcoind|running bitcoind]] for more detail and an example of the configuration file.
See [[Running_bitcoind|running bitcoind]] for more detail and an example of the configuration file.


bitcoind is a headless daemon, and also bundles a testing tool for the same daemon.  It provides a JSON-RPC interface, allowing it to be controlled locally or remotely.  [[Original Bitcoin client/API Calls list|Various commands]] are made available by the API.
Bitcoind is a headless daemon, and also bundles a testing tool for the same daemon.  It provides a JSON-RPC interface, allowing it to be controlled locally or remotely which makes it useful for integration with other software or in larger payment systems.  [[Original Bitcoin client/API Calls list|Various commands]] are made available by the API.


To use locally, first start the program in daemon mode:
To use locally, first start the program in daemon mode:
Line 14: Line 14:


Then you can use the same program to execute [[Original Bitcoin client/API Calls list|API commands]], e.g.:
Then you can use the same program to execute [[Original Bitcoin client/API Calls list|API commands]], e.g.:
:bitcoind listreceivedbyaddress 0 true
:bitcoind getinfo
:bitcoind getbalance
:bitcoind listtransactions


To stop the bitcoin daemon, execute:
To stop the bitcoin daemon, execute:
Line 40: Line 40:


===[[Satoshi Client Node Discovery|Node Discovery]]===
===[[Satoshi Client Node Discovery|Node Discovery]]===
The client uses various techniques find out about other bitcoin nodes that may exist.
The client uses various techniques find out about other Bitcoin nodes that are currently connected to the network.


===[[Satoshi Client Node Connectivity|Node Connectivity]]===
===[[Satoshi Client Node Connectivity|Node Connectivity]]===
Line 49: Line 49:


===[[Satoshi Client Block Exchange|Block Exchange]]===
===[[Satoshi Client Block Exchange|Block Exchange]]===
Nodes advertise their inventory of blocks to each other and exchange blocks to build block chains.
Nodes advertise their inventory of blocks to each other and exchange blocks to yeahbuild block chains.


===[[Satoshi Client Transaction Exchange|Transaction Exchange]]===
===[[Satoshi Client Transaction Exchange|Transaction Exchange]]===
Line 61: Line 61:


===User Interface===
===User Interface===
The user interface code was based on [http://www.wxwidgets.org wxWidgets] and was superseded by [[Bitcoin-qt]] in version 0.5.0.
Bitcoind's current user interface is the command line while it used to be based on [http://www.wxwidgets.org wxWidgets]. A graphical user interface is now provided by [[Bitcoin-qt]] in version 0.5+ for the reference client.
 
===Troubleshooting===
 
'''I get "Error loading blkindex.bat" when I try to run the client'''
 
blkindex.dat is part of the database that stores the local copy of the blockchain which may have become corrupted. Open the Bitcoin data dir:
 
Windows: %APPDATA%\Bitcoin
Linux: ~/.bitcoin
Mac: ~/Library/Application Support/Bitcoin/
 
Make a backup of that entire folder, then delete everything EXCEPT wallet.dat. Start bitcoind again and it will download a fresh copy of the blockchain.


==See Also==
==See Also==

Revision as of 17:56, 4 August 2012

Bitcoind is a program that implements the Bitcoin protocol for command line and remote procedure call (RPC) use. It is also the first Bitcoin client in the network's history. It is available under the MIT license in 32-bit and 64-bit versions for Windows, GNU/Linux-based OSes, and Mac OS X.

Prior to version 0.5, this service-provider client used a wxWidgets GUI as its default GUI. It is now instead bundled with Bitcoin-Qt.

Running

See running bitcoind for more detail and an example of the configuration file.

Bitcoind is a headless daemon, and also bundles a testing tool for the same daemon. It provides a JSON-RPC interface, allowing it to be controlled locally or remotely which makes it useful for integration with other software or in larger payment systems. Various commands are made available by the API.

To use locally, first start the program in daemon mode:

bitcoind -daemon


Then you can use the same program to execute API commands, e.g.:

bitcoind getinfo
bitcoind listtransactions

To stop the bitcoin daemon, execute:

bitcoind stop

History

  • Version 0.4.0 was released for all supported platforms on September 23th, 2011 [1].
  • Version 0.3.24 was released for all supported platforms on July 8th, 2011 [2].
  • Version 0.3.23 was released for all supported platforms on June 13th, 2011 [3].
  • Version 0.3.22 was released for all supported platforms on May 19th, 2011 [4].
  • Version 0.3.20 was released for all supported platforms on February 21st, 2011[5].


Theory of Operation

bitcoind is a multithreaded C++ program. It is designed to be portable across Windows, Mac, and Linux systems. The multithreaded aspect leads to some complexity and the use of certain code patterns to deal with concurrency that may be unfamiliar to many programmers. Also, the code is aggressive in the use of C++ constructs, so it will help to be fluent with map, multimap, set, string, vector, iostream, and templates. As is typical of a C++ program, a lot of code tends to end up in the header files so be sure to search both the .cpp and .h files when looking for a function.

The client is oriented around several major operations, which are described in separate detailed articles and summarized in the following sections.


Initialization and Startup

Upon startup, the client performs various initialization routines including starting multiple threads to handle concurrent operations.

Node Discovery

The client uses various techniques find out about other Bitcoin nodes that are currently connected to the network.

Node Connectivity

The client initiates and maintains connections to other nodes.

Sockets and Messages

The client processes messages from other nodes and sends messages to other nodes using socket connections.

Block Exchange

Nodes advertise their inventory of blocks to each other and exchange blocks to yeahbuild block chains.

Transaction Exchange

Nodes exchange and relay transactions with each other. The client associates transactions with bitcoin addresses in the local wallet.

Wallet Services

The client can create transactions using the local wallet. The client associates transactions with bitcoin addresses in the local wallet. The client provides a service for managing the local wallet.

RPC Interface

The client offers an JSON-RPC interface over HTTP over sockets to perform various operational functions and to manage the local wallet.

User Interface

Bitcoind's current user interface is the command line while it used to be based on wxWidgets. A graphical user interface is now provided by Bitcoin-qt in version 0.5+ for the reference client.

Troubleshooting

I get "Error loading blkindex.bat" when I try to run the client

blkindex.dat is part of the database that stores the local copy of the blockchain which may have become corrupted. Open the Bitcoin data dir:

Windows: %APPDATA%\Bitcoin Linux: ~/.bitcoin Mac: ~/Library/Application Support/Bitcoin/

Make a backup of that entire folder, then delete everything EXCEPT wallet.dat. Start bitcoind again and it will download a fresh copy of the blockchain.

See Also

External Links

References