Download Bitcoin Blockchain [bootstrap.dat] (before Bitcoin Cash netsplit)
4 stars based on
64 reviews
Where each step begins is documented in the code. Locks the data directory. If unable, print error and quit. Spawn X threads for the Script-checking bitcoin bootstrapdat 2015. Start RPC server in "warmup" mode. If the user knows that the wallet has been corrupted -salvagewallettry to recover the private keys. The node registers for certain signals. Checks whether the user wants to interact only with peers on a certain network ip4, ip6, bitcoin bootstrapdat 2015.
Checks whether to use onion routing tor. Checks whether the user wants to whitelist any bitcoin bootstrapdat 2015 peers. Attempts to listen on the bitcoin port exits on failure. If user specified a certain peer to seed connections, attempt to connect. Load the blockchain into memory and initialize the UTXO caches. There is a total cache size, which is divided amongst three specific caches.
This is the LevelDB cache. Half of the remaining cache space. This cache size defines the size of the cacheCoins object a protected member of CoinsViewCache. Load the blockchain into mapBlockIndex. By "blockchain" this means the entire block tree all known blocks, not just those in the active chain.
What is loaded into memory are the CBlockIndex objects, which contain metadata about the block. Verifies the last blocks VerifyDB. The program takes less than 1 second from startup until this point; this step takes about seconds. The UTXO set is not loaded into memory; instead, the cache will be filled as coins are accessed from the database. Calls StartNode in net. This starts up the networking thread group, including Bitcoin bootstrapdat 2015, which is the program's main thread see below.
Transition RPC server from "warmup" mode to normal mode. There, the code's top-level thread loops indefinitely in a function called WaitForShutdown. Bitcoin bootstrapdat 2015 sleeps for 2 seconds and checks to see if the user pressed ctrl-C. If so, it calls Shutdown back in init.
Shutdown shuts down the RPC server, stops the node, unregisters the signal handlers, etc. Step 7 initialized the cache sizes. There are 3 caches contemplated in step 7. Two are LevelDB database caches and the other is the coins cache, whose size is managed by the flushing code in main. The user can allocate a total cache size bitcoin bootstrapdat 2015 -dbcache. The user cannot pick and choose how much space to allocate to each specific cache.
If -txindex is not enabled then only bitcoin bootstrapdat 2015 MiB is needed. This is the coins cache that is managed by the main. The variable nCoinsCache is declared as extern in main. This cache is not loaded during initialization, rather it is filled as coins are accessed. It should be noted that although Bitcoin Core is a multi-threaded bitcoin bootstrapdat 2015, "the reference Satoshi client is largely single-threaded. What is meant is that the vast majority of the program's activity takes bitcoin bootstrapdat 2015 in the messaging thread ThreadMessageHandler - see below.
Almost all of the threads are part of a single, master thread group that is created on the stack at program bitcoin bootstrapdat 2015 see bitcoind. This thread group is passed to init. The thread group is passed to net.
Naturally, the node will only create the RPC server thread group if the RPC server is activated, and will only create the miner thread group if it is mining. If both are disabled, then Bitcoin Core only has a single thread group. The parent thread meaning the thread in which the program begins operating delegates almost all of the program's work to child threads.
After spawning threads in init. Overview Bitcoin Core 0. Data Storage Bitcoin Core 0. P2P Network Bitcoin Core 0. Initial Block Download Bitcoin Core 0. This page describes the Bitcoin Core code that manages startup and initialization.
Retrieved from " https: Navigation menu Personal tools Create account Log in. Views Read View source View history. Sister projects Essays Source. This page was last edited on 21 Januaryat Content is available under Creative Commons Attribution 3. Privacy policy About Bitcoin Wiki Disclaimers.
Certain command-line options require other options to be set in a certain way. Sets global variables for certain parameters. For the wallet, it sanity-checks transaction bitcoin bootstrapdat 2015 levels makes sure your fee is high enough to qualify for relay [error]; but not absurdly high [warning]. If wallet is enabled, try to open it. If this is the first time the program has been run, it creates a wallet and gives you an initial key address.
Scan for better chains in the block chain database, that are not yet connected as the active best chain. This is a set of threads - 4 by default.
Script-checking including bitcoin bootstrapdat 2015 checking is expensive so is handled in separate threads. Attempts to build a vector bitcoin bootstrapdat 2015 IP addresses based on the dns seeds, stores the vector and the thread exits.
In a test in Junethis took about 4 seconds and found addresses. This thread services the sockets: Processes new incoming connections on listening socket and creates a CNode for the new peer. Receives and sends data streams. Sets sockets bitcoin bootstrapdat 2015 have not done anything to a disconnected state.
Initiates outbound connections specified by the user with the —addnode parameter. If can't connect, sleeps for 2 minutes each cycle. Initiates other outbound connections from DNS seeds if that fails, find nodes based on fixed seeds If can't connect, sleeps for milliseconds each cycle. This is the program's main thread. This thread runs a while true loop, receiving and sending messages. The code introducing signals is in PR - see the next-to-last commit in that pull.
ProcessMessage and SendMessage run in this thread. So, most of the code in main.