Your predictions are encoded in bits. One means up. Zero means down. The universe, reduced to binary. This is not a metaphor — it is literally how the contract stores your opinion about the future of Bitcoin, the weather in Tokyo, and the disruption level of the Northern Line.Documentation Index
Fetch the complete documentation index at: https://docs.generalmarket.io/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start: Encode a Bitmap
Encode UP/DOWN predictions for 5 markets:Bitmap Flow
Sealed Commitment
Bitmaps are committed on-chain as a keccak256 hash before the actual bitmap bytes are revealed. Nobody can see your predictions. Nobody can copy them. Your beliefs are sealed inside a hash, invisible until the moment they are judged. There is a dignity in this — the dignity of a private wager.Commitment Flow
- Player constructs bitmap locally (array of UP/DOWN predictions).
- Player computes hash:
bitmapHash = keccak256(bitmap). - Player commits hash on-chain by calling
joinBatch(batchId, deposit, stakePerTick, bitmapHash)orupdateBitmap(batchId, newBitmapHash). - Player reveals bitmap off-chain by sending the actual bytes to oracles via
POST /vision/bitmap.
Reveal Process
After committing the hash on-chain, the player must reveal the actual bitmap bytes to oracles before the tick resolves. The sealed prediction becomes public. What was private becomes shared. What was hope becomes arithmetic.Submitting to Oracles
- The player exists in the batch (checked against the on-chain scheduler state).
- The
expected_hashmatches the player’s on-chainbitmapHashcommitment. keccak256(bitmap_bytes) == expected_hash(the bitmap is authentic).
Reveal Window
After a tick ends, there is a configurable reveal window (default: 600 seconds) before bitmaps are made public. During this window, oracles use the bitmaps for resolution but do not expose them via the API. After the window expires, anyone can query revealed bitmaps:Technical Details
Bit Packing Specification
The encoding is precise. Each bit occupies an exact position. There is no ambiguity, no room for interpretation. In a world of shifting prices and uncertain outcomes, at least the encoding is certain. Bitmaps use big-endian bit ordering within each byte:- Bit 0 = most significant bit (MSB) of byte 0
- Bit 7 = least significant bit (LSB) of byte 0
- Bit 8 = MSB of byte 1
- And so on…
marketIds array:
| Bit Value | Meaning |
|---|---|
1 | Player predicts UP for this market |
0 | Player predicts DOWN for this market |
ceil(marketCount / 8) bytes.
Visual Example
For a batch with 5 markets where a player predicts UP, DOWN, UP, UP, DOWN:0xB0 (1 byte).
Encoding Examples
TypeScript
Python
Decoding a Bit
To read a specific market’s prediction from a bitmap:Edge Cases
Every system has edges. The interesting question is what happens when you reach them.Unused Bits
If the number of markets does not fill the last byte, unused bits are padded with0. These unused bits are ignored during resolution — they do not count as DOWN predictions.
For example, a batch with 3 markets only uses bits 0-2 of byte 0. Bits 3-7 are ignored regardless of their value. Silence is not an opinion.
Unrevealed Bitmaps
If a player commits a bitmap hash on-chain but fails to reveal the actual bytes to oracles before resolution, the player is voided for that tick. They committed to having an opinion but never shared it. Voided players:- Do not participate in side matching for any market.
- Keep their balance unchanged (delta = 0) — they neither win nor lose.
- Are listed in the tick result’s
voided_playersarray.
Empty Batch
If a batch has zero markets (marketIds is empty), the bitmap is 0 bytes. This is a valid but degenerate case — no markets resolve and all players’ balances remain unchanged. A game with no questions has no losers, which is also a way of having no winners.