# Overview

<figure><img src="/files/9EhCKWLfOUPZ8HnnQEYj" alt=""><figcaption></figcaption></figure>

**Decontext** is a decentralized infrastructure protocol for building intelligent Web3 agents and applications that operate with shared, verifiable, and composable context models.

At its core is the **Decentralized Model Context Protocol (DMCP)** — a modular, blockchain-native protocol that enables AI agents, dApps, and smart contracts to interact through contextual intelligence without compromising user sovereignty or system transparency.


# What is Decontext?

**Decontext** is a decentralized infrastructure protocol that transforms how AI agents, smart contracts, and decentralized applications (dApps) interact on Web3. At its core lies the **Decentralized Model Context Protocol (DMCP)** — a blockchain-native standard that enables composable, verifiable, and modular context sharing across agents and applications.

### Why It Matters

In today’s decentralized ecosystem, smart contracts operate in isolation — they lack awareness, adaptability, and historical context. AI agents, on the other hand, need structured data to reason intelligently but often rely on off-chain, opaque, or centralized APIs.

**Decontext bridges that gap.**\
It introduces a trustless, modular layer of **contextual intelligence** that all Web3 components can read, update, and reason with — enabling truly intelligent behavior across the blockchain stack.

### 🧠 Core Vision

> **“Context is the new compute.”**\
> Decontext envisions a future where context becomes a shared and interoperable primitive — just like tokens or contracts — making decentralized systems more intelligent, secure, and responsive.


# Key Highlights

* **DMCP (Decentralized Model Context Protocol):**\
  A protocol for defining, registering, and managing context models on-chain.
* **Composable Contexts:**\
  Developers and agents can build and evolve contextual models collaboratively.
* **AI Agent Integration:**\
  AI agents can access contextual graphs, behavior history, reputation scores, identity modules, and more.
* **Smart Contract Utility:**\
  Contracts can make decisions based on up-to-date, decentralized context — not static logic.
* **User Sovereignty:**\
  Context data is stored, managed, and verified without compromising user ownership or privacy.


# Vision and Mission

### Vision

**To empower a new generation of intelligent, autonomous, and interoperable Web3 agents by making context a first-class citizen on the blockchain.**

Decontext envisions a decentralized future where AI agents, smart contracts, and dApps communicate through shared, composable, and verifiable context layers — enabling trustless cooperation, dynamic decision-making, and adaptive intelligence across chains and ecosystems.

In this future:

* Context flows as freely as tokens.
* Applications adapt in real-time to users, environments, and evolving data.
* Agents think, reason, and interact based on shared truths rather than static code.

***

### Mission

Our mission is to:

#### 1. **Standardize Context in Web3**

Develop and maintain the **Decentralized Model Context Protocol (DMCP)** as an open, blockchain-native standard for contextual data modeling and access.

#### 2. **Build a Composable Context Ecosystem**

Create an ecosystem of reusable context modules that developers, protocols, and agents can adopt, extend, and interconnect.

#### 3. **Enable AI-Native Infrastructure**

Integrate context-awareness into AI agents and decentralized apps, allowing them to reason, evolve, and act autonomously.

#### 4. **Preserve Sovereignty & Transparency**

Ensure all contextual interactions are verifiable, trustless, and under full user control — with zero key custody and open governance.

#### 5. **Foster a Decentralized Developer Community**

Support developers, researchers, and creators who believe in the power of open, intelligent, and modular context layers.


# DMCP Modules

### What is DMCP?

**DMCP (Decentralized Model Context Protocol)** is the foundational protocol powering **Decontext**. It provides a blockchain-native, modular framework for defining, managing, and interacting with **context models** across AI agents, smart contracts, and decentralized applications (dApps).

> Think of DMCP as a **universal context layer** — similar to how ERC-20 standardizes tokens, DMCP standardizes how *contextual data* is created, updated, verified, and consumed on-chain.

***

### 🎯 Core Purpose

