Menu

Explorer & Settings

Tempo Explorer Submit Project
Back to all projects

jagantara

by auto-defi · Updated 3 months ago

Jagantara is a decentralized insurance for Digital Assets + staking platform on **Stacks** (Clarity) that supports **real on-chain settlement** across **USDCx / sBTC / STX** and includes an **x402-style payment gate** for AI-agent actions.

In the AI payments ecosystem

jagantara is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.

README.md View on GitHub →

Jagantara (on Stacks)

Jagantara is a decentralized insurance for Digital Assets + staking platform on Stacks (Clarity) that supports real on-chain settlement across USDCx / sBTC / STX and includes an x402-style payment gate for AI-agent actions.

Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Jagantara Frontend                        │
│              (Next.js + @stacks/connect)                     │
└──────────────────────────┬──────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                   Stacks Testnet                             │
│              (Bitcoin-Secured via PoX)                       │
│                                                              │
│  ┌──────────────────┐  ┌──────────────────┐  ┌────────────┐ │
│  │insurance-manager │  │  dao-governance  │  │claim-mgr   │ │
│  │                  │  │                  │  │            │ │
│  │ - pay-premium    │  │ - submit-claim   │  │ - claim    │ │
│  │ - transfer-rev   │  │ - vote           │  │            │ │
│  └────────┬─────────┘  └────────┬─────────┘  └─────▲──────┘ │
│           │                     │                  │        │
│           ▼                     ▼                  │        │
│  ┌──────────────────┐  ┌──────────────────┐       │        │
│  │    jaga-stake    │  │   jaga-token     │◄──────┘        │
│  │                  │  │   (SIP-010)      │                │
│  │ - stake          │  │ - mint/burn      │                │
│  │ - unstake        │  │ - transfer       │                │
│  └──────────────────┘  └──────────────────┘                │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Key Parameters

Parameter Value Description
Voting Period 1008 blocks (~7 days) Time for DAO voting
Minimum Voting 720 blocks (~5 days) Before execution allowed
Approval Threshold 66% Required for claim approval
Claim Expiry 1008 blocks (~7 days) Time to claim after approval
Premium Duration 4320 blocks (~30 days) Policy validity period
Rewards Duration 4320 blocks (~30 days) Staking reward period

Revenue Distribution

Premiums are distributed as follows:

  • 30% → JagaStake (staking rewards)
  • 25% → ClaimManager (claim payouts)
  • 20% → Owner
  • 25% → Treasury (morpho-reinvest)

Tier System

Tier Premium Rate Example (1000 USDCx coverage)
Tier 1 0.1% (10/100,000) 1 USDCx premium
Tier 2 0.3% (30/100,000) 3 USDCx premium
Tier 3 0.5% (50/100,000) 5 USDCx premium

Getting Started

Prerequisites

  • Clarinet v3.11+
  • Node.js 18+ / npm
  • Leather or Xverse wallet (for Stacks)

Installation

cd stacks-contracts

# Install dependencies
npm install

# Check contracts compile
clarinet check

# Run tests
npm test

# Deploy to devnet
clarinet deployments apply --devnet

Testing

cd stacks-contracts

# Run all tests
npm run test:all

# Run unit tests
npm test

# Run with coverage
npm run test:report

Deployment

Devnet

clarinet deployments apply --devnet

Testnet

clarinet deployments apply --testnet

After deployment, update contract addresses in:

  • Frontend: jagantara/src/constants/abi.tsx

Testnet deployment

Deployer: ST3DB3G0GA39FA8NZ5GG4FQ89D5AN6EJRJJ20R0SY

Successfully deployed:

x402 payment for AI agents

Jagantara exposes an MCP-compatible API route and server-side tool execution that can require a proof-of-payment (x402-like) on Stacks testnet.

Where it lives

How it works

  1. Client calls POST /api/mcp with tool name buy_insurance_onchain or create_claim_onchain.
  2. Server checks payment requirement via getX402Requirement().
  3. Client must send a token transfer tx and include its txid in the header (default: x-payment-txid).
  4. Server verifies the tx via verifyUsdcxTransferTxid():
    • tx must be contract_call
    • contract must match X402_USDCX_CONTRACT_ID
    • function must be transfer
    • recipient must match X402_MERCHANT_ADDRESS (defaults to NEXT_PUBLIC_DEPLOYER_ADDRESS)
    • amount must be >= X402_PRICE_*
  5. Server rejects replayed txids for a TTL window.

Environment variables (x402)

Server-side:

  • X402_USDCX_CONTRACT_ID (required) — token contract ID used for payment verification (SIP-010 USDCx)
  • X402_MERCHANT_ADDRESS (optional) — recipient principal; defaults to NEXT_PUBLIC_DEPLOYER_ADDRESS
  • X402_HEADER_NAME (optional) — defaults to x-payment-txid
  • X402_PRICE_BUY_INSURANCE (optional) — default 100000 (uint)
  • X402_PRICE_SUBMIT_CLAIM (optional) — default 50000 (uint)

Resources


License

MIT


Jagantara on Stacks - Secured by Bitcoin

All DeFi projects →