A batch groups markets together. Like a parlay. Like a prayer — multiple requests, one outcome, usually disappointing. And yet people create them, join them, fund them with real money. The persistence of hope in the face of arithmetic is the most human thing about this protocol.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: Join a Batch
Fetch active batches and join one with a USDC deposit:Batch Lifecycle
What Is a Batch?
A batch groups multiple markets (e.g., BTC-USD, ETH-USD, SOL-USD) into a single prediction game. Every tick, all markets in the batch resolve simultaneously, and players win or lose based on how many markets they predicted correctly. You pick UP or DOWN for each market. Your payout depends on how your picks compare to other players’ picks across all markets. It is a contest of opinions, settled by reality, which is indifferent to both sides.Creating a Batch
Anyone can create a batch. This is a freedom that carries weight — you are constructing a small arena where strangers will lose money to each other, and you are responsible for choosing the terms. CallcreateBatch:
marketIds and resolutionTypes must be the same length. If they differ, the transaction reverts with ArrayLengthMismatch.Tick Duration Options
The tick duration controls how often the world is measured and judgment is passed. Common configurations:| Duration | Use Case |
|---|---|
| 60s (1 min) | High-frequency trading games |
| 600s (10 min) | Standard prediction rounds |
| 3600s (1 hour) | Hourly market predictions |
| 86400s (1 day) | Daily market predictions |
| 604800s (1 week) | Weekly outlook predictions |
Batch States
A batch moves through states, as all things do. Unlike most things, its states are well-defined:- Created: The batch is registered on-chain. Players can immediately join.
- Running: Ticks resolve at every
tickDurationinterval. Players can join, deposit, update bitmaps, and claim rewards. - Paused: Oracles can pause a batch via BLS consensus (e.g., if a price feed is unreliable). While paused, no new players can join. Existing players retain their positions.
- Unpaused: Oracles unpause the batch via BLS consensus. Normal operation resumes.
Pausing and unpausing require BLS signatures from 2/3+ of registered oracles. This prevents any single party from disrupting a batch.
Updating Markets
A batch creator can change which markets are included, but not unilaterally. Altering the rules of a game that people have already entered requires BLS oracle consensus — the closest thing to democratic oversight a smart contract can offer:Joining a Batch
To join is to commit — money and opinion, simultaneously. Players deposit USDC and commit a bitmap hash:Technical Details
Batch Struct
On-chain, a batch is stored as the following struct. Every field is a constraint. Every constraint is a promise the protocol makes to strangers who will never meet:| Field | Description |
|---|---|
creator | The address that called createBatch. Only the creator can set metadata and update markets. |
marketIds | Array of bytes32 market identifiers. Each is keccak256(assetId) where assetId is a UTF-8 string like "BTC-USD". |
resolutionTypes | Parallel array to marketIds. Each entry is a uint8 from the ResolutionType enum (0-7). See Resolution Types. |
tickDuration | How often the batch resolves, in seconds. Must be between 1 second and 30 days (MAX_TICK_DURATION). |
customThresholds | Parallel array for resolution types that use custom thresholds (UP_X, DOWN_X, FLAT_X). Values are in basis points. |
createdAtTick | The tick number when the batch was created, computed as block.timestamp / tickDuration. |
paused | When true, no new players can join. Requires a BLS-signed oracle consensus to pause or unpause. |
Batch Metadata
Batch creators can attach metadata to make their batch discoverable. A name, a description, an image — the small vanities that make a contract feel inhabited:StringTooLong.
Creators can also set a display name for themselves: