# Project export: TrustWise AI

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: OpenAI Build Week
- Tagline: Decentralized escrow combining GPT-5.6 AI arbitration with zkTLS web proof instead of screenshots. Smart contracts hold funds; AI instantly resolves disputes privately with zero KYC required.
- Devpost: https://devpost.com/software/trustwise-ai
- GitHub: https://github.com/daksha311/TrustWise-AI.git
- Video: https://www.youtube.com/embed/JNBP467fJt4?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 2 GitHub contributor(s) — Harsha K (16 commits), DAKSHA S G (11 commits)

## Devpost submission (written by the team)

### Inspiration

Trust is one of the biggest challenges in online commerce. Whether it's freelance work, peer-to-peer marketplaces, second-hand goods, or digital services, disputes often arise because buyers and sellers provide conflicting claims. Today, these disputes are usually resolved using screenshots, emails, or manually uploaded documents that can be edited, forged, or taken out of context. Human arbitration is expensive, time-consuming, and often inconsistent. We wanted to answer a simple question: Can AI make trustworthy decisions if its evidence is itself trustworthy? This led us to build TrustWise AI, an intelligent escrow dispute resolution platform where AI decisions are based on cryptographically verified evidence instead of user-submitted screenshots. By combining TLSNotary, GitHub Models (GPT-4o), and Ethereum smart contracts, we created a system that automatically verifies shipment information, reasons over authenticated evidence, and securely settles escrow funds on-chain.

### What it does

TrustWise AI is a full-stack escrow dispute resolution platform that combines blockchain, AI, and cryptographic verification into a single workflow. 1. Escrow Creation A buyer creates an escrow agreement by locking funds in a Solidity smart contract deployed on the Sepolia Ethereum network. The escrow stores transaction information, participating wallet addresses, and the payment amount until the transaction is completed or disputed. 2. Dispute Submission If a disagreement occurs, the buyer or seller opens a dispute through the React dashboard. Instead of uploading screenshots or manually collected evidence, the user only enters: Escrow ID Shipment tracking number Buyer claim Seller claim This simplifies the dispute process while preventing fabricated evidence. ## 3. Automatic Evidence Collection The backend automatically retrieves shipment information using the supplied tracking number. Rather than trusting raw web responses, the system generates a TLSNotary proof, allowing shipment data to be cryptographically verified. This ensures that the information genuinely originated from the courier's website and has not been modified during transmission. ## 4. Cryptographic Verification A Rust-based TLSNotary verifier validates: Authenticity of the TLS session Integrity of the response Cryptographic signatures Proof correctness Only successfully verified evidence is forwarded to the AI layer. This guarantees that GPT-4o never reasons over forged or manipulated shipment information. ## 5. AI Arbitration After verification, GPT-4o—accessed through GitHub Models—receives through route /dispute: Buyer statement Seller statement Authenticated shipment status Verified metadata Dispute context Instead of producing free-form text, the AI generates a structured arbitration result containing recommended action, confidence score, detailed reasoning, supporting evidence and explanation for the verdict The backend validates this response generated by AI in the json format and it is structured before returning it to the frontend. ## 6. Blockchain Settlement Depending on the AI recommendation: Funds are released to the seller or refunded to the buyer. The settlement transaction is executed through MetaMask, updating the Ethereum smart contract while maintaining a transparent and immutable record. ##

### How we built it

# Frontend The frontend was developed using React and Vite, providing a responsive dashboard for managing escrow transactions and disputes. ### Dashboard The dashboard serves as the application's control center, displaying: Connected wallet information Active escrows Escrow status Dispute status Recent transactions ### Wallet Integration MetaMask integration allows users to: Connect Ethereum wallets Switch to the Sepolia test network Sign blockchain transactions Authorize escrow settlement Wallet state is synchronized throughout the application to provide a seamless blockchain experience. ### Escrow Management Users can: Create new escrow contracts Specify buyer and seller information Define escrow amounts Monitor contract status All blockchain interactions are performed using Ethers.js. Dispute Interface The dispute page provides an intuitive workflow where users simply enter: Tracking number Buyer claim Seller claim Seller claim The frontend then communicates with backend APIs and displays: The frontend then communicates with backend APIs and displays: AI verdict AI verdict Confidence score Confidence score Reasoning Reasoning Verified shipment information Verified shipment information Settlement recommendation Arbitration Results Rather than presenting raw JSON, the frontend visualizes AI decisions through structured UI components, making arbitration results easy to understand. Transaction History Settlement recommendation Arbitration Results Rather than presenting raw JSON, the frontend visualizes AI decisions through structured UI components, making arbitration results easy to understand. Transaction History The history page records completed escrows and resolved disputes, allowing users to review previous transactions and settlement outcomes. The backend was built using Node.js and Express.js, acting as the orchestration layer between blockchain, AI, and cryptographic verification. Its responsibilities include: API routing Request validation Proof generation TLS verification AI arbitration Blockchain coordination Structured responses Centralized logging Automated testing ## Automatic Proof Generation Instead of requiring users to upload TLS proofs manually, the backend automatically: Accepts a shipment tracking number. Fetches shipment information. Generates the TLSNotary proof. Submits the proof for verification. This significantly improves usability while preserving cryptographic guarantees. TLSNotary Integration A Rust-based verifier validates every generated proof before it reaches the AI layer. Verification includes: TLS transcript validation Cryptographic signature verification Response integrity checks Domain validation Supported hashing algorithms Only verified evidence proceeds further. ## AI Arbitration Engine GitHub Models provides GPT-4o, which acts as the arbitration engine. The backend constructs a structured prompt containing: Verified shipment data Buyer statement Seller statement Dispute amount Transaction metadata The AI returns structured JSON rather than free-form text, ensuring consistent downstream processing. ## API Design The backend exposes REST APIs for: Escrow creation Dispute submission Proof verification AI arbitration Settlement execution Health monitoring Request validation prevents malformed or incomplete submissions before processing begins. ## Reliability Features To improve robustness, we implemented: Centralized error handling Request logging Response standardization Retry mechanisms Deterministic demo mode Integration testing Structured validation These features make the system easier to debug and maintain while improving reliability during demonstrations. # System Architecture text Buyer / Seller │ ▼ React Frontend (Dashboard) │ ▼ Express Backend API │ ├────────► Tracking Fetcher │ ├────────► TLSNotary Proof Generation │ ├────────► Rust TLSNotary Verifier │ ├────────► GPT-4o (GitHub Models) │ ▼ Structured Arbitration Decision │ ▼ Ethereum Smart Contract │ ▼ MetaMask Settlement

### Challenges we ran into

Developing TrustWise AI required integrating technologies that rarely appear together in a single application. Our major challenges included: Integrating a Rust-based TLSNotary verifier with a JavaScript backend. Automatically generating cryptographic proofs instead of relying on manual uploads. Designing APIs capable of handling verifier failures, AI failures, and blockchain failures gracefully. Coordinating frontend, backend, and Solidity development across multiple contributors while managing Git merges. Ensuring GPT-4o only consumed authenticated evidence. Synchronizing blockchain settlement with AI decisions. Building a smooth user experience despite the complexity of cryptographic verification happening behind the scenes. Throughout this project, we successfully designed and implemented a complete end-to-end AI-powered escrow dispute resolution platform that combines blockchain, cryptographic verification, and large language models into a unified workflow. Our key accomplishments include: Built a full-stack application using React, Vite, Node.js, and Express.js, providing an intuitive user experience for escrow management and dispute resolution. Developed secure Solidity smart contracts deployed on the Ethereum Sepolia network to lock, release, and refund escrow funds. Integrated MetaMask to enable seamless wallet connectivity, transaction signing, and blockchain settlement. Automated shipment evidence collection by generating TLSNotary proofs directly from shipment tracking numbers, eliminating the need for manually uploaded screenshots or documents. Successfully integrated a Rust-based TLSNotary verifier with the Node.js backend, ensuring that only cryptographically verified evidence is processed. Built an AI-powered arbitration engine using GPT-4o through GitHub Models, capable of analyzing verified shipment information alongside buyer and seller claims to generate structured, explainable dispute resolutions. Implemented a backend orchestration layer responsible for request validation, proof generation, cryptographic verification, AI reasoning, blockchain coordination, centralized logging, and standardized API responses. Designed a responsive frontend featuring wallet integration, escrow creation, dispute submission, AI verdict visualization, settlement execution, and transaction history. Added robust engineering practices including centralized error handling, request logging, structured validation, retry mechanisms, and automated integration testing using Jest and Supertest. Successfully integrated technologies written in JavaScript, Rust, and Solidity, demonstrating reliable communication across multiple services and programming languages. Created a trust-first architecture where AI decisions are grounded in cryptographically verified evidence, significantly improving transparency and reducing reliance on potentially manipulated user-submitted data. Above all, we're proud of demonstrating how AI, cryptographic verification, and blockchain can work together to build a more transparent, explainable, and trustworthy digital dispute resolution system.

### What we learned

This project significantly expanded our understanding of modern trustworthy AI systems. We gained practical experience with: Full-stack application architecture React and Vite Node.js and Express Solidity smart contracts Ethereum wallet integration Ethers.js GitHub Models and GPT-4o Prompt engineering for structured AI outputs TLSNotary cryptographic verification Rust service integration REST API design Automated integration testing with Jest and Supertest Secure blockchain workflows Collaborative software engineering across multiple technologies Most importantly, we learned that AI becomes substantially more reliable when its decisions are grounded in cryptographically verifiable evidence instead of user-provided data.

### What's next

We envision TrustWise AI becoming a universal trust layer for online commerce. Future improvements include: Support for multiple courier providers and logistics companies. Integration with major e-commerce and freelance platforms. Multi-agent AI arbitration for more nuanced decision-making. On-chain storage of cryptographic verification hashes. Decentralized arbitration history for transparency. Human appeal workflows for exceptional cases. Support for additional verifiable data sources such as invoices, payment confirmations, digital contracts, and identity proofs. Reputation scoring based on verified transaction history. Cross-chain escrow support beyond Ethereum.

## README (from the GitHub repository)

# TrustWise-AI
A decentralized escrow protocol that combines GPT-5.6-powered arbitration with cryptographic evidence verification via zkTLS. Users submit mathematically verifiable proofs of web data (delivery status, receipts) instead of fakeable screenshots. Smart contracts hold funds; AI adjudicates disputes fairly, privately, and instantly—no KYC required.

## Backend: /api/dispute/resolve

Endpoint: `POST /api/dispute/resolve`

Request body (JSON) — two supported formats:
- Provide a `proof` object (preferred):
	- `proof` should contain `content`, `url`, `proof_hash`, `notary_signature`, `timestamp`, and `tracking_id` when available.
- Or provide a `trackingNumber` (frontend-only): the backend will generate a deterministic zkTLS proof by fetching the carrier tracking page.

Required fields (when not using `proof` alone):
- `disputeId`, `escrowId`, `buyer`, `seller`, `buyerClaim`, `sellerClaim`, `amount`.

Success response (200):
```
{
	"success": true,
	"dispute_id": "...",
	"escrow_id": "...",
	"action": "release_funds|refund_buyer|split_payment|need_more_evidence",
	"confidence": 85,
	"explanation": "...",
	"reasoning": "...",
	"key_evidence": [...],
	"risk_score": 15,
	"timestamp": "...",
	"usage": { }
}
```

Standardized error format (all non-2xx responses):
```
{
	"success": false,
	"error": {
		"code": "TRACKING_NOT_FOUND|INVALID_REQUEST|TLS_VERIFICATION_FAILED|AI_SERVICE_UNAVAILABLE|INTERNAL_ERROR",
		"message": "Human-readable explanation"
	}
}
```

Common status codes used:
- `200` — success
- `400` — invalid request / missing fields
- `404` — tracking number not found / carrier page unavailable
- `422` — proof verification failed (cryptographic mismatch)
- `503` — AI provider or carrier verifier unavailable
- `500` — internal server error

Architecture notes:
- Flow: trackingNumber → trackingFetcher.generateProof → tlsnotary.verifyProof → buildArbitrationContext → codex.arbitrateDispute → JSON response
- `tlsnotary` performs only deterministic cryptographic verification and returns verified facts + quality scores.
- `codex-real` (arbitration) receives a compact, evidence-only prompt and must return JSON-only responses with a fixed schema.

Logging & middleware:
- Requests are logged (request id, method, route, disputeId, escrowId, response time).
- Centralized error handler ensures consistent JSON error responses.



## Detected evidence (automated analysis)

Indexed codebase: 54 recognized source files, 248 KB.
- CSS (language) — detected in the code
- Express (technology) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- OpenAI (technology) — detected in the code
- React (technology) — detected in the code
- Solidity (language) — detected in the code
- TypeScript (language) — detected in the code
- Docker (technology) — claimed on Devpost, not found in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- Rust (language) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (69 of 69)

```
.env
.gitignore
backend/package.json
backend/src/agents/evidenceCollector.js
backend/src/agents/riskAdjudicator.js
backend/src/agents/settlementExecutor.js
backend/src/api/trustwise.js
backend/src/index.js
backend/src/middleware/errorHandler.js
backend/src/middleware/requestLogger.js
backend/src/routes/verify.js
backend/src/services/codex-real.js
backend/src/services/codex.js
backend/src/services/contract.js
backend/src/services/tlsnotary.js
backend/src/services/trackingFetcher.js
backend/src/utils/arbitrationContextBuilder.js
backend/src/utils/logger.js
backend/src/utils/response.js
backend/src/validators/disputeValidator.js
backend/test/codex-real-test.js
backend/test/integration/resolve.test.js
backend/test/simple-test.js
backend/test/tlsnotary-test.js
backend/test/verify-test.js
contracts/artifacts/artifacts.d.ts
contracts/artifacts/build-info/solc-0_8_24-784e5776af231fc20fb1d478f4b48cddf036dfba.json
contracts/artifacts/build-info/solc-0_8_24-784e5776af231fc20fb1d478f4b48cddf036dfba.output.json
contracts/artifacts/contracts/Escrow.sol/artifacts.d.ts
contracts/artifacts/contracts/Escrow.sol/Escrow.json
contracts/cache/compile-cache.json
contracts/contracts/Escrow.sol
contracts/hardhat.config.ts
contracts/package.json
contracts/scripts/deploy.ts
contracts/types/ethers-contracts/common.ts
contracts/types/ethers-contracts/Escrow.ts
contracts/types/ethers-contracts/factories/Escrow__factory.ts
contracts/types/ethers-contracts/factories/index.ts
contracts/types/ethers-contracts/hardhat.d.ts
contracts/types/ethers-contracts/index.ts
frontend/.gitignore
frontend/eslint.config.js
frontend/index.html
frontend/package.json
frontend/README.md
frontend/src/api/trustwise.js
frontend/src/App.css
frontend/src/App.tsx
frontend/src/components/DisputePanel.jsx
frontend/src/config.ts
frontend/src/contracts/Escrow.json
frontend/src/hooks/useTLSNotary.js
frontend/src/index.css
frontend/src/main.tsx
frontend/src/pages/CreateEscrow.tsx
frontend/src/pages/Dashboard.tsx
frontend/src/pages/DisputeView.tsx
frontend/src/pages/History.tsx
frontend/src/utils/api.ts
frontend/src/web3Service.ts
frontend/tsconfig.app.json
frontend/tsconfig.json
frontend/tsconfig.node.json
frontend/vite.config.ts
package.json
README.md
test/e2e-test.js
test/tlsnotary-test.js
```

### Dependencies

- backend/package.json: axios@^1.6.0, cors@^2.8.5, dotenv@^16.3.1, ethers@^6.8.0, express@^4.18.2, jest@^29.0.0, nodemon@^3.0.1, openai@^6.48.0, supertest@^6.3.0, winston@^3.11.0
- contracts/package.json: @nomicfoundation/hardhat-toolbox-mocha-ethers@^3.0.7, dotenv@^17.4.2, hardhat@^3.9.1
- frontend/package.json: @eslint/js@^10.0.1, @types/node@^24.13.2, @types/react@^19.2.17, @types/react-dom@^19.2.3, @vitejs/plugin-react@^6.0.3, eslint@^10.6.0, eslint-plugin-react-hooks@^7.1.1, eslint-plugin-react-refresh@^0.5.3, ethers@^6.17.0, globals@^17.7.0, react@^19.2.7, react-dom@^19.2.7, react-router-dom@^7.18.1, typescript@~6.0.2, typescript-eslint@^8.62.0, vite@^8.1.1
- package.json: @react-router/node@^7.18.1, ethers@^6.17.0, react-router@^7.18.1

### Recent commits (newest first)

- Final integration
- chore: remove temporary test proof files
- tests(integration): add Jest+Supertest integration tests for /api/dispute/resolve; standardize responses and add middleware; token-bypass mock for Codex
- Merge pull request #6 from daksha311/Harsha_TackA
- Merge branch 'Harsha_TackA' of https://github.com/daksha311/TrustWise-AI into Harsha_TackA
- Integration part
- Merge pull request #5 from daksha311/Harsha_TackA
- Update README.md
- Update README.md
- Update README.md
- Update README.md
- read me
- Merge branch 'daksha-trackB'
- ready to integrate
- Merge pull request #3 from daksha311/Harsha_TackA
- Background animation coding done
- Final finished UI
- Ignore TLSNotary build artifacts
- Merge pull request #2 from daksha311/daksha-trackB
- Merge branch 'main' into daksha-trackB

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "dependencies": {
    "@react-router/node": "^7.18.1",
    "ethers": "^6.17.0",
    "react-router": "^7.18.1"
  }
}

```

### contracts/package.json

```
{
  "name": "contracts",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@nomicfoundation/hardhat-toolbox-mocha-ethers": "^3.0.7",
    "dotenv": "^17.4.2",
    "hardhat": "^3.9.1"
  },
  "type": "module"
}

```

### backend/package.json

```
{
  "name": "trustwise-backend",
  "version": "3.0.0",
  "description": "TrustWise AI Backend - Real zkTLS + Codex 3-Agent Pipeline",
  "main": "src/index.js",
  "scripts": {
    "start": "node src/index.js",
    "dev": "nodemon src/index.js",
    "test": "jest --runInBand",
    "test:integration": "node test/tlsnotary-test.js"
  },
  "dependencies": {
    "axios": "^1.6.0",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "ethers": "^6.8.0",
    "express": "^4.18.2",
    "openai": "^6.48.0",
    "winston": "^3.11.0"
  },
  "devDependencies": {
    "nodemon": "^3.0.1",
    "jest": "^29.0.0",
    "supertest": "^6.3.0"
  }
}

```

### frontend/package.json

```
{
  "name": "frontend",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint .",
    "preview": "vite preview"
  },
  "dependencies": {
    "ethers": "^6.17.0",
    "react": "^19.2.7",
    "react-dom": "^19.2.7",
    "react-router-dom": "^7.18.1"
  },
  "devDependencies": {
    "@eslint/js": "^10.0.1",
    "@types/node": "^24.13.2",
    "@types/react": "^19.2.17",
    "@types/react-dom": "^19.2.3",
    "@vitejs/plugin-react": "^6.0.3",
    "eslint": "^10.6.0",
    "eslint-plugin-react-hooks": "^7.1.1",
    "eslint-plugin-react-refresh": "^0.5.3",
    "globals": "^17.7.0",
    "typescript": "~6.0.2",
    "typescript-eslint": "^8.62.0",
    "vite": "^8.1.1"
  }
}

```

### frontend/src/main.tsx

```typescript
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <App />
  </StrictMode>,
)

```

### backend/src/index.js

```javascript
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const verifyRoutes = require('./routes/verify');
const logger = require('./utils/logger');
const errorHandler = require('./middleware/errorHandler');
const requestLogger = require('./middleware/requestLogger');

const app = express();
const PORT = process.env.PORT || 3001;

// Middleware
app.use(cors({
  origin: ['http://localhost:5173', 'http://localhost:3000'],
  credentials: true
}));
app.use(express.json({ limit: '10mb' }));
app.use(requestLogger);

// Routes
app.use('/api', verifyRoutes);

// Root
app.get('/', (req, res) => {
  const { success } = require('./utils/response');
  return success(res, { name: 'TrustWise AI Backend', version: '3.0.0', status: 'running' });
});

// Error handler
// Centralized error handler
app.use(errorHandler);

if (require.main === module) {
  app.listen(PORT, () => {
    logger.info(`🚀 TrustWise Backend running on http://localhost:${PORT}`);
  });
}

module.exports = app;

```

### frontend/src/App.tsx

```typescript
import React, { useState, useEffect, useRef, useCallback } from 'react';
import { BrowserRouter, Routes, Route, Link } from 'react-router-dom';
import { connectWallet, getEscrowContract, fetchDashboardMetrics } from './web3Service';
import { ethers } from 'ethers';

// Import views
import Dashboard from './pages/Dashboard';
import CreateEscrow from './pages/CreateEscrow';
import DisputeView from './pages/DisputeView';
import History from './pages/History';

// Binary Matrix Rain Canvas Component
function BinaryRainBackground() {
  const canvasRef = useRef<HTMLCanvasElement | null>(null);

  useEffect(() => {
    const canvas = canvasRef.current;
    if (!canvas) return;
    const ctx = canvas.getContext('2d');
    if (!ctx) return;

    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;

    const binaryUnits = "01";
    const fontSize = 14;
    const columns = canvas.width / fontSize;
    const rainDrops = Array.from({ length: columns }).fill(1) as number[];

    const draw = () => {
      ctx.fillStyle = 'rgba(0, 0, 0, 0.08)';
      ctx.fillRect(0, 0, canvas.width, canvas.height);

      ctx.fillStyle = '#00ff00';
      ctx.font = fontSize + 'px monospace';

      for (let i = 0; i < rainDrops.length; i++) {
        const text = binaryUnits.charAt(Math.floor(Math.random() * binaryUnits.length));
        ctx.fillText(text, i * fontSize, rainDrops[i] * fontSize);

        if (rainDrops[i] * fontSize > canvas.height && Math.random() > 0.975) {
          rainDrops[i] = 0;
        }
        rainDrops[i]++;
      }
    };

    const interval = setInterval(draw, 33);
    
    const handleResize = () => {
      canvas.width = window.innerWidth;
      canvas.height = window.innerHeight;
    };

    window.addEventListener('resize', handleResize);
    return () => {
      clearInterval(interval);
      window.removeEventListener('resize', handleResize);
    };
  }, []);

  return (
    <canvas 
      ref={canvasRef} 
      style={{ 
        position: 'fixed', 
        top: 0, 
        left: 0, 
        width: '100%', 
        height: '100%', 
        zIndex: 0, 
        backgroundColor: '#000000', 
        pointerEvents: 'none' 
      }} 
    />
  );
}

