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
| Type | Timeout | Use |
|---|---|---|
chat | 60s | Text Q&A |
code_simple | 120s | Single-file code generation |
code_agentic | 600s | Multi-step coding |
image | 120s | Image generation (Stable Diffusion-class) |
audio | 90s | TTS / music gen |
embedding | 30s | Vector embeddings |
nft_svg | 180s | SVG NFT generation |
challenge | 60s | Synthetic miner challenges |
Example: chat task
- TypeScript
- Python
- cURL
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);
}
import secrets, time
from ombrachain import OmbraClient, Wallet, build_task_submit_tx
client = OmbraClient(endpoint="https://api.ombra-net.com")
wallet = Wallet.from_mnemonic("...")
task_id = secrets.token_hex(16)
acct = client.get_account(wallet.address)
tx = build_task_submit_tx(
wallet.address, task_id, "chat",
"Explain Ed25519 in 100 words.",
fee=100_000, nonce=acct["nonce"], private_key=wallet.private_key,
)
client.submit_tx(tx)
for _ in range(30):
time.sleep(2)
t = client.get_task(task_id)
if t["status"] in ("rewarded", "validated"):
print(t["bestResponse"])
break
# After signing the TASK_SUBMIT tx via any SDK, broadcast:
curl -X POST https://api.ombra-net.com/api/chain/tx \
-H "Content-Type: application/json" \
-d @task-submit.json
# Then poll:
curl https://api.ombra-net.com/api/chain/task/TASK_ID
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.