DMCP enables the Web3 ecosystem to:

* Share structured context across agents and apps.
* Ensure **data integrity, traceability, and composability**.
* Power **intelligent and adaptive behavior** in decentralized environments.

***

### 🔑 Key Features

#### **On-Chain Context Schema**

* Define data structures (schemas) that represent context types (e.g., identity, reputation, usage behavior).
* Each schema is versioned, verified, and discoverable.

#### **Updatable Context Entries**

* Context can evolve over time — DMCP supports permissioned or public context updates.
* All updates are **cryptographically signed** and stored on-chain.

#### **Composable & Modular**

* Contexts are reusable and interoperable.
* Smart contracts and agents can “plug into” different context types via DMCP.

#### **Standardized Context Access**

* Developers use a **unified interface** to query or update any context regardless of its source or schema.


# DMCP Structure

* **Context Schema Registry**
  * Stores all approved context structures and metadata.
  * Includes versioning, type signatures, field descriptions.
* **Context Record Store**
  * Holds actual values associated with a schema for a given entity (wallet address, contract, or agent).
  * Example: `user.profile(name, country, activityScore)`
* **Permission Layer**
  * Determines who can update what.
  * Can be owner-based, role-based, oracle-fed, or DAO-governed.
* **Event Hooks**
  * Enables reactive behavior — smart contracts or agents can subscribe to changes in context.


# Security & Integrity

DMCP ensures:

* **Immutable history** of context changes via on-chain logs.
* **Cryptographic proof** of origin and authorship for every update.
* Optional integration with **ZK proofs** for privacy-preserving context validation (future release).


# Why DMCP Matters

Without DMCP, context remains:

* Hardcoded
* Off-chain
* Inaccessible to others
* Non-verifiable

With DMCP, context becomes:

* Trustless
* Modular
* Shareable
* A programmable primitive


# Interaction Methods

* **Smart Contracts**: Import `IContextModule` and use `getContext()`, `setContext()`.
* **AI Agents**: Use the Decontext SDK to subscribe, analyze, and react.
* **Oracles**: Push external data into DMCP using the publisher role.


# Context Graph Layer

### What is the Context Graph?

The **Context Graph Layer** is a dynamic, decentralized knowledge layer that models contextual relationships between entities, data, events, and logic within the Decontext ecosystem.

It acts as a **semantic brain** for Web3 — connecting fragmented pieces of information across agents, contracts, and dApps into a unified, queryable structure.

> If DMCP is the protocol standard, the Context Graph is the **living dataset** built on top of it.

### Core Concept

The Context Graph represents context as a **graph-based structure** where:

* **Nodes** = Entities (e.g., users, tokens, dApps, wallets)
* **Edges** = Relationships (e.g., owns, voted\_on, funded\_by)
* **Attributes** = Properties of nodes and edges (e.g., reputationScore, voteWeight, role)

Each piece of context is stored in a way that’s:

* Structurally connected
* Easily traversable
* Modular and composable

### Example Visualization

```
cssCopyEdit[User: 0x123]
   ├── owns ──> [Token: 0xABC]
   ├── voted_on ──> [Proposal: 17]
   └── has_reputation_score ──> [85]
```

An AI agent or smart contract could query:

* Who did this user interact with?
* What projects has this user funded?
* What's their behavioral score across platforms?


# Features

#### 1. **Interconnected Context**

All individual data points (identity, behavior, governance, history) are interlinked, forming a complete picture of an entity’s role and evolution in Web3.

#### 2. **Real-Time Querying**

Agents and dApps can perform graph-based queries like:

* “Who are the most active DAOs this user is involved with?”
* “What other users share similar staking behavior?”

#### 3. **Schema-Driven**

Every relationship and data field in the graph is derived from DMCP-defined schemas, ensuring consistency and interoperability.

#### 4. **Temporal Awareness**

Context Graphs are **time-aware** — meaning they can reflect how entities or relationships evolve over time.

