Nostra Technical Whitepaper

Advanced Market Models & Chainlink Oracle Integration

By Jay Lee | December 2025

Part 1: Market Design Fundamentals

Understanding Prediction Market Economics

1.1Market Structures

Two Main Approaches

50% Grouped Binary

  • Each outcome starts at 50% YES / 50% NO
  • Markets are independent (not linked)
  • Sum of YES can be anything (N ร— 50%)
  • Converges to ~100% via arbitrage
  • Simple to implement
5 outcomes at 50% each:
Sum = 250%
(Converges via trading)

100/n% Binary Market

  • Each outcome starts at 100/N %
  • Can be independent OR mechanically linked (CTF)
  • Sum of YES = 100%
  • No initial arbitrage opportunity
  • Creator doesn't lose to arbitrageurs at start
5 outcomes at 20% each:
Sum = 100%
(No arbitrage opportunity)

Polymarket's Hybrid Approach (NegRisk CTF)

Different Structures for Different Markets
  • High Volume Markets (e.g., Super Bowl): NegRisk CTF - YES + NO = 100ยข per outcome
  • Low Volume Markets (e.g., CFP): Grouped Binary - YES + NO โ‰  100ยข
Super Bowl (NegRisk CTF):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Team       โ”‚ YES   โ”‚ NO    โ”‚ YES + NO โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Chiefs     โ”‚ 23ยข   โ”‚ 77ยข   โ”‚ 100ยข โœ“   โ”‚
โ”‚ Eagles     โ”‚ 19ยข   โ”‚ 81ยข   โ”‚ 100ยข โœ“   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

CFP (Grouped Binary):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Team       โ”‚ YES   โ”‚ NO    โ”‚ YES + NO โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Indiana    โ”‚ 93.4ยข โ”‚ 99ยข   โ”‚ 192.4ยข   โ”‚
โ”‚ Ohio State โ”‚ 72ยข   โ”‚ 98ยข   โ”‚ 170ยข     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

1.2Initial Probability Settings

The Problem with 50% Initial Probability

Arbitrage Loss If each outcome starts at 50%, the sum exceeds 100%, creating a guaranteed profit for arbitrageurs at the creator's expense.
5 outcomes at 50% each:
Sum = 250%

Arbitrageurs:
- Buy all NO tokens
- Guaranteed profit when one outcome loses
- Creator loses to arbitrageurs

Solution: 100/n% Initial Probability

No Arbitrage Starting at 100/n% means sum = 100% from the start. No free money for arbitrageurs.

Critical Clarification: 250% Sum is NOT Arbitrage

Common Misconception The 250% sum (5 ร— 50%) in grouped binary markets does NOT create arbitrage. Each market is independent!
Grouped Binary (5 outcomes ร— 50%):

Market 1: Team A  YES (50ยข) + NO (50ยข) = $1 โœ“
Market 2: Team B  YES (50ยข) + NO (50ยข) = $1 โœ“
Market 3: Team C  YES (50ยข) + NO (50ยข) = $1 โœ“
Market 4: Team D  YES (50ยข) + NO (50ยข) = $1 โœ“
Market 5: Team E  YES (50ยข) + NO (50ยข) = $1 โœ“

Sum of YES = 250%... but so what?

Why no arbitrage?
โ€ข Each market is INDEPENDENT
โ€ข You CANNOT merge tokens across different markets
โ€ข Each market individually has YES + NO = $1 โœ“

The 250% โ†’ 100% convergence is just PRICE DISCOVERY,
not arbitrage. Smart traders normalize it.

What IS Real Arbitrage?

Case Condition Action Result
Single Market YES + NO < $1 Buy both Guaranteed profit
Single Market YES + NO > $1 Mint & sell both Guaranteed profit
CTF Multi-Outcome Sum < $1 Buy all, merge Guaranteed profit
CTF Multi-Outcome Sum > $1 Split & sell all Guaranteed profit
Cross-Platform YES_A + NO_B < $1 Buy both sides Guaranteed profit

Key: Arbitrage means zero risk, guaranteed profit. The 250% sum doesn't qualify.

Comparison: 5 Outcomes (True Probabilities: 60%, 15%, 10%, 10%, 5%)

50% Initial (Sum = 250%)

Outcome Initial Fair Gap
A (favorite) 50ยข 60ยข -10ยข
B 50ยข 15ยข +35ยข
C 50ยข 10ยข +40ยข
D 50ยข 10ยข +40ยข
E 50ยข 5ยข +45ยข

Favorite: small underpricing (-10ยข)
Underdogs: extreme overpricing (+35~45ยข)

100/n% = 20% Initial (Sum = 100%)

Outcome Initial Fair Gap
A (favorite) 20ยข 60ยข -40ยข
B 20ยข 15ยข +5ยข
C 20ยข 10ยข +10ยข
D 20ยข 10ยข +10ยข
E 20ยข 5ยข +15ยข

Favorite: large underpricing (-40ยข)
Underdogs: small overpricing (+5~15ยข)

The Real Problem: Stuck NO Tokens on Favorites

With 100/n% (20% initial)
  • Favorite YES = 20ยข (way underpriced) โ†’ traders BUY โ†’ creator sells cheap
  • Favorite NO = 80ยข (way overpriced) โ†’ nobody buys โ†’ creator STUCK

When the favorite wins, creator holds worthless 80ยข NO tokens.

Conclusion: Neither Solves the Problem

100/n% trades one problem for another
  • โœ… Underdogs priced closer to fair value
  • โŒ Favorites MORE underpriced than 50%
  • โŒ High-priced NO tokens (80ยข) on favorites won't sell

Whether it minimizes loss depends on trading patterns.

True Solutions Remain:

  1. CTF Multi-Outcome - No stuck inventory (can merge)
  2. Market Maker - Professional takes inventory risk
  3. No initial platform liquidity - Let market discover prices first
  4. Accept loss as bootstrap cost - Part of business

1.3Liquidity Provision

The Bootstrap Problem

Liquidity Bootstrap Cycle
No liquidity โ†’ No trading โ†’ No fees โ†’ No LPs attracted
โ†“
Platform must break the cycle
โ†“
Platform provides liquidity โ†’ Trading starts โ†’
Fees generated โ†’ Volume proven โ†’ External LPs join

Who Provides Liquidity?

Provider Reality When
Random traders Won't come to empty market Never initially
Professional MMs Only for proven high-volume markets After volume is established
Platform itself Must bootstrap new markets From day 1

Balanced Position Strategy

For a 5-outcome market with $1000 liquidity:

Split equally: $200 per market

For each market (at 20% YES / 80% NO):
- 200 YES @ $0.20 = $40
- 200 NO @ $0.80 = $160
- Total: $200 โ†’ 200 YES + 200 NO (balanced)

If A wins:
- A: 200 YES ร— $1 = $200
- B: 200 NO ร— $1 = $200
- C: 200 NO ร— $1 = $200
- D: 200 NO ร— $1 = $200
- E: 200 NO ร— $1 = $200

Return: $1000 โœ“ (break even when balanced)

Small Liquidity Problem

