👨‍💻 AiloCoin Developers

API Documentation & SDK Reference

🚀 Quick Start

AiloCoin provides a JSON-RPC 2.0 compatible API and a JavaScript SDK for easy integration.

RPC Endpoint

https://ailo.site/api/v1/rpc

Explorer API

https://ailo.site/api/v1/explorer/*

Install SDK (Browser)

<script src="https://ailo.site/sdk/ailocoin-sdk.js"></script>
<script>
    const sdk = new AiloCoinSDK();
    sdk.getTotalSupply().then(supply => console.log('Total Supply:', supply));
</script>

💰 Token Schema

Property Value
Name AiloCoin
Symbol ALC
Decimals 8
Type Utility Token
Standard AiloNetwork-v1
Max Supply Unlimited (mined through AI training)

Transaction Types

Type Description
MINT New tokens created as mining rewards
TRANSFER Tokens transferred between addresses
BURN Tokens permanently destroyed
STAKE Tokens locked for staking rewards

📡 JSON-RPC Methods

alc_getBalance

Get the balance of an address.

// Request
{
    "jsonrpc": "2.0",
    "method": "alc_getBalance",
    "params": ["0xab33ea13f25eca5e90435f150892a1235f4f8b4d"],
    "id": 1
}

// Response
{
    "jsonrpc": "2.0",
    "result": 173.31626367,
    "id": 1
}

alc_getTransaction

Get transaction details by hash.

// Request
{
    "jsonrpc": "2.0",
    "method": "alc_getTransaction",
    "params": ["0x165aad9b50739feddd07c0d8accf0eae"],
    "id": 1
}

// Response
{
    "jsonrpc": "2.0",
    "result": {
        "hash": "0x165aad9b50739feddd07c0d8accf0eae",
        "type": "MINT",
        "from": "0xSYSTEM",
        "to": "0xab33ea13f25eca5e90435f150892a1235f4f8b4d",
        "amount": 5.731210183780282,
        "timestamp": 1765537562181
    },
    "id": 1
}

alc_getTotalSupply

Get total ALC in circulation.

// Request
{
    "jsonrpc": "2.0",
    "method": "alc_getTotalSupply",
    "params": [],
    "id": 1
}

// Response
{
    "jsonrpc": "2.0",
    "result": 173.31626367,
    "id": 1
}

alc_getNetworkStats

Get network statistics.

// Request
{
    "jsonrpc": "2.0",
    "method": "alc_getNetworkStats",
    "params": [],
    "id": 1
}

// Response
{
    "jsonrpc": "2.0",
    "result": {
        "blockNumber": 35,
        "totalSupply": 173.31626367,
        "activeAddresses": 7,
        "latestTimestamp": 1766093366470
    },
    "id": 1
}

All RPC Methods

Method Params Returns
alc_getBalance [address] number
alc_getTransaction [hash] object
alc_getTransactionsByAddress [address, limit?] array
alc_getBlockNumber [] number
alc_getTotalSupply [] number
alc_getNetworkStats [] object
alc_getTokenInfo [] object

🔍 Explorer API

REST API for blockchain exploration (no authentication required).

Endpoint Method Description
/api/v1/explorer/stats GET Network & token statistics
/api/v1/explorer/transactions GET Recent transactions (limit, offset)
/api/v1/explorer/tx/:hash GET Transaction by hash
/api/v1/explorer/address/:address GET Address info with balance
/api/v1/token GET Token schema

Example: Get Network Stats

curl https://ailo.site/api/v1/explorer/stats

🔐 Transaction Verification API

Decentralized transaction verification with node-based confirmations and consensus-based rollback.

Confirmation Requirements:
  • MIN_CONFIRMATIONS: 10 (required for transaction funds to be spendable)
  • MAX_CONFIRMATIONS: 10 (maximum tracked per transaction)
  • System Transactions: Rewards from NETWORK/SYSTEM are auto-confirmed (no verification needed)

POST /api/verify-transaction

Submit a positive verification for a transaction (acts as node confirmation).

// Request
{
    "txHash": "0x29eec573e3c5a9f82b30aa3752acf3dd...",
    "verifierWallet": "0xab33ea13f25eca...",
    "nodeId": "unique-node-identifier"
}

