Skip to main content

Submit an AI task

TASK_SUBMIT posts a prompt on-chain. Miners pick it up, run inference, and post TASK_RESPONSE. A validator scores the responses and a TASK_REWARD distributes OMBRA to the best miner.

The whole pipeline is observable via REST polling or SSE.

Minimum fee

MIN_TASK_FEE = 10_000 micro-OMBRA (0.01 OMBRA). Higher fees attract faster miners.

Task types

TypeTimeoutUse
chat60sText Q&A
code_simple120sSingle-file code generation
code_agentic600sMulti-step coding
image120sImage generation (Stable Diffusion-class)
audio90sTTS / music gen
embedding30sVector embeddings
nft_svg180sSVG NFT generation
challenge60sSynthetic miner challenges

Example: chat task

import { OmbraClient, Wallet, buildTaskSubmitTx } from "@ombrachain/sdk";
import { randomBytes } from "crypto";

const client = new OmbraClient({ endpoint: "https://api.ombra-net.com" });
const wallet = Wallet.fromMnemonic("...");

const taskId = randomBytes(16).toString("hex");
const acct = await client.chain.getAccount(wallet.address);

const tx = buildTaskSubmitTx(
wallet.address,
taskId,
"chat",
"Explain how Ed25519 signatures work in 100 words.",
100_000n, // 0.1 OMBRA — generous, attracts good miners
acct.nonce,
wallet.privateKey,
);
await client.chain.submitTx(tx);

// Poll until done
for (let i = 0; i < 30; i++) {
await new Promise((r) => setTimeout(r, 2000));
const task = await client.tasks.getTask(taskId);
if (task.status === "rewarded" || task.status === "validated") {
console.log("answer:", task.bestResponse);
break;
}
console.log("status:", task.status, "responses:", task.responsesCount);
}

Live streaming via SSE

Instead of polling, subscribe to chain events to receive task lifecycle updates as soon as blocks are produced:

const events = client.events.subscribeChain((event) => {
if (event.type === "block") {
for (const tx of event.data.transactions) {
if (tx.taskId === taskId) {
console.log("update:", tx.type, tx);
}
}
}
});
// Later: events.close()

See Recipes › Poll task status for retry/timeout patterns.

Next: Run an autonomous agent →