IFF Trust Oracle
The Trust Middleware for x402 Protocol. Validate endpoints, calculate trust scores, and publish to ERC-8004 on-chain reputation registries.
x402 Probing
Actively verify endpoints for x402 protocol compliance
Trust Scoring
Multi-dimensional scoring: availability, latency, compliance
TEE Verification
Trusted Execution Environment attestation support
ERC-8004
Decentralized AI agent reputation registry on-chain
Introduction
What is IFF Trust Oracle?
IFF Trust Oracle is a trust middleware service for the x402 ecosystem. It provides:
- Endpoint Probing — Validates if endpoints return proper 402 Payment Required responses
- Trust Scores — Calculates reputation scores based on availability, latency, and protocol compliance
- TEE Attestation — Verifies Trusted Execution Environment proofs for enhanced security
- ERC-8004 Integration — Publishes AI agent reputation scores to decentralized registries on Ethereum/Base
What is ERC-8004?
ERC-8004 is an Ethereum standard for decentralized AI agent reputation registries. It enables:
- Agent Registration — Register AI agents with unique identifiers on-chain
- Reputation Scores — Store and query trust scores (0-100) for any registered agent
- Oracle Network — Authorized oracles publish verified reputation data
- Interoperability — Standard interface for cross-platform agent trust verification
IFF Trust Oracle serves as an authorized oracle, calculating trust scores from real-world endpoint probes and publishing them to ERC-8004 registries.
Trust Score Algorithm
Scores are calculated using weighted factors:
| Factor | Weight | Description |
|---|---|---|
| Availability | 30% | Success rate of probe requests |
| Latency | 15% | Response time performance |
| x402 Compliance | 25% | Protocol adherence |
| Data Quality | 20% | Quality of returned data |
| History | 10% | Historical stability |
| TEE Bonus | +10 | Bonus for TEE verified endpoints |
Tutorial
Query Trust Score (Public)
Check the trust score of any indexed endpoint:
curl "https://ifandonlyif.io/api/v2/trust/check?url=https://example.com"
Response includes trust score, level (EXCELLENT/GOOD/MODERATE/LOW/CRITICAL), and breakdown.
List All Endpoints (Public)
Browse all indexed endpoints with pagination:
curl "https://ifandonlyif.io/api/v2/trust/endpoints?page=1&page_size=20"
Register (For Protected APIs)
Register your wallet address to access protected endpoints:
curl -X POST "https://ifandonlyif.io/api/v2/auth/register" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "0xYourWalletAddress",
"username": "your_username"
}'
Login with Wallet Signature
Sign a message with your wallet (EIP-191 personal_sign) and login:
curl -X POST "https://ifandonlyif.io/api/v2/auth/login" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "0xYourWalletAddress",
"message": "Login to IFF Trust Oracle\nTimestamp: 1706600000",
"signature": "0xYourSignatureHere"
}'
Returns access_token and refresh_token. Use the access_token in Authorization header.
Register an Endpoint (Protected)
Register your x402 endpoint for trust monitoring:
curl -X POST "https://ifandonlyif.io/api/v2/endpoints" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"url": "https://your-x402-endpoint.com/api",
"name": "My x402 Service",
"description": "Payment-enabled API endpoint"
}'
API Documentation
Base URL
https://ifandonlyif.io
Public Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /api/v2/trust/check?url= | Query trust score by URL |
| GET | /api/v2/trust/endpoints | List all indexed endpoints |
| GET | /api/v2/trust/endpoints/:id | Get endpoint details |
| GET | /api/v2/trust/endpoints/:id/history | Get score history |
| GET | /api/v2/trust/endpoints/:id/on-chain | Get on-chain reputation |
Authentication Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v2/auth/register | Register new user with wallet |
| POST | /api/v2/auth/login | Login with wallet signature |
| POST | /api/v2/auth/refresh | Refresh access token |
Protected Endpoints (Requires Auth)
Include header: Authorization: Bearer YOUR_TOKEN
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v2/endpoints | Register new endpoint |
| PUT | /api/v2/endpoints/:id | Update endpoint |
| DELETE | /api/v2/endpoints/:id | Delete endpoint |
| POST | /api/v2/endpoints/:id/link-agent | Link endpoint to ERC-8004 on-chain agent |
| POST | /api/v2/probe/check | Trigger manual probe |
| GET | /api/v2/probe/results/:endpointId | Get probe results |
Admin Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v2/admin/verify-tee/:id | Verify TEE attestation |
| POST | /api/v2/admin/recalculate-scores | Recalculate all scores |
| POST | /api/v2/admin/register-oracle | Register oracle in ERC-8004 registry |
| POST | /api/v2/admin/publish-reputation/:id | Publish reputation to ERC-8004 |