Developer Guid

Installation

Install the Decontext Protocol package via npm:

npm install decontext-protocol

Or clone the full repository:

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:


Contract Compilation

Use Hardhat to compile the contracts:


Deploying to Sepolia

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

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


Running Tests

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


Using the SDK

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

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


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).

Last updated