Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2011-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_QT_BITCOIN_H6#define BITCOIN_QT_BITCOIN_H8#include <bitcoin-build-config.h> // IWYU pragma: keep10#include <interfaces/node.h>11#include <qt/initexecutor.h>13#include <cassert>14#include <memory>15#include <optional>17#include <QApplication>19class BitcoinGUI;20class ClientModel;21class NetworkStyle;22class OptionsModel;23class PaymentServer;24class PlatformStyle;25class SplashScreen;26class WalletController;27class WalletModel;28namespace interfaces {29class Init;30} // namespace interfaces33/** Main Bitcoin application object */34class BitcoinApplication: public QApplication35{36Q_OBJECT37public:38explicit BitcoinApplication();39~BitcoinApplication();41#ifdef ENABLE_WALLET42/// Create payment server43void createPaymentServer();44#endif45/// parameter interaction/setup based on rules46void parameterSetup();47/// Create options model48[[nodiscard]] bool createOptionsModel(bool resetSettings);49/// Initialize prune setting50void InitPruneSetting(int64_t prune_MiB);51/// Create main window52void createWindow(const NetworkStyle *networkStyle);53/// Create splash screen54void createSplashScreen(const NetworkStyle *networkStyle);55/// Create or spawn node56void createNode(interfaces::Init& init);57/// Basic initialization, before starting initialization/shutdown thread. Return true on success.58bool baseInitialize();60/// Request core initialization61void requestInitialize();63/// Get window identifier of QMainWindow (BitcoinGUI)64WId getMainWinId() const;66/// Setup platform style67void setupPlatformStyle();69interfaces::Node& node() const { assert(m_node); return *m_node; }71public Q_SLOTS:72void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info);73/// Request core shutdown74void requestShutdown();75/// Handle runaway exceptions. Shows a message box with the problem and quits the program.76void handleRunawayException(const QString &message);78/**79* A helper function that shows a message box80* with details about a non-fatal exception.81*/82void handleNonFatalException(const QString& message);84Q_SIGNALS:85void requestedInitialize();86void requestedShutdown();87void windowShown(BitcoinGUI* window);89protected:90bool event(QEvent* e) override;92private:93std::optional<InitExecutor> m_executor;94OptionsModel* optionsModel{nullptr};95ClientModel* clientModel{nullptr};96BitcoinGUI* window{nullptr};97QTimer* pollShutdownTimer{nullptr};98#ifdef ENABLE_WALLET99PaymentServer* paymentServer{nullptr};100WalletController* m_wallet_controller{nullptr};101#endif102const PlatformStyle* platformStyle{nullptr};103std::unique_ptr<QWidget> shutdownWindow;104SplashScreen* m_splash = nullptr;105std::unique_ptr<interfaces::Node> m_node;107void startThread();108};110int GuiMain(int argc, char* argv[]);112#endif // BITCOIN_QT_BITCOIN_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.