Code Cannot See Outside the Window
Let a reporter, challenger, and arbitrator complete one round of bringing a real-world result onchain.
- Separate a data source, an initial report, and a final result
- Explain how a challenge window and economic bond can correct an error
- Judge why an unchallenged wrong report can still enter settlement
- PREVIOUSCourse introduction
- CURRENTCode Cannot See Outside the Window
Let a reporter, challenger, and arbitrator complete one round of bringing a real-world result onchain.
- NEXTWhy Is One API Result Not Enough?
Think about these questions first.
Choose an answer before opening the explanation. You can add anything unexpected to your review list.
Q01Why can an honest oracle reporter still be wrong?+
Honesty means no deliberate lie, not perfect information. A reporter can read a bad source, misread rules, or face an outage; the oracle needs a correction process, not an infallible person.
Smart contracts can verify balances, signatures, and state transitions, but they cannot see a launch, a match, or the weather outside the chain. An oracle is not simply an API call: it is a process for deciding who may report, who may challenge, and what an error costs.
A source, a report, and a final result are different
The prediction market asks: “Will humans return to the Moon before 2028?” The price can move onchain, but whether the event happened must come from outside. A complete oracle flow has at least three layers:
- Data source: official records, APIs, or evidence that may be delayed, conflicting, or manipulated.
- Initial report: a participant writes YES or NO and locks a bond.
- Final result: only after the challenge window and dispute process may a market read the result and pay out.
现实结果如何进入链上?
2028 年前,人类会再次踏上月球吗?
揭开数据源记录(教学用真相)
初报与官方记录相反,必须依靠挑战期纠错。
- 可用积分
- 1,000
- 锁定担保
- 0
- 正确 / 错误
- 0 / 0
- 可用积分
- 1,000
- 锁定担保
- 0
- 正确 / 错误
- 0 / 0
数据源是现实世界的输入;担保金是让参与者在错误报告时付出代价的激励。两者都不能被价格本身替代。
预言机不是把 API 结果复制上链,而是把一组带激励、担保和争议流程的事实输入接入结算。
- 02
数据源为「未经核验的社交媒体账户」,状态 CONFLICTING。
- 01
等待报告:2028 年前,人类会再次踏上月球吗?
Use the slider to return to an earlier step. Continuing from there replaces the later history with a new sequence.
Why a challenge window matters
If a report settled immediately, a delayed or manipulated source would directly trigger payouts. A challenge window gives other participants a public interval to submit the opposite result and lock a bond that proves they are willing to bear the risk.
This lab simplifies the window to two blocks. Advancing time changes the deadline, not the report. Only after the window ends can the protocol finalize the report or enter arbitration. Real systems may use timestamps, dispute rounds, voting, or decentralized evidence, but the question is the same: when can an error be detected, and why would an honest participant step forward?
A bond makes an opinion accountable
The Primary Reporter and Challenger both lock credits. With no challenge, the reporter gets the bond back, even if the result is wrong; with a challenge, the arbitrator reads the evidence, the correct side receives both bonds, and the wrong side absorbs the loss.
This is not magic correctness. It puts attack cost, discovery reward, and time into the state machine. An attacker may still control a source, collude, or make honest challenges too expensive.
Expand: how this step works
submit(outcome, bond):
lock(reporter, bond)
open(challengeWindow)
challenge(oppositeOutcome, bond):
lock(challenger, bond)
after window:
if no challenge:
finalize(reportedOutcome)
else:
winner = evidence == reportedOutcome ? reporter : challenger
winner receives both bonds
Production systems add source aggregation, reputation, commit/reveal, governance, Sybil resistance, and upgrade controls. This lab compresses those concerns into observable bonds and events so the trust boundary stays visible.
Why the market cannot repair a bad fact by itself
An order book knows how many credits traders will exchange for a position; it does not know whether the Moon launch or match actually happened. If an oracle writes the wrong result into settlement, a later price rebound cannot automatically reverse payouts.
That is why serious systems separate price discovery from fact reporting. The first handles beliefs and liquidity; the second handles sources, challenges, and disputes. Clear module boundaries make risks easier to test and explain.
What is the most important job of an oracle challenge window?
Five questions for evaluating an oracle
After the lab, explain:
- What is the different role of a data source and a reporter?
- Why should a report not trigger a payout immediately?
- Why must a challenger lock a bond?
- Why can a wrong report still finalize when nobody challenges it?
- When should a prediction market read the final result?
Oracles are the reality interface for onchain finance: prediction markets, lending collateral ratios, stablecoin reserves, and liquidation prices all depend on them. Understanding their boundary is part of understanding blockchain finance itself.