<p>John Newbery <a href="https://bitcoincore.reviews/21767#l-228" rel="nofollow noreferrer">answered</a> this at the Bitcoin Core PR review club session.</p>
<blockquote>
<p>Conceptually validation stores and maintains our best view of the blockchain and associated UTXO set. It also includes an interface to submit unconfirmed transactions to the mempool.</p>
</blockquote>
<p>In addition, James O'Beirne's <a href="https://jameso.be/dev++2018/#50" rel="nofollow noreferrer">slides</a> from 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++ stated:</p>
<blockquote>
<p>Validation handles modifying in-memory data structures for chainstate and transactions (mempool) on the basis of certain acceptance rules.</p>
<p>It both defines some of these data structures (<a href="https://bitcoin.stackexchange.com/questions/106558/what-do-the-classes-chainstatemanager-cchainstate-cchain-and-blockmanager-do-i">CChainState</a>, <code>mapBlockIndex</code>) as well as procedures for validating them, e.g. <code>CheckBlock()</code>.</p>
<p>Oddly, it also contains some utility functions for marshalling data to and from disk, e.g. <code>ReadBlockFromDisk()</code>, <code>FlushStateToDisk()</code>, <code>{Dump,Load}Mempool()</code>. This is probably because <code>validation.{h,cpp}</code> is the result of refactoring <code>main.{h,cpp}</code> into smaller pieces.</p>
</blockquote>
<p>Here is a diagram from James' presentation showing how validation relates to other regions of the codebase.</p>
<p><a href="https://i.sstatic.net/nNhgQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nNhgQ.png" alt="James validation diagram" /></a></p>

CC BY-SA 4.0
2021-05-13T09:31:47.123Z
2021-05-24T10:59:43.083Z
2021-05-24T10:59:43.083Z
Michael Folkson
<p>What does validation (<a href="https://github.com/bitcoin/bitcoin/blob/master/src/validation.h" rel="nofollow noreferrer">.h</a> and <a href="https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp" rel="nofollow noreferrer">.cpp</a>) cover conceptually in the Bitcoin Core codebase?</p>
<p>This question was asked by Larry Ruane at the May 12th 2021 <a href="https://bitcoincore.reviews/21767" rel="nofollow noreferrer">Bitcoin Core PR review club</a> on a Carl Dong <a href="https://github.com/bitcoin/bitcoin/pull/21767" rel="nofollow noreferrer">PR</a> to de-globalize <code>ChainstateManager</code></p>

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

(Asked by: username_0 on 2021-05-13)

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

This question was asked by Larry Ruane at the May 12th 2021 [Bitcoin Core PR review club](https://bitcoincore.reviews/21767) on a Carl Dong [PR](https://github.com/bitcoin/bitcoin/pull/21767) to de-globalize `ChainstateManager`

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


---

## 1 answers

### Answer by username_0 on 2021-05-13. Score: 1 | Accepted answer

John Newbery [answered](https://bitcoincore.reviews/21767#l-228) this at the Bitcoin Core PR review club session.

> Conceptually validation stores and maintains our best view of the blockchain and associated UTXO set. It also includes an interface to submit unconfirmed transactions to the mempool.

In addition, James O'Beirne's [slides](https://jameso.be/dev++2018/#50) from a [presentation](https://btctranscripts.com/scalingbitcoin/tokyo-2018/edgedevplusplus/overview-bitcoin-core-architecture/) on Bitcoin Core architecture at Bitcoin Edge Dev++ stated:

> Validation handles modifying in-memory data structures for chainstate and transactions (mempool) on the basis of certain acceptance rules.
>
> It both defines some of these data structures ([CChainState](https://bitcoin.stackexchange.com/questions/106558/what-do-the-classes-chainstatemanager-cchainstate-cchain-and-blockmanager-do-i), `mapBlockIndex`) as well as procedures for validating them, e.g. `CheckBlock()`.
>
> Oddly, it also contains some utility functions for marshalling data to and from disk, e.g. `ReadBlockFromDisk()`, `FlushStateToDisk()`, `{Dump,Load}Mempool()`. This is probably because `validation.{h,cpp}` is the result of refactoring `main.{h,cpp}` into smaller pieces.

Here is a diagram from James' presentation showing how validation relates to other regions of the codebase.

[![James validation diagram](https://i.sstatic.net/nNhgQ.png)](https://i.sstatic.net/nNhgQ.png)


---

