Settlement on Horizen L3

Understand how Harpocrates uses ETH on Horizen L3 for transparent, on-chain billing and metering of AI inference requests while ZEN is not yet live on the L3 mainnet.

How Inference Billing Works

Every inference request on Harpocrates is metered and settled in ETH on the Horizen L3 blockchain. Here's the flow:

  1. You make an inference request with encrypted data
  2. The TEE enclave processes your request and generates a ZK attestation
  3. Usage metrics (input/output tokens) are recorded on-chain
  4. ETH is automatically deducted from your account balance
  5. You receive an on-chain receipt for the transaction
All billing is transparent and auditable. You can verify every charge on the Horizen L3 blockchain using the transaction hash.

Reading On-Chain Receipts

Every inference response includes an on-chain receipt in the usage object:

{
  "id": "inf_1234567890abcdef",
  "usage": {
    "input_tokens": 42,
    "output_tokens": 128,
    "cost_eth": "0.00025",
    "transaction_hash": "0xabcd1234...5678efgh",
    "block_number": 1234567,
    "timestamp": 1704067200
  }
}

You can verify this transaction on a Horizen block explorer using the transaction hash.

// Verify a transaction on-chain
const receipt = await client.getTransactionReceipt(
  result.usage.transaction_hash
);

console.log("Verified on-chain:", receipt.confirmed);
console.log("Block:", receipt.block_number);
console.log("Cost:", receipt.cost_eth, "ETH");

Setting Spending Limits

Protect your account from unexpected costs by setting spending limits:

// Set a daily spending limit
await client.setSpendingLimit({
  period: "daily",
  limit_eth: "0.1" // 0.1 ETH per day
});

// Set a per-request limit
await client.setSpendingLimit({
  period: "per_request",
  limit_eth: "0.01" // Max 0.01 ETH per inference
});

When a limit is reached, new requests will be rejected with a 429 status code until the period resets or you increase the limit.

Example Billing Response

Complete billing information is included in every response:

{
  "id": "inf_9876543210fedcba",
  "object": "inference",
  "created": 1704067200,
  "model": "llm-secure-7b",
  "output": "encrypted_response_data",
  "usage": {
    "input_tokens": 156,
    "output_tokens": 412,
    "total_tokens": 568,
    "cost_eth": "0.000568",
    "cost_usd": "0.042",
    "transaction_hash": "0x1234abcd...efgh5678",
    "block_number": 1234567,
    "gas_used": "21000",
    "timestamp": 1704067200
  },
  "attestation": {
    "proof": "zk_proof_data",
    "enclave_id": "sgx_measurement_xyz",
    "on_chain_verification": "0xverify...hash"
  }
}

Pay-As-You-Go Design

Harpocrates uses a pure pay-as-you-go model with no monthly fees or commitments:

  • ƒ?›Only pay for actual inference tokens used
  • ƒ?›No minimum spending requirements
  • ƒ?›Automatic settlement in ETH on Horizen L3
  • ƒ?›Transparent, verifiable pricing on-chain
  • ƒ?›Volume discounts available (contact sales)
Current pricing is denominated in ETH on Horizen L3 (for example: 0.0001 ETH per token on testnet). Prices are subject to change based on network demand; always check your dashboard or on-chain data for the latest rates.

Funding Your Account

Add ETH on Horizen L3 to your Harpocrates account balance:

# Get your account address
harpocrates account address

# Send ETH on Horizen L3 to your account address from any wallet
# Minimum deposit: 0.01 ETH

Your balance is updated automatically after 12 block confirmations (~2 minutes).

// Check your current balance
const balance = await client.getBalance();
console.log("Available ETH:", balance.available);
console.log("Reserved ETH:", balance.reserved);
console.log("Total:", balance.total);