đ Quick Start
đ Demo Mode (Free Testing):
âĸ Use payment_id starting with "demo_" (e.g., demo_test_123)
âĸ No payment required - instant testing!
đ° Production Mode:
1. Send 0.1 USDC to the service wallet on Base network
2. Use the transaction hash as payment_id
3. Call the API with your contract address
đŗ X402 Protocol Support
RugDetector is fully X402-compliant, enabling native HTTP payment flow using industry-standard headers.
đĄ Payment Required Response (HTTP 402)
When payment is required, the API returns:
HTTP/1.1 402 Payment Required
X-PAYMENT-RESPONSE: eyJzY2hlbWVzIjpbeyJzY2hlbWUiOi...
WWW-Authenticate: X402
Content-Type: application/json
{
"error": "Payment required",
"error_code": "PAYMENT_REQUIRED",
"message": "This endpoint requires payment. Send 0.1 USDC on Base network.",
"payment_details": {
"amount": "0.1",
"currency": "USDC",
"network": "base"
}
}
đ X-PAYMENT Header
Include payment proof via X-PAYMENT header (base64-encoded JSON):
// Payment payload (before encoding)
{
"scheme": "exact",
"network": "base",
"currency": "USDC",
"amount": "0.1",
"txHash": "0xYOUR_TRANSACTION_HASH"
}
// Example request with X-PAYMENT header
curl -X POST https://rugdetector.ai/check \
-H "Content-Type: application/json" \
-H "X-PAYMENT: eyJzY2hlbWUiOiJleGFjdCIsIm5ldHdvcmsi..." \
-d '{"contract_address": "0x1234..."}'
đ X-PAYMENT-RESPONSE Header
The X-PAYMENT-RESPONSE header contains base64-encoded payment details:
// Decoded X-PAYMENT-RESPONSE header
{
"schemes": [{
"scheme": "exact",
"network": "base",
"currency": "USDC",
"amount": "0.1",
"recipient": "0xYourServiceWallet",
"description": "Smart contract analysis",
"metadata": {
"service": "rugdetector",
"version": "1.0.0",
"endpoint": "/check"
}
}]
}
âšī¸ Dual Payment Support: RugDetector accepts payment proof via both X-PAYMENT header (X402 standard) and JSON body payment_id field for maximum compatibility.
đ Service Discovery
GET /.well-known/ai-service.json
Returns X402 manifest with pricing and capabilities
đ¤ Request Format
{
"payment_id": "tx_0xYOUR_TRANSACTION_HASH",
"contract_address": "0x1234567890abcdef1234567890abcdef12345678",
"blockchain": "ethereum"
}
payment_id
required
USDC payment transaction hash (format: tx_0x...)
contract_address
required
Smart contract address to analyze (0x...)
blockchain
optional
Network: ethereum, base, bsc, polygon, or solana (default: ethereum)
đĨ Response Format
{
"success": true,
"data": {
"riskScore": 0.78,
"riskCategory": "high",
"confidence": 0.92,
"features": {
"hasOwnershipTransfer": true,
"liquidityRatio": 0.23,
"giniCoefficient": 0.76,
"... 57 more features": "..."
},
"recommendation": "High risk detected. Avoid investing.",
"analysis_timestamp": "2025-10-24T02:00:00Z",
"zkml": {
"proof_id": "cc0bad36b87b96ea",
"protocol": "jolt-atlas-v1",
"verifiable": true
}
}
}