Local Setup
Running TrustGate Locally
Clone the repo, install dependencies, and run the frontend, contracts, and oracle pages against Arc testnet.
Prerequisites
- Node.js 18+ and a recent npm.
- Git.
- An Arc testnet wallet with at least 0.05 USDC for gas. Faucet: faucet.circle.com.
- WalletConnect Project ID (optional, only needed for mobile wallet support). Free at cloud.walletconnect.com.
Clone
git clone https://github.com/rudazy/TrustGate
cd TrustGateContracts
Hardhat workspace lives at the repo root. Install once at the top level:
npm install
npx hardhat compile
npm testThe test suite is 142 tests across registration, allowance, claim routing, lifecycle, and full integration scenarios — all passing on a vanilla Hardhat node. The 36 FHE-dependent TrustScoring tests are marked pending because the Zama coprocessor is not available on Arc.
Frontend
cd frontend
npm install
cp .env.example .env.local # then edit .env.local
npm run devThe dev server starts on http://localhost:3000.
Environment variables
# Required
NEXT_PUBLIC_ORACLE_URL=http://38.49.216.201:3001
# Optional — enables WalletConnect mobile flows
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_idBoth variables are read at build time. Without NEXT_PUBLIC_ORACLE_URL, the oracle and live agents pages still render but cannot fetch live stats.
Deploy your own contracts
The default frontend points at the canonical TrustGate deployment. To deploy fresh contracts to Arc testnet:
# at repo root
cp .env.example .env
# add PRIVATE_KEY=<your deployer key>
npx hardhat run scripts/deploy-arc.ts --network arcTestnetThe script deploys TrustScoringPlaintext, AgentRegistry, and TrustGate, then wires them together. Update frontend/src/lib/constants.ts with the new addresses.
Verify on Arcscan
ETHERSCAN_API_KEY=arcscan npx hardhat verify \
--network arcTestnet <ADDRESS> <...CTOR_ARGS>Arcscan accepts any non-empty API key. If verification fails on the first attempt, retry with --force — the explorer sometimes lags one block behind a fresh deployment.
Repository layout
TrustGate/
├── contracts/ Solidity sources (TrustGate, AgentRegistry, TrustScoring)
├── deploy/ hardhat-deploy scripts
├── scripts/ One-shot deploy + verification scripts
├── test/ Hardhat tests (142 passing)
├── frontend/ Next.js 14 app (dashboard, oracle, docs, demo)
│ ├── src/app/ Routes (App Router)
│ └── src/lib/ Wagmi config, ABIs, constants
└── docs/ Long-form architecture notesCommon issues
- Wrong network — the dashboard prompts a network switch automatically. If a wallet refuses, add Arc Testnet manually with chain ID
5042002and RPChttps://rpc.testnet.arc.network. - Insufficient gas — Arc uses USDC as native gas. The Register Agent and Calculate Score buttons stay disabled below 0.01 USDC; refill via faucet.
- Score returns 0 — the wallet has zero Arc transactions and is BLOCKED by the formula. Send any tx to leave the BLOCKED tier.