Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.shodai.network/llms.txt

Use this file to discover all available pages before exploring further.

The onchain execution engine is the first concrete runtime for Agreements Protocol. It is implemented in CNSLabs/agreements-protocol-evm, including Solidity contracts and the lower-level @cns-labs/agreements-protocol-evm SDK. The engine interprets agreement definitions produced from the agreement data standard and gives them a verifiable onchain execution surface. The current onchain implementation runs on Linea Sepolia and Linea Mainnet.

Execution model

Each deployed agreement definition becomes an isolated onchain execution instance. The AgreementFactory deploys AgreementEngine instances, and each instance stores the agreement-specific inputs, verifiers, transitions, initialization values, and optional actions. Agreements are deployed through an AgreementFactory. Each deployed agreement has an associated engine that tracks its state, validates submitted inputs, and applies the authored transition rules. The agreement’s deployed behavior is derived from the agreement definition and associated deployment data. Once deployed, the core agreement definition is fixed, which makes the agreement reliable as a shared operational source of truth. For signing details, typed data, and current factory addresses, see the EIP-712 Signing Reference.

What the engine enforces

The engine enforces the agreement lifecycle:
  1. A participant submits an input.
  2. The engine validates and verifies the submitted payload.
  3. The engine checks whether the input is allowed from the current state.
  4. The engine updates state when the transition is valid.
  5. Optional actions run as part of the configured transition.
  6. The result is emitted through onchain state and events.
This gives each agreement deterministic execution: the same agreement definition and same valid inputs lead to the same state transition and result.

Agreement instances and execution history

A deployed agreement instance produces a sequence of events, state transitions, submitted inputs, and final outcomes. That history becomes the shared source of truth for the agreement. Participants do not need to reconcile independent application databases to understand what happened. They can read the agreement instance, inspect input history, and verify the state that follows from accepted inputs.

Direct engine usage

Use the direct onchain path when your integration already works with wallets, RPC clients, and contract-level execution. The onchain repository contains:
AreaPurpose
contracts/Solidity contracts, tests, deployment scripts, and deployment artifacts.
sdk/TypeScript SDK package for AgreementFactory, AgreementEngine, ABIs, deployments, and payload helpers. Published as @cns-labs/agreements-protocol-evm.
agreements/Sample agreement artifacts used for execution-engine tests and examples.
For current factory and implementation addresses, see Contracts. For most application integrations, start with the API client instead. It uses the onchain SDK where needed but gives you higher-level validation, signing, deployment, state, and input-history methods. See Agreements API.