Workspace IndexDev Notes › A price at a moment — the instant, the window, and who can move it

#16PoC

A price at a moment — the instant, the window, and who can move it

Polymarket's five-second trick and Balance Coin's oracle attack are the same defect: one price, one instant, no band, no delay. The push-versus-pull oracle split exists because of exactly that problem, and the fix is a parameter with a number attached rather than a principle.

Start by pricing the attack rather than modelling anything: given order-book depth on the reference venue, what does it cost to move the price by X for T seconds, and how does that cost scale as the averaging window grows? Then trace the other half in code — the off-chain signature verification path in the Data Streams docs — and calculate the bounded gas cost of settling a single market, which is the number that makes per-market unit economics computable. Sources: Stanford/SMU settlement-manipulation study (CoinDesk, 2026-08-07); SlowMist on the Balance Coin oracle exploit (2026-07-22); docs.chain.link/data-streams.

Why

Two 2026 incidents look unrelated and are not. Polymarket settled its short-dated crypto contracts on a single price at a single moment, and researchers at Stanford and Singapore Management University documented 821 accounts taking $8.2M out of settlement windows they classified as likely manipulated — with 93% of the losses in those windows, market makers excluded, landing on retail. Balance Coin let its lending contract accept an oracle price without checking it against a plausible range and without any liquidation delay; an attacker wrote an abnormally low bitcoin price, instantly liquidated vaults that were never eligible, and took roughly $912,000, collapsing a $3.5M stablecoin by more than 99%.

Neither was a cryptographic failure and neither required a bug in the contract's arithmetic. Both read one price at one instant and treated it as truth. What makes this a card rather than two postmortems is that the fix is a parameter, not a principle: how long must an averaging window be, and how tight must a validation band be, before moving the input costs more than the payoff it unlocks?

And the other half of the card is why an entire oracle architecture exists to answer that question. The distinction between Chainlink Data Feeds and Data Streams is the boundary between push and pull. A push feed has oracle nodes continuously writing prices on-chain on deviation thresholds or heartbeat intervals; contracts read the latest on-chain state, the price is inherently stale between writes, and the oracle network bears the gas indefinitely. A pull feed keeps high-frequency data aggregated and cryptographically signed off-chain; when a caller settles, they pull the timestamped signed report and submit it with their transaction, and the contract verifies the signature on-chain and executes against that exact moment's price.

That is not a performance improvement, it is the answer to the incident above. Prediction markets resolve on closing price at 16:00:00 UTC or price at event occurrence. A push feed may simply not hold a value for that instant — no deviation triggered an update at that second. A pull feed can fetch a report signed at it. The fix Polymarket shipped is public and specific enough to test rather than invent: the single-price snapshot replaced by a TWAP — 30 seconds for five-minute markets, 60 seconds for 15-minute and four-hour markets — sourced from Data Streams, mirroring what Kalshi already does with regulated indexes and moving averages.

The limit is worth stating plainly, because it decides how much of the problem this solves. Data Streams is a price product. It does not resolve categorical outcomes — who won an election, whether a milestone was met — which remains the domain of decentralised consensus and CRE. Since a large share of event contracts are events rather than prices, this fills roughly half the column in the event-contract-plumbing table.

How it works

Push versus pull, and why the split exists

Data Feeds (push) Data Streams (pull)
Where the price lives Written on-chain by oracle nodes Aggregated and signed off-chain
Update trigger Deviation threshold (e.g. 0.5%) or heartbeat (e.g. hourly) Continuous, sub-second
Staleness between updates Inherent None — the caller fetches the instant it needs
Who pays gas The oracle network, indefinitely The caller, only when a state transition needs it
Price at an arbitrary timestamp May not exist A report signed at that millisecond
Cost predictability Unbounded, borne externally Per resolution call — computable per market

The three knobs, and the curve that decides them

Knob What it does How to size it
Window length Averages away a short push Plot cost-to-manipulate against window length; the crossing point with the payoff is the design output — not the window itself
Band width Refuses an implausible price outright Cheaper than averaging and independent of it — Balance Coin's contribution
Delay Interval in which a bad price could be noticed Not latency overhead — it is the detection window

The cost of moving a reference venue's mid by X for T seconds is a function of book depth; the payoff is the notional held into settlement. Those two curves crossing is the whole model.

The three concrete advantages of pull

  • Gas on demand — the oracle does not burn gas writing prices nobody reads.
  • Sub-second latency — delivery is not bounded by block time or heartbeat.
  • Millisecond granularity — which is what deterministic settlement of a dated contract requires.

Where the oracle lands in the event-contract table

