Cross-Language Arithmetic and Timelocks in SEMALAM’s Verifiable AI Game

Illustrative photo: SEMALAM combines LLM prompt compilation with deterministic game execution across 300 turns.

SEMALAM, an experimental turn-based game developed for the World Is Flat hackathon, tackles a core challenge in decentralized gaming: allowing user-owned AI agents to compete overnight while ensuring every action and outcome can be independently verified without trusting a central server. According to developer documentation and project resources detailed by creator Edy Cutjong, the system combines a single-pass LLM order compiler with entirely deterministic, non-AI game execution. Players submit up to 280 characters of text describing their agent's strategy, which an LLM parses once into a tightly constrained typed policy. Once sealed and committed on-chain, plain deterministic code takes over at midnight, running the simulation across 300 turns and posting a definitive result hash.

Sealing Orders and Cross-Language Arithmetic

To prevent any party—including the server operator—from peeking at player orders before execution, SEMALAM relies on drand timelock encryption. Orders are encrypted to a future beacon round that remains undecryptable until the proper time arrives. However, determining the exact target round presents a synchronization hurdle between blockchain execution and client-side processing. To solve this, creator Edy Cutjong implemented an identical integer arithmetic formula in both Solidity for the smart contracts and TypeScript for the browser, settler, and replay command-line interface. This formula incorporates a 300-second buffer specifically designed to account for Layer 2 clock drift, which testing on Robinhood Chain measured at a maximum of 1.75 seconds over a twelve-sample run. Furthermore, structural checks on incoming blobs ensure that malformed data is rejected consistently across all validating machines before any decryption attempts occur.

Ensuring Deterministic Replays and Testing Across Runtimes

A cornerstone of the project’s architecture is achieving strict determinism encapsulated by the principle of one seed in, one hash out. Because the game simulator operates completely free of runtime randomness, system clock calls, or non-deterministic map iterations, identical inputs must yield identical output hashes regardless of the underlying hardware. To validate this claim, the project repository includes a 230-agent golden hash and multiple golden rounds derived from real quicknet beacons. According to project documentation, these test suites have been executed successfully across a matrix of nine distinct runtime environments, covering Node.js versions 20, 22, and 24 on macOS, as well as Linux arm64 and amd64 architectures. Continuous integration pipelines pin these expected hashes across Linux, macOS, and Windows environments, while the network settler enforces that its posted results match those generated locally by fresh CLI processes.

Token Economics and Practical Limitations

Economic interactions within the ecosystem utilize the $WIF token through a dedicated Scrimmage contract. Practice runs against established leaderboards cost 200 tokens, structured such that 80 percent are permanently burned using the token's native burn function within the same transaction, while the remaining 20 percent cover computation costs. Fork testing confirms that token supplies adjust accurately without maintaining a centralized prize pool or permitting owner withdrawals. Despite these technical mechanics, public deployment on chain 4663—which went live on November 3, 2026—currently operates under practical constraints. Initial nights have been executed entirely using house-managed agents rather than external human players, and the platform acknowledges an unsolved Sybil vulnerability where a single adversary could theoretically saturate the 1,000-account admission cap per round. Additionally, gas-free onboarding relies on a nightly budgeted relay rather than true account abstraction, requiring users to supply their own wallets once the relay funds are exhausted.

Practice runs cost 200 tokens, with 80 percent burned and 20 percent for computation.

Why Verifiable Off-Chain Logic Matters for Web3 Gaming

The architecture of SEMALAM highlights an evolving paradigm in blockchain development where heavy computation is handled off-chain while cryptographic determinism guarantees trust. By separating the natural-language flexibility of large language models during the initial prompt-compilation phase from the rigid predictability of hardcoded game rules, the project addresses a fundamental tension in autonomous agent design. Historically, trusting automated agents to manage assets or compete in persistent worlds required either centralized servers vulnerable to manipulation or prohibitively expensive on-chain execution loops. By anchoring execution to time-locked beacons and requiring cross-language arithmetic synchronization, developers can prove that outcomes were computed honestly without forcing every single turn onto the main ledger. However, the reliance on specialized infrastructure—such as precise clock-drift buffers, fixed-format policy constraints, and auxiliary token-burning mechanisms—demonstrates that building verifiable autonomous systems remains a complex engineering feat. While current limitations like zero external player adoption and potential Sybil vulnerabilities illustrate the gap between theoretical protocol design and live ecosystem growth, projects like this establish valuable technical benchmarks for cross-language consistency, deterministic runtime verification, and trustless auditing in decentralized environments.

The project establishes benchmarks for cross-language consistency, deterministic runtime verification, and trustless auditing.

Cover: Michael Gaylard from Horsham, UK · CC BY 4.0 · Wikimedia Commons. Layout and headline text by Signal Titans.

Source: One seed in, one hash out: sealing orders and replaying a game night on chain · SEMALAM — the night market your agent plays while you sleep

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *