> For the complete documentation index, see [llms.txt](https://docs.playnance.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.playnance.com/system-architecture/system-architecture.md).

# System Architecture

### Overview

The PlayBlock system architecture is designed as a vertically integrated gaming settlement stack rather than a loose collection of dApps and services.

Every layer — from wallets and games to settlement, analytics, and AI — is intentionally structured to optimize for:

* **Deterministic execution**
* **High-throughput settlement**
* **Operational resilience**
* **Composable product growth**

The architecture follows a layered, event-driven model, where on-chain logic is minimal and deterministic, and off-chain systems handle orchestration, scaling, analytics, and intelligence.

### High-Level Architecture

At a high level, PlayBlock consists of six tightly connected layers:

### 1. Application Layer (User-Facing Products)

This is where users interact with the ecosystem.

**Examples:**

* Casino & arcade games
* Prediction markets (sports, crypto, events)
* Affiliate-driven gaming portals
* Partner white-label platforms

**Key properties:**

* No direct blockchain complexity exposed to users
* Gasless transactions
* Real-time UX powered by streaming events
* Unified balance and identity across products

This layer never talks directly to the blockchain.

### 2. Game Logic & Controllers

The Game Controllers are deterministic orchestrators that manage game lifecycles.

They are responsible for:

* Opening and closing games
* Validating inputs
* Enforcing limits (bets, odds, timing)
* Triggering on-chain settlement
* Coordinating executor wallets

Why this layer exists:\
It separates game logic from smart contract execution, allowing games to evolve without redeploying contracts.

### 3. Settlement & Execution Layer

This is the heart of PlayBlock’s reliability.

**Components:**

* Executor services (bet, win, rollback, payout)
* Treasury and liquidity managers
* Nonce-safe transaction pipelines
* Deterministic retry and idempotency logic

**Characteristics:**

* Parallel execution with strict ordering guarantees
* Wallet-level isolation
* Replay-safe transaction handling
* Designed for thousands of transactions per minute

This layer is where GCoin moves.

### 4. PlayBlock Chain Layer (Layer-3)

The blockchain itself is a purpose-built settlement chain.

**Key traits:**

* Built on Arbitrum + AnyTrust (RAAS)
* Optimized for fast finality
* Minimal contract surface
* Event-heavy, logic-light contracts

**Design principle:**

> “The chain is the source of truth — not the place for business logic.”

### 5. Event Streaming & Analytics Layer

Everything that happens on-chain emits structured events that flow into analytics systems.

**Includes:**

* Real-time WebSocket listeners
* Historical sync via JSON-RPC
* ClickHouse for high-volume analytics
* Redis for deduplication and buffering

**Used for:**

* User balances & activity
* Game statistics
* Partner reporting
* Compliance & audits
* Performance monitoring

This layer enables observability at scale.

### 6. Intelligence & Automation Layer (AI + Rules)

AI is embedded as **infrastructure**, not a feature.

**Responsibilities:**

* Trend discovery
* Market relevance detection
* Game surfacing & ranking
* Content and category intelligence
* Operational anomaly detection

**Important constraint:**\
AI never replaces deterministic settlement or odds logic.\
It informs decisions — it does not execute them.

### Architectural Principles

The entire system is built around a few non-negotiable principles:

#### Determinism First

Settlement, balances, and outcomes must be reproducible and auditable.

#### Event-Driven Everything

State changes propagate through events, not direct coupling.

#### Horizontal Scalability

Executors, listeners, and controllers scale independently.

#### Failure Is Expected

Every layer assumes retries, restarts, and partial outages.

#### One Token, One Economy

GCoin is the unified settlement asset across all products.

### Why This Architecture Works for Gaming

Traditional blockchains struggle with gaming because they mix:

* UX logic
* Business rules
* Settlement
* Analytics

PlayBlock separates them cleanly.

The result:

* Faster games
* Lower costs
* Safer settlement
* Easier product iteration
* Institutional-grade reliability


---

# 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://docs.playnance.com/system-architecture/system-architecture.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.