event-contract-plumbing sorts regulated-stack requirements into free, must-build and no-answer. Settlement and audit trail come free on-chain. "The value at a specific moment" does not — and that is precisely what event-contract settlement turns on. Where a regulated venue solves this with market-data vendor contracts and audit-trail obligations, an on-chain venue solves it by verifying a signed report. It also answers the cost-ceiling question: paying per call makes per-market economics computable, the exact property Chainlink Functions could not deliver and the reason it sunset.

The line to carry forward

Treat the interval between oracle finalisation and trading halt as an attack surface with its own atomicity requirement, not an implementation detail. If a position can still be opened after the price that will settle it is already determined, that window is the product — and it is the same reasoning arb-bots-are-the-peg applies to a no-trade band and priced-by-the-wrong-thing applies to an instrument settling against a mark nobody publishes continuously.

1 diagram(s) on the live page.

← All Dev Notes · Workspace Index · Top ↑

한 시점의 가격 — 그 순간, 그 창, 그리고 그것을 움직일 수 있는 자

폴리마켓의 5초 트릭과 Balance Coin 오라클 공격은 같은 결함입니다 — 가격 하나, 순간 하나, 검증 범위 없음, 지연 없음. Push 대 Pull 오라클의 갈림은 정확히 그 문제 때문에 존재하고, 해법은 원칙이 아니라 숫자가 붙은 파라미터입니다.

모델링보다 공격의 값을 매기는 것부터: 기준 거래소의 호가창 깊이가 주어졌을 때, 가격을 X만큼 T초 동안 움직이는 데 드는 비용은 얼마이며, 평균 창이 길어질수록 그 비용은 어떻게 커지는가. 그다음 나머지 절반을 코드로 추적합니다 — Data Streams 문서의 오프체인 서명 검증 경로 — 그리고 단일 마켓 정산의 상한 가스 비용을 계산합니다. 마켓당 단위 경제를 계산 가능하게 만드는 숫자입니다. 출처: 스탠퍼드/SMU 정산 조작 연구(CoinDesk 2026-08-07), SlowMist 의 Balance Coin 오라클 익스플로잇 분석(2026-07-22), docs.chain.link/data-streams.

2026년의 두 사고는 무관해 보이지만 아닙니다. 폴리마켓은 단기 암호자산 계약을 한 시점의 가격 하나로 정산했고, 스탠퍼드와 싱가포르경영대 연구진은 조작 가능성이 높다고 분류한 정산 구간에서 계정 821개가 820만 달러를 빼갔다고 기록했습니다 — 그 구간 손실의 93%가, 마켓메이커를 제외하면, 리테일에 떨어졌습니다. Balance Coin 은 대출 컨트랙트가 타당 범위 검증도, 청산 지연도 없이 오라클 가격을 받아들이게 두었고, 공격자는 비정상적으로 낮은 비트코인 가격을 써넣어 애초에 대상이 아니던 볼트를 즉시 청산해 약 91만 2천 달러를 가져갔으며, 350만 달러짜리 스테이블코인이 99% 넘게 붕괴했습니다.

둘 다 암호학의 실패가 아니었고, 컨트랙트 산술의 버그도 필요 없었습니다. 둘 다 한 시점의 가격 하나를 읽고 그것을 진실로 취급했습니다. 이것이 사후분석 두 건이 아니라 카드인 이유는 해법이 원칙이 아니라 파라미터이기 때문입니다 — 평균 창은 얼마나 길어야 하고, 검증 밴드는 얼마나 좁아야, 입력을 움직이는 비용이 그것이 여는 보상보다 커지는가?

그리고 카드의 나머지 절반은, 왜 그 질문에 답하려고 오라클 아키텍처 하나가 통째로 존재하는가입니다. Chainlink Data Feeds 와 Data Streams 의 차이는 Push 와 Pull 의 경계입니다. Push: 오라클 노드가 편차 임계(예: 0.5%)나 하트비트 간격(예: 1시간)에 따라 온체인에 가격을 계속 씁니다. 컨트랙트는 최신 온체인 상태를 읽지만 기록 사이의 가격은 본질적으로 낡았고, 오라클 네트워크가 가스를 무한정 부담합니다. Pull: 고빈도 데이터가 오프체인에서 집계되고 암호학적으로 서명됩니다. 정산 시 호출자가 타임스탬프가 찍힌 서명 리포트를 가져와 트랜잭션과 함께 제출하고, 컨트랙트가 온체인에서 서명을 검증바로 그 순간의 가격으로 실행합니다.

이건 성능 개선이 아니라 위 사고에 대한 답입니다. 예측시장은 UTC 16:00:00 종가사건 발생 시점의 가격 으로 해소됩니다. Push 피드는 그 순간의 값을 아예 갖고 있지 않을 수 있습니다 — 그 초에 편차가 갱신을 트리거하지 않았다면. Pull 은 그 시점에 서명된 리포트를 가져올 수 있습니다. 폴리마켓이 실제로 낸 해법은 공개돼 있고 지어내는 대신 시험할 만큼 구체적입니다 — 단일 가격 스냅샷을 TWAP 로 교체: 5분 마켓 30초, 15분·4시간 마켓 60초, 출처는 Data Streams. Kalshi 가 규제 지수와 이동평균으로 이미 하는 것과 같은 모양입니다.

한계는 분명히 말할 값이 있습니다. 이것이 문제의 얼마를 푸는지를 결정하기 때문입니다. Data Streams 는 가격 상품입니다. 범주형 결과 — 누가 선거에서 이겼는가, 마일스톤이 달성됐는가 — 는 해소하지 못하고, 그건 여전히 분산 합의와 CRE 의 영역입니다. 이벤트 계약의 상당 부분이 가격이 아니라 사건이므로, event-contract-plumbing 표에서 이것이 채우는 것은 그 칸의 대략 절반입니다.

동작 방식

Push 대 Pull, 그리고 갈림이 존재하는 이유

Data Feeds (Push) Data Streams (Pull)
가격이 사는 곳 오라클 노드가 온체인에 기록 오프체인에서 집계·서명
갱신 트리거 편차 임계(예: 0.5%) 또는 하트비트(예: 1시간) 연속, 서브초
갱신 사이의 낡음 본질적 없음 — 필요한 순간을 호출자가 가져옴
가스 부담 오라클 네트워크가 무한정 호출자가, 상태 전이가 필요할 때만
임의 시점의 가격 없을 수 있음 그 밀리초에 서명된 리포트
비용 예측 가능성 무한, 외부 부담 해소 호출당 — 마켓 단위로 계산 가능

손잡이 셋, 그리고 그것을 정하는 곡선

손잡이 하는 일 크기 정하는 법
창 길이 짧은 밀어붙임을 평균으로 지움 조작 비용을 창 길이에 대해 그리고, 보상과 만나는 지점이 설계 산출물 — 창 자체가 아니라
밴드 폭 타당하지 않은 가격을 아예 거부 평균보다 싸고 독립적 — Balance Coin 의 기여
지연 나쁜 가격을 알아챌 수 있었던 간격 지연 오버헤드가 아니라 탐지 창

기준 거래소 중간가를 X만큼 T초 움직이는 비용은 호가창 깊이의 함수이고, 보상은 정산까지 들고 간 명목금액입니다. 그 두 곡선이 교차하는 것이 모델 전부입니다.

Pull 의 구체적 이점 셋

  • 필요할 때만 가스 — 아무도 안 읽는 가격을 쓰느라 가스를 태우지 않음.
  • 서브초 지연 — 블록 타임이나 하트비트에 묶이지 않음.
  • 밀리초 단위 — 만기 있는 계약의 결정론적 정산이 요구하는 바로 그것.

이벤트 계약 표에서 오라클의 자리

event-contract-plumbing 은 규제 스택 요구사항을 공짜·직접구축·답없음으로 나눕니다. 정산과 감사 추적은 온체인에서 공짜로 옵니다. "특정 순간의 값"은 아닙니다 — 그리고 이벤트 계약 정산이 바로 그것에 달려 있습니다. 규제 거래소가 시장데이터 벤더 계약과 감사 추적 의무로 푸는 것을, 온체인 거래소는 서명된 리포트를 검증해서 풉니다. 비용 상한 질문에도 답합니다 — 호출당 지불이 마켓당 경제를 계산 가능하게 만들고, 이것이 Chainlink Functions 가 주지 못했던 성질이자 그것이 sunset 된 이유입니다.

가져갈 한 줄

오라클 확정과 거래 중단 사이의 간격을, 구현 세부가 아니라 자체 원자성 요건을 가진 공격면으로 취급할 것. 정산할 가격이 이미 정해진 뒤에도 포지션을 열 수 있다면, 그 창이 곧 제품입니다arb-bots-are-the-peg 가 거래하지 않는 밴드에, priced-by-the-wrong-thing 이 연속 공표되지 않는 마크에 적용하는 같은 논리입니다.

1 diagram(s) on the live page.

← 전체 개발 노트 · 워크스페이스 인덱스 · 맨 위 ↑