$500 liquidity is NOT enough
  • Wide spreads (bad prices)
  • High slippage on small trades
  • Can't execute large orders
  • Poor user experience
Liquidity Level Trading Quality User Experience
$500/market Poor Frustrating, large slippage
$5,000/market Okay Acceptable for small traders
$50,000+/market Good Professional-grade

1.4Stuck Inventory Problem

The Core Issue

Critical Problem In Grouped Binary markets, LP can get stuck with worthless tokens that nobody wants to buy.
Initial: Market A at 20% YES / 80% NO
Creator holds: 200 YES + 200 NO

Time passes... A becomes favorite (80% YES):

Traders: "I want to BUY YES on A!"
Creator: Sells YES, happy ๐Ÿ˜Š

Traders: "I don't want NO on A, A will win!"
Creator: Can't sell NO, stuck ๐Ÿ˜ฐ

Result:
- YES: 200 โ†’ 50 (sold 150, good!)
- NO: 200 โ†’ 200 (nobody bought, stuck!)

If A wins:
- 50 YES ร— $1 = $50
- 200 NO ร— $0 = $0
Creator started with $200, ends with $50
LOSS: $150 โŒ

Why Cross-Market Selling Doesn't Help

Selling NO on losing markets (B, C, D, E) does NOT compensate:

Sell 200 NO on B @ 95ยข = $190 received
But: If A wins, buyer gets 200 ร— $1 = $200

Creator sold $200 value for $190 = LOSS

Cross-market selling adds MORE losses, not compensation.

CTF Solves This

CTF Multi-Outcome allows merging complete sets
100 A + 100 B + 100 C + 100 D + 100 E โ†’ $100 USDC

No counterparty needed!
Always can exit via merge.
No stuck inventory problem.

Worst Case Scenario for LP

Scenario Fee Income Inventory Loss Total Loss
Best case $500 $100 +$500 profit
Average $200 $350 -$150 (15%)
Bad case $75 $400 -$325 (32.5%)
Worst case $75 $860 -$785 (78.5%)

1.5Market Makers (MM)

How MMs Make Profit

1. Spread (Buy Low, Sell High)

MM posts orders:
BUY YES @ 49ยข
SELL YES @ 51ยข

When both sides fill:
- Trader A buys YES @ 51ยข โ†’ MM receives 51ยข
- Trader B sells YES @ 49ยข โ†’ MM pays 49ยข

MM profit: 51ยข - 49ยข = 2ยข per share
If 10,000 shares traded: Profit = $200

2. Fee Rebates

Taker (takes order): Pays 2% fee
Maker (provides order): Receives 0.5% rebate

MM always provides orders โ†’ earns rebate
on every trade

3. High-Frequency Adjustments

Price moving up?
โ†’ Cancel BUY orders (avoid buying expensive)
โ†’ Raise SELL prices (sell higher)

Amateur LP: Updates hourly โ†’ Gets run over
Pro MM: Updates every second โ†’ Captures spread

4. Hedging Across Markets

Correlated markets:
- "Chiefs win Super Bowl" (YES @ 25ยข)
- "Mahomes wins MVP" (YES @ 30ยข)

MM sells Chiefs YES, buys Mahomes YES (hedge)
Net exposure: ~zero
But: Keeps spread profit!

MM Profit Formula

MM Profit = Spread Income
          + Fee Rebates
          + Arbitrage Gains
          - Inventory Losses
          - Operating Costs

How to Attract MMs to Nostra

Method Description Cost to Platform
Pay Monthly Fee $2-10K/month for liquidity Fixed, predictable
Fee Rebates MM earns 0.5% on trades Reduced revenue
Revenue Sharing 50% of trading fees Variable
Token Incentives NOSTRA tokens for liquidity Token dilution

Key Insight: Polymarket Model

Polymarket has NO public LP UI

Liquidity comes from:

  • Professional MMs (via API, not UI)
  • Polymarket internal (hidden, behind scenes)
  • Traders' limit orders

Regular users just trade. They don't "provide liquidity" through UI.

Liquidity Mirroring (Bridge Market Maker)

Strategic Advantage: Copying Global Liquidity

Nostra employs a "Bridge Market Maker" bot that mirrors the order books of global leaders (e.g., Polymarket) in real-time.

  • Mechanism: If Polymarket trades YES at $0.60, our bot places a sell order at $0.60 on Nostra.
  • Benefit: Users experience global-level depth and pricing explicitly from Day 1, without needing organic liquidity.
  • Result: We effectively "share" the liquidity of the entire ecosystem.

1.6Fee Structure

Proposed Fee Structure

Trading Fee: 0%
Redemption Fee (on Net Winnings): 2%
Net winnings = total payout minus initial investment (amount spent on buying shares/tickets).
Distribution:
โ”œโ”€โ”€ Platform Fee: 1%
โ””โ”€โ”€ Creator Fee: 1%

The Tradeoff

Fee Level LP Yield Trading Activity
High (3%+) High Low (expensive to trade)
Medium (2%) Medium Medium
Low (0.5%) Low High (cheap to trade)

Can Fees Cover Losses?

Not always

If volume is low AND market moves hard in one direction:

  • Fee income: small
  • Inventory loss: large
  • Net: significant loss

Fees help but don't guarantee profit.

Industry Benchmarks

Platform Fee Model Details
Polymarket (Global/Crypto) No Trading Fee / Spread
  • Trading Fee: 0% (Source).
  • Net Profit Fee: 2% (Source).
  • Cost: Bid-ask spread.
  • Note: CTF structure; users can mint/merge.
  • Rewards:
Polymarket US (Regulated/Upcoming) Flat Trading Fee
  • Trading Fee: 0.01% ($0.0001 per share).
  • Comparison: ~100x lower than Kalshi.
  • Source
Kalshi (US Regulated) Maker-Taker
  • Taker: Variable (approx. 1.75% - 7%) based on probability.
    Formula: 0.07 ร— Price ร— (1-Price)
  • Maker: Lower or rebate.
  • Source
Reference: Bid-Ask Spread

The Bid-ask spread is an implicit cost representing the gap between the Price you can Buy at (Ask) and the Price you can Sell at (Bid).

  • If you enter a trade and exit immediately, you lose this difference.
  • This "cost" is captured by Market Makers/Liquidity Providers, not the platform.
  • In zero-fee markets like Polymarket, this is the primary cost for users.

Fee Distribution Model

Fee Flow
LP provides liquidity
โ†“
Traders can trade
โ†“
Traders pay fees
โ†“
Fees go to LP as yield
โ†“
LP compensated for risk
โ†“
More LPs attracted โ†’ More liquidity

1.7AMM vs Order Book

Fundamental Difference

Order Book

  • Match buyers with sellers
  • Need counterparty for every trade
  • Prices set by traders
  • Can have no liquidity

AMM

  • Trade against liquidity pool
  • No counterparty needed
  • Prices set by formula
  • Always some liquidity

AMM Example: World Cup

LMSR AMM for 8 teams:

Initial pool ($5000 liquidity):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Team        โ”‚ Tokens โ”‚ Price โ”‚ Implied Odds โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Brazil      โ”‚ 5000   โ”‚ 12.5ยข โ”‚ 12.5%        โ”‚
โ”‚ France      โ”‚ 5000   โ”‚ 12.5ยข โ”‚ 12.5%        โ”‚
โ”‚ Argentina   โ”‚ 5000   โ”‚ 12.5ยข โ”‚ 12.5%        โ”‚
โ”‚ ...         โ”‚ 5000   โ”‚ 12.5ยข โ”‚ 12.5%        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Trader buys $100 Brazil:
โ†’ Gets ~700 Brazil tokens
โ†’ Pool Brazil: 5000 โ†’ 4300
โ†’ Brazil price: 12.5% โ†’ 25% (automatic!)

Comparison Table

Feature Order Book AMM
Always tradeable No (need counterparty) Yes
Capital needed High ($50K+) Lower ($5K)
Price discovery Order matching Formula
Large trades Better (if deep) Higher slippage
Complexity Medium Medium
Pro traders prefer Yes No

Key Insight

Order Book and AMM don't mix

They are fundamentally different systems. You choose ONE, not both.

Nostra currently has Order Book. Switching to AMM would require significant rebuild.

1.8Shared Liquidity Protocol

Nostra as a Liquidity Layer

More than a Website

Nostra is designed as a Protocol, not just a standalone application. The core orderbook lives on the blockchain, creating a permissionless global liquidity layer.

Fragmented (Web2 Style)

  • Each app has its own isolated liquidity
  • Users on App A cannot trade with users on App B
  • Liquidity is fractured and shallow

Shared (Nostra Protocol)

  • One single global orderbook
  • Multiple UIs (Nostra App, 3rd Party Apps, Wallets) share the same liquidity
  • Aggregated volume leads to tighter spreads

Ecosystem Benefits

By building a shared liquidity layer, we enable:

1.9Platform Economics

The Unavoidable Bootstrap Cost

Before external LPs/MMs are attracted, the platform MUST:
  • Provide initial liquidity
  • Take inventory risk
  • Accept potential losses as cost of business

This is unavoidable. Every marketplace subsidizes early growth.

Budget Example

Nostra Year 1 Plan:

Launch 50 markets
Initial liquidity: $500 per market = $25,000
Expected loss rate: 20%
Expected loss: $5,000

Think of it as:
"$5,000 marketing spend to build a prediction market"

Compare to:
- Google Ads: $10,000
- Influencer marketing: $20,000
- Traditional marketing: $50,000+

$5,000 liquidity loss = CHEAP customer acquisition

Growth Path

Platform Growth Phases
Phase 1: Platform Provides All Liquidity
โ”œโ”€โ”€ Provide $500/market
โ”œโ”€โ”€ Lose ~20% = $100/market
โ””โ”€โ”€ Build volume and reputation
โ†“
Phase 2: Attract External LPs
โ”œโ”€โ”€ Show track record
โ”œโ”€โ”€ "We did $1M volume last month"
โ””โ”€โ”€ LPs see fee opportunity
โ†“
Phase 3: Sustainable Model
โ”œโ”€โ”€ External LPs provide liquidity
โ”œโ”€โ”€ Platform just takes fees
โ””โ”€โ”€ Profit!

Polymarket's Business Model

Component Polymarket Risk Bearer
Platform Takes 2% fee on winnings Zero inventory risk
Market Makers Provide liquidity via API Bear inventory risk
Users Trade only Market risk

1.10Implementation Considerations

Code Changes for 100/n% Pricing

Database Schema (No Change Needed)

// Prisma schema
// Price is set at market creation
model Outcome {
  currentPrice Decimal @default(0.5)
  probability  Decimal @default(50)
}

Market Creation Logic

// When creating market with N outcomes
const totalOutcomes = outcomes.length;
const initialPrice = 1 / totalOutcomes;
const initialProbability = 100 / totalOutcomes;

for (const outcome of outcomes) {
  await outcomeRepository.create({
    ...outcome,
    currentPrice: initialPrice,      // 0.20 for 5 outcomes
    probability: initialProbability, // 20% for 5 outcomes
  });
}

Price Update Options

Option A: Independent (Simple)

Buy A โ†’ A price up
Others unchanged
Sum drifts from 100%
Arbitrage corrects

Option B: Linked (Complex)

Buy A โ†’ A price up
Others auto-decrease
Sum stays at 100%
Requires more logic

MM Bot Architecture (Optional)

// Auto-rebalancing market maker bot
const MM_CONFIG = {
  maxImbalance: 50,       // Max YES/NO difference
  spreadBps: 400,         // 4% spread
  rebalanceThreshold: 25  // Rebalance at 25 token imbalance
};

async function onTrade(market, side, amount) {
  const position = getPosition(market);
  const imbalance = Math.abs(position.yes - position.no);

  if (imbalance > MM_CONFIG.rebalanceThreshold) {
    await rebalance(market, position);
  }

  // Adjust spreads based on inventory
  await adjustSpreads(market, position);
}

async function checkToxicInventory(market) {
  const yesPrice = market.yesPrice;

  // If YES is winning big, NO is toxic
  if (yesPrice > 0.70) {
    const noTokens = getPosition(market, 'NO');
    if (noTokens > 0) {
      // Sell at ANY price before it goes to zero
      await placeSellOrder(market, 'NO', noTokens, yesPrice * 0.5);
    }
  }
}

UI Considerations

Following Polymarket's approach
  • โŒ No public "Provide Liquidity" UI
  • โœ… Simple trading interface only
  • โœ… Admin panel for platform liquidity (internal)
  • โœ… API access for MM partners (later)

Risk Disclosure (Required)

For any LP feature (if built):

โš ๏ธ RISK WARNING

Providing liquidity involves significant risk.

โ€ข You may lose 30-80% of deposited funds
โ€ข Fee income may NOT cover losses
โ€ข Worst case: lose almost everything

Only deposit what you can afford to lose.

Part 1 Summary: Key Design Decisions

Decision Recommendation Rationale
Initial Probability 100/n% or 50% Neither prevents loss; trade-offs exist
Market Structure Grouped Binary โ†’ NegRisk Already implemented; upgrade path available
Trading System Keep Order Book Already built; AMM requires rebuild
Initial Liquidity Platform provides No external LPs at start
Liquidity Amount $1-5K per market Balance between UX and risk
Expected Loss ~20% of liquidity Marketing/customer acquisition cost
Fee Structure 2% fee Industry standard
Public LP UI No (like Polymarket) Keep it simple; internal only

Bottom Line: Accept initial liquidity losses as cost of bootstrapping. Focus on building volume. External LPs and MMs will come after platform proves itself.

1.11Decimal Precision and Dust

Understanding how fixed-point arithmetic affects token calculations in prediction markets.

The Precision Problem

Example: $10 purchase at 55ยข
// Mathematical calculation
$10 / $0.55 = 18.181818181818181818... (infinite repeating)

// With 18 decimal precision (blockchain limit)
Stored: 18.181818181818181818 (truncated)

// Multiply back to verify
18.181818181818181818 ร— $0.55 = $9.99999999999999999990

