Cover photo

Introducing Decontext: A Decentralized Context Layer for Agent-Native Web3

As Web3 systems begin integrating autonomous agents, traditional smart contract interfaces are no longer sufficient. Agents require structured and semantically rich data to make decisions, interpret contract state, and coordinate actions across protocols. The current blockchain stack lacks a standardized, decentralized mechanism for exposing this kind of context.

Decontext is a protocol that solves this problem by introducing a verifiable, on-chain context infrastructure. At its core is DMCP, the Decentralized Model Context Protocol, which acts as a trustless schema registry. It enables developers to publish structured context definitions on-chain that can be consumed by AI agents, wallets, and dApps.

This post introduces the architecture, use case, and code-level foundation of the Decontext protocol.


What Problem Does Decontext Solve?

From ABI to Understanding
From ABI to Understanding

Smart contracts expose functions via ABI, but they do not describe *what* those functions *mean*. For example, a contract may have a `transfer(address,uint256)` function, but an autonomous agent has no way of understanding whether this function represents a token transfer, a withdrawal, or something else.

Context provides that missing semantic layer. It describes the purpose and structure of on-chain interactions so that agents and apps can reason about them programmatically and securely.


Overview of the Decontext Architecture

The Decontext protocol consists of several key components:

1. DMCP Smart Contract (Solidity)

A verifiable, public registry for publishing and referencing context schemas. Each schema is assigned a unique ID and metadata URI and is timestamped on-chain.

2. Schema Definitions (Off-Chain Storage)

Schemas define the semantics and structure of interactions. They are stored in IPFS, Arweave, or any content-addressed storage system and referenced via URI.

3. TypeScript SDK

A lightweight SDK for interacting with the registry. It provides methods for registering schemas, fetching metadata, verifying timestamps, and more.

4. Developer Tooling

Includes deployment scripts, tests, and reference examples that demonstrate how to build context-aware agents and applications.


Contract-Level Design: DMCP.sol

The `DMCP.sol` contract provides the following key functionality:

  • registerSchema(bytes32 schemaId, string uri)

Publishes a new schema with a unique identifier and off-chain URI. Emits an event and stores the timestamp and owner.

  • getSchema(bytes32 schemaId)

Returns the schema URI and metadata for the given schema ID.

  • getSchemaTimestamp(bytes32 schemaId)

Returns the block timestamp when the schema was published.

This smart contract is currently deployed on Sepolia testnet at:

https://sepolia.etherscan.io/address/0x661C815E467957Bf45fcE920BA35017184814925#code


Setting Up the Project

Clone the open source repository and install dependencies:

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

Create a .env file with your environment variables:

SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY
PRIVATE_KEY=your_private_key_without_0x
ETHERSCAN_API_KEY=your_etherscan_key

Compile the smart contracts:

npx hardhat compile

Deploy to Sepolia:

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

Run the included tests:

npx hardhat test

Repository Breakdown

The repository is modular and structured for real-world usage:

  • contracts/ contains the Solidity implementation of DMCP

  • sdk/ provides the TypeScript SDK for schema interaction

  • scripts/ includes deployment and utility scripts

  • examples/ shows how to build context-aware logic

  • test/ contains Mocha and Chai unit tests

  • docs/ provides technical documentation for the protocol

GitHub repository:

https://github.com/Decontext/decontext-protocol


Why Context Is Critical for Autonomous Agents

Agents need to understand the intent behind data and function calls. DMCP allows developers to encode intent in verifiable context schemas, enabling:

  • Safer AI wallet operations

  • DAO automation with semantic verification

  • Interoperable agent protocols across chains

  • Reduced reliance on centralized API layers

Decontext creates a shared vocabulary for Web3 agents, enabling composability without breaking trust or decentralization.


Resources


Sepolia ContractThis is the first post in a technical series diving deep into the architecture, tooling, and use cases of Decontext.

In the next post, we will explore how to define your first schema and publish it to DMCP using the SDK and Solidity contract interface.