// Response (pending - needs more verifications)
{
    "success": true,
    "status": "PENDING",
    "confirmations": 1,
    "required": 2,
    "max": 10,
    "message": "Need 1 more verification(s)"
}

// Response (confirmed - reached minimum)
{
    "success": true,
    "status": "CONFIRMED",
    "confirmations": 2,
    "required": 2,
    "max": 10,
    "message": "Transaction confirmed with 2 verifications"
}

GET /api/transaction-verifications/:hash

Get the verification count for a specific transaction.

// Response
{
    "success": true,
    "confirmations": 3,
    "isConfirmed": true,
    "required": 2,
    "max": 10,
    "firstVerified": 1766282833180
}

POST /api/report-transaction

Report a suspicious transaction for network consensus.

// Request
{
    "reporterWallet": "0xab33ea13f25eca...",
    "txTimestamp": 1765537562181,
    "reason": "Local verification failed"
}

// Response (under threshold)
{
    "success": true,
    "status": "REPORTED",
    "reporterCount": 2,
    "activeNodeCount": 5,
    "consensusPercent": 40.0,
    "threshold": 51,
    "message": "Report recorded. 11.0% more needed for rollback."
}

// Response (consensus reached - REVERSED)
{
    "success": true,
    "status": "REVERSED",
    "message": "Transaction reversed due to consensus",
    "consensusPercent": 60.0,
    "rollbackTxId": 156
}

GET /api/transaction-status/:timestamp

Check the verification status of a transaction.

// Response
{
    "success": true,
    "data": {
        "timestamp": 1765537562181,
        "status": "CONFIRMED",  // CONFIRMED | REPORTED | DISPUTED | REVERSED
        "reporterCount": 0,
        "consensusPercent": 0,
        "reversedAt": null
    }
}

Transaction Status Flow

Status Description
CONFIRMED Transaction verified, no reports
REPORTED Some nodes reported, under 51% consensus
DISPUTED 51% consensus reached, rollback pending
REVERSED Rollback executed, funds returned to sender
Note: System rewards (TRAINING_REWARD, INFERENCE_REWARD, BLOCK_REWARD) with from=NETWORK cannot be rolled back.

📦 JavaScript SDK

Installation

// Browser
<script src="https://ailo.site/sdk/ailocoin-sdk.js"></script>

// Or download and include locally
<script src="/path/to/ailocoin-sdk.js"></script>

Usage Examples

// Initialize SDK
const sdk = new AiloCoinSDK();

// Get balance
const balance = await sdk.getBalance('0xab33ea13f25eca5e90435f150892a1235f4f8b4d');
console.log('Balance:', balance, 'ALC');

// Get total supply
const supply = await sdk.getTotalSupply();
console.log('Total Supply:', supply, 'ALC');

// Get network stats
const stats = await sdk.getNetworkStats();
console.log('Block Number:', stats.blockNumber);
console.log('Active Addresses:', stats.activeAddresses);

// Get transaction history
const addressInfo = await sdk.getAddressInfo('0x123...');
console.log('Transaction Count:', addressInfo.transactionCount);

SDK Methods

Method Returns Description
getBalance(address) Promise<number> Get address balance
getAddressInfo(address) Promise<object> Full address info
getTransaction(hash) Promise<object> Transaction details
getTransactionsByAddress(address) Promise<array> Address transactions
getRecentTransactions(limit) Promise<object> Recent transactions
getBlockNumber() Promise<number> Current block height
getTotalSupply() Promise<number> Total ALC supply
getNetworkStats() Promise<object> Network statistics
getTokenInfo() Promise<object> Token schema

⛏️ CUDA Mining API

GPU-accelerated mining endpoints for submitting training gradients and receiving rewards.

Mining Requirements:
  • GPU: NVIDIA GPU with CUDA support (RTX 2060+ recommended)
  • VRAM: Minimum 4GB, 8GB+ recommended
  • Gradient Size: Maximum 50MB per submission

POST /api/cuda/submit

Submit compressed gradients from CUDA training to earn rewards.

// Request (multipart/form-data)
{
    "walletAddress": "0xab33ea13f25eca...",
    "gradients": ,  // Compressed gradient buffer
    "epoch": 42,
    "loss": 3.5648,
    "tokensProcessed": 40960
}