// The "dust"
$10.00000000000000000000
-$9.99999999999999999990
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 $0.00000000000000000010  โ† Lost to precision (~0.00000000000000001 cents)

Where Does The Dust Go?

In CTFExchange, the contract uses integer division which always rounds DOWN:

Operation Where Dust Stays
MINT (create new tokens) CTFExchange's internal balances mapping
COMPLEMENTARY (match with seller) Seller gets slightly less, or CTFExchange keeps remainder
MERGE (redeem tokens for collateral) CTFExchange keeps the fractional collateral
Internal Balance Ledger
// CTFExchange contract - dust accumulates here
mapping(address => uint256) public balances;

When you buy 18.181818181818181818 shares for $10:

  • You pay: $10.000000 USDC (transferred to CTFExchange)
  • You receive: 18181818181818181818 shares (in 18 decimals)
  • Dust: ~$0.00000000000000000001 stays in CTFExchange

Practical Impact

Per Trade

  • Dust amount: ~$0.00000000000000000001
  • Negligible for individual trades
  • Not "lost" - just trapped in contract

Over Time

  • Accumulates with each trade
  • Millions of trades = few cents total
  • Some protocols implement "dust collection"
Key Insight

Perfect reversibility is impossible with finite decimals on repeating decimals like 1/0.55, 1/0.33, etc. This is inherent to all fixed-point arithmetic systems on blockchain.

Part 2: Advanced Market Models

Nostra Grouped Binary vs Polymarket NegRisk

2.1Market Model Comparison Overview

Understanding the two primary market model architectures for prediction markets with multiple outcomes: Nostra's current Grouped Binary approach vs Polymarket's NegRisk Adapter solution.

Feature Grouped Binary (Nostra) Grouped Binary + NegRisk (Polymarket)
Initial Probability Flexible (50% or 100/N%) Flexible (Market Decided)
Sum of YES Prices Flexible (Unlinked) ~100% (Arbitrage Enforced)
Market Linkage Independent (No Connection) Adapter Layer (NegRisk)
Stuck Inventory Yes (Major Issue) No (Convertible)
conditionId Multiple (Per Outcome) Multiple + negRiskMarketId
Position Conversion Not Possible Via Adapter
Liquidity Fragmentation Severe (N Markets) Unified
Implementation Complexity Simple 6-10 Weeks
Key Takeaway
  • Nostra Current: Grouped Binary - Simple implementation but serious liquidity fragmentation and stuck inventory issues
  • Polymarket: Grouped Binary + NegRisk - Same base structure, but solves inventory and liquidity via adapter layer
  • Core Difference: NegRisk adapter enables NO token equivalence, converting independent markets into a unified liquidity system

2.2Grouped Binary Model (Nostra)

The Grouped Binary model is Nostra's current implementation. Each outcome in a multi-outcome question is treated as an independent binary market with its own YES/NO tokens.

How It Works

Grouped Binary Architecture

Each outcome = Independent binary market with separate conditionId

Market 1
Spain
YES / NO
Market 2
France
YES / NO
Market 3
Brazil
YES / NO
Market 4
Argentina
YES / NO
Market 5
England
YES / NO

Key Characteristics

Advantages

  • Simple Implementation: Each market is independent, easy to create and manage
  • Familiar UX: Standard YES/NO betting interface
  • Flexible Pricing: No mechanical constraints on initial prices
  • Easy Resolution: One winner resolves YES, others resolve NO

Disadvantages

  • No Market Linkage: Prices don't sum to 100%
  • Stuck Inventory: Can't convert Spain YES โ†’ France YES
  • Arbitrage Leakage: No mechanical arbitrage enforcement
  • Capital Inefficiency: Must sell + rebuy to switch positions

The Stuck Inventory Problem

Example Scenario

You hold 100 Spain YES tokens at $0.25 each. Spain gets eliminated. Now you want France YES instead:

  1. Sell Spain YES: Price crashed to $0.05 โ†’ You get only $5 (lost $20)
  2. Buy France YES: Price rose to $0.40 โ†’ You get only 12.5 tokens

Result: Double slippage, significant value loss. Your position is effectively "stuck."

When Grouped Binary Works Well
  • Low volume markets where conversion demand is minimal
  • Markets with few outcomes (2-3)
  • Short duration markets where position changes are rare
  • MVP/early stage products prioritizing simplicity

2.3Liquidity Problems in Grouped Binary

Nostra's Grouped Binary model is simple, but serious liquidity issues arise in multi-outcome markets. Let's examine specific scenarios where problems occur.

๐Ÿ“Œ Scenario Setup: 2026 World Cup Winner Prediction

Nostra Market Structure

Creating a "2026 World Cup Winner" market with 5 teams on Nostra:

Spain
YES/NO
conditionId_1
Brazil
YES/NO
conditionId_2
France
YES/NO
conditionId_3
Argentina
YES/NO
conditionId_4
England
YES/NO
conditionId_5

Key Point: Each team is an independent market with no connection to others.

๐Ÿ”ด Problem 1: Stuck Inventory (Cannot Convert Position)

Alice's Situation

Alice invested expecting Spain to win:

// Alice's Initial Investment
Purchased: Spain YES 1,000 tokens @ 20ยข
Investment: $200
Expected Return: $1,000 if Spain wins (5x)

// One week later: Spain eliminated in group stage!
Spain YES price: 20ยข โ†’ 3ยข (85% drop)
Alice's position value: $200 โ†’ $30

Alice now thinks France will win and wants to switch her position:

โŒ Nostra (Current)

// Step 1: Sell Spain YES
Sell: 1,000 tokens @ 3ยข
Amount received: $30
Slippage: -10% โ†’ Actual $27

// Step 2: Buy France YES
France YES price: 25ยข
Can purchase: $27 / 0.25 = 108 tokens
Slippage: +8% โ†’ Actual 100 tokens

Result: 1,000 โ†’ 100 tokens (90% loss)

โœ… NegRisk (Polymarket)

// Direct Conversion via Adapter
Spain YES โ†’ France YES
Mathematical conversion (no slippage)

Value-based conversion:
$30 value โ†’ $30 value
France @ 25ยข = 120 tokens

Result: Value preserved, 20% more tokens

๐Ÿ”ด Problem 2: Liquidity Fragmentation

Bob's Large Order

Bob wants to invest $10,000 in Brazil YES:

// Nostra Order Book State (Brazil YES)
Total market liquidity: $50,000 (all 5 teams)
Brazil market liquidity: $10,000 (1/5)

Order book depth:
  15ยข: 5,000 shares ($750)
  16ยข: 8,000 shares ($1,280)
  17ยข: 10,000 shares ($1,700)
  18ยข: 15,000 shares ($2,700)
  19ยข: 20,000 shares ($3,800)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Total depth: ~$10,230

// Bob executes $10,000 market order
$750  @ 15ยข = 5,000 shares
$1,280 @ 16ยข = 8,000 shares
$1,700 @ 17ยข = 10,000 shares
$2,700 @ 18ยข = 15,000 shares
$3,570 @ 19ยข = 18,789 shares
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Total: 56,789 shares @ avg 17.6ยข

