Web3 / Web4 Infrastructure for the ARZY-G AI Token Ecosystem
MetaCoreX is a full-stack Web3/Web4 infrastructure project built around the ARZY-G ERC-20 AI token β an on-chain token with an embedded AI integration layer, Chainlink Functions oracle support, and a real-time Operator Console dashboard (in the metacorex-site frontend).
Live deployment (Sepolia testnet): 0xC3f4231F619F8D22666d70aeaA5D43EA56498770 (verified source β
)
Deploy your own with docs/deploy.md (Fly.io, API only) or docs/deploy-render.md (Render, API + site) for a permanent URL.
- Overview
- Proof of Usefulness (PoU) Protocol
- Architecture
- System Metrics
- Repository Topology
- Smart Contract
- API Reference
- Quick Start
- Operator Console Dashboard
- Connect Your Own Agent
- Deployment
- Tech Stack
ARZY-G is an ERC-20 AI token with an on-chain intelligence layer. Unlike standard ERC-20 tokens, ARZY-G enforces that new tokens are minted only after an AI agent submits a verifiable proof of useful computation β evaluated and settled on-chain via Chainlink Functions.
Core capabilities:
| Feature | Description |
|---|---|
registerAgent / submitProof |
Permissionless β any wallet registers itself and mints amount * score / 10 by self-reporting a proof + score (0β10), no oracle round trip required |
requestUsefulness β birthToken |
Oracle-verified path: a Chainlink Functions callback approves a proof (score β₯ 1) and mints, split 99% agent / 1% protocol reserve |
Daily Quota |
Both mint paths share a global dailyMintLimit and a per-agent agentDailyCap, enforced on-chain via a UTC day epoch |
Supply Cap |
Hard MAX_SUPPLY ceiling (1,000,000,000 ARZY-G) enforced in every mint path via _update |
The Proof of Usefulness protocol is MetaCoreX's core economic and consensus mechanism. It replaces arbitrary inflationary minting with a verifiable, AI-evaluated work gate.
AI Agent ARZY-G Contract Chainlink Functions
β β β
βββ requestUsefulness() βββββΆβ β
β (agentAddr, prompt, βββββ sendRequest() βββββββΆβ
β amount) β (DON ID, sub ID) β
β β β
β βββββ fulfillRequest() ββββ
β β (score: uint256) β
β β β
β β if score β₯ 1: β
β β birthToken() β
β β ββ mint 99% β agent β
β β ββ mint 1% β reserve β
β β else: β
ββββ ProofRejected event βββββ emit ProofRejected() β
Every submitted proof carries a PoU Score β an integer from 0 to 10 β but it means slightly different things on the two mint paths:
| Path | Score | Result |
|---|---|---|
submitProof (direct, self-reported) |
0 |
ProofRejected β no mint |
submitProof (direct, self-reported) |
1β10 |
ProofAccepted β mints amount * score / 10 |
requestUsefulness β oracle callback |
0 |
OracleProofRejected β no mint |
requestUsefulness β oracle callback |
β₯ 1 |
TokenBirthed β mints the full pre-agreed amount (99% agent / 1% reserve) |
The PoU Score is displayed in real time on the Operator Console dashboard.
| Role | Capability |
|---|---|
DEFAULT_ADMIN_ROLE |
Full contract governance, can reassign RESERVE_ROLE |
DEV_ADMIN_ROLE |
Trigger requestUsefulness, update dailyMintLimit / agentDailyCap |
RESERVE_ROLE |
Held by the protocol fee reserve address |
registerAgent and submitProof are intentionally permissionless β no role is required, so any wallet (including third-party agents) can call them directly. See Connect Your Own Agent.
Every AI-driven mint (submitProof and birthToken) shares a global daily limit and a per-agent cap, enforced on-chain using the UTC day epoch:
uint256 day = block.timestamp / 1 days;
require(mintedInDay[day] + amount <= dailyMintLimit, "Daily mint limit exceeded");
require(agentMintedInDay[agent][day] + amount <= agentDailyCap, "Agent daily cap exceeded");This prevents runaway minting while still allowing high-throughput AI pipelines across many independent agents. Both limits are admin-adjustable (setDailyMintLimit, setAgentDailyCap) and a hard MAX_SUPPLY ceiling backstops every path regardless of quota.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MetaCoreX OS β
β β
β ββββββββββββββββββββ WebSocket βββββββββββββββββββββββ β
β β metacorex-site βββββββββββββββββββΆβ API Server β β
β β (marketing + β /api/ws β (Express 5) β β
β β dashboard) β β port 8080 β β
β ββββββββββββββββββββ ββββββββββ¬βββββββββββββ β
β β β
β ββββββββββΌβββββββββββββ β
β β ContractService β β
β β (ethers.js v6) β β
β ββββββββββ¬βββββββββββββ β
β β JSON-RPC β
β ββββββββββΌβββββββββββββ β
β β Hardhat Local Node β β
β β 127.0.0.1:8545 β β
β ββββββββββ¬βββββββββββββ β
β β β
β ββββββββββββββββββββ΄βββββββββββββ β
β β β β
β βββββββββββΌβββββββββββ ββββββββββββββββΌβ β
β β ARZYG_ERC20_AI β β MockFunctionsβ β
β β (ERC-20 + PoU) β β Router β β
β β chain ID: 31337 β β (Chainlink β β
β ββββββββββββββββββββββ β simulator) β β
β βββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The MetaCoreX EventBus (src/ws/eventBus.ts) is the central nervous system of the OS. All on-chain events are captured by ContractService via ethers.js listeners and republished to all connected metacorex-site dashboard clients over WebSocket in real time.
Blockchain Event βββΆ ContractService βββΆ McxEventBus βββΆ WebSocket βββΆ Dashboard
(MintRequested) (ethers.js) (EventEmitter) (/api/ws) (Terminal)
These are the live on-chain system metrics exposed by the dashboard and API:
| Metric | Source | Update Frequency |
|---|---|---|
| Token Balance | ARZYG.balanceOf(deployer) |
Every 5 seconds |
| Total Supply | ARZYG.totalSupply() |
Every 5 seconds |
| Block Number | provider.getBlockNumber() |
Every 5 seconds |
| Chain ID | provider.getNetwork() |
On connect |
| PoU Score | WebSocket event stream | Real-time |
| Pending Requests | MintRequested event counter |
Real-time |
| Minted / Birthed / Rejected | On-chain event counters | Real-time |
| Parameter | Value |
|---|---|
| Network | Hardhat Local (chainId: 31337) |
| RPC URL | http://127.0.0.1:8545 |
| Initial Supply | 1,000,000 ARZY-G |
| Protocol Fee | 1% (to reserve on every birthToken) |
| Supply Cap | 1,000,000,000 ARZY-G (hard ceiling) |
| EVM Target | Cancun (required for OpenZeppelin v5) |
| Chainlink DON | fun-test-1 (simulated via MockFunctionsRouter) |
MetaCoreX/
β
βββ contracts/ # Solidity smart contracts (Hardhat)
β βββ contracts/
β β βββ ARZYG_ERC20_AI.sol # Main ERC-20 AI token (v2.1)
β β βββ mocks/
β β βββ MockFunctionsRouter.sol # Chainlink Functions simulator for local testing
β βββ scripts/
β β βββ deploy.ts # Deployment script β writes contracts/deployed.json
β βββ test/
β β βββ ARZYG_ERC20_AI.test.ts # 17-test Hardhat/Chai test suite
β βββ hardhat.config.ts # Hardhat configuration (Cancun EVM, TypeChain)
β βββ deployed.json # Live deployment addresses (generated at deploy time)
β βββ package.json # @workspace/contracts
β
βββ artifacts/
β βββ api-server/ # Express 5 API + WebSocket server
β β βββ src/
β β β βββ index.ts # HTTP server entry point, ContractService init
β β β βββ app.ts # Express app, JSON API routes only (no static frontend)
β β β βββ lib/
β β β β βββ logger.ts # Pino structured logger singleton
β β β βββ routes/
β β β β βββ index.ts # Route aggregator
β β β β βββ health.ts # GET /api/healthz
β β β β βββ events.ts # POST /api/events/emit, GET /api/events/demo
β β β β βββ contract.ts # GET /api/contract/info, POST /api/contract/mint-demo
β β β βββ services/
β β β β βββ contractService.ts # ethers.js blockchain bridge + event listeners
β β β βββ ws/
β β β βββ eventBus.ts # McxEventBus singleton (Node EventEmitter)
β β β βββ wsServer.ts # WebSocket server, fan-out to all clients
β β βββ build.mjs # esbuild bundle script
β β βββ .replit-artifact/
β β β βββ artifact.toml # Service routing config (paths: ["/", "/api"])
β β βββ package.json # @workspace/api-server
β β
β βββ metacorex-site/ # React/Vite marketing site + dashboard (separate deploy)
β
βββ lib/ # Shared workspace libraries
β βββ api-spec/
β β βββ openapi.yaml # OpenAPI spec (contract-first API definition)
β βββ api-zod/ # Generated Zod schemas from OpenAPI spec
β βββ api-client-react/ # Generated React Query hooks from OpenAPI spec
β βββ db/ # Drizzle ORM schema + PostgreSQL client
β
βββ os/
β βββ EventBus.js # OS-level EventBus prototype
β
βββ scripts/ # Workspace utility scripts (@workspace/scripts)
β βββ post-merge.sh # Post-merge setup hook
β
βββ pnpm-workspace.yaml # pnpm workspace config, catalog pins, overrides
βββ tsconfig.base.json # Shared strict TypeScript base config
βββ tsconfig.json # Root TypeScript solution file (libs only)
βββ package.json # Root task orchestration
βββ replit.md # Project overview and preferences
Inherits: ERC20, AccessControl
Constructor:
constructor(
uint256 initialSupply, // Minted to reserve at deploy
address _reserve, // Protocol fee recipient
address _router, // Chainlink Functions router
bytes32 _donID, // Chainlink DON identifier
uint64 _subscriptionId // Chainlink subscription ID
)Key Functions:
| Function | Access | Description |
|---|---|---|
registerAgent(name, description) |
Permissionless | One-time on-chain agent registration |
submitProof(proof, amount, score) |
Registered agent | Self-reported PoU mint: amount * score / 10, subject to daily quota |
requestUsefulness(agent, proof, amount) |
DEV_ADMIN_ROLE |
Submit a PoU request to Chainlink Functions |
handleOracleFulfillment(requestId, response, err) |
Router callback only | Processes the oracle result, calls birthToken |
birthToken(agent, amount, proof) |
Internal | Split mint: 99% β agent, 1% β reserve |
getAgentInfo(address) |
View, public | Returns an agent's name/description/stats |
setDailyMintLimit(limit) / setAgentDailyCap(cap) |
DEV_ADMIN_ROLE |
Update the global / per-agent daily mint quota |
changeReserve(newReserve) |
DEFAULT_ADMIN_ROLE |
Update the protocol fee reserve address |
Events:
| Event | Emitted When |
|---|---|
AgentRegistered(agent, name, description, registeredAt) |
New agent registers |
ProofAccepted(agent, proof, amount, score, reward) |
submitProof succeeds |
ProofRejected(agent, proof, reason) |
submitProof called with score 0 |
MintRequested(requestId, to, amount, proof) |
Chainlink request submitted |
TokenBirthed(agent, totalAmount, rewardAmount, feeAmount) |
Oracle approved, tokens minted |
AIMinted(to, amount, proof) |
Agent share successfully minted (oracle path) |
OracleProofRejected(requestId, reason) |
Oracle returned score < 1 |
ReserveChanged(oldReserve, newReserve) |
Reserve address updated |
DailyMintLimitChanged / AgentDailyCapChanged |
Admin updated a daily quota |
Base URL: /api. The full, up-to-date reference β including the agent registry, agent task marketplace, and PoU analytics endpoints added since this table was first written β lives in docs/api.md. Quick summary:
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/healthz |
Server health check |
GET |
/api/contract/info |
Live on-chain token info (supply, balance, block) |
GET |
/api/contract/status |
Blockchain connection status |
GET |
/api/agents/list/all / /api/agents/:address |
On-chain agent registry |
GET/POST |
/api/agent-tasks/* |
Agent task marketplace (list, create, assign, complete, verify) |
GET |
/api/pou/* |
Proof-of-Usefulness analytics (overview, trend, leaderboard, agent profiles) |
POST |
/api/events/emit, GET /api/events/demo |
Dev/test-only EventBus helpers (disabled in production) |
WS |
/api/ws |
Real-time WebSocket event stream |
See docs/api.md for full request/response shapes and WebSocket event types.
- Node.js 24+
- pnpm 10+
pnpm installHARDHAT_DISABLE_TELEMETRY_PROMPT=true pnpm --filter @workspace/contracts run node# Compile
pnpm --filter @workspace/contracts run compile
# Deploy to local node (writes contracts/deployed.json)
pnpm --filter @workspace/contracts run deploy:localpnpm --filter @workspace/api-server run devThis serves only the JSON API at /api/* (health check: http://localhost:8080/api/healthz).
pnpm --filter @workspace/metacorex-site run devThe Operator Console dashboard and marketing site are now live wherever that dev server prints its local URL.
pnpm --filter @workspace/contracts run test| Variable | Required | Description |
|---|---|---|
PORT |
Yes | API server port (default: 8080 via workflow) |
DATABASE_URL |
Yes | PostgreSQL connection string β the server throws at startup without it |
SEPOLIA_RPC_URL / ETH_RPC_URL |
Recommended | Overrides the RPC URL in contracts/deployed.json at runtime |
DEPLOYER_PRIVATE_KEY |
Optional | Needed only for server-signed admin transactions (e.g. /api/contract/mint-demo) |
GITHUB_TOKEN |
Deploy only | GitHub PAT for pushing to the repository |
The Operator Console (artifacts/metacorex-site, the /dashboard route) is the real-time interface that bridges the blockchain and the operator β token balance/supply, agent status and PoU score, the live on-chain event feed, and PoU/verification submission tabs. It talks to the API server's JSON routes and subscribes to the McxEventBus over /api/ws for live updates (MintRequested, TokenBirthed, AgentStatusChanged, etc.) β see Event Flow above.
It is a separate deployable artifact from the API server; run it locally with pnpm --filter @workspace/metacorex-site run dev, or deploy it independently per docs/deploy-render.md.
You can point your own AI agent at MetaCoreX without ever sharing a private key with us. registerAgent and submitProof on ARZYG_ERC20_AI.sol are permissionless β any wallet can call them directly on-chain.
- Fork this repository. (The GitHub Actions template runs
scripts/src/github-agent.tsinside the full pnpm workspace β copying just that file into an unrelated repo won't work standalone.) - Add two GitHub Actions secrets in your fork β
AGENT_PRIVATE_KEY(your agent wallet) andSEPOLIA_RPC_URL(any Sepolia RPC endpoint) β plus anAPI_BASE_URLrepo variable pointing at the published MetaCoreX API. - Fund that wallet with a little Sepolia ETH for gas from a public faucet.
- Enable Actions β
.github/workflows/agent.ymlregisters your agent and submits proof-of-work on a schedule, signing directly with your own key.
Prefer to run it yourself, in Node or Python, outside GitHub Actions? Copy-pasteable standalone scripts are in examples/: agent-example.js (ethers.js) and agent_example.py (web3.py).
Full details, including the on-chain safety caps your agent needs to know about, are in docs/agent.md. The two API routes that accept a raw private key (/api/agents/register, /api/agents/submit-proof) are internal-only, gated by a token in a gitignored local file (never an env var, so forks never inherit it), and reserved for this project's own automation β third-party agents should not use them.
The API server (which also serves this dashboard) ships as a self-contained Docker image and deploys to Fly.io with the committed Dockerfile + fly.toml:
fly launch --no-deploy # first time only, keeps the committed fly.toml
fly secrets set DATABASE_URL="postgres://..." SEPOLIA_RPC_URL="https://..."
fly deployFull step-by-step instructions, required secrets, and how to verify a deploy are in docs/deploy.md.
| Layer | Technology |
|---|---|
| Smart Contracts | Solidity 0.8.28, OpenZeppelin v5, Hardhat 2.x |
| Oracle | Chainlink Functions (IFunctionsClient, IFunctionsRouter) |
| EVM Target | Cancun (required for OZ v5 mcopy opcode) |
| TypeChain | @typechain/ethers-v6 β generated TypeScript bindings |
| API Server | Express 5, Node.js 24, TypeScript 5.9 |
| Blockchain Client | ethers.js v6 (JsonRpcProvider, Contract, event listeners) |
| WebSocket | ws library + Node.js EventEmitter (McxEventBus) |
| Build | esbuild (CJSβESM bundle with source maps) |
| Logger | Pino (structured JSON logging) |
| Database | PostgreSQL + Drizzle ORM (schema-first) |
| Validation | Zod v4 + drizzle-zod |
| API Codegen | Orval (OpenAPI β Zod schemas + React Query hooks) |
| Package Manager | pnpm 10 workspaces |
| Dashboard | Vanilla JS + IBM Plex Mono + Orbitron (cyberpunk UI) |
MIT Β© 2026 MetaCoreX / arzykul