Dark ComputeOpen the pool
Agents API · v1

Rent sealed, from code.

A read-only API for programs and AI agents: markets, the batch clock, the spec and a book simulator. It never takes an order or a salt. Sealing and signing stay on your side, so the server cannot see what you are about to trade.

Markets

Every GPU class and Dark Room, who can enter it, and the live open-market reference.

curl https://www.darkcompute.cfd/api/v1/markets

Batch clock

The L1 block the contract reads, the open batch, its phase and how long is left.

curl https://www.darkcompute.cfd/api/v1/clock

Spec

Chain, contract addresses, the commitment format, fees and holder tiers.

curl https://www.darkcompute.cfd/api/v1/spec

Clear a book

Run the contract's clearing rule on a hypothetical book before you bid.

curl -X POST https://www.darkcompute.cfd/api/v1/clear \
  -H "content-type: application/json" \
  -d '{
    "bids": [{ "gpuHours": 192, "limit": 2.95, "tier": 2 }, { "gpuHours": 400, "limit": 2.80 }],
    "asks": [{ "gpuHours": 300, "limit": 2.60 }]
  }'

Seal an order in your own process

The commitment is one hash over eight fields. Build it locally, send only the hash on-chain, and keep the salt until the reveal window.

import { encodeAbiParameters, keccak256, toHex } from "viem";

// 1. read the open batch
const clock = await fetch("https://www.darkcompute.cfd/api/v1/clock").then((r) => r.json());
if (clock.phase !== "commit" || clock.blocksLeft < 2) throw new Error("wait for the next batch");

// 2. seal the order locally: the salt never leaves this process
const salt = toHex(crypto.getRandomValues(new Uint8Array(32)));
const order = { market: MARKET_ID, side: 0, gpus: 8, hrs: 24, limit: 2_950_000n };
const hash = keccak256(encodeAbiParameters(
  [{ type: "address" }, { type: "uint64" }, { type: "bytes32" }, { type: "uint8" },
   { type: "uint32" }, { type: "uint32" }, { type: "uint128" }, { type: "bytes32" }],
  [TRADER, BigInt(clock.batchId), order.market, order.side, order.gpus, order.hrs, order.limit, salt],
));

// 3. commit(hash) now, reveal(commitId, ...order, salt) in the reveal window
No key, no account

Open endpoints with CORS enabled. Markets and spec are cached for five minutes; the clock is live.

Same rule as the contract

The simulator runs the code that is tested bit for bit against on-chain settlement, tiers included.

Nothing to leak

No endpoint accepts an order. What you have not revealed on-chain exists only where you computed it.