# synctxai/synctx architecture

> Architecture diagram of the GitHub repository synctxai/synctx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/synctxai/synctx
- Repository: https://github.com/synctxai/synctx

## Overview

1. **What this repo is**
   SyncTx is not a single application; it is a **platform toolkit** for agent-to-agent commerce. The architecture is split into **on-chain contracts**, **agent-facing skills/tools**, and **off-chain verifier services** that can settle disputes by proving task completion.

2. **Core boundary: on-chain vs off-chain**
   The main trust boundary is the blockchain. Deals are enforced by smart contracts in `contracts/`, while verification of real-world actions happens off-chain in example verifier services under `examples/*-verifier`. Settlement only becomes final when the contract receives the expected on-chain state transitions or verifier result.

3. **On-chain contract layer**
   `contracts/` contains the reusable primitives:
   - `DealBase.sol` and `IDeal.sol` define the deal lifecycle and common deal interface
   - `VerifierBase.sol`, `VerifierSpec.sol`, and `IVerifier.sol` define the verification model
   - `FeeCollector.sol` handles protocol fees
   - `TwitterVerification.sol` provides privacy-preserving wallet-to-X binding via on-chain commitment
   - `ERC1967Proxy.sol` and `UUPSUpgradeable.sol` support upgradeable contracts
   This layer is the enforcement engine for escrow, state transitions, timeouts, and payment release.

4. **Agent interaction layer**
   The repo’s agent-facing entry point is `core-skills/synctx-cli/`, which wraps SyncTx workflows for agents. The README also shows MCP integration, so agents can either use the CLI skill or connect through the HTTP MCP endpoint. This layer is responsible for discovery, deal setup, negotiation, and transaction orchestration, but it does not hold funds itself.

5. **Wallet extension skill**
   `ext-skills/wallet/` is the operational bridge between agents and EVM chains. Its Deno scripts cover reading chain state, decoding ABIs, signing messages, and sending transactions. Architecturally, this is the execution boundary that gives an agent “wallet capabilities” without embedding those concerns into the core protocol contracts.

6. **X/Twitter helper skill**
   `ext-skills/x-helper/` is a separate auxiliary service for X-specific lookups, such as user identity resolution, tweet retrieval, and influence metrics. It is a support dependency, not part of settlement logic. In diagrams, it sits beside the wallet skill as an optional enrichment tool for agent workflows and verifier lookups.

7. **Example deal contracts**
   The `examples/` directory shows how the protocol is instantiated for concrete tasks:
   - `x-repost/` implements a sponsored repost deal
   - `x-follow/` implements a follow-campaign deal
   Each example has a corresponding spec and, in some cases, display JSON artifacts. These examples demonstrate how a deal contract specializes the generic base contract for a specific task and payout condition.

8. **Example verifier services**
   `examples/x-follow-verifier/` is a Python off-chain service that watches or evaluates follow completion and submits results back on-chain when needed. Its internal structure suggests a clean split:
   - `main.py` and `handlers.py` for service entry and request handling
   - `verification.py` and `chain.py` for verification logic and blockchain interaction
   - `signer.py` for signing
   - `providers/` for external data-source adapters
   - `mcp_client.py` for agent/MCP integration
   This is the dispute-resolution side of the architecture.

9. **Verifier provider abstraction**
   The verifier service uses a provider interface in `providers/base.py`, with concrete adapters such as `twitter_api.py` and `twitterapi_io.py`. That implies the verifier can swap data sources for X verification without changing the service’s core logic. In architecture terms, external platform APIs are isolated behind an adapter boundary.

10. **Verification specs as the contract between on-chain and off-chain**
   The `*-verifier-spec` directories define the expected verification rules for each deal type. These specs are the shared contract between the on-chain deal and the off-chain verifier service. They are what makes it possible for a contract to trust a third-party verifier’s output without embedding the full verification logic on-chain.

11. **Typical end-to-end flow**
   A transaction starts when an agent uses the CLI or MCP path, optionally with wallet and X-helper support, to create a deal and escrow funds into a specialized contract. The counterparty performs the task off-chain. If the result is undisputed, the contract settles directly; if disputed, an off-chain verifier service checks evidence or external APIs and submits a result that drives on-chain settlement.

12. **Deployment and chain context**
   The protocol targets EVM chains, with Optimism as the primary deployment and support for Base, Arbitrum, and Ethereum mainnet. That means the architecture is fundamentally EVM-centric: contracts are chain-native, while the skills and verifier services are chain-agnostic orchestration layers that can point at different networks.

13. **How to draw the architecture**
   The diagram should have three major zones: **agent tools** on the left, **on-chain contracts** in the center, and **off-chain verification services plus external APIs** on the right. The important arrows are:
   agent tool → wallet skill → blockchain,
   agent tool → deal contract,
   deal contract ↔ verifier service,
   verifier service → X APIs/provider adapters.
   The central trust anchor is the deal contract; everything else is support or evidence generation around it.

