Verdikta Simple Frontend is a reference web application that showcases how to interact with the Verdikta on‑chain AI‑jury protocol. It lets a user:
- Define a question / dispute with a set of mutually exclusive outcomes.
- Bundle supporting evidence into a query package (ZIP archive) that is uploaded to IPFS.
- Choose an AI jury (set of models or nodes) and submit the request to the Verdikta Aggregator smart‑contract running on Base Sepolia.
- Poll the chain until the Chainlink job fulfils the request, then fetch and render the result vector and the AI‑generated justification.
This repository contains:
- client/ – React 18 SPA powered by
ethers.js. - server/ – Minimal Express API that uploads files to IPFS (via Pinata) and persists contract metadata.
⚠️ This project is meant for local development and demonstration. Do not deploy to production without a proper security review.
| Layer | Tech |
|---|---|
| Front‑end | React 18 · React Router · Chart.js · Ethers v6 |
| Back‑end | Node 20 · Express 4 · Multer · Pinata SDK |
| Blockchain | Base Sepolia test‑net · Chainlink Functions |
| Storage | IPFS |
.
├─ client/ # React SPA (Create‑React‑App)
│ ├─ src/
│ │ ├─ pages/ # Main wizard‑style pages
│ │ ├─ components/ # Re‑usable presentational comps
│ │ └─ utils/ # Pure helpers & blockchain utils
│ └─ public/
│
├─ server/ # Express API + utility scripts
│ ├─ routes/ # REST endpoints (file & contract mgmt)
│ ├─ services/ # IPFS/Pinata abstraction
│ ├─ utils/ # JSON persistence, graceful shutdown
│ └─ tmp/ # Runtime upload buffer (git‑ignored)
└─ README.md # ← you are here
The smart‑contracts live in a dedicated Solidity repo and are not part of this project.
- Node.js ≥ 18 and npm ≥ 9 (or
pnpm/yarn). - A MetaMask wallet connected to Base Sepolia with a small amount of test ETH & LINK.
- A Pinata account (or any IPFS pinning service) to obtain a JWT token.
# clone
$ git clone https://github.com/verdikta/verdiktaSimpleFrontend.git
$ cd verdiktaSimpleFrontend
# client dependencies
$ cd client && npm install
# server dependencies
$ cd ../server && npm installCreate .env files from the provided templates and fill in the blanks:
# client/.env
cp client/.env.example client/.env
# server/.env
cp server/.env.example server/.envKey variables:
| File | Variable | Description |
|---|---|---|
| client/.env | REACT_APP_CONTRACT_ADDRESSES |
Comma‑separated list of Verdikta contract addresses. |
REACT_APP_CONTRACT_NAMES |
Human‑readable labels in the same order. | |
REACT_APP_CONTRACT_CLASSES |
Comma-separated list of class values (0-99999, default 128) for each contract, in the same order as addresses/names. | |
REACT_APP_SERVER_URL |
URL where the Express API is reachable. | |
| server/.env | PORT |
Port for the API (defaults to 5000). |
IPFS_PINNING_SERVICE |
Base URL of your pinning provider. | |
IPFS_PINNING_KEY |
JWT token for the above provider. |
Open two terminals:
# Terminal 1 – start the API
$ cd server
a) cp .env.example .env # if not done yet
b) npm run dev # nodemon will watch & restart
# Terminal 2 – start the React app
$ cd client
a) cp .env.example .env # if not done yet
b) npm start # CRA will serve on http://localhost:3000The client proxies API calls to http://localhost:5000 by default (configure via REACT_APP_SERVER_URL). When both services are up you can navigate to the React app and follow the wizard.
- Query Definition – Write the question and enumerate possible outcomes.
- Jury Selection – Choose which AI nodes / models will deliberate and set runtime parameters.
- Run Query – Build or upload a query package and submit the on‑chain transaction.
- Results – Once the Chainlink oracle fulfils the request the result vector is displayed alongside the justification markdown.
Each step corresponds to a page in client/src/pages/* and local‑storage keeps draft data so you can navigate back & forth.
| Location | Script | Purpose |
|---|---|---|
| client | npm start |
Development server (CRA) |
npm test |
Jest + React‑Testing‑Library | |
npm run build |
Production build to client/build/ |
|
| server | npm run dev |
Run API with nodemon watch |
npm start |
Run API with Node |
Small helper shells are included at root of each package: startClient.sh, startServer.sh, killold3001.sh.
- Build the React app:
cd client && npm run build
- Serve
client/buildvia Nginx, Vercel, Netlify or any static host. - Deploy the Express API on Render, Heroku, Fly.io or your own server.
- Point
REACT_APP_SERVER_URLto the deployed API and rebuild/redeploy the front‑end if needed.
For containerised deployments create a Dockerfile per package or leverage multi‑stage builds.
- Front‑end uses Jest & @testing‑library/react (
npm test). - Back‑end currently has no automated tests – PRs welcome 🤝.
MetaMask RPC Error: chainId– ensure you added Base Sepolia (chainId84532). The app will attempt to prompt MetaMask automatically.- IPFS upload fails – verify your
IPFS_PINNING_KEYJWT is valid and the server can reach the pinning service. - Contract mismatch – the server keeps a copy of contracts in
server/data/contracts.json. It is auto‑synced with the client.env. Delete the JSON file if you change addresses and restart the server.
- Fork the repo & create a feature branch (
git checkout -b feature/my‑idea). - Adhere to the existing coding style – run
npm run lintif you add ESLint. - Include tests and documentation for any new feature.
- Submit a clear Pull‑Request describing what and why.
We follow the Conventional Commits spec for commit messages.
This repository is released under the MIT License – see LICENSE for details.