Bring your own engine
Sentik handles the parts around the model: segments, hashes, saving, retrying, stitching and an optional on-chain record. You bring the engine.
Engine interface
One method. The runner calls it once per segment and saves the answer immediately. A thrown error marks that segment failed and nothing else.
// src/lib/resume/engine.ts
export interface TranscriptionEngine {
readonly id: string; // committed on chain as keccak256("<id>@<version>")
readonly version: string;
readonly label: string;
transcribe(input: SegmentInput, signal?: AbortSignal): Promise<{ text: string }>;
}
type SegmentInput = {
index: number; startMs: number; endMs: number; sampleRate: number;
sha256: string; // of the segment's 16-bit PCM bytes
pcm: Float32Array; // mono samples in [-1, 1]
attempt: number; // 1 = first try, 2 = first retry, ...
};
// Throw SegmentError(message, code) for a failure worth retrying (lost GPU,
// timeout, out of memory). Any throw marks the segment failed; only failed
// and unfinished segments run again.Local runner and its HTTP API
examples/runner/server.ts runs on your machine, listens on 127.0.0.1 only, reads WAV files (PCM 8/16/24/32-bit or float), and keeps every job in a folder (job.json rewritten after every segment, plus the exact audio bytes). Kill it at any moment; the next run does only unfinished and failed segments. Every request needs the token it prints at start; requests with another Host, or from a web page (an Origin header), are refused unless you pass --allow-origin; JSON must be sent as application/json; {"path": …} jobs read only regular files inside --input-dir (symlinks resolved). Still, keep it on your own machine: do not expose it to a network. The public repository link appears here once it exists.
# from the repository root
npm install
npm run runner # 127.0.0.1:6526, simulated engine
# it prints a fresh token once: Token (send as "Authorization: Bearer <token>"): 3f9c…
SENTIK_FAIL_FIRST=2,5 npm run runner # make segments 2 and 5 fail once
npm run runner -- --input-dir ~/recordings # allow {"path": …} jobs for files in this folder only
# your own engine: any command that prints the text of one WAV file
SENTIK_ENGINE_CMD="/path/to/transcriber --input {wav}" \
npm run runner -- --engine examples/runner/command-engine.mjsT=<token printed at start>; H="Authorization: Bearer $T"
curl -s -X POST -H "$H" -H 'content-type: audio/wav' --data-binary @meeting.wav \
'http://127.0.0.1:6526/jobs?targetSec=30' # -> {"id":"5d2b…","segmentCount":180,...}
curl -s -X POST -H "$H" -H 'content-type: application/json' -d '{"path":"meeting.wav"}' \
http://127.0.0.1:6526/jobs # only with --input-dir
curl -s -X POST -H "$H" -H 'content-type: application/json' -d '{}' http://127.0.0.1:6526/jobs/<id>/run
curl -s -H "$H" http://127.0.0.1:6526/jobs/<id> # counts + every segment's status
curl -s -X POST -H "$H" -H 'content-type: application/json' -d '{"only":"failed"}' http://127.0.0.1:6526/jobs/<id>/run
curl -s -H "$H" 'http://127.0.0.1:6526/jobs/<id>/transcript?format=srt' # 409 + missing list until complete
curl -s -H "$H" http://127.0.0.1:6526/jobs/<id>/manifest # root, leaves, proofs, result hashesNo speech engine is bundled. command-engine.mjs writes each segment to a temporary 16-bit WAV, runs your command, and takes its standard output as the text; a non-zero exit, a timeout or empty output marks the segment failed.
SentikSegmentManifest on Elysium
Prototype Written and tested (unit, fuzz, invariant and Elysium fork tests); not deployed yet. No owner, no fee, no upgrade path, no payable function. It stores hashes only: no audio, no text, no funds. Deploying costs about 1,650,000 gas in HYPE.
Manifest tree and digests
leaf(i) = keccak256(keccak256(abi.encode(uint32 i, uint64 startMs, uint64 endMs, bytes32 sha256)))
node = keccak256(abi.encode(min(a, b), max(a, b))) // sorted pair
odd node at the end of a layer moves up unchanged
result = keccak256(utf8(JSON {"index","startMs","endMs","text"}))
digest = keccak256(result[0] ‖ result[1] ‖ … ‖ result[n-1]) // stored by finalize()The site, the runner and the contract compute the same values; a test vector written by the TypeScript tests is checked by the Solidity tests.
Trust, stated plainly
- A receipt proves that a worker posted a result hash for a segment whose audio hash is in the committed manifest. It does not prove the text is a correct transcription.
- With open workers, anyone can post a receipt; the owner can reject one, which makes that segment missing again.
- The job owner alone can finalize or cancel. A finalized job is frozen.
- Every write costs gas in HYPE. Nothing is needed on chain to run, retry or stitch.
Check a deployment
npm run contracts:artifacts -- --check # artifacts.json equals a fresh forge build npm run verify-deployment -- --manifest <address> --tx <creation tx hash>