// Engineering briefODIN v1.9.2counted at commit df410d3 · 2026-11-27
Rules that hold because a test fails if they don't.
ODIN spends real money on its owners' accounts, so the rules below are written as code and checked by named tests that every release must pass. Everything on this page was counted in the source of v1.9.2.
- 2 s
- one cycle of six steps
- 409
- tests in the trading engine (408 run on every build; 1 is a manual check against a live market)
- 17
- simulated sessions of the real program
- 18
- tests in SLEIPNIR
- 12
- direct dependencies in ODIN (13 on Windows), each scanned for known vulnerabilities
Counted with cargo test -- --list and odin/Cargo.toml at commit df410d3, 2026-11-27. The full test list.
01One program, six steps
ODIN is one program. main reads the command line, sets up, builds an Engine that holds everything carried between cycles, and then calls engine.cycle() in a loop. A cycle is six steps in a fixed order: read the markets, decide, work the NiceHash orders, run the other markets, keep records, draw the screen.
Each step is a struct. It takes this cycle's values by copy, what it only reads by shared reference, and the state it may change by mutable reference, so a step's reach is visible in its field list: the drawing step holds no way to reach an order. Time comes from one clock and every outside address goes through one door; tests replace both.
- 01 READ reading.rs · struct Read: reads markets and config
- 02 DECIDE decide.rs · struct Decide: returns a Decision
- 03 ORDERS orders.rs · struct OrderDesk: may change NiceHash orders
- 04 VENUES venues.rs · struct OtherMarkets: may change venue state
- 05 RECORDS records.rs · struct Records: ledger, report, learned state
- 06 PRESENT present.rs · struct Frame: reads only
- SHARED clock.rs (the one clock), net.rs (the one door outside), model.rs, money.rs, safety.rs, audit.rs
Enforced by: only_
02The gates and the one hold
A spending action needs every gate open: the market set to LIVE, ODIN not in watch-only (DRY_RUN=0), the kill switch armed, a paid plan, a key and a budget, and fresh data. Braiins is the reference every newer market is gated against.
Since v1.6.4 there is one hold for all markets: venue_hold() turns watch-only and a tripped kill switch into a single reason that every market reads. While held: no new orders or rentals, no raised bids, no re-bids; safety stops still run. The Clore and Vast passes read the hold again right before each spending call and start out held. A NiceHash outage also sets the hold, because the kill-switch checks need NiceHash.
The hold gives a reason for watch-only and for a trip: watch_
03The kill switch
The kill switch trips on the daily loss cap across all markets (default 20,000 sats, counting only verified, already-used cost, with a warning at 75%) or on a file named odin_KILLED.flag created while ODIN runs. A trip about money cancels ODIN's own NiceHash orders and Braiins bid, destroys the Vast rentals it started and cancels the Clore rentals it started; anything you placed yourself is left running and listed in one urgent alert. If ODIN can't show a Clore rental is its own, it cancels nothing and tells you to check by hand. In watch-only it holds but stops no rentals. Each stop is made once, from a list read that minute; an unreadable flag stops nothing, because destroying is never the fail-safe direction, holding is.
Enforced by: the_
04Unknown replies
A timeout or an unreadable answer to a rental request does not mean “no”. ODIN counts the rental as placed (it takes a slot and counts toward the budget), reads the account again, and sends no second request. On Braiins the same request is retried under Braiins' own idempotent rule until it is confirmed, and Vast's create re-reads the instance list first.
Enforced by: mrr_
05Stale data and hostile numbers
ODIN never prices from a NiceHash order book older than 20 seconds; stale data marks the market as waiting. Every number read from an outside API passes one reader that rejects NaN, infinities and absurd values. A recorded NiceHash order book and thousands of corrupted copies (wrong types, nulls, 1e308, truncated bodies, outage pages) are replayed through every parser by the test suite.
Enforced by: freshness_
06Whole satoshis
Amounts sent to an exchange and balances read from one are Sats: a whole number of satoshis in a 64-bit integer, parsed digit for digit and written back exactly. Prices, rates and margins stay decimal on purpose, because they are rates, not money. A balance ODIN can't read as a proper amount means hold.
Enforced by: a_
07Simulated sessions
The real ODIN program is started by a test on a clock the test controls, with its outside address pointed at a stand-in NiceHash. Each session trades up to 80 minutes of scripted market in seconds, about 9 hours across all 17. The test then reads back every request ODIN actually sent and checks the money rules on them. To prove a refactor changed nothing, the request logs of the old and new build are compared byte for byte.
- TEST PLAN market moves and a number of cycles
- ODIN the real program, built with test hooks
- STAND-IN NICEHASH answers and records every request
- REQUEST LOG every call ODIN made
- MONEY RULES asserted on each request
- a_
dip_ into_ profit_ is_ walked_ down_ step_ by_ step_ and_ never_ bid_ past_ the_ maximum - a_
kill_ switch_ cancel_ refused_ before_ a_ restart_ is_ carried_ out_ once_ after_ it - a_
limit_ odin_ cannot_ read_ means_ watch_ only_ not_ a_ guess - a_
live_ trip_ cancels_ only_ odins_ order_ and_ names_ yours_ still_ running - a_
losing_ order_ of_ yours_ never_ trips_ odins_ loss_ cap - a_
loss_ trip_ with_ nicehash_ on_ watch_ cancels_ odins_ own_ order_ exactly_ once - a_
pending_ kill_ cancel_ note_ without_ the_ kill_ flag_ cancels_ nothing - a_
refused_ kill_ switch_ cancel_ is_ retried_ until_ it_ goes_ through_ and_ never_ twice - an_
unreadable_ kill_ cancel_ note_ only_ holds - live_
but_ not_ told_ to_ start_ orders_ sends_ nothing_ that_ could_ move_ money - live_
odin_ reprices_ only_ its_ own_ order_ and_ never_ touches_ yours - live_
trading_ never_ bids_ above_ the_ profitable_ maximum_ or_ past_ the_ wallet - the_
kill_ switch_ stops_ all_ spending_ and_ cancels_ the_ orders - watch_
only_ after_ a_ live_ session_ cancels_ only_ the_ order_ odin_ placed - watch_
only_ cancels_ an_ order_ odin_ placed_ before_ 1_ 9_ on_ a_ loss_ trip - watch_
only_ from_ the_ start_ with_ only_ your_ order_ cancels_ nothing - watch_
only_ sends_ nothing_ that_ could_ move_ money
08The audit chain
Every create, re-price, re-bid, cancel and destroy is written to odin_audit.jsonl. Each record holds a sequence number, a time, the event and the SHA-256 of the record before it; the first record points at 64 zeros. odin --verify-audit reports the first edited, removed or reordered line.
{"seq":1841,"ts":"2026-11-27T14:05:12.481…+00:00","event_type":"ORDER_PRICE", … ,"prev_hash":"4be0…71c2","hash":"9f3c…2a1b"} {"seq":1842,"ts":"2026-11-27T14:05:14.902…+00:00","event_type":"QUANT_CHANGEPOINT", … ,"prev_hash":"9f3c…2a1b","hash":"d61a…0e93"} {"seq":1843,"ts":"2026-11-27T14:05:16.117…+00:00","event_type":"ORDER_CANCEL", … ,"prev_hash":"d61a…0e93","hash":"27b8…c4f0"} $ odin --verify-audit odin_audit.jsonl
Fig. 3 Format only: synthetic values, shortened hashes. Notice that each record's prev_hash is the hash of the line above.
Enforced by: chain_
09Keys, licences and secrets
No withdraw rights. Setup tells you to make every market key with withdrawals off; ODIN cannot check a key's rights; what ODIN controls is its own code, and the source contains no withdrawal or transfer call to any market. Keys at rest: on Windows, keys in odin.env are sealed with DPAPI. On Linux, sudo odin-seal-secrets (offered by the installer) encrypts each key with systemd's encrypted credentials, bound to the machine and to its TPM2 chip when it has one; systemd decrypts them only for the ODIN service. It needs systemd 250 or newer (Ubuntu 24.04+, Debian 12+); on Ubuntu 22.04 the keys stay in a root-only file. A key ODIN can't open is never used: that market stays watch-only.
By rule, keys never appear in HUGINN, logs, alerts, the support file, the audit log or error strings. Tests check the places a key or a balance could leak: the support e-mail masks balances and the pool account, HUGINN Fleet sends its key only in a header of a read request.
Licences fail closed. Offline licence files are Ed25519-signed and checked locally; online licence answers are signed by the licence server, and offline grace runs from the date inside that signature. A lapsed or forged licence means watch-only.
Enforced by: support_
10Supply chain and signing
Every release must pass, before it is published: lint with warnings treated as errors, a scan of every dependency against the RustSec vulnerability database (any known vulnerability stops the release), the full test suite, the simulated sessions, and a check that the release program names no test hook. Each release ships a CycloneDX software bill of materials for ODIN and SLEIPNIR and a SHA256SUMS.txt over every file, signed with the Asgard Hashworks key (Ed25519), which never leaves the signing PC.
odin --upgrade reads the latest version, requires a valid signature on that version's checksum list, checks the file's SHA-256, test-runs it, swaps it in, keeps the old program, and puts it back if the new one doesn't report that it started.
Enforced by: an_
11The models
Every number ODIN can measure, it measures on your own account. On NiceHash every estimate carries an error band, and a dip boost needs the band's lower bound to clear your rule. Vast and Clore value cards with the pool's rates and a fixed delivery allowance, without a band. These are the models in the source, each with the test that checks it on known data.
| Model | What it does | Where | Checked by |
|---|---|---|---|
| Bayesian online change-point | The full posterior over how long the current market regime has lasted. Its predictive is a Student-t (a bell curve with heavier tails), so one spike does not read as a shift. | quant.rs §3 | bocpd_ |
| Two-sided CUSUM | A fast alarm on the clearing price; fill history from before a shift is down-weighted. | main.rs | cusum_ |
| Ornstein–Uhlenbeck reversion | Mean reversion on two time scales, with exact first-passage times: how long a dip lasts before it would cost a fee. | quant.rs §7 | ou_ |
| Conformalised quantile forecast | The clearing price 30 minutes ahead as a 10–50–90 band, learned online and scored against a random walk. | quant.rs §8 | forecaster_ |
| Adaptive conformal inference | Error bars whose long-run coverage holds for any data sequence; on NiceHash a dip boost needs the lower bound to clear. | quant.rs §2 | conformal_ |
| Kalman delivery filter | What the pool really credits, tracked as a hidden level with its own error bar. Its consistency is checked by NIS, the normalised innovation squared, which sits near 1 when the filter's error bar is honest. | quant.rs §1 | kalman_ |
| Rival ceiling posterior | Each rival bot's ceiling bracketed from where it gave up, product-limit estimated for the ones still bidding. | quant.rs §4 | rival_ |
| Thompson sampling | Learns which bid step actually wins against each market's bots, weighed against the headroom it leaves. | quant.rs §5 | thompson_ |
| Backtest-overfitting probability | Combinatorially symmetric cross-validation; a tuned setting is adopted only if its win is unlikely to be luck. | quant.rs §6 | pbo_ |
| Isotonic fill curve | How much of an order really fills at each distance from the clearing price; a higher bid can never fill less. | main.rs | fill_ |
12Rules the code enforces
Each rule as it stands in v1.9.2: the mechanism that makes it true, the tests that fail if it breaks, and the version since which it has held in this form.
| Rule | Mechanism | Test that proves it | Since |
|---|---|---|---|
| Only one part of the program can place, fund or re-price a NiceHash order. | The order desk (orders.rs) is the single caller of create, refill and re-price. The test reads every source file and fails if any other file calls them (main.rs, where they are defined, and orders.rs are exempt). | only_ | v1.8.0 |
| Watch-only sends nothing that could move money; live trading never bids above the profitable maximum or past the wallet. | The real program, on a controlled clock, against a stand-in NiceHash; the test reads back every request it sent. | watch_ | v1.8.0 |
| A money trip stops all new spending and cancels only ODIN's own orders and rentals, exactly once, retried until it goes through. | Daily loss cap across every market, or odin_KILLED.flag created while running. The hold gives every market a reason to stop; the Clore and Vast passes re-read it before each spending call. Only ODIN's own: NiceHash since v1.9.0, Clore since v1.9.2. | the_ | v1.9.2 |
| Watch-only and a trip each produce a hold reason; held markets raise no bid and rent nothing. | venue_hold() turns watch-only and a tripped kill switch into one reason string; the full-pass tests run a whole Clore and Vast pass while held and assert that no spending request is sent. | watch_ | v1.6.4 |
| A reply whose outcome is unknown never leads to a second order or rental. | On a timeout or an unreadable answer, the rental counts as placed and the account is read again before anything else is sent. | mrr_ | v1.9.0 |
| Stale or absurd data means hold, never a trade. | A freshness gate (NiceHash book at most 20 s old) and one reader for every outside number that rejects NaN, infinities and absurd values. | freshness_ | v1.6.3 |
| A limit ODIN cannot read as a number puts every market on watch-only. | One reader for number settings; anything that is not a finite number is named on screen and in odin --doctor. | a_ | v1.8.0 |
| Amounts sent to an exchange are exact whole satoshis. | A Sats type (a 64-bit integer) for every amount sent or balance read; prices and rates stay decimal on purpose. | a_ | v1.8.0 |
| The audit log is tamper-evident. | Each record carries the SHA-256 of the one before it; odin --verify-audit names the first edited, removed or reordered line. | chain_ | v1.3.0 |
| An upgrade installs only a newer program that Asgard Hashworks signed. | An Ed25519 signature over the release's SHA256SUMS.txt, then the file's SHA-256, then a test run; the old program is kept and put back if the new one doesn't start. | an_ | v1.8.0 |
| HUGINN is read-only and key-gated. | Answers reads only; keys compared in constant time; connection limits per address; a wrong key is answered slowly. | huginn_ | v1.6.5 |
| Every module lists what it uses, and the main source files carry no known personal identifiers. | No catch-all imports; a scan of 13 main source files for five known personal patterns. | no_ | v1.8.0 |
13Known limits
- Model outcomes on live data (coverage of the forecast band, skill against a random walk, sample size, window) are not yet published here.
- Cycle timing (p50 / p99 of one cycle) is not yet published here.
- MiningRigRentals rentals can't be cancelled; a trip holds new spending, and a running rental runs to the end of the hours paid for.
- The per-card hashrate the pool reports for Vast rentals is shown as “pool-reported”: the pool does not state its unit or averaging time.
- One PeakMiner measurement exists (an H100 SXM); one measurement is not a comparison, so SRBMiner runs everywhere.
- The release checks are run by hand on each release until they move to Asgard Hashworks' own build machines.
- The setup's own test suites run on Windows PowerShell, and the Linux key-sealing script has its own shell test suite; their case counts are not stated here until counted on the machines they run on.
- Windows code signing is in final review with the certificate authority; until then Windows may warn on first run.