<p>This was answered by James O'Beirne during a <a href="https://btctranscripts.com/scalingbitcoin/tokyo-2018/edgedevplusplus/overview-bitcoin-core-architecture/" rel="nofollow noreferrer">presentation</a> on Bitcoin Core architecture at Bitcoin Edge Dev++ (2018).</p>
<p>net_processing routes P2P messages into validation calls and response P2P messages. It adapts the network layer to the chainstate layer and translates network messages into calls for local state changes.</p>
<p>Much of net_processing is <code>ProcessMessage()</code>, a giant conditional for rendering particular network message types to calls deeper into Bitcoin.</p>
<p>Peers are also penalized based on bad behavior (e.g. sending our node invalid blocks) in net_processing. (<code>git grep Misbehaving</code> to see the various cases where Core keeps tracks of bad behavior).</p>
<p>net is at the bottom of the Bitcoin Core stack and handles network communication with the P2P network. <code>CConMan</code> in net forwards messages to net_processing via <code>CConMan::ThreadMessageHandler</code>.</p>
<p>Net processing uses function calls like <code>ProcessNewBlock()</code> and <code>AcceptToMemoryPool()</code> to call into <a href="https://bitcoin.stackexchange.com/questions/106276/what-does-validation-cover-conceptually-in-the-bitcoin-core-codebase">validation</a>, which is responsible for our view of the block chain and the UTXO set.</p>
<p>net_processing was covered in various Bitcoin Core PR review clubs such as this <a href="https://bitcoincore.reviews/20721" rel="nofollow noreferrer">one</a> on <a href="https://github.com/bitcoin/bitcoin/pull/20721" rel="nofollow noreferrer">PR 20721</a> on February 3rd 2021.</p>

CC BY-SA 4.0
2021-06-02T15:27:17.847Z
2021-06-02T15:36:55.773Z
2021-06-02T15:36:55.773Z
Michael Folkson
<p>What does net_processing (<a href="https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.h" rel="nofollow noreferrer">.h</a> and <a href="https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp" rel="nofollow noreferrer">.cpp</a>) cover conceptually in the Bitcoin Core codebase?</p>

<bitcoin-core-development><validation><c++><p2p>
What does net_processing cover conceptually in the Bitcoin Core codebase?
Michael Folkson
# What does net_processing cover conceptually in the Bitcoin Core codebase?

(Asked by: username_0 on 2021-06-02)

What does net\_processing ([.h](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.h) and [.cpp](https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp)) cover conceptually in the Bitcoin Core codebase?

**Tags:** bitcoin-core-development, validation, c++, p2p


---

## 1 answers

### Answer by username_0 on 2021-06-02. Score: 1 | Accepted answer

This was answered by James O'Beirne during a [presentation](https://btctranscripts.com/scalingbitcoin/tokyo-2018/edgedevplusplus/overview-bitcoin-core-architecture/) on Bitcoin Core architecture at Bitcoin Edge Dev++ (2018).

net\_processing routes P2P messages into validation calls and response P2P messages. It adapts the network layer to the chainstate layer and translates network messages into calls for local state changes.

Much of net\_processing is `ProcessMessage()`, a giant conditional for rendering particular network message types to calls deeper into Bitcoin.

Peers are also penalized based on bad behavior (e.g. sending our node invalid blocks) in net\_processing. (`git grep Misbehaving` to see the various cases where Core keeps tracks of bad behavior).

net is at the bottom of the Bitcoin Core stack and handles network communication with the P2P network. `CConMan` in net forwards messages to net\_processing via `CConMan::ThreadMessageHandler`.

Net processing uses function calls like `ProcessNewBlock()` and `AcceptToMemoryPool()` to call into [validation](https://bitcoin.stackexchange.com/questions/106276/what-does-validation-cover-conceptually-in-the-bitcoin-core-codebase), which is responsible for our view of the block chain and the UTXO set.

net\_processing was covered in various Bitcoin Core PR review clubs such as this [one](https://bitcoincore.reviews/20721) on [PR 20721](https://github.com/bitcoin/bitcoin/pull/20721) on February 3rd 2021.


---