#### 5. **Composable for AI**

LLMs or AI agents can consume subgraphs as contextual input for reasoning, decision-making, and interactions.


# Security and Ownership

* Every edge and node is **signed and verifiable**.
* Context Graph data respects **permission models** defined by DMCP.
* Private data can be linked via references to **ZK-Proof verifiable claims** (in future upgrades).


# How Developers Use It

* Use the **Decontext SDK** to query or subscribe to graph updates.
* Leverage the **GraphQL interface** to retrieve structured subgraphs.
* Use **event triggers** to sync updates to off-chain systems or agents.


# Agent Context Interface (ACI)

### What is ACI?

The **Agent Context Interface (ACI)** is a standardized interface within Decontext that allows **AI agents** to **read, reason, and react** based on composable, on-chain context. It acts as a bridge between decentralized context models (DMCP + Context Graph) and intelligent agents operating in Web3.

> ACI enables agents to plug directly into the decentralized brain of Web3 — understanding context just like humans do.

### 🧠 Why It Matters

In traditional systems, AI agents rely on centralized APIs or proprietary databases for context. That’s:

* Insecure
* Non-verifiable
* Opaque

With ACI, agents can:

* Access verifiable context on-chain
* Subscribe to real-time changes
* Perform context-driven decision-making
* Achieve autonomous interaction with dApps and smart contracts


# Core Capabilities

#### 1. **Context Querying**

Agents can query any available on-chain context using:

* Direct key-value access
* Graph-based traversal
* Schema-aware search

Example:

```python
import requests

requests.get("https://api.dctx.ai/context/user.reputation.score", params={"address": "0xabc..."}).json()
```

#### 2. **Context Subscription**

Agents can subscribe to updates for specific entities or schema types, enabling real-time reactions.

Example:

```python
# Simulated polling or event listener
while True:
    signal = requests.get("https://api.dctx.ai/context/market.signal.volatility", params={"token": "ETH"}).json()
    if signal.get("alert") == True:
        print("⚠️ Volatility spike detected!")
    time.sleep(5)
```

#### 3. **Context Injection into AI Reasoning**

Decontext allows context data to be injected directly into:

* LLM prompts
* Strategy modules
* Multi-agent communication channels

Example Prompt:

```
context = requests.get("https://api.dctx.ai/context/user.reputation.score", params={"address": "0xabc..."}).json()

prompt = f"User 0xABC has {context['score']} reputation and {context['votes']} governance votes in the last 30 days."
```

#### 4. **Behavioral Triggers**

Agents can bind behaviors to context events using rule sets:

* “If wallet stake > 10 ETH AND behavior score > 80, initiate high-tier offer.”
* “If DAO proposal passes, trigger knowledge sync.”


# Architecture Diagram

###

<pre><code>mathematicaCopyEdit       
       ┌──────────────────┐
       │ On-chain Context │
       └──────────────────┘
                │
     ┌──────────▼──────────────┐
     │ Agent Context Interface │
<strong>     └──────────┬──────────────┘
</strong>                │
    ┌───────────▼────────────────┐
    │  AI Agent (LLM, Bot, etc.) │
    └────────────────────────────┘
</code></pre>


# SDK/API Example

```python
import requests

BASE_URL = "https://api.dctx.ai"

# Fetch wallet profile (GET)
def get_context(key, address):
    response = requests.get(f"{BASE_URL}/context/{key}", params={"address": address})
    return response.json()

# Update context (POST)
def update_context(key, address, data):
    payload = { "address": address, **data }
    response = requests.post(f"{BASE_URL}/context/{key}", json=payload)
    return response.json()

# Mock agent invoke (POST)
def invoke_agent(agent_id, action):
    response = requests.post(f"{BASE_URL}/agents/{agent_id}/invoke", json={ "action": action })
    return response.json()

# Example usage
profile = get_context("user.profile", "0xBEEF123")
print("👤 Profile:", profile)

update_result = update_context("user.trading.behavior", "0xBEEF123", {
    "days": 30,
    "strategy": "momentum",
    "active": True
})
print("📥 Update Result:", update_result)

invoked = invoke_agent("mock-agent", "start-analysis")
print("⚙️ Agent Invoked:", invoked)

```