Expected at 15ยข: 66,667 shares
Slippage loss: ~15% (9,878 shares)

๐Ÿ”ด Problem 3: Price Inconsistency

Because markets are independent, the sum of all YES prices may not equal 100%:

Team YES Price Implied Probability Issue
Spain 25ยข ~22% Sum: 112ยข

12% Overbook
(Arbitrage Opportunity)
Brazil 23ยข ~20%
France 22ยข ~19%
Argentina 21ยข ~18%
England 21ยข ~18%
Why Does This Happen?

Nostra: Each market is independent โ†’ No price adjustment mechanism โ†’ Relies on manual arbitrage

Polymarket: NegRisk adapter โ†’ NO token equivalence โ†’ Automatic arbitrage maintains ~100%

๐Ÿ”ด Problem 4: LP Inventory Risk

Market Maker Charlie's Situation
// Charlie provides liquidity to Spain market
Provided: YES side $5,000, NO side $5,000 (total $10,000)

// Trading occurs: Users buy Spain YES heavily
Result: Charlie sells Spain YES and receives USDC
Position: Holding $8,000 Spain NO (skewed inventory)

// After Spain is eliminated
Spain NO = $1 (wins!)
Charlie profit: +$8,000

// But what if Spain had won?
Spain NO = $0 (loses)
Charlie loss: -$8,000

Problem: Cannot convert inventory to another team!
Even if Charlie wants to hedge with France NO:
1. Sell Spain NO (slippage)
2. Buy France NO (slippage)
= Double slippage makes hedging too expensive

๐Ÿ“Š Problem Summary: Nostra vs Polymarket

Scenario Nostra (Grouped Binary) Polymarket (NegRisk)
Position Conversion
Spain โ†’ France
Impossible
Sell โ†’ Buy (double slippage)
Possible
Mathematical conversion (0% slippage)
Large Orders
$10K market order
10-20% slippage
Fragmented liquidity
1-3% slippage
Unified liquidity
Price Consistency
ฮฃ YES = ?
90-120%
Relies on manual arbitrage
~100%
Automatic arbitrage
LP Hedging
Inventory rebalancing
High cost
Requires double trade
Low cost
Direct conversion possible
๐Ÿ’ก Key Insights
  • 2-3 outcomes: Nostra's Grouped Binary works adequately
  • 5+ outcomes: Liquidity fragmentation becomes severe, degrading UX
  • Solution: NegRisk adapter in Section 2.4 solves all these problems

2.4NegRisk Adapter (Polymarket Approach)

The key insight: Collateral is split directly into mutually exclusive YES tokens. This concentrates liquidity.

Core Formula

Sum(Price(YES)) = $1.00

Sum(Price(NO)) = $(N - 1).00

Instead of creating independent binary markets where YES + NO = $1 for each outcome, NegRisk links them all together. A single dollar of collateral is split across all outcomes.

  • Grouped Binary: $1 collateral โ†’ 1 YES(Spain) + 1 NO(Spain)
  • NegRisk: $1 collateral โ†’ 1 YES(Spain) + 1 YES(Brazil) + ... + 1 YES(England)

Worked Example: $10,000 Liquidity, 5 Countries

Let's see how NegRisk solves the liquidity crisis that Grouped Binary cannot handle.

Initial Setup
5 Countries: Spain, Brazil, France, Argentina, England

Initial price: 20ยข YES / 80ยข NO each (20% probability)
Market maker: $2,000 per country โ†’ 2,000 (YES+NO) pairs each
Total liquidity: $10,000
After 5 Trades (mostly Spain YES buys)
Country YES Left NO Left Status
Spain 500 2,000 1,500 NO excess
Brazil 1,600 2,000 400 NO excess
France 1,800 2,000 200 NO excess
Argentina 2,000 2,000 Balanced
England 2,000 2,000 Balanced

โŒ Grouped Binary (Nostra)

Trade 6: Buy $100 more Spain YES...

Only 500 Spain YES left!
Price jumps: 20ยข โ†’ 30ยข โ†’ 40ยข

$100 buys only 250 tokens (not 500)

1,500 Spain NO tokens sit useless ๐Ÿ’€
Cannot move to other countries!

โœ… NegRisk (Polymarket)

// Market Maker rebalances:
Collect 200 NO from each of 5 countries
= 200 complete "NO sets" (5 tokens each)
= 200 ร— $4 = $800 USDC

Mint 400 new Spain YES+NO pairs
โ†’ Spain liquidity restored! โœ“
Result Comparison

Grouped Binary

  • Spain YES: 500 (depleted)
  • Slippage: HIGH (+100%)
  • Excess NO: STUCK forever

NegRisk

  • Spain YES: 1,300 (restored)
  • Slippage: LOW (normal)
  • Excess NO: CONVERTED to USDC
Why This Works

The Magic: In NegRisk, all NO tokens can be combined and converted back to USDC (because one of them MUST win). This "unlocks" the stuck inventory and allows market makers to continuously rebalance liquidity where it's needed most.

Result: Even with many outcomes, liquidity stays healthy because excess inventory can always flow to where demand is highest.

2.5NegRisk Architecture

Open Source Reference

Polymarket's NegRisk implementation is open source and audited by ChainSecurity and OpenZeppelin.

GitHub: Polymarket/neg-risk-ctf-adapter โ†’

Contains: NegRiskAdapter, NegRiskOperator, NegRiskCtfExchange, WrappedCollateral, Vault, FeeModule

Architecture Layers

User Interface
"Convert my Spain YES to France YES"
โ†“
NegRisk Adapter
splitPosition()
mergePositions()
convertPosition()

Core: USDC โ†” NO tokens โ†” YES tokens conversion

โ†“
Grouped Binary Markets

Spain YES/NO | France YES/NO | Brazil YES/NO | ...
All linked by negRiskMarketId

โ†“
Conditional Tokens Framework (CTF)

Base layer for all token operations

Key Contracts

Contract Purpose Nostra Has?
NegRiskAdapter Core conversion logic (NO โ†’ YES) No
NegRiskOperator Admin functions, oracle integration No
WrappedCollateral Wrapped USDC for atomic operations No
ConditionalTokens (CTF) Base token framework Yes
MarketFactory Create binary markets Yes
CTFExchange Order book trading Yes

2.6Implementation Options

What Nostra Needs to Implement NegRisk

Estimated Effort

Component Time Complexity
Smart Contracts (1-3) 2-3 weeks High (security critical)
Backend API (4-5) 3-5 days Medium
Frontend UI (6) 3-5 days Medium
Testing & Audit 2-4 weeks Critical
Total 6-10 weeks
Alternative: Arbitrage Bots

Before implementing NegRisk, consider if you really need it. Current arbitrage bots can provide economic position balancing with much simpler implementation.

When to implement NegRisk?

  • High volume when conversion demand justifies complexity
  • User complaints about stuck inventory
  • Competitive pressure for Polymarket-level features

Part 3: Oracle Integration

Decentralized Market Resolution Strategy

3.1Oracle Strategy & Comparison

Nostra adopts a Multi-Oracle Strategy to handle various market types, ranging from crypto prices to niche local events. We benchmark against industry leaders like Opinion Labs (who use Hybrid AI + Optimistic Oracles) and Polymarket (UMA).

