The Last Alibi

A cryptographically verifiable AI detective game where suspects can lie, but the truth cannot.

The Last Alibi

Created At

ETHGlobal Lisbon 2026

Project Description

The Last Alibi is a cinematic, browser-based AI detective game set inside a private museum. Every investigation begins with one hidden case selected from exactly 64 combinations of suspect, room, weapon, and time. The case is cryptographically committed before the player can act, preventing the answer from being changed after the investigation begins.

The player explores the museum, questions AI-controlled suspects, records observations, requests up to five certified warrants, narrows the remaining possibilities, and makes one irreversible accusation. Suspects can be evasive, emotional, misleading, or dishonest. Their dialogue is useful for forming hypotheses, but it is never treated as canonical evidence.

AI performs each character’s dialogue, tone, emotion, and evasiveness, but it never controls the hidden case, registered evidence, candidate elimination, disclosure rules, proof acceptance, or final verdict. This separation allows the characters to behave unpredictably without allowing a model to rewrite the mystery.

Sui maintains the canonical investigation state. Certified warrants are selected from registered binary predicates rather than arbitrary model-generated questions. Before a warrant is authorized, the game calculates both possible branches of the remaining 64-case candidate set. A query is rejected unless either answer still leaves at least two possible cases. This prevents exact-case extraction, repeated probing, and unlimited disclosure. Certified results are shown only after the corresponding Sui state transition is confirmed.

The final accusation is evaluated privately. A zero-knowledge proof binds the binary YES or NO verdict to the committed case and the player’s committed accusation without publicly revealing the case, accusation, verdict, or private salts. The encrypted verdict capsule is stored on Walrus and can be decrypted through Seal only by the correct player after Sui records the investigation as terminal.

The judged suspect-inference path runs through 0G Compute. Responses are schema-validated and verified before they can be displayed, but 0G-generated dialogue remains explicitly non-authoritative. World AgentKit protects Ranked Agent mode by granting a scarce attempt only to a registered detective agent acting for a unique human. The resulting authorization is converted into a narrowly scoped, expiring, single-use Sui permit.

“The Last Exhibit” is the first case in a versioned level system. Progression is designed around increasingly complex case universes, new predicate catalogs, different disclosure limits, and stricter information-management rules. Certified warrants form an explicit information economy: every binary answer consumes a scarce disclosure, while the interface can show how much uncertainty that answer removes. This allows later levels to become harder through both narrative complexity and cryptographically enforced limits on how much truth may be revealed.

The result is a complete deduction game built around an enforceable trust boundary: every suspect can lie, but the committed truth cannot.

How it's Made

The Last Alibi is implemented as a TypeScript and pnpm monorepo containing a responsive Next.js game, deterministic case engine, server-side orchestration layer, Sui transaction adapters, 0G and World integration boundaries, zero-knowledge proving components, and Sui Move contracts.

The case universe is generated mechanically from four suspects, four rooms, two weapons, and two time windows, producing exactly 64 possible cases. Each case occupies one bit of a u64 candidate mask. The mask begins with all 64 bits set and is progressively reduced by certified evidence.

The 64-case universe is an intentional optimization for the hackathon level because the complete candidate set fits inside one u64, making branch checks, candidate elimination, and onchain population counts compact and auditable. The surrounding protocol is organized around versioned level manifests containing the dimensions, predicate catalog, verifier identities, disclosure limit, and minimum-survivor policy. This allows additional levels to introduce different mysteries and difficulty profiles without changing the core trust model.

The five certified binary disclosures provide an upper bound of five bits of disclosed information, although the actual information gained from an answer depends on the size of the resulting branch. The interface may express this as Shannon information gain, while the implemented protocol conservatively enforces the fixed disclosure count and minimum-survivor floor. A production extension can replace the single u64 with chunked bitmaps or a Merkle-backed candidate structure to support level universes larger than 64 and enforce a configurable cumulative information budget.

