Developer Reference

API Reference

JSON-RPC and REST endpoints for QuantumDEX — karma scores, pool data, routing, and ThiChain L1 precompile calls.

RPC JSON-RPC 2.0REST HTTPSChain 420420 / 420421

Base URLs

EnvironmentURLChain ID
Mainnet RPChttps://rpc.thichain.io420420
Testnet RPChttps://testnet-rpc.thichain.io420421
REST APIhttps://api.quantumdex.io/v1
Testnet RESThttps://api-testnet.quantumdex.io/v1
WebSocketwss://rpc.thichain.io/ws420420

Authentication

Public RPC endpoints are rate-limited but require no authentication for standard read operations. For higher rate limits, include your API key in the header:

curl https://api.quantumdex.io/v1/karma/0x1234... \
  -H "X-API-Key: qb_live_your_api_key_here"

API keys are available from the Developer Dashboard (launching with testnet).

JSON-RPC Methods

ThiChain L1 is EVM-compatible and supports all standard Ethereum JSON-RPC methods plus ThiChain-specific extensions:

Standard Methods (inherited from Ethereum)

// Get block number
{ "method": "eth_blockNumber", "params": [] }

// Get balance
{ "method": "eth_getBalance", "params": ["0x...", "latest"] }

// Send transaction
{ "method": "eth_sendRawTransaction", "params": ["0x...signedTx"] }

// Call contract
{ "method": "eth_call", "params": [{ "to": "0x...", "data": "0x..." }, "latest"] }

ThiChain Extensions

// Get karma score
{ "method": "thichain_getKarmaScore", "params": ["0xWalletAddress"] }
// Returns: { "score": 420, "tier": "PRACTITIONER", "lastUpdated": "0x..." }

// Get dharmic validation result
{ "method": "thichain_dharmicValidate",
  "params": ["0xContractAddress", "0xCalldata"] }
// Returns: { "passed": true, "yamaScores": {...}, "overallScore": 0.87 }

// Get consciousness score (if opted in)
{ "method": "thichain_getConsciousnessScore", "params": ["0xAddress"] }
// Returns: { "dimensions": {...}, "overallScore": 72.4 }

REST Endpoints

Karma

MethodEndpointDescription
GET/karma/{address}Get karma score + tier for address
GET/karma/{address}/historyKarma event history (paginated)
GET/karma/leaderboardTop 100 karma scores

Pools

MethodEndpointDescription
GET/poolsList all pools (sorted by TVL)
GET/pools/{address}Single pool details + reserves
GET/pools/{address}/swapsRecent swaps for a pool

Routing

MethodEndpointDescription
POST/route/quoteGet swap quote with karma-adjusted fee
POST/route/bestGet optimal route (multi-hop)
// POST /route/quote
{
  "tokenIn": "0x...USDC",
  "tokenOut": "0x...THI",
  "amountIn": "100000000",      // 100 USDC in wei
  "walletAddress": "0x..."      // optional — for karma fee lookup
}
// Response
{
  "amountOut": "98450000000000000000",
  "priceImpact": "0.012",
  "feeBps": 15,
  "karmaTier": "PRACTITIONER",
  "route": [{ "pair": "0x...", "fee": 15 }]
}

ThiChain Precompiles

ThiChain L1 exposes consciousness and dharmic functionality as EVM precompiles — callable from Solidity contracts or directly via eth_call:

AddressNameFunction
0x0420ConsciousnessAIML inference for 15D QCS scoring
0x0421KarmaOracleOn-chain karma score lookup
0x0422TemporalOracleTime-aware predictions
0x0423DharmicValidator5-Yama ethical validation
// Call KarmaOracle precompile directly (Solidity)
(bool success, bytes memory result) = address(0x0421).staticcall(
    abi.encode(userAddress)
);
uint256 karmaScore = abi.decode(result, (uint256));

Rate Limits

TierRequests/minAuth Required
Public60No
Developer (Visitor karma)300API Key
Practitioner (karma 251+)1,000API Key
Guardian (karma 751+)UnlimitedAPI Key
Rate limits are karma-adjusted — higher karma scores unlock faster API access, mirroring the on-chain fee tier system.