export default function App() {
  const [walletAddress, setWalletAddress] = useState<string>("");
  const [statusMessage, setStatusMessage] = useState<string>("");
  const [isLoading, setIsLoading] = useState<boolean>(false);
  const [contractDetails, setContractDetails] = useState<string>("Initializing Connection...");
  const [totalEscrows, setTotalEscrows] = useState<number>(0);
  const [activeVaults, setActiveVaults] = useState<number>(0);
  const [disputedAssets, setDisputedAssets] = useState<number>(0);

  const [sellerAddress, setSellerAddress] = useState<string>("");
  const [depositAmount, setDepositAmount] = useState<string>("");

  const fetchContractData = useCallback(async () => {
    if (!walletAddress) return;
    try {
      setStatusMessage("⏳ Querying smart contract state...");
      const metrics = await fetchDashboardMetrics();
      setTotalEscrows(metrics.totalEscrows);
      setActiveVaults(metrics.activeVaults);
      setDisputedAssets(metrics.disputedAssets);
      setContractDetails(
        `Live at: ${metrics.contractAddress.substring(0, 6)}...${metrics.contractAddress.slice(-4)} | Total: ${metrics.totalEscrows}`
      );
      setStatusMessage("🟢 Contract handshake completed successfully.");
    } catch (error: any) {
      setContractDetails("Error Interfacing Registry");
      setStatusMessage(`⚠️ Registry sync block: ${error.message}`);
    }
  }, [walletAddress]);

  // 2. Fetch contract parameters when walletAddress updates
  useEffect(() => {
    fetchContractData();
  }, [walletAddress, fetchContractData]);

  const handleConnect = async () => {
    try {
      setIsLoading(true);
      const address = await connectWallet();
      setWalletAddress(address);
      setStatusMessage("🟢 Wallet safely authenticated.");
    } catch (error: any) {
      setStatusMessage(`❌ Connection error: ${error.message}`);
    } finally {
      setIsLoading(false);
    }
  };

  const handleCreateEscrow = async (e: React.FormEvent) => {
    e.preventDefault();
    if (!sellerAddress || !depositAmount) {
      setStatusMessage("❌ Please supply a target seller address and valid ETH metric.");
      return;
    }

    const trimmedSeller = sellerAddress.trim();
    // Accept any 0x + 40 hex; ignore EIP-55 casing (ethers.isAddress rejects bad checksums)
    let seller: string;
    try {
      if (!/^0x[a-fA-F0-9]{40}$/.test(trimmedSeller)) {
        throw new Error("bad format");
      }
      seller = ethers.getAddress(trimmedSeller.toLowerCase());
    } catch {
      setStatusMessage(
        "❌ Seller must be a wallet address: 0x followed by exactly 40 hex characters."
      );
      return;
    }
    if (seller.toLowerCase() === walletAddress.toLowerCase()) {
      setStatusMessage("❌ Seller cannot be your own wallet address.");
      return;
    }

    let valueWei: bigint;
    try {
      valueWei = ethers.parseEther(depositAmount);
      if (valueWei <= 0n) throw new Error("zero");
    } catch {
      setStatusMessage("❌ Deposit amount must be a positive ETH value, e.g. 0.005");
      return;
    }

    try {
      setIsLoading(true);
      setStatusMessage("⏳ Broadcasting transaction execution matrix to Sepolia...");
      const contract = await getEscrowContract();

      const tx = await contract.createEscrow(seller, {
        value: valueWei,
        gasLimit: 300000,
      });

      setStatusMessage("🚀 Transaction broadcasted! Awaiting block confirmation...");
      const receipt = await tx.wait();
      setStatusMessage(`💥 Escrow Vault Initialized! Hash: ${receipt.hash}`);
      fetchContractData();
    } catch (error: any) {
      const raw = error?.reason || error?.shortMessage || error?.message || "Unknown error";
      const hint = String(raw).includes("ResolverNotFound")
        ? " — sell
[truncated — 5034 more characters]
```

### contracts/types/ethers-contracts/index.ts

```typescript
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export type { Escrow } from './Escrow.js';
export * as factories from './factories/index.js';
export { Escrow__factory } from './factories/Escrow__factory.js';
```

### contracts/types/ethers-contracts/factories/index.ts

```typescript
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
export { Escrow__factory } from './Escrow__factory.js';
```

### frontend/vite.config.ts

```typescript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
})

```

[45 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]