Inspiration

We kept asking the same question when looking at all these prediction markets: “What happens to these odds if something else happens first? And how can we capitalize on this?”

A Bitcoin forecast depends on interest rates, regulation, and the economy, but those questions usually live in separate markets. We wanted to explore them together and keep track of the assumptions behind our thinking.

Fork takes its name from the sick branching it does. Start with a world, change an assumption, and explore a different direction without losing the original. We wanted that to feel natural enough that someone could follow their curiosity through several possible futures.

What it does

Fork is a workspace for conditional forecasting.

Choose a live Gemini prediction market or a hypothetical target, drag related events into an assumption basket, and select their outcomes. Press FORK REALITY, and Fork creates a new saved world called a Verse.

Four AI analysts evaluate the target under those assumptions. You can inspect their reasoning, explore disagreements, compare worlds, and branch again.

For supported live events, Fork also connects those scenarios to conditional markets on Solana devnet. Users can trade YES/NO shares in a target event given a specific condition. The markets use SOL collateral and explicit settlement rules; model forecasts never determine payouts.

How we built it

The frontend uses Next.js, React, TypeScript, and Zustand, with SQLite for server-side persistence. Our custom graph combines Canvas-rendered edges and effects with interactive DOM nodes. Animation runs independently of React updates, keeping the workspace responsive while forecasts are running.

The forecasting pipeline performs parallel research across available Claude, Codex, and Grok providers, then assigns four analytical roles: causal, empirical, market-focused, and skeptical. Each analyst initially works without seeing the others’ answers.

When disagreement is substantial, a revision round shares arguments while withholding numerical estimates. Outputs are schema-validated, and the final forecast is an equal-weight mean of completed analysts. We preserve individual estimates because the average alone can hide important differences.

Gemini provides live event definitions, quotes, and resolution information. We distinguish observed market prices, model estimates, and demonstration data throughout the interface.

The Solana program uses Rust and Anchor, with program-derived accounts for markets, vaults, traders, and liquidity providers. It defines our tradeable conditional prediction contract. It implements an AMM with integer LMSR pricing, collateral checks, conditional settlement, and refunds. The browser connects the exact graph condition and target to the corresponding onchain market.

Challenges we ran into

Formulating what we were actually forecasting

The first challenge was defining the question precisely.

For a target B and assumption A, we want to explore:

$$ P(B \mid A) $$

Separate market prices for A and B do not tell us that conditional probability. We would need their joint distribution:

$$ P(B \mid A)=\frac{P(A \cap B)}{P(A)} $$

That shaped the architecture. Market prices provide observed context; the models estimate how the target changes under additional assumptions. We cannot present that estimate as something directly implied by the two market prices.

We also had to distinguish conditioning from causation. A forecast changing between two Verses does not prove that one event causes another. The graph records the scenario and reasoning, rather than claiming to establish a causal model.

Dealing with combinatorial markets

With n binary events, there are 2n possible complete outcome combinations. Even 20 events produce more than a million possible worlds.

Creating a separate market for every combination would fragment liquidity and make discovery, pricing, and settlement difficult. Most combinations would never attract enough activity to be useful.

We therefore separated the scope of exploration from the scope of trading. Users can build multi-assumption Verses, but the current contract supports a precise pair: target B, conditional on A=YES. A multi-assumption world explicitly selects one supported condition before creating a market.

That was an important scope decision. It let us implement and test conditional market mechanics without pretending we had solved general combinatorial liquidity.

Making conditional payouts solvent

A conditional market needs a different accounting model from an ordinary YES/NO market.

If the condition holds, traders receive payouts based on the target. If the condition fails—or either event is invalid—our design refunds original deposits. Trading gains and fees therefore remain contingent until settlement.

We track deposited principal separately from conditional cash and share holdings. Selling shares increases conditional cash, but withdrawals remain locked until a terminal outcome. Otherwise, someone could withdraw trading proceeds before an invalidation and leave the vault unable to honor refunds.

For normal settlement, every trade enforces a reserve constraint:

$$ V \geq C + \max(Y,N) $$

Here, V is vault collateral, C is aggregate conditional cash, and Y and N are outstanding YES and NO liabilities in collateral units.

Working through these cases forced us to specify exactly what a “balance” means before settlement.

Implementing pricing with integer arithmetic

We used a logarithmic market scoring rule, whose cost function involves exponentials and logarithms. Implementing it onchain required bounded, fixed-point arithmetic, checked operations, and deliberate rounding.

Small numerical errors matter when users can repeat transactions. We used conservative buy/sell rounding and independent liability checks so reserve safety does not depend solely on the pricing approximation.

Liquidity-provider funding also locks when trading begins. Supporting live liquidity changes would require additional accounting for unresolved liabilities and LP ownership, which we kept outside the current scope.

Handling resolution order and source uncertainty

The target can resolve before its condition. A source can enter review. An observation time can pass before a final result is published.

We implemented explicit lifecycle states for these situations. Unknown never becomes NO, and elapsed time alone never creates a settlement result. If the target resolves first, the market must retain that result while waiting for the condition.

Each registered event binds exact source identifiers, resolution terms, and timing information. A trusted reporter relays source outcomes, and the contract enforces the resulting transitions. That reporter remains a trust assumption in the prototype.

Integrating native SOL safely

Moving the trading flow to SOL introduced account-lifecycle and precision concerns. SOL uses nine-decimal lamport accounting, and older collateral configurations could not safely be interpreted using the new units.

We separated the SOL configuration namespace and used temporary native token accounts to move SOL atomically into and out of market vaults. Those transactions close the temporary accounts and preserve existing wallet token accounts.

We tested rejected signatures, insufficient funds, vault backing, and one-time redemption against actual local-validator transactions.

Understanding model disagreement

In one Bitcoin scenario, Claude estimates landed around 13–17%, while Codex estimates were around 43-48%. The gap persisted through revision.

That changed how we thought about the forecasting interface. We needed to show the competing premises, not just calculate an average. The spread is useful evidence of disagreement, but it is not a calibrated confidence interval.

Accomplishments that we're proud of

We built a complete path from exploring assumptions to reviewing a precisely defined conditional trade.

The project includes a persistent branching interface, a working multi-provider forecasting pipeline, and a verified native-SOL conditional market deployment on devnet.

We’re especially proud of the verification behind the contracts. Our recorded checks cover Rust and TypeScript tests, browser interactions, real local-validator trades, normal settlement, VOID refunds, and repeat-claim prevention. We checked displayed balances against onchain accounts rather than treating a successful UI message as proof.

We also kept synthetic settlement tests separate from live markets. Test outcomes let us exercise every terminal path without claiming an unresolved real-world event had finished.

What we learned

The hardest part was agreeing on the meaning of a conditional position. Once we wrote down what happens when the condition fails, the target resolves first, or a source invalidates an event, the accounting and state machine became much much clearer.

We learned that combinatorial forecasting and combinatorial trading have different constraints. Exploring another scenario is relatively cheap. Supporting a liquid, collateralized market for it introduces obligations that persist until resolution.

We also learned that multiple models can reveal uncertainty without resolving it. Their disagreements often gave us better questions to ask next.

What's next for Fork

We want to evaluate forecasts against resolved outcomes, measure calibration, and use that evidence before changing analyst weights.

On the exploration side, we want shareable Verses, better contradiction detection, and tools for identifying which assumptions actually change a forecast.

On the market side, the next steps are independent security review, more economic testing, and stronger resolution infrastructure. We also want to investigate ways to support richer combinations without creating an isolated liquidity pool for every possible world.

Built With

Share this project:

Updates

Submission history