Certified warrants are registered typed predicates, not arbitrary natural-language questions. For a current candidate mask M, the engine calculates Y = M & yesMask and N = M & noMask. A warrant can proceed only when there is no pending query, it has not already been used, fewer than five disclosures have been resolved, and both possible answers preserve at least two candidates. This safety check occurs before the hidden case is evaluated, preventing a player from constructing an exact-case probe. The certified answer is withheld until its state transition is confirmed.

Sui is the authoritative execution layer. Move objects represent the level configuration, session commitment, candidate mask, disclosure counter, used predicates, pending actions, replay-protected nonces, ranked permits, proof receipts, terminal state, verdict commitment, and Walrus blob reference. The contracts enforce valid transitions and reject unknown predicates, unsafe branches, repeated or sixth warrants, stale nonces, duplicate ranked permits, invalid proofs, and mutations after terminal state. The web server coordinates these operations but cannot unilaterally redefine the case or verdict.

The private accusation relation is implemented with BN254 Groth16 using Circom, TypeScript orchestration, and a Rust prover built with arkworks. Poseidon commitments bind the hidden case, player accusation, and binary verdict to domain-separated protocol data and private salts. Session and attempt context is additionally bound through a BLAKE2b-derived domain, preventing a proof from being replayed across investigations or accusation attempts.

The circuit proves that the hidden case opens the stored commitment, the private accusation opens its commitment, and the private verdict bit is exactly the result of comparing all four accusation fields with the case. It then binds that bit to a separate verdict commitment. The Sui package pins the expected verifying key and uses Sui’s native Groth16 verification API. Public signals expose only commitments and session-bound metadata, while the case, accusation, verdict bit, and salts remain private. The current proving parameters are explicitly treated as hackathon test parameters rather than production ceremony output.

Suspect dialogue runs directly through 0G Compute using the official @0gfoundation/0g-compute-ts-sdk. Each request contains only bounded information approved for that suspect: public room state, discovered evidence, available lead and warrant identifiers, persona context, and a limited conversation history. It excludes the hidden case, case salt, verdict secret, prover credentials, and canonical evidence internals.

The model must return a strict structured response containing an utterance, approved emotion, allowlisted action, and optional registered lead or warrant identifier. Unknown identifiers, malformed output, additional fields, provider failures, and timeouts are rejected. The response must also pass the 0G SDK’s processResponse verification before any model-controlled text is rendered. Live mode has no fallback to a conventional AI provider. Importantly, verified provenance does not make the dialogue truthful: 0G performs the suspect, while the deterministic engine and Sui control the truth.

The terminal verdict is serialized into a minimal capsule, encrypted, and written to Walrus. Its content-derived blob identifier is bound to the session’s terminal record. Walrus provides durable retrieval but is not trusted to determine the verdict or authorize access. Seal evaluates a Sui-defined policy requiring the correct player, matching session and commitment, and confirmed terminal state before releasing decryption material. After decryption, the client recomputes the verdict commitment before displaying only YES or NO.

World AgentKit powers Ranked Agent mode. A canonically registered detective agent sends a signed request bound to the protected resource. The service checks agent registration, signature, freshness, nonce, and resource binding before resolving a privacy-preserving human-backed entitlement. An atomic persistent check limits each unique human to one ranked attempt per level without publishing the underlying human identifier.

Successful AgentKit authorization produces an expiring Sui permit scoped to the player, detective agent, level, version, and authorization nonce. Sui consumes that permit exactly once when the ranked session is created. Unregistered agents, stale or malformed requests, wrong-resource signatures, replayed nonces, reused entitlements, and expired or mismatched permits are rejected.

Every live integration follows the same fail-closed rule: unverified AI dialogue is hidden, unsafe warrants are rejected before secret evaluation, failed proofs cannot update canonical state, unconfirmed transactions cannot reveal certified answers, replayed ranked permissions cannot create another session, and unauthorized verdict requests cannot decrypt the result.

This architecture lets AI make the mystery expressive while keeping truth, information release, authorization, and the final outcome cryptographically constrained and independently inspectable.

background image mobile

Join the mailing list

Get the latest news and updates