# StealthMark Collateral Cycle Detector

> StealthMark Collateral Cycle Detector is a paid API for AI agents from gateway.stealthmark.io, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-20).

Detects circular collateral dependencies in DeFi lending graphs using formal Z3 theorem proving, returning cycle counts and risk attestation.

## Facts

- Endpoint: POST https://gateway.stealthmark.io/x402/detect-collateral-cycles?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/stealthmark-collateral-cycle-detector-e56cf105
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_i0taOdliqmY9sP6CxRDvh

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability stealthmark-collateral-cycle-detector-e56cf105 -d '<json body>'
```

Example prompt: Check my DeFi collateral graph for circular borrowing cycles — I have three edges: WETH→stETH on Aave at 8000 bps LTV, stETH→rETH on Compound at 7500 bps, and rETH→WETH on Morpho at 7000 bps. Tell me if there's a circular risk and how many cycles exist.

## When to prefer this

Use this endpoint when you need formal, provably correct cycle detection in DeFi collateral graphs — especially for ERC-4626 vaults, multi-protocol lending stacks, or Polymarket baskets where circular collateral dependencies could cause cascade liquidations. Prefer over heuristic graph scanners when you need a cryptographic attestation digest for audit trails or compliance. Best suited for pre-deployment safety validation of complex DeFi strategies involving cross-protocol collateral.

## Known failure modes

- Malformed edge objects missing required source_asset or target_asset fields return validation errors
- Empty edges array may return zero cycles with no meaningful analysis
- Very large graphs may time out or return incomplete cycle detection
- Invalid asset identifiers or protocol names may cause prover to skip edges
- Network or gateway errors return non-200 HTTP responses with error messages

## How this service works

Autonomous Z3 Formal Invariant Prover (ERC-4626 Vaults, Polymarket Baskets, ZK Circuits, Differential Consensus) &amp; 100-Point Perimeter Security Gateway on Base Mainnet (x402 v2).

## Output

Returns a JSON object with: a status string, human-readable message, integer cycle_count of detected loops, an array of detected_cycles describing each circular path, a boolean has_circular_risk flag, and an attestation_digest for cryptographic auditability of the result.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "edges": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "source_asset",
     "target_asset"
    ],
    "properties": {
     "protocol": {
      "type": "string"
     },
     "max_ltv_bps": {
      "type": "integer"
     },
     "source_asset": {
      "type": "string"
     },
     "target_asset": {
      "type": "string"
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "status": {
   "type": "string"
  },
  "message": {
   "type": "string"
  },
  "cycle_count": {
   "type": "integer"
  },
  "request_digest": {
   "type": "string",
   "description": "SHA-256 of fields in this response; unsigned, not an attestation"
  },
  "detected_cycles": {
   "type": "array"
  },
  "has_circular_risk": {
   "type": "boolean"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/stealthmark-collateral-cycle-detector-e56cf105/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from gateway.stealthmark.io](https://www.zero.xyz/host/gateway.stealthmark.io/llms.txt)