Comparative Analysis: Three Oracle Tiers

Oracle Type Mechanism Pros Cons Best For
Manual Admin Trusted admin key resolves outcome
  • Fastest
  • Cheapest (Gas only)
  • Flexible
  • Centralized Trust
  • Scalability bottleneck
Beta launch, test markets, emergency resolution
Chainlink
(Functions / Feeds)
Decentralized nodes fetch API/Price data
  • Trustless & Automated
  • Industry Standard
  • Instant settlement
  • Requires digital source (API/URL)
  • Cost (LINK tokens)
Sports, Crypto Prices, Election Results (with API)
UMA
(Optimistic Oracle)
"True until disputed" + Voter Jury
  • Any arbitrary event
  • No API needed (human verification)
  • Crypto-economic security
  • Slow (2hr+ challenge period)
  • Complex Game Theory
Long-tail events, "Opinion" based markets (e.g., "Will AI take over?")
Benchmark: Opinion Labs Strategy

Opinion Labs utilizes a sophisticated Hybrid Oracle approach:

  • AI Oracle (Opinion AI): First pass to ingest/summarize data and propose an outcome.
  • Optimistic Oracle (UMA): Final security layer. If the AI is wrong, humans can dispute it via UMA.

Nostra will adopt this "Optimistic Verification" pattern for unstructured markets.

Adoption Roadmap: Step-by-Step Evolution

1. Manual Admin (Beta / V1)

Goal: Validate market demand and UI/UX.

Method: Admin key resolves all markets. Fast, free, but centralized.

2. Hybrid Integration (V1.5)

Goal: Automate high-volume markets.

Method: Introduce Chainlink for Sports & Crypto markets. Keep Admin for long-tail events.

3. Decentralized Long-Tail (V2.0)

Goal: Permissionless market creation.

Method: Integrate UMA (Optimistic Oracle). Admin key allows "veto" only (emergency brake).

4. Full Decentralization (DAO)

Goal: Unstoppable protocol.

Method: Remove Admin key. Markets resolved only by Chainlink, UMA, or DAO governance.

3.2Optimistic Oracle (UMA) Integration

For markets where verifiable on-chain data or APIs are unavailable (e.g., "Will this YouTuber reach 1M subscribers?" or highly subjective "Opinion" markets), we utilize UMA's Optimistic Oracle. This allows humans to resolve markets with crypto-economic guarantees.

The "Optimistic" Mechanism

Flow of Truth

  1. Assert: A market creator or bot asserts: "Outcome A won."
  2. Challenge Window: A 2-hour window opens.
  3. No Dispute: If no one disagrees, the assertion becomes Truth. (Optimistic Path)
  4. Dispute: If someone challenges (stakes bond), UMA token holders vote to decide.

Why it works

  • Costly to lie: Asserters must post a bond (e.g., $100). If they lie and are disputed, they lose it.
  • Voter Incentives: UMA voters are incentivized to vote correctly to maintain the protocol's value.

Resolution Call Flow

Nostra โ†” UMA โ†” Challenger Interaction
1 Assert Truth
Nostra Contract
โ†’
2 Monitor
3rd Party Keepers (Permissionless)
โ†’
3 Dispute (Opt)
UMA Contract
โ†’
4 Settle
Payout / Resolve

Hybrid Implementation: Opinion AI + UMA

To scale resolution for unstructured markets, we employ a Hybrid AI approach similar to Opinion Labs. This combines the speed of AI with the security of the Optimistic Oracle.

How it Works

  1. Ingest & Analyze: An off-chain AI agent (LLM) continuously monitors active markets and relevant real-world data (news, social sentiment).
  2. Propose Outcome: The AI determines the result and acts as the Asserter, submitting the tx to UMA.
  3. Human Review (Watchdog): If the AI is correct, the market resolves quickly. If the AI hallucinates, human watchers dispute it to earn the bond.

Benefits

  • Scalability: AI can resolve thousands of long-tail markets 24/7.
  • Cost Efficiency: Reduces the need for manual admin intervention.
  • Safety: UMA provides the ultimate "kill switch" against AI errors.

3.3OptimisticOracleV3 Specification

The OptimisticOracleV3 is the core contract governing assertion lifecycles. It utilizes an escalation game where truth is assumed unless disputed.

Key Functions

// Core OOv3 Interface
interface IOptimisticOracleV3 {
    /**
     * @notice Asserts a truth about a world state.
     * @param claim Encoded data or string representing the statement (e.g. "BTC > 50k at block 100").
     * @param asserter Address that receives the bond back if correct.
     * @param callbackRecipient Address to notify when settled.
     * @return assertionId Unique ID for this assertion.
     */
    function assertTruthWithDefaults(
        bytes calldata claim,
        address asserter
    ) external returns (bytes32 assertionId);

    /**
     * @notice Settles the assertion. Can only be called after liveness period.
     * @return bool True if the assertion was resolved as TRUTHFUL.
     */
    function settleAndGetAssertionResult(bytes32 assertionId) external returns (bool);

    /**
     * @notice View function to check status.
     */
    function getAssertionResult(bytes32 assertionId) external view returns (bool);
}

Integration Logic in Nostra

Dispute Flow

๐Ÿ”ด Role of UMA Token

The UMA token is critical for the DVM (Data Verification Mechanism):

  • Voting Rights: Token holders vote on disputed outcomes (e.g., "Did Candidate X win?").
  • Economic Guarantee: If the DVM is corrupted, the cost to corrupt it must exceed the profit from corruption (Cost of Corruption > Profit from Corruption).
  • Buyback & Burn: Unused rewards or fees may be used to buy back and burn UMA, aligning incentives.
Required: The "Watchdog" Bot

The optimistic model only works if someone is watching. Nostra must operate (or incentivize) Watchdog Bots that monitor all active assertions. If a malicious user asserts a false outcome, the bot must detect it and trigger a dispute to protect market participants.

3.5Resolution Architecture

Current vs Proposed Flow

Current: Admin Resolution

Admin UI
โ†“
POST /api/admin/resolve
โ†“
Server Wallet signs tx
โ†“
reportPayouts() โ†’ Resolved

Admin manually decides winner

Proposed: Chainlink Resolution

Market Deadline
โ†“
Chainlink Automation triggers
โ†“
Contract reads Price Feed
โ†“
reportPayouts() โ†’ Resolved

Data-driven automatic resolution

3.6Smart Contract Integration

Functions Client Example (Request)

// FunctionsClient.sol (Inherited by our market contract)
import { FunctionsClient } from "@chainlink/.../FunctionsClient.sol";
import { FunctionsRequest } from "@chainlink/.../FunctionsRequest.sol";