# Access and Permissions

* ACI respects the permission model defined by DMCP.
* Agents can only access public or permission-granted context data.
* For privacy, encrypted or zero-knowledge linked context may be supported in the future.


# Integration Points

* **Agent Frameworks:** LangChain, AutoGPT, Custom LLMs
* **dApps:** Enable agents to interface with contracts using context-aware strategies
* **Data Pipelines:** Sync context to off-chain ML systems or agent memory


# ZK Context Layer (Future Upgrade)

### What is the ZK Context Layer?

The **ZK Context Layer** is a planned extension of the Decontext protocol that introduces **Zero-Knowledge Proofs (ZKPs)** into the context infrastructure. It enables agents and users to **prove knowledge or ownership of certain context** without revealing the actual data — enhancing privacy, security, and trust in decentralized intelligence.

> Think of it as **private context with public verifiability** — where facts are proven, but secrets are kept.

***

### Why It Matters

While transparency is a strength in Web3, **not all context should be public**. In sensitive applications — such as identity, financials, health data, or private strategies — context must be kept confidential, yet still **provably true**.

The ZK Context Layer solves this by:

* Preserving **user privacy**
* Enabling **confidential reasoning** for AI agents
* Supporting **selective disclosure** of on-chain context

***

### Core Features

#### **Zero-Knowledge Proofs for Context**

Users or agents can generate cryptographic proofs (e.g., zk-SNARKs or zk-STARKs) attesting to:

* Meeting certain conditions (e.g., “reputation > 80”)
* Belonging to a group (e.g., “verified contributor”)
* Having a behavior pattern (e.g., “active for 60+ days”)

Without revealing the exact values.

***

#### **Private Inputs, Verifiable Outputs**

Context consumers (contracts or dApps) receive a proof and verify its validity without needing access to the private data.

#### **ZK-Enabled Context Modules**

Decontext will support optional context modules that automatically generate and verify ZK-proofs related to specific data schemas.

***

### Example Use Cases

| Use Case                 | ZK Context Application                                                           |
| ------------------------ | -------------------------------------------------------------------------------- |
| **Private Identity**     | Prove “is verified human” without revealing name, wallet, or KYC                 |
| **DAO Voting**           | Vote weights based on hidden reputation or contribution score                    |
| **DeFi Access**          | Access high-tier pools based on private financial behavior                       |
| **Agent Decision Logic** | Agents make decisions based on private signals but prove fairness or eligibility |
| **Compliance**           | Selectively prove age, region, or status without doxxing identity                |

***

### Planned Architecture

```
[Context Data (Private)] --> [ZK Prover] --> [ZK Proof]
                                   ↓
                [Smart Contract Verifier (On-Chain)]
```

All ZK components are modular and compatible with DMCP schemas and the Context Graph Layer.

***

### Tech Considerations

* **ZK Proof Systems**: SNARKs / STARKs / Bulletproofs
* **Off-chain Provers**: Required for scalable, low-cost proof generation
* **On-chain Verifiers**: Efficient contracts for validating proof authenticity
* **Compatible Libraries**: Halo2, Circom, zkSync, Noir (planned)

***

### &#x20;Status

| Component                   | Status               |
| --------------------------- | -------------------- |
| ZK Schema Design            | In Research          |
| ZK Module Prototype         | Planned              |
| ZK Agent Integration        | In Design            |
| On-chain Verifier Templates | In Development Queue |

***

### 📌 Summary

The **ZK Context Layer** brings **privacy, security, and compliance** to Decontext — enabling intelligent systems that are both **verifiable and confidential**.

> Privacy is not a limitation — it's a feature of intelligent decentralization.


