<p><code>main.cpp</code> was primarily split into <code>net_processing.cpp</code> and <code>validation.cpp</code>. However, over the years, parts of <code>main.cpp</code> were moved out of it and into many other files.</p>

CC BY-SA 4.0
2022-06-17T15:07:11.253Z
2022-06-17T15:07:11.253Z
Ava Chow
<p>I was reading this <a href="https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_1):_Overview" rel="nofollow noreferrer">article</a> about bitcoin-core. It is an explanation of bitcoin-core source code version 0.3, and it described a file named main.cpp. In the recent versions this file does not exist (or at least I couldn't find it). And based on the explanations this file managed the main process of the program:</p>
<blockquote>
<p>main.h declares some key global variables (mapBlockIndex, chainActive,
mempool, etc), constants, and functions. main.cpp is the program's
longest source file (5,237 lines). main.cpp has most of the key
functions for managing the blockchain, such as connecting,
disconnecting, validating and storing blocks; identifying a certain
block as the tip of the longest chain; and so forth. The &quot;entry point&quot;
for most of the code is ProcessMessages (which listens for a signal
from the message-handling thread.). Some of the code is run during
initialization, called directly from init.cpp. Key dependencies: net.h</p>
</blockquote>
<p>For the purpose of studying the source code I want to know where this file is moved, and if the name is changed what's the new name of the file?</p>
<p>I've searched for <code>ProcessMessages</code> in the whole source code and found that it was defined in the <code>net_processing.cpp</code>, does this file is the newer version of <code>main.cpp</code>?</p>
<p>I'm using version 23.0</p>

<bitcoind><bitcoin-core-development><source-code>
where does the main.cpp moved to in recent versions?
Amir reza Riahi
# where does the main.cpp moved to in recent versions?

(Asked by: username_0 on 2022-06-17)

I was reading this [article](https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_1):_Overview) about bitcoin-core. It is an explanation of bitcoin-core source code version 0.3, and it described a file named main.cpp. In the recent versions this file does not exist (or at least I couldn't find it). And based on the explanations this file managed the main process of the program:

> main.h declares some key global variables (mapBlockIndex, chainActive,
> mempool, etc), constants, and functions. main.cpp is the program's
> longest source file (5,237 lines). main.cpp has most of the key
> functions for managing the blockchain, such as connecting,
> disconnecting, validating and storing blocks; identifying a certain
> block as the tip of the longest chain; and so forth. The "entry point"
> for most of the code is ProcessMessages (which listens for a signal
> from the message-handling thread.). Some of the code is run during
> initialization, called directly from init.cpp. Key dependencies: net.h

For the purpose of studying the source code I want to know where this file is moved, and if the name is changed what's the new name of the file?

I've searched for `ProcessMessages` in the whole source code and found that it was defined in the `net_processing.cpp`, does this file is the newer version of `main.cpp`?

I'm using version 23.0

**Tags:** bitcoind, bitcoin-core-development, source-code


---

## 1 answers

### Answer by username_1 on 2022-06-17. Score: 4 | Accepted answer

`main.cpp` was primarily split into `net_processing.cpp` and `validation.cpp`. However, over the years, parts of `main.cpp` were moved out of it and into many other files.


---

