Bitcoin client program major operations

in bitcoin •  8 years ago  (edited)

operations:

the client program is oriented around several major operation

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 may exist

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 modes using socke connections

block exchange

nodes advertisr their inventory of blocks to each other and exchange blocks to build block chains.

Transaction exchange

nodes exchange and rely transactions with each other as the client associates transactions with bitcoin addresses in the local wallet

wallet services

the client can creates 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

the user interface code is scheduled to be superseded by bitcoin-qt therefore it is not covered In further detail see their individual articles for more detail on each of these operations

-- fClient Mode --

It is worth noting that there is code in the client to allow it to operate in a mode where it only downloads block headers,
The implementation is intended to be used as a lightweight client mode which can operate without verifying and storing all blocks and transactions.

This is controlled by the fClient variable in the code which is currently hard coded to false. This is currently not considered to be finished code.

This mode is known as fClient mode and the phrase Simplified Payment Verification (or SPV) mode has also been used to describe a lightweight client approach

-- Main Thread Level Functions --

init.cpp:

main()
ExitTimeout
Shutdown

net.cpp:

StartNode
ThreadGetMyExternalIP
ThreadMapPort
ThreadSocketHandler
ThreadOpenConnections
ThreadMessageHandler

rpc.cpp:

ThreadRPCServer

irc.cpp:

ThreadIRCSeed

db.cpp:

ThreadFlushWalletDB

ui.cpp:

ThreadDelayedRepaint
SendingDialogStartTransfer

-- Significant Classes By File --

net.cpp/.h:

Cnode: hands one socket connection
CInv
CAddress
CMessageHeader
CRequestTracker

main.cpp/.h:

CDiskTxPos
CInPoint
COutPoint
CTxIn
CTxOut

CTransaction
CMerkleTx
CTxIndex

CBlock
CBlockIndex
CDiskBlockIndex
CBlockLocator

CAlert : CUnsignedAlert

wallet.cpp/.h

CWallet : CKeyStore
CReserveKey
CWalletTx : CMerkleTx
CWalletKey
CAccount
CAccountingEntry

db.cpp/.h:

CTxDB
CKeyPool
CWalletDB

bignum.h

CBigNum

util.h

CCriticalSection: used for thread contention

what is a header file:

A header file is a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.

Bitcoin 0.1.5 ALPHA source code

Base58.h 201 lines, bignum.h 498 lines, changelog.txt 1 line, db.cpp 614 lines, db.h 420 lines, headers.h 71 lines, irc.cpp 314 lines, irc.h 10 lines, key.h 156 lines, makedfile.vc 77 lines, market.cpp 264 lines, market.h 182 lines, script.h 597 lines, serialize.h 1158 lines, sha.cpp 554 lines, uibase.cpp 1825 lines, uibase.h 723 lines,, unint256.h 749 lines, license.txt 19 lines, main.cpp 2692 lines, main.h 1329 lines, makefile 83 lines, net.cpp 1100 lines, net.h 855 lines, readme.txt 76 lines, script.cpp 1127 lines, sha.h 177 lines, ui.cpp 3291 lines, ui.h 415 lines, ui.rc 14 lines,uiproject.fbp, util.cpp 383 lines, until.h 399 lines

references
https://bitcointalk.org/index.php?topic=41718.0

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://bitcointalk.org/index.php?topic=41718.0

i found so important to collect and publish everything regarding bitcoin source code as its a huge process to analyize it it needs collective cooperation