# Developer Guid

### Installation

Install the Decontext Protocol package via npm:

```bash
npm install decontext-protocol
```

Or clone the full repository:

```bash
git clone https://github.com/Decontext/decontext-protocol
cd decontext-protocol
npm install
```

***

### Project Structure

* `contracts/`: Solidity smart contracts implementing DMCP
* `sdk/`: TypeScript SDK to interact with context models
* `scripts/`: Deployment and utility scripts
* `examples/`: Sample code for integration
* `test/`: Unit tests using Hardhat
* `docs/`: Developer documentation and walkthroughs

***

### Prerequisites

* Node.js ≥ v16
* npm ≥ v8
* Hardhat (for testing/deployment)
* Metamask-compatible wallet
* Infura or Alchemy key for Sepolia testnet (or another RPC)

***

### Environment Setup

Create a `.env` file in the root directory with the following:

```env
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY
PRIVATE_KEY=your_wallet_private_key_without_0x
ETHERSCAN_API_KEY=your_etherscan_key
```

***

### Contract Compilation

Use Hardhat to compile the contracts:

```bash
npx hardhat compile
```

***

### Deploying to Sepolia

You can deploy the DMCP contracts to Sepolia using the included script:

```bash
npx hardhat run scripts/deploy.cjs --network sepolia
```

This will deploy the protocol contracts and output the deployed addresses.

***

### Running Tests

Ensure the protocol behaves correctly using the built-in tests:

```bash
npx hardhat test
```

***

### Using the SDK

You can interact with the protocol using the provided TypeScript SDK in `sdk/`. Example:

```ts
tsCopyEditimport { ContextClient } from "decontext-protocol";

const client = new ContextClient({
  rpcUrl: process.env.SEPOLIA_RPC_URL,
  privateKey: process.env.PRIVATE_KEY,
});

// Fetch context
const userContext = await client.getContext("user.profile", "0xABC...");

// Set new context
await client.setContext("user.reputation", { score: 85 });
```

The SDK abstracts interaction with DMCP contracts and schema logic, making it easy to build context-aware agents and dApps.

***

### Example Use Case

In the `examples/` folder, you'll find templates for:

* Registering a context schema
* Updating a user's context
* Querying an entity's behavior context
* Integrating with smart contracts or AI agents

***

### Additional Resources

* **Docs:** Inside the `/docs` folder or GitHub wiki
* **Live Package:** [npmjs.com/package/decontext-protocol](https://www.npmjs.com/package/decontext-protocol)
* **Source Code:** [github.com/decontextai/decontext-protocol](https://github.com/decontextai/decontext-protocol)

***

### Next Steps

1. Register a new context schema
2. Deploy your own context-aware dApp or AI agent
3. Integrate with other Decontext-compatible modules

> Need help? Join the Decontext developer community (Discord/Forum coming soon).


# Ecosystem Flow

### Flow Diagram (Conceptual)

```
[ Off-chain Events / Data ] ←────┐
                                 │
                             [Context Oracles]
                                 │
                                 ▼
                          [DMCP Smart Contracts]
                                 │
      ┌──────────────────────────┼───────────────────────────┐
      ▼                          ▼                           ▼
[Context Graph]         [Context Registry]           [Context Modules]
      │                          │                           │
      ▼                          ▼                           ▼
[AI Agents]               [Smart Contracts]              [dApps / UI]
      ▲                          │
      └────────── [Agent Context Interface] ─────────────────┘
```

### Step-by-Step Flow

#### 1. **Context Creation**

* Developers define a **context schema** (e.g., user.reputation, dao.activity).
* This schema is registered on-chain through the **DMCP**.

#### 2. **Data Injection**

* **Context Oracles** push off-chain or on-chain event data into the Decontext system.
* This data is written into the **Context Graph** using the defined schema.

#### 3. **Context Management**

* The **DMCP** validates and stores all context entries with versioning and signatures.
* The **Context Registry** maintains all schemas and active modules.

#### 4. **Agent Consumption**

* **AI agents** use the **Agent Context Interface (ACI)** to query, subscribe, and reason with context.
* Context is injected into LLM prompts or agent memory to guide intelligent behavior.

#### 5. **Smart Contract Execution**

* **Smart contracts** import context modules and use real-time context in logic execution (e.g., access control, dynamic pricing, gamified features).

#### 6. **dApp Interaction**

* **Frontends and users** interact with context-aware features in real-time.
* Users may view, approve, or even generate **ZK proofs** tied to private context.


# Tokenomics

**Token Information**

|              |             |
| ------------ | ----------- |
| Name         | Decontext   |
| Symbol       | DCTX        |
| Total Supply | 100 000 000 |

**Allocation Breakdown**

| Allocation         | Amount (DCTX) | Percentage |
| ------------------ | ------------- | ---------- |
| Liquidity          | 80 000 000    | 80%        |
| Ecosystem & Grants | 5 000 000     | 5%         |
| Staking Rewards    | 5 000 000     | 5%         |
| Advisor & Partners | 4 000 000     | 4%         |
| Team & Founders    | 3 000 000     | 3%         |
| Treasury           | 2 000 000     | 2%         |
| Community Airdrop  | 1 000 000     | 1%         |

**Transaction Tax**

To sustainably fund protocol growth and support market stability, any **buy or sell** of DCTX incurs a **5% tax**, allocated as follows:

* **2% Ecosystem & Grants**.
* **1% Marketing & Partnerships**.
* **2% Liquidity Support.**

Peer-to-peer transfers (wallet-to-wallet) are **tax-free**.


# Privacy Policy

At **Decontext**, your privacy is not just respected — it’s fundamentally architected into the system. As a decentralized protocol, **Decontext does not collect, store, or process any personal data** unless explicitly provided through user interaction with integrated applications.

***

### 1. 🔄 Data Collection

**Decontext does not collect:**

* Personal identifiers (name, email, IP address)
* Device or location data
* Off-chain usage logs

All interactions occur on-chain or via user-controlled interfaces such as wallets or agents.

However, third-party dApps or agents using Decontext may:

* Store user-inputted metadata (e.g., context values)
* Request permissions to access wallet or context modules

> These third-party applications are responsible for their own data practices.

***

### 2. 🧠 Context Data

Context entries (e.g., `user.reputation`, `dao.activity`) are:

* **Publicly verifiable** when published to chain
* **Fully owned by the user**
* **Permissioned** via the DMCP protocol (only authorized parties can update)

No personal identifiers are ever required to interact with context modules.

***

### 3. 🔐 Zero-Custody Guarantee

Decontext:

* Does **not hold** any user private keys
* Does **not track** or profile users
* Ensures full **data sovereignty** via cryptographic signatures

***

### 4. 🛡️ ZK Context (Future Upgrade)

For sensitive use cases, Decontext will support **Zero-Knowledge Proofs (ZKPs)**, enabling users to prove facts about their context (e.g., score thresholds, activity patterns) without revealing the underlying data.

This ensures privacy **without compromising verifiability**.

***

### 5. 🔗 Third-Party Links

This documentation and ecosystem may reference third-party tools, SDKs, and applications. Please review their privacy policies individually, as Decontext does not control their behavior.

***

### 6. 📞 Contact

For governance-related privacy concerns or protocol-related questions, reach out via the Decontext DAO or through official communication channels:

* GitHub: [github.com/decontextai](https://github.com/decontextai)
* Twitter: [https://x.com/DecontextAI](https://x.com/DecontexAI)
* Telegram: <https://t.me/decontext>

***

### 🔚 Summary

Decontext is built to respect **user sovereignty, transparency, and trustlessness**. Privacy is not added as an afterthought — it's embedded into the protocol design.

> You own your data. We simply make it composable.


# Useful Links


