24
MAIN HEADER
In this chapter, we delve into the main.h file from Bitcoin v0.01 Alpha. This C++ header file is a cornerstone of the Bitcoin software, containing declarations for functions, classes, and variables that are integral to the system.
The file includes standard C++ libraries and other Bitcoin-specific header files. It defines constants like COIN, CENT, and MIN_TX_FEE, representing various values within Bitcoin. Classes such as CBlock, CTransaction, CBlockIndex, and CWalletTx are declared here, embodying components like blocks, transactions, and wallets.
Global variables like mapBlockIndex, pindexGenesisBlock, and nBestHeight track the system’s state. Functions like AddKey(), CreateNewBlock(), and ProcessMessages() perform key operations. Lastly, macros like foreach and loop simplify the code, enhancing readability and writeability.