contract NostraMarket is FunctionsClient {
    using FunctionsRequest for FunctionsRequest.Request;

    address router = 0x...; // Chainlink Router (Oracle Contract)
    bytes32 donId = 0x...;  // DON ID
    uint64 subscriptionId = 1234; // My Subscription ID

    // This function calls the Chainlink Router contract
    function resolveMarket() external {
        
        // 1. Create Request (Include JS Logic)
        FunctionsRequest.Request memory req;
        req.initializeRequestForInlineJavaScript("const apiResponse = await Functions.makeHttpRequest(...)");

        // 2. Send to Chainlink Router (Step 1 in Diagram)
        bytes32 requestId = _sendRequest(
            req.encodeCBOR(),
            subscriptionId,
            gasLimit,
            donId
        );
        
        // 3. Store ID for verification
        pendingRequests[requestId] = true;
    }
}
            

Price Feed Resolver Example

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract PriceFeedResolver {
    AggregatorV3Interface internal priceFeed;
    IConditionalTokens public ctf;

    struct PriceMarket {
        bytes32 questionId;
        uint256 threshold;      // Price threshold in 8 decimals
        bool resolveAbove;      // true = YES wins if price > threshold
        uint256 deadline;
        bool resolved;
    }

    mapping(bytes32 => PriceMarket) public markets;

    function resolveMarket(bytes32 questionId) external {
        PriceMarket storage market = markets[questionId];
        require(!market.resolved, "Already resolved");
        require(block.timestamp >= market.deadline, "Too early");

        // Get latest price from Chainlink
        (, int256 price, , , ) = priceFeed.latestRoundData();

        // Determine winner
        bool yesWins = market.resolveAbove
            ? price > int256(market.threshold)
            : price < int256(market.threshold);

        // Report payouts to CTF
        uint256[] memory payouts = new uint256[](2);
        payouts[0] = yesWins ? 1 : 0;  // YES outcome
        payouts[1] = yesWins ? 0 : 1;  // NO outcome

        ctf.reportPayouts(questionId, payouts);
        market.resolved = true;
    }
}
            

Chainlink Functions Example (JavaScript)

// This code runs in Chainlink Functions DON
const apiEndpoint = args[0];  // e.g., "https://api.sportsdata.io/..."
const jsonPath = args[1];     // e.g., "Games[0].Winner"

const response = await Functions.makeHttpRequest({
  url: apiEndpoint,
  headers: { "Ocp-Apim-Subscription-Key": secrets.apiKey }
});

if (response.error) {
  throw Error("API request failed");
}

// Navigate JSON path and return result
const homeTeamWins = result === "HomeTeam" ? 1 : 0;
return Functions.encodeUint256(homeTeamWins);
            

Network Addresses

BSC Testnet

LINK: 0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06
BTC/USD: 0x5741306c21795FdCBb9b265Ea0255F499DFe515C
ETH/USD: 0x143db3CEEfbdfe5631aDD3E50f7614B6ba708BA7
BNB/USD: 0x2514895c72f50D8bd4B4F9b1110F0D6bD2c97526

Polygon Amoy

Functions Router: 0xC22a79eBA640940ABB6dF0f7982cc119578E11De
BTC/USD: 0xe7656e23fE8077D438aEfbec2fAbDf2D8e070C4f
ETH/USD: 0xF0d50568e3A7e8259E16663972b11910F89BD8e7

3.7Cost & Security Considerations

Monthly Cost Estimation (100 markets)

Component Cost per Use Monthly (100 markets)
Data Feeds (read) FREE $0
Functions Request ~0.25 LINK 25 LINK (~$250)
Automation Check ~0.01 LINK 30 LINK (~$300)
Automation Execute ~0.1 LINK 10 LINK (~$100)
Total ~65 LINK (~$650)

Security Considerations

Trust Assumptions

  • Data Feeds: High trust (decentralized nodes)
  • Functions: Medium (relies on API)
  • API Sources: Varies by provider

Required Checks

  • Validate Chainlink response data
  • Handle Functions errors gracefully
  • Implement fallback to manual
  • Set appropriate gas limits
  • Monitor subscription balances

Part 4: Multi-Chain Strategy

Scaling & Interoperability

4.1Deployment Networks

Strategic Priorities

Low Transaction Fees

Prediction markets require frequent interaction (buying, selling, claiming). Gas must be < $0.01.

High Liquidity

Deployment on a chain with existing USDC liquidity reduces friction for user onboarding.

EVM Compatibility

Essential for supporting existing tooling, wallets (MetaMask), and Chainlink services.

Fast Confirmation

Trading requires instant feedback. Sub-2s block time (like Polygon/BSC/Monad) is preferred for UX.

Why Single Chain Deployment? (Liquidity Concentration)

We should NOT deploy market contracts on multiple chains simultaneously. Prediction markets rely heavily on liquidity depth.

  • Fragmentation: Splitting liquidity across Polygon and BSC makes order books thin on both.
  • User Experience: Bettors should meet in one place to match orders efficiently.
  • Operation: We maintain the "Core" on one chain, and use bridges (CCIP) to let users from other chains participate.

The Criticality of Gas Fees in Batch Processing

For optimal UX, our server will likely batch process user actions (e.g., matching 50 orders in one transaction) to provide instant confirmation and gasless experience for users. This makes gas fees a direct operating cost for the platform.

Scenario Cost on Polygon/BSC (~$0.01) Cost on Arbitrum/Op (~$0.15) Impact
1 Single Trade $0.01 $0.15 Manageable
Daily Batch (10,000 txs) $100 / day $1,500 / day Critical Difference
Monthly Cost $3,000 $45,000 Business Viability Risk

Conclusion: If we subsidize gas or run batch processors, L2s like Arbitrum are currently too expensive at scale. Polygon or BSC is mandatory for economic viability.

Comparative Analysis: L1 vs L2

Category Network Gas Fee Avg. Block Time Finality Pros Cons Verdict
L1 / Sidechain BNB Smart Chain (BSC) 0.05 Gwei (~$0.01) 450ms (0.45s) Probabilistic
(15 block ร— 0.45s โ‰ˆ 7s)
  • Huge global user base
  • Low fees
  • High liquidity
  • Used by Opinion Labs (Mainnet)
More centralized validator set Top Choice
Polygon PoS ~ $0.001 ~ 2.1s Probabilistic
(~128 block ร— 2.1s โ‰ˆ 5m)
  • Extremely low fees
  • Mature ecosystem
  • Excellent EVM compatibility
Reorg risks (rare now) Strong Alternative
Monad < $0.001 1.0s Instant
(1 block ร— 1s = 1s)
  • 10,000 TPS (Parallel EVM)
  • 1s Block Time (Instant)
  • Fully EVM Compatible
  • Supported by Opinion Labs
  • Mainnet not fully proven
  • No Chainlink support yet (Critical)
  • Liquidity not established
Future Contender
Monero (XMR) Low ~ 2 mins Slow
(10 block ร— 2m โ‰ˆ 20m)
  • Total Privacy (Ring Signatures)
  • Censorship Resistant
  • No Smart Contracts
  • Slow Confirmation
Incompatible
Zcash (ZEC) Low ~ 75s Slow
(24 block ร— 75s โ‰ˆ 30m)
  • Optional Privacy (zk-SNARKs)
  • No Smart Contracts
  • UTXO Model
Incompatible
Ethereum (L1) $2.00 - $50.00+ ~ 12s Safe: ~12m
(2 Epochs)
  • Maximum Security
  • Highest Liquidity
  • Prohibitive Costs
  • Slow for high-freq trading
Settlement Only
Solana ~ $0.00025 ~ 400ms Fast
(~12s finalized)
  • High Throughput
  • Low Latency
  • Requires Rust rewrite
  • History of outages
Incompatible
Layer 2 Base < $0.01 Instant (~2s) Instant (Soft)
Hard: ~12m (Eth L1)
  • Coinbase integration (easy onboarding)
  • Rapidly growing
  • EVM equivalent
  • Used by Limitless Exchange
Newer ecosystem Alternative
Arbitrum One ~ $0.10 Instant (~0.25s) Instant (Soft)
Hard: ~12m (Eth L1)
  • Highest L2 TVL
  • Deep USDC liquidity
  • Used by PrismX / Rain
Fees slightly higher than Polygon/BSC Alternative
zkSync Era ~ $0.05 Instant (~1s) Instant (Soft)
Hard: ~20m (Eth L1)
  • Native Account Abstraction
  • Supports Smart Contracts
  • ZK Security
Ecosystem fragmentation Good Alternative
Lighter Low Instant Instant
  • Optimized for Orderbooks
  • Proven Speed
  • App-Specific Chain
  • Cannot deploy user contracts
Incompatible

Primary Recommendation: BNB Smart Chain (BSC)

Why BSC Wins
  • Superior Speed: With the recent upgrade to 450ms block times, BSC offers ~7s finality. This is significantly faster than Polygon PoS (~2-5 minutes), creating a much snappier trading experience closer to centralized exchanges.
  • Binance Exchange Alignment: Building natively on BSC provides a significant strategic advantage for potential listing on Binance. Projects that drive volume and utility to the BNB ecosystem are often prioritized for support and listing opportunities.
  • Proven Liquidity: BSC consistently maintains high liquidity and active user counts, crucial for bootstrapping a prediction market.
  • Growing & Competitive: BNB Chain is proactively evolving, recently announcing fee reductions and speed upgrades to directly compete with Base and Solana, ensuring it remains an optimal environment for high-frequency trading.

While Polygon remains a viable backup due to its low fees, BSC's combination of raw performance and strategic ecosystem alignment makes it the optimal launchpad for Nostra.

Technical Note: Zero Code Change (EVM Portability)

Because both Polygon and BSC are fully EVM (Ethereum Virtual Machine) Compatible, there is NO risk of code divergence.

  • Singular Codebase: We use the exact same Solidity smart contracts for either network.
  • Configuration Only: The only differences are deployment parameters (e.g., USDC address, Chainlink Oracle address), which are handled by config files, not code changes.
  • Flexibility: We can switch between them or deploy to the other later with zero engineering overhead.

4.2Bridging Strategy (CCIP)

Why Bridge?

The Liquidity Fragmentation Problem

Users have funds on Ethereum Mainnet, Optimism, Arbitrum, etc. We don't want to force them to manually bridge to our specific chain using complex 3rd party bridges.

Solution: Chainlink CCIP (Cross-Chain Interoperability Protocol)

CCIP allows us to accept deposits from any supported chain and route them to our specific market implementation.

Cross-Chain Betting Flow
[User on Ethereum Mainnet]
โ†“
Sends USDC + "Bet on Brazil" Msg via CCIP
โ†“
Network of Chainlink Nodes (Secure Transport)
โ†“
[Nostra Contract on Base]
Receives USDC โ†’ Mints YES Tokens for User

Integration Architecture

Source Chain (User)

  • Router Contract: User interacts with this.
  • Function: `ccipSend(destinationChainSelector, message)`
  • Tokens: Programmable Token Transfer blocks tokens here and releases on destination.

Destination Chain (Nostra)

  • CCIP Receiver: Our contract implements `_ccipReceive`.
  • Logic:
    1. Verify sender
    2. Decode "Bet on Brazil" message
    3. Use received USDC to buy positions
    4. Credit user address (mapped)

Benefits of CCIP

Part 5: Technical Implementation

System Architecture & Workflows

5.1Market Creation Process (Under the Hood)

The "Gasless" Creator Experience

Nostra abstracts the complexity of blockchain interaction from market creators. When a user clicks "Start Batch Creation", the server handles all on-chain operations asynchronously.

Batch Creation Workflow
[User Client]
Sends JSON Config (Name, Outcomes, Dates)
โ†“
[API Server]
Creates "PENDING" BatchJob in DB
โ†“
[Batch Processor Service]
(Running in bg with Server Wallet)
โ†“
1. Blockchain Creation Loop: Deploys each binary market to MarketFactory
2. Database Sync: Records Condition IDs & Token IDs
3. Liquidity Minting: Mints USDC โ†’ Splits into Yes/No positions
4. Auto-Seeding: Places initial Ask/Bid orders on OrderBook
โ†“
[Websocket]
Push "COMPLETED" status to Client

Step-by-Step Execution

Step Action Status Message
1. Init Processor picks up job "Job started processing"
2. createBinaryMarket Calls Smart Contract for each outcome "Creating market X/Y: [Name]"
3. Persistence Saves Group/Markets to PostgreSQL "Saving to database..."
4. Liquidity Mints collateral & calls `splitPosition` "Minting collateral for market inventory..."
5. Seeding Places initial limit orders "Seeding initial liquidity..."

Detailed Token Flow: Liquidity & Seeding

To ensure markets are tradable immediately, the Server Wallet acts as the initial liquidity provider. This involves a specific sequence of token transfers:

Step 4: Liquidity Provision

  • Source: Server Wallet (Operator)
  • Action: Calls splitPosition() on CTF
  • Transfer In: Sends USDC (Collateral) to CTF Contract.
  • Transfer Out: Receives newly minted Position Tokens (YES/NO shares) to Server Wallet.

Step 5: Seeding Order Book

  • Source: Server Wallet (Operator)
  • Action: Places Limit Orders (ASKs) via API
  • Logic: The Server Wallet offers to sell its held YES/NO tokens at specific prices (e.g., $0.50).
  • Result: Users can buy immediately because the Server Wallet has already "pre-minted" the inventory.

5.2Claiming Process (Double Confirmation)

Why two transactions?

Users often ask why claiming winnings requires two wallet confirmations. This is due to the architectural separation between the Conditional Tokens Framework (CTF) and the Nostra Exchange Contract.

Transaction 1: Redemption

contract.redeemPositions(...)
  • From: CTF Core Contract
  • To: User's Wallet
  • Action: Burns winning position tokens and releases the collateral (USDC) directly to the user's wallet.

Transaction 2: Auto-Deposit

exchange.deposit(...)
  • From: User's Wallet
  • To: CTF Exchange Contract
  • Action: Moves the just-claimed USDC back into the Exchange balance so it can be immediately used for new trades.

Why not automatic deposit?

A common question is: "Why can't the Redemption step automatically send funds to the Exchange?"

UX Tradeoff

We prioritize continuous trading. By auto-depositing, we ensure users don't have to navigate to a separate "Deposit" page to re-use their winnings. The second confirmation ensures funds are ready for the next bet immediately.