api.kasparex.com

Kasparex API

The coordination brain of the decentralized Kasparex network

What is the Kasparex API?

The Kasparex API is a lightweight backend service that coordinates KREX Nodes, tracks uptime and performance, calculates rewards (GRID + KREX multipliers), and provides public data for the Kasparex frontend and ecosystem.

Think of it as:

  • KREX Nodes are the body: they pin and mirror data
  • Kasparex API is the brain: it tracks, scores, and coordinates them

Important: The Kasparex API does NOT replace Kaspa BlockDAG, Storacha, or IPFS. It simply manages the node network and reward coordination.

Why is the Kasparex API needed?

Without the Kasparex API, KREX Nodes would have no identity, uptime tracking, reward calculation, reputation system, or coordination. Decentralized storage (IPFS/Storacha) alone is blind; the Kasparex API gives structure and reward mechanisms to the network.

Node Management

Allows KREX Nodes to register, send heartbeat pings, and report stats

Reward Engine

Calculates and distributes GRID rewards with KREX multipliers

Public Data

Provides node lists, dApp availability, and network statistics

Coordination

Organizes how dApps find mirror nodes and ensures graceful fallback

API Endpoints

All endpoints begin with /api

1. Node Management Endpoints

POST/api/node/register

Nodes call this when they start for the first time to create an identity.

{
  "nodeName": "MyNode01",
  "role": "light",
  "ownerWallet": "kaspa:q....",
  "version": "1.0.0"
}
POST/api/node/ping

Heartbeat every 60 seconds to report uptime and stats.

{
  "nodeId": "grid_02f8a9c",
  "uptimeSeconds": 60,
  "pinnedCount": 120,
  "apiRequestsServed": 34,
  "dappRequests": {
    "raffles": 12,
    "heatmap": 5
  }
}
GET/api/nodes

Returns list of active nodes for frontend, explorers, and node dashboards.

2. Reward Engine Endpoints

GET/api/rewards/node/:nodeId

Returns rewards for a specific node including GRID and multipliers.

{
  "epoch": "2025-02-08",
  "gridReward": 52,
  "rewardsDetail": {
    "heatmap": 12,
    "raffles": 22
  },
  "multiplier": {
    "role": 2.0,
    "krex": 1.2
  }
}
GET/api/rewards/epoch/:epochId

Summary of all rewards in an epoch.

3. Public Data Endpoints

GET/api/dapps/availability

Returns which nodes mirror which dApps. Helps frontend prioritize fast/nearby nodes.

{
  "raffles": ["grid_02f8a9c", "grid_1aa24fe"],
  "heatmap": ["grid_02f8a9c"],
  "time-locker": []
}
GET/api/stats

General network statistics for dashboards and explorers.

{
  "nodesOnline": 17,
  "mirrorNodes": 4,
  "lightNodes": 13,
  "totalPinnedCids": 22000,
  "networkHealth": "good"
}

How the Kasparex API Affects Your Project

1. Enables Decentralization

KREX Nodes need a place to report, sync, and coordinate. Without this API, they have no network structure.

2. Enables Rewards

You cannot calculate uptime, requests, pinned data, or KREX multipliers without this API. The reward system is impossible without the Kasparex API.

3. Protects the Marketplace

If Vercel/CDN fails, IPFS, Storacha, and KREX Nodes deliver. Frontend discovers memoized mirrors via /api/dapps/availability.

4. Reduces Costs

The Kasparex API redirects "where to download from". If the API says a mirror node is nearby, the frontend loads metadata from it instead of Vercel.

5. Enables Dashboards

User dashboards can show "My KREX Node: Online/Offline", rewards, uptime, GRID earnings, and KREX multiplier tier.

Technical Summary

Kasparex API is:

  • A lightweight JSON REST API
  • Stores node registrations and tracks uptime/performance
  • Calculates GRID rewards and handles KREX multipliers
  • Provides data for the frontend and organizes dApp mirror discovery
  • Ensures graceful fallback if IPFS is slow
  • Enables analytics, dashboards, and future features

It is the "network coordinator" of your decentralized network.

Future: vProgs Integration

When Kaspa smart contracts (vProgs) mature, you could migrate some parts of the Kasparex API logic to vProgs:

  • Reward distribution (store map of wallets → reward totals)
  • Multiplier tiers (based on KREX balances)
  • Node reputation (hashed states)
  • Reward claiming (users claim GRID on-chain)

This becomes a hybrid architecture: Off-chain Kasparex API collects data and processes heavy logic, while On-chain vProg smart contracts verify hashed epochs and allow claiming.

Learn More

Explore the Kasparex ecosystem and learn how to run a KREX Node.