> For the complete documentation index, see [llms.txt](https://polarischain-1.gitbook.io/polarischain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polarischain-1.gitbook.io/polarischain/5.-system-architecture-and-network-economics/5.1-layered-architecture-design.md).

# 5.1 - Layered Architecture Design

Polarischain follows a five-layer modular stack, separating concerns to enable independent optimization, auditability, and upgrade pathways:

1. **Application Layer:** Hosts the full node binary, wallet CLI, block explorer, application-level P2P service, and the blockchain state manager that processes ordered transactions into account balances and asset registries.
2. **Consensus Layer:** Implements DAG-based BFT consensus, including the block store, write-ahead log (WAL), universal committer, linearizer, epoch manager, and validator-to-validator networking.
3. **Cryptography Layer:** Provides NIST-standardized post-quantum primitives: CRYSTALS-Dilithium2 (ML-DSA-44) signatures, ML-KEM-768 key encapsulation, BLAKE2b-256 hashing, AES-256-GCM authenticated encryption, and Argon2id-based key derivation.
4. **Storage Layer:** Combines LMDB for hot state (balances, nonces, faucet claims) via zero-copy memory-mapped reads, and RocksDB for cold/historical data (blocks, asset metadata, indices) with strict column-family isolation. A memory-mapped WAL ensures crash recovery, while per-store encryption-at-rest protects persisted data.
5. **Network Layer:** Uses persistent TCP P2P with LZ4 message compression, length-prefixed framing, protocol versioning, peer health tracking, and PQXDH post-quantum transport encryption. Connection management enforces per-IP and per-authority controls to mitigate spam and DDoS vectors.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://polarischain-1.gitbook.io/polarischain/5.-system-architecture-and-network-economics/5.1-layered-architecture-design.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