Main entry points: [`contracts`](https://github.com/synctxai/synctx/tree/main/contracts) (Deal base), [`examples/x-follow-verifier`](https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier) (Follow verifier), [`core-skills/synctx-cli`](https://github.com/synctxai/synctx/tree/main/core-skills/synctx-cli) (SyncTx CLI), [`examples/x-follow`](https://github.com/synctxai/synctx/tree/main/examples/x-follow) (X follow deal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent_tools["Agent tools"]
  node_synctx_cli["SyncTx CLI<br/>agent skill"]
  node_wallet_skill["Wallet skill<br/>evm tool"]
  node_x_helper["X helper<br/>x utility"]
end

subgraph group_contracts["On-chain contracts"]
  node_deal_base{{"Deal base<br/>contract base"}}
  node_verifier_base{{"Verifier base<br/>contract base"}}
  node_fee_collector["Fee collector<br/>protocol fee"]
  node_twitter_verification["X binding<br/>identity contract"]
  node_upgradeability["Upgradeable core<br/>proxy support"]
end

subgraph group_verification["Off-chain verification"]
  node_x_follow_verifier["Follow verifier<br/>off-chain service"]
  node_verifier_entry(("Service entry<br/>[main.py]"))
  node_verification_core["Verification core<br/>logic module<br/>[verification.py]"]
  node_chain_bridge["Chain bridge<br/>chain adapter<br/>[chain.py]"]
  node_provider_layer["Provider adapters<br/>adapter layer"]
  node_external_apis(("X APIs<br/>external api"))
end

subgraph group_examples["Examples"]
  node_x_follow_deal["X follow deal<br/>example deal"]
  node_x_repost_deal["X repost deal<br/>example deal"]
  node_x_follow_spec["Follow spec<br/>verification spec"]
  node_x_repost_spec["Repost spec<br/>verification spec"]
end

node_synctx_cli -->|"sign/send"| node_wallet_skill
node_synctx_cli -.->|"enrich"| node_x_helper
node_synctx_cli -->|"create deal"| node_deal_base
node_wallet_skill -->|"EVM tx"| node_deal_base
node_deal_base -->|"verify"| node_verifier_base
node_deal_base -->|"fees"| node_fee_collector
node_deal_base -.->|"bind identity"| node_twitter_verification
node_deal_base -.->|"upgrade"| node_upgradeability
node_x_follow_deal -->|"specializes"| node_deal_base
node_x_repost_deal -->|"specializes"| node_deal_base
node_x_follow_deal -->|"governed by"| node_x_follow_spec
node_x_repost_deal -->|"governed by"| node_x_repost_spec
node_x_follow_verifier -->|"implements"| node_x_follow_spec
node_x_follow_verifier -->|"starts at"| node_verifier_entry
node_x_follow_verifier -->|"checks"| node_verification_core
node_x_follow_verifier -->|"settles"| node_chain_bridge
node_x_follow_verifier -->|"adapts"| node_provider_layer
node_provider_layer -->|"queries"| node_external_apis
node_chain_bridge -->|"on-chain state"| node_deal_base

click node_synctx_cli "https://github.com/synctxai/synctx/tree/main/core-skills/synctx-cli"
click node_wallet_skill "https://github.com/synctxai/synctx/tree/main/ext-skills/wallet"
click node_x_helper "https://github.com/synctxai/synctx/tree/main/ext-skills/x-helper"
click node_deal_base "https://github.com/synctxai/synctx/tree/main/contracts"
click node_verifier_base "https://github.com/synctxai/synctx/tree/main/contracts"
click node_fee_collector "https://github.com/synctxai/synctx/tree/main/contracts"
click node_twitter_verification "https://github.com/synctxai/synctx/tree/main/contracts"
click node_upgradeability "https://github.com/synctxai/synctx/tree/main/contracts"
click node_x_follow_deal "https://github.com/synctxai/synctx/tree/main/examples/x-follow"
click node_x_repost_deal "https://github.com/synctxai/synctx/tree/main/examples/x-repost"
click node_x_follow_spec "https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier-spec"
click node_x_repost_spec "https://github.com/synctxai/synctx/tree/main/examples/x-repost-verifier-spec"
click node_x_follow_verifier "https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier"
click node_verifier_entry "https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/main.py"
click node_verification_core "https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/verification.py"
click node_chain_bridge "https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/chain.py"
click node_provider_layer "https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier/service/providers"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_synctx_cli,node_wallet_skill,node_x_helper toneBlue
class node_deal_base,node_verifier_base,node_fee_collector,node_twitter_verification,node_upgradeability toneAmber
class node_x_follow_verifier,node_verifier_entry,node_verification_core,node_chain_bridge,node_provider_layer,node_external_apis toneMint
class node_x_follow_deal,node_x_repost_deal,node_x_follow_spec,node_x_repost_spec toneRose
```

## Components

### Agent tools

Agent-facing entry points and operational helpers.

- [SyncTx CLI](https://github.com/synctxai/synctx/tree/main/core-skills/synctx-cli): agent skill · Primary agent workflow entry point for deal setup and orchestration. · `core-skills/synctx-cli`
- [Wallet skill](https://github.com/synctxai/synctx/tree/main/ext-skills/wallet): evm tool · Reads chain state, signs messages, decodes ABIs, and sends transactions. · `ext-skills/wallet`
- [X helper](https://github.com/synctxai/synctx/tree/main/ext-skills/x-helper): x utility · Auxiliary X-specific lookup and enrichment service. · `ext-skills/x-helper`

### On-chain contracts

EVM enforcement layer for deals, verification, fees, and upgradeability.

- [Deal base](https://github.com/synctxai/synctx/tree/main/contracts): contract base · Core deal lifecycle and escrow settlement primitive. · `contracts`
- [Verifier base](https://github.com/synctxai/synctx/tree/main/contracts): contract base · Verification model and interface for dispute resolution. · `contracts`
- [Fee collector](https://github.com/synctxai/synctx/tree/main/contracts): protocol fee · Collects and routes protocol fees on-chain. · `contracts`
- [X binding](https://github.com/synctxai/synctx/tree/main/contracts): identity contract · Privacy-preserving wallet-to-X binding via on-chain commitment. · `contracts`
- [Upgradeable core](https://github.com/synctxai/synctx/tree/main/contracts): proxy support · Proxy and UUPS upgrade support for contract deployment. · `contracts`

### Off-chain verification

Verifier services, specs, and external data adapters.

- [Follow verifier](https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier): off-chain service · Python service that validates follow completion and submits results. · `examples/x-follow-verifier`
- [Service entry](https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/main.py): service entry · Process bootstrap and request routing. · `examples/x-follow-verifier/service/main.py`
- [Verification core](https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/verification.py): logic module · Task-evidence evaluation and rule enforcement. · `examples/x-follow-verifier/service/verification.py`
- [Chain bridge](https://github.com/synctxai/synctx/blob/main/examples/x-follow-verifier/service/chain.py): chain adapter · Blockchain interaction used to read state and submit settlement signals. · `examples/x-follow-verifier/service/chain.py`
- [Provider adapters](https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier/service/providers): adapter layer · Swappable external data-source adapters behind a common interface. · `examples/x-follow-verifier/service/providers`
- **X APIs**: external api · Platform APIs and third-party data sources used by verifiers.

### Examples

Concrete deal instantiations and their specs.

- [X follow deal](https://github.com/synctxai/synctx/tree/main/examples/x-follow): example deal · Specialized contract for sponsored follow campaigns. · `examples/x-follow`
- [X repost deal](https://github.com/synctxai/synctx/tree/main/examples/x-repost): example deal · Specialized contract for repost-based campaigns. · `examples/x-repost`
- [Follow spec](https://github.com/synctxai/synctx/tree/main/examples/x-follow-verifier-spec): verification spec · Ruleset shared between the follow deal and its verifier. · `examples/x-follow-verifier-spec`
- [Repost spec](https://github.com/synctxai/synctx/tree/main/examples/x-repost-verifier-spec): verification spec · Ruleset shared between the repost deal and its verifier. · `examples/x-repost-verifier-spec`

## Connections

- SyncTx CLI → Wallet skill: sign/send · Agents use wallet capabilities to prepare and execute on-chain actions.
- SyncTx CLI → X helper: enrich · Optional X-specific lookup support for agent workflows.
- SyncTx CLI → Deal base: create deal · CLI orchestrates deal creation and settlement through contracts.
- Wallet skill → Deal base: EVM tx · Wallet skill is the execution boundary for chain transactions.
- Deal base → Verifier base: verify · Deal settlement can defer to verification logic for disputed outcomes.
- Deal base → Fee collector: fees · Protocol fees are collected during deal execution.
- Deal base → X binding: bind identity · Wallet-to-X commitment support for identity-linked workflows.
- Deal base → Upgradeable core: upgrade · Core contracts can be deployed behind proxy/UUPS infrastructure.
- X follow deal → Deal base: specializes · Concrete follow campaign contract derives from the generic deal base.
- X repost deal → Deal base: specializes · Concrete repost campaign contract derives from the generic deal base.
- X follow deal → Follow spec: governed by · The deal is paired with its verification spec.
- X repost deal → Repost spec: governed by · The deal is paired with its verification spec.
- Follow verifier → Follow spec: implements · Verifier service executes the rules described by the spec.
- Follow verifier → Service entry: starts at · Main entry point for the verifier service.
- Follow verifier → Verification core: checks · Core logic evaluates completion evidence.
- Follow verifier → Chain bridge: settles · Service reads and writes chain state for dispute resolution.
- Follow verifier → Provider adapters: adapts · Verification delegates external lookups through provider adapters.
- Provider adapters → X APIs: queries · Adapters isolate third-party X data sources from service logic.
- Chain bridge → Deal base: on-chain state · Verifier interacts with the settlement contracts.
