Testnet Proofs

Source: docs/INTEGRATIONS.md

INTEGRATION & VERIFICATION CONTRACTS: RAGA PROTOCOL

Primary Network: NEAR Protocol Testnet Root Contract Account: raga-protocol-mw93m309.testnet Explorer Base: https://testnet.nearblocks.io Interface Stack: Rust Contract -> near-api-js v7.4.0 -> Next.js 14 Foundry -> Off-Chain Worker Daemon

1. On-Chain Live Testnet Deployment

The RAGA Protocol is deployed live on NEAR Testnet. No simulated mocks, sandbox environments, or synthetic accounts are used for judge verification.

Contract Identity Matrix

RoleTestnet Account IDPurpose & Security Scope
Parent Contractraga-protocol-mw93m309.testnetHolds root state, NFT registry, and sub-account authorization keys
Deployer / Ownerraga-protocol-mw93m309.testnetProtocol administrative authority, creator of root agents
Authorized Tenantraga-renter-mw94dqty.testnetActive leaseholder executing workloads via bound sub-accounts
Worker Operatorraga-operator-mw94dqty.testnetOff-chain daemon key submitting cryptographic task proofs

2. Cryptographic Proofs & Verified Transactions

The table below records real, permanent on-chain transactions verifying protocol execution invariants:

CODE
[MINT PROOF]  -->  agent-sentinel-01  -->  Tx: HhVM2HDrzLx... (Bound: agent-sentinel-01.raga...)
[LEASE PROOF] -->  agent-yield-02     -->  Tx: DmYqBB5af4E... (Leased to raga-renter-mw94dqty.testnet)
[LOCK PROOF]  -->  agent-yield-02     -->  Tx: 3XDMyhU9XoD... (PANIC: Transfer forbidden under active rental)
[CLAIM PROOF] -->  agent-yield-02     -->  Tx: CP7L1VWE5MB... (2 NEAR yield claimed to owner)
[PROXY PROOF] -->  agent-yield-02     -->  Tx: ENFyqfgM6wV... (wrap.testnet::ft_total_supply executed)

Full Transaction Ledger

Lifecycle EventAgent Token IDTransaction HashVerifiable Outcome
Contract Deployraga-protocol-mw93m309.testnet4t1mhziPh8ah3WQRFeT2Ldz2Y3fLdNfHWJ3jm6dkAFZoDeployed Wasm binary (raga_contracts.wasm)
Contract Init (new)raga-protocol-mw93m309.testnetFxDs3ufv47pVHzaBCb1CcXgrpLZCBkVjRgoKT4fbTYe9Initialized metadata with NEP-171/178 parameters
Mint Agent 01agent-sentinel-01HhVM2HDrzLx4s7ytwqb5rnt9tJERyLuGix1J4uTwYph8Created sub-account agent-sentinel-01.raga...
Mint Agent 02agent-yield-02G2cQFii3gH8N5dReGDXUNfbiAZmyizmwQHVEb3B2TDEfCreated sub-account agent-yield-02.raga...
Mint Agent 03agent-oracle-036kfKkqNoGAHCVReD1eYrmgUNnHMqM8Ra8CimXHQDmw9nCreated sub-account agent-oracle-03.raga...
Mint Agent 04agent-nexus-043Yn1ummno2t79kFLKGvCjgRDT5uFAUZK5GPc9H6jgNzGCreated sub-account agent-nexus-04.raga...
Time-Lock Lease (Yield)agent-yield-02DmYqBB5af4ETt6XECSJ3a88oz1syV45rYwccZ12qYj8YDeposited lease fee; assigned operator to renter
Time-Lock Lease (Oracle)agent-oracle-03G53dRkSKUeAUrsUz4mYRt4sWXmBwV16pyfeDax6ySkwyDeposited 0.85 NEAR for 1 hr lease; operator assigned to renter
Anti-Theft Freezeagent-yield-02 / agent-oracle-033XDMyhU9XoDtqkec8PUThhC3vcu4Z3qRYoWNW9fJ3kpVPanicked as expected: NEP-178 transfer locked
Revenue Withdrawalagent-yield-02CP7L1VWE5MBuDH5vuoZ76ogu69jjbtZjgyRLpwWseHbF2 NEAR streaming yield withdrawn by token owner
Proxy Invocation (Yield)agent-yield-02ENFyqfgM6wVgWFyYTM6SwpXcFPC1R9NMBmbfS16S9mDrDispatched cross-contract execution to external contract
Proxy Invocation (Oracle)agent-oracle-03DsBWx5CN36nGUKRWddkNdibSPWoCYEhfhyD2ED6gUB8sDispatched execute_as_agent -> get_contract_owner, tasks += 1
Daemon Task Settlementagent-oracle-036jyYAgnCqpPri5dMRQ89E2Tirz2VcrS6htGbhNtRj8vYSubmitted task completion with SHA-256 proof; reputation boosted

3. Off-Chain Autonomous Worker Daemon Specification

The off-chain daemon (worker-daemon/src/worker.ts) acts as the execution bridge between autonomous off-chain AI reasoning loops and NEAR on-chain verification.

Heartbeat Loop & Attestation Engine

typescript
// worker-daemon/src/worker.ts execution cycle:
export async function runDaemonCycle(agentId: string) {
  // 1. Fetch current on-chain state via near-api-js JsonRpcProvider
  const agent = await queryAgentState(agentId);
  
  // 2. Validate current delegation: Is lease active or expired?
  const isAuthorized = validateOperator(agent);
  if (!isAuthorized) return;

  // 3. Formulate autonomous task payload (e.g. DeFi rebalance / Oracle validation)
  const taskPayload = {
    taskId: `task-${Date.now()}`,
    agentId,
    operator: agent.effective_operator,
    targetContract: "wrap.testnet",
    action: "ft_balance_of",
    timestamp: Date.now()
  };

  // 4. Generate SHA-256 cryptographic attestation proof
  const proofHash = crypto
    .createHash("sha256")
    .update(JSON.stringify(taskPayload))
    .digest("hex");

  // 5. Submit settlement to NEAR Protocol
  await submitTaskCompletion(agentId, taskPayload.taskId, proofHash);
}

Heartbeat Invariants

  • Poll Interval: 15 seconds per active agent unit.
  • Failover RPC: Rotates between https://rpc.testnet.near.org and https://near-testnet.drpc.org.
  • Proof Structure: sha256(taskId + agentId + operator + payload + block_height).

4. Web3 Client Integration (near-api-js v7.4.0)

The frontend dApp communicates with NEAR Testnet through an enterprise clean architecture:

  1. near-provider.ts: Pure read-only JSON-RPC gateway featuring retry policies, exponential backoff, and local response caching for high-frequency methods (nft_tokens, nft_token, get_agent).
  2. near-signer.ts: Transaction signing abstraction supporting NEAR browser wallets, private key signers, and local key-stores.
  3. agent-query.repo.ts & agent-tx.repo.ts: Typed domain repositories mapping low-level NEAR Borsh/JSON responses to strongly-typed TypeScript domain entities.
  4. /api/rpc Gateway: Next.js App Router edge route preventing client-side CORS issues and shielding public RPC limits from overwhelming the user interface.