# Architecture Overview

Axiom consists of two main technical pieces:

* `AxiomV2Core` -- a cache of Ethereum block hashes starting from genesis
* `AxiomV2Query` -- a smart contract which fulfills user queries by verifying against `AxiomV2Core`

### Caching block hashes in AxiomV2Core

The `AxiomV2Core` smart contract caches Ethereum block hashes from genesis in two forms. &#x20;

* First, we cache the [Keccak](https://www.quicknode.com/guides/ethereum-development/smart-contracts/how-to-use-keccak256-with-solidity) Merkle roots of groups of 1024 consecutive block hashes. These Merkle roots are kept updated by ZK proofs which verify that hashes of block headers form a commitment chain that ends in either one of the 256 most recent blocks [directly accessible](https://www.evm.codes/#40?fork=shanghai) to the EVM or a block hash already present in the `AxiomV2Core` cache.
* Second, we store a padded [Merkle Mountain Range](https://github.com/opentimestamps/opentimestamps-server/blob/master/doc/merkle-mountain-range.md) of these Merkle roots starting from the genesis block. This Merkle Mountain Range is updated alongside updates to the Keccak Merkle roots in the first portion of the `AxiomV2Core` cache.

In summary, `AxiomV2Core` provides an efficient way for smart contracts to verify the validity of any historic block hash on Ethereum.

See the page below for more details on how this cache is maintained or accessed.

{% content-ref url="caching-block-hashes" %}
[caching-block-hashes](https://intrinsic-1.gitbook.io/axiomv2-sdk/protocol-design/caching-block-hashes)
{% endcontent-ref %}

### Fulfilling queries in AxiomV2Query

The `AxiomV2Query` protocol is a collection of smart contracts that fulfill user queries for computations over historic Ethereum data. Queries can be made on-chain and are fulfilled on-chain with ZK proof verification.

All computations and Ethereum data accessed within a user query are ZK proved to be valid with respect to Ethereum block hashes. The `AxiomV2Query` smart contract verifies this ZK proof on-chain and also verifies the block hashes against the block hashes cached in `AxiomV2Core`. The result is that all user queries are trustlessly verified with the same security guarantees as Ethereum itself.

Further details about our query protocol are in the page below.

{% content-ref url="axiom-query-protocol" %}
[axiom-query-protocol](https://intrinsic-1.gitbook.io/axiomv2-sdk/protocol-design/axiom-query-protocol)
{% endcontent-ref %}
