StarkExchange: Fast Withdrawals using Cookie Jars

A trustless mechanism that breaks the “proof-time” barrier

Jul 22, 2019 · 4 min read
Image for post
Image for post

Benefit: Lower Cost of Capital & Faster Response to Market Opportunities

Faster withdrawals mean lower cost of capital for traders: a trader needs less capital to participate in the market, because it is easier/faster for them to move funds around to benefit from arbitrage opportunities.

Image for post
Image for post
Table 1: Comparison of Exchange Solutions

Technical Discussion

Changes to the StarkExchange System:

  • The Cookie Jar contract: The exchange sets up an additional smart contract, from which it pays out Fast Withdrawals. Note that this contract can benefit from the fact registry design pattern, in order to store the evolving history of payments made on-chain to the participating parties.
  1. The exchange — assuming the user indeed has the funds in their off-chain balance, and the exchange has sufficient funds available in the Cookie Jar — instructs the contract to transfer the requested funds to the user, and mark the Fast Withdrawal as complete.
  2. The exchange submits the conditional payment to the prover. As this payment’s condition is satisfied (a corresponding payment to the user can be observed on-chain), the prover includes it in its next proof, and consequently funds are moved off-chain from the user’s account, to the exchange’s account.

New Revenue Stream for Exchanges

Fast withdrawals can be priced for different tiers of service. As such, they present an interesting business opportunity for exchanges, one which allows to price-discriminate between professionals (arbitrageurs, for example) who will pay for a premium service, and retail customers.

Historical Note

A similar proposal for fast withdrawals on Plasma was presented back in June 2018. That mechanism relied on fraud proofs, not validity proofs, resulting in a more complex protocol. Importantly, the “liquidity contract” presented there (the Cookie Jar contract, in our proposal), had to cover the period of time for disputing frauds (on the order of two weeks, compared to our one hour timeframe), resulting in a much higher cost of capital (about 200X higher).


StarkExchange V1.0 was designed to enable liquid self-custodial trading.

  • For the exchange: greater revenue potential (for example by enabling new pricing tiers, appealing to arbitrageurs, and more)
  • For all parties: inexpensive & trustless. Neither the exchange nor the user can steal the other party’s funds
Image for post
Image for post


Developing the Full Proof Stack for STARK

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store