# Architecture Overview

**2.1 Technical Architecture:**

1. **User/Client Interface:**
   1. Client(s) can communicate with blockchain using JSON-RPC methods using HTTP/HTTPS protocol.
2. **Network Layer:**
   1. **P2P Network:** Uses TCP for reliable, connection-oriented communication between nodes.
   2. **Peer Discovery:** Likely uses UDP for efficient, connectionless discovery of new peers.
   3. **Block Propagation:** Uses TCP to ensure reliable delivery of new blocks.
   4. **Transaction Propagation:** Also uses TCP for reliable transaction broadcasting.
3. **Consensus Layer:**
   1. Communicates with the Network Layer using TCP/UDP.
   2. **BlockDAG Management:** Handles the structure of the Directed Acyclic Graph.
   3. **SPECTRE Protocol:** SPECTRE reduces the time it takes to confirm transactions by using recursive voting mechanisms between blocks.
   4. **Block Validation:** Verifies the validity of new blocks.
4. **Storage Layer:**
   1. Communicates with the Consensus and Execution Layers via Internal APIs.
   2. **BlockDAG Store:** Persists the blockchain data using LevelDB.
   3. **Transaction Pool:** Manages unconfirmed transactions.
5. **Execution Layer:**
   1. Communicates with the Storage Layer and State Management via Internal APIs.
   2. **Transaction Execution:** Processes individual transactions.
   3. **Smart Contract VM:** Executes smart contract code
   4. **State Management:** Receives state updates from the Execution Layer.
6. **Mining Node:**
   1. Communicates with the Network Layer using the Stratum Protocol over TCP for mining pools.

**2.2 Consensus Mechanism**

BlockDAG employs a Directed Acyclic Graph *(DAG)* architecture with a Proof-of-Work *(PoW)* consensus mechanism. This hybrid design combines the security benefits of traditional PoW with the scalability offered by DAG structures. The DAG allows for partial asynchronous block production, where multiple blocks can be added to the DAG in parallel without waiting for sequential confirmations.

**2.3 DAG Structure and Model**

In BlockDAG, blocks are not only organized in a linear sequence but also as vertices in a DAG. This structure enables multiple chains of blocks to coexist, where each block can reference several previous blocks, creating a web of interconnections. This significantly enhances transaction throughput by allowing simultaneous block validation.

**Each block contains:**

* A unique block identifier *(hash)*
* A reference to multiple previous blocks *(instead of just one parent block as in traditional blockchains)*
* Transactions processed in the block
* A proof of work for consensus validation

The DAG structure helps mitigate common blockchain challenges, such as orphaned blocks, by allowing diverging branches *(or forks)* in the network to eventually merge back into the main graph. Unlike traditional blockchains, where forks can lead to orphaned blocks that do not contribute to the main chain, DAGs ensure that all valid transactions and blocks remain part of the overall network structure. This approach maintains data consistency and enhances transaction finality, reducing wasted computational resources and improving network efficiency.

**2.4 Block Structure**

The basic components of a BlockDAG block include:

* **Header:** Contains block metadata, such as version, timestamp, and block height.
* **Transaction Merkle Tree Root Hash:** Represents the transactions included in the block.
* **DAG References:** Links to multiple parent blocks.
* **Proof-of-Work (PoW) hash:** Used to validate and secure the block in the network.

**2.5 Peer-to-Peer (P2P) Network Design**

BlockDAG utilizes a decentralized P2P network for node communication and block propagation. Nodes in the network can act as either full nodes or miner nodes. Full nodes participate in block validation and consensus, while miner nodes store a reduced version of the ledger and primarily engage in transaction mining.

The P2P network uses a gossip protocol to disseminate transactions and block data efficiently across the network, ensuring that information is shared rapidly among nodes.

\
**2.6 Transaction Flow and Management**

BlockDAG blocks follow a different flow compared to traditional blockchains due to the DAG structure. Transactions are submitted to the network, validated by nodes, and included in multiple parallel blocks, ensuring rapid finalization.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blockdagnetwork.io/get-started/blockdag-architecture/architecture-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