// Response (success)
{
    "success": true,
    "message": "Gradients received and queued for aggregation",
    "reward": 0.0425,
    "txId": 2547,
    "poolSize": 3,
    "aggregationThreshold": 3
}

// Response (error - gradient too large)
{
    "success": false,
    "error": "Gradient too large (52MB > 50MB limit). Please update your miner."
}

GET /api/cuda/stats

Get real-time statistics about active CUDA miners.

// Response
{
    "clients": [
        {
            "wallet": "0xab33ea13f2...",
            "gpu": "NVIDIA GeForce RTX 3080",
            "vram": 10,
            "hashrate": 45.2,
            "gradientsSubmitted": 127,
            "totalRewards": "12.4500",
            "lastLoss": 3.5648,
            "lastSeen": 15
        }
    ],
    "poolSize": 2,
    "totalGradientsSubmitted": 5842,
    "aggregationThreshold": 3
}

GET /api/cuda/version

Check if a miner update is available. Miners can use this to notify users about new versions.

// Response
{
    "success": true,
    "requiredVersion": "1.3.0",
    "downloadUrl": "https://ailo.site/downloads/cuda-miner-latest.zip",
    "changelog": "v1.3.0: FP16 optimization for 5-10x faster training"
}

GET /api/model/weights

Get current model metadata and training state.

// Response
{
    "version": 146,
    "lastUpdated": "2025-12-26T18:42:44.831Z",
    "paramCount": 899000000,
    "avgLoss": 3.674,
    "totalGradientsApplied": 233,
    "hasCheckpoint": true,
    "bestCheckpointLoss": 2.87
}

GET /api/model/aggregated-gradients

Download the latest aggregated gradients for model synchronization.

// Response: Binary Float16 gradient data
Content-Type: application/octet-stream
X-Gradient-Version: 146
X-Param-Count: 8041120

Reward Calculation

Factor Description
Base Reward 0.01 ALC per valid gradient submission
Loss Bonus Up to 2x multiplier for low loss values
Checkpoint Bonus +50% if new best loss achieved

⚖️ Transaction Dispute API

Endpoints for disputing fraudulent transactions and admin rollback functionality.

Important: Only TRANSFER transactions within 5 days can be disputed. System rewards (MINT, TRAINING_REWARD) cannot be disputed.

GET /api/transaction/disputed

List all currently disputed transactions (admin use).

// Response
{
    "success": true,
    "transactions": [
        {
            "id": 2547,
            "type": "TRANSFER",
            "from_wallet": "0xab33ea13f2...",
            "to_wallet": "0x9e3f4d2d2a...",
            "amount": 10.5,
            "timestamp": 1735234567890,
            "status": "DISPUTED"
        }
    ]
}

POST /api/transaction/dispute

Dispute a transaction (sender or admin only, within 5 days).

// Request
{
    "txId": 2547,
    "reason": "Unauthorized transaction",
    "requesterWallet": "0xab33ea13f2..."
}

// Response (success)
{
    "success": true,
    "message": "Transaction disputed successfully",
    "txId": 2547,
    "status": "DISPUTED",
    "note": "Admin must approve rollback to reverse this transaction"
}

// Response (error - too old)
{
    "success": false,
    "error": "Transaction too old to dispute (>5 days)"
}

POST /api/transaction/rollback

Rollback a disputed transaction (admin only).

// Request
{
    "txId": 2547,
    "adminKey": "your-admin-key"
}

// Response
{
    "success": true,
    "message": "Transaction rolled back successfully",
    "txId": 2547,
    "amount": 10.5,
    "returnedTo": "0xab33ea13f2...",
    "deductedFrom": "0x9e3f4d2d2a..."
}

Transaction Status Flow

Status Description Can Dispute?
PENDING Awaiting confirmations Yes (within 5 days)
CONFIRMED Fully confirmed (10+ verifications) No
DISPUTED Under admin review N/A
ROLLED_BACK Reversed, funds returned N/A

⚠️ Rate Limits

Current Limits:
• 100 requests per minute per IP
• Maximum 100 transactions per request
• No authentication required for read operations
Note: Write operations (transfers) require wallet authentication and are not available via public RPC.