← 回到 ETHTaipei 2026

Polymarket:一天約 3 萬個市場,Polygon 撐得住?

How we scaled to serve $50B+ volume on chain

影片

影片與逐字稿來源:ETHTaipei

場次摘要

Polymarket 的 Aditya 說,平台計畫留在 Polygon,透過改造市場與結算合約降低鏈上負擔。新版架構允許先建立市場、到需要結算時才上鏈初始化,並減少多結果市場的資料寫入。他估計,高峰時 Polymarket 占用的 Polygon 區塊空間可由約 70% 降至約 30%;這是預估,並非已完成的成效。

值得記下的 5 件事

  1. Polymarket V2 設計把市場與預言機拆開,透過 aggregator 支援不同結算來源,降低單一預言機停擺時抵押品卡住的風險。
  2. V2 把市場、結果數、結算鏈與部位索引塞進單一 256-bit ID,減少鏈上讀寫。
  3. V2 可先交易、到結算時才初始化預言機,開市前不必先為每個結果建立鏈上問題。
  4. 多結果市場只需把贏家寫上鏈,其餘結果可推導為 no,避免逐一寫入全部結果。
  5. 現有 V1 市場會繼續運作,V2 市場當時尚待推出;Polygon 區塊空間占用從高峰約 70% 降至約 30% 是估計。

逐字稿

開場:留在 Polygon 上撐住預測市場成交量

謝謝。今天比較想講我們怎麼在鏈上把預測市場做大。主要是:怎麼吃下進來的成交量,又怎麼能跑在 Polygon 上,不必自己做 app chain,也不必專用 L2。怎麼在既有 L2 上服務使用者、撐住成交量,以及我們為了做到這件事,對協議做了哪些改善。Thanks, guys. Yeah. So, so today's talk is more about how we are scaling prediction markets on-chain. So, like, mainly about... How we support all the volume that we get, and how we're able to run on Polygon chain and not have our own app chain or not our own dedicated L2. How we're able to run it on an existing L2 and still serve customers and still have all the volume, and mainly going through all the protocol optimizations that we have been doing to enable that.

講 V2 之前,先說明過去五年 V1 怎麼跑。我們蓋在 Gnosis Conditional Token Framework 上面。那是 Gnosis Foundation 做的合約,同一批人也做了 Gnosis Safe。原語很單純:你存 1 顆 USDC 或 1 顆抵押代幣進任何預測市場,會拿到 1 份 yes 和 1 份 no。市場結算時,例如「ETHTaipei 會不會在九月舉辦」結算成 yes,持有 yes 的人可以把整份 USDC 領回。持有 no 的人,代幣價值是零。So before we start on the V2 process, I want to explain how the V1 worked for these, like, last five years. We built it on top of the Gnosis Conditional Token Framework. So this was a contract built by the Gnosis Foundation, the same guys who wrote the Gnosis Safe. And the primitive was pretty simple, right? You deposit one USDC or one collateral token. On any prediction market, and it gives you one yes and one no. And whenever the prediction market gets resolved, like let's say will ETHTaipei happen in September, it gets resolved to yes. So whoever holds the yes can claim it back to the winning yes. So they can claim it back to the whole USDC. And the person who had the no, their value, the token value is zero.

如果市場是「ETHTaipei 會不會在十月舉辦」,no 會有 1 美元賠付,持有 yes 的人幾乎什麼都沒有。另一方面,如果你同時持有 yes 和 no,還是可以合併,把當初放進去的那 1 美元拿回來。所以它永遠有抵押。幕後是 conditional tokens 合約,我們在 UMA 協議上建立問題:這件事會不會發生。UMA 為真實世界事件給答案,我們再依此決定怎麼賠付。UMA 說事件發生了,我們就記到合約上:答案在這裡。If the market was like, will ETHTaipei happen in October, the no will have a payout of $1, and then the person who will hold the yes has practically nothing. But on the other hand, if I have both yes and a no token, I can still merge them and get the dollar back that I put in. So that way, like, it's always collateralized. And behind the scenes, how we do it is we have the conditional tokens contract, and we create a question on the UMA protocol whether this will happen or not. UMA provides us an answer for the real-world event that happens, and based on that, you know, we decide how we want to provide the payouts. So if UMA says, yeah, this event happened, we will record it on the contract. The answer is here.

你的錢包裡有抵押與部位,就可以去 conditional token 贖回。V1 最大瓶頸是:讓你開始交易之前,要先在鏈上做很多交易。conditional tokens 上要建立市場:這是預測 ETHTaipei 會不會舉辦的市場。UMA 那邊也要丟問題:我們在開這個市場,市場可結算時想要這個答案。若市場有多個結果,例如選舉市場有五位候選人,那就不是二元市場,沒有單純的 yes 或 no。And then your wallet that contains the collateral and the positions, you can, you know, go and get it redeemed from the conditional token. So in the V1, the biggest bottleneck that we have is we have to do a lot of transactions on-chain before we are able to let you trade on the market. So on the conditional tokens, we have to create a market. Hey, this is a prediction market saying whether the ETHTaipei event will happen or not. On the UMA side, we have to give them a question saying, hey, we are creating this market. We want to know this answer whenever this market is resolvable. And in case the market has multiple outcomes, for example, take an election market, like we have five different candidates, and there's not a binary market, so there's no yes or no.

V1 綁死單一 oracle,V2 把市場與結算拆開

這是多結果市場:候選人 A、B、C 誰會贏。那會是 neg-risk 市場。我們得去 UMA 建五個問題:A 會贏嗎、B 會贏嗎、C 會贏嗎。開市前就要做很多鏈上交易,負擔很大。開始交易之後,又要做很多鏈上讀取,也就是 SLOAD,很貴。對 condition 做 split,也就是放進抵押、換成 yes 與 no,又要讀 storage。convert 與 redeem 也一樣。V1 是協議的 Gnosis 版本,每個市場都綁死 oracle。It's a multiple-outcome market. As in, will candidate A win, B win, C win? That would be a neg-risk market. So we will have to go to UMA and create five questions: hey, will candidate A win, will B win, will C win. So that's a lot of on-chain transactions that we have to do, and that's a lot of overhead that we have to deal with before we can even start trading on a market. So. Once you start trading on the market, again you have to do a lot of on-chain reads, which, like, are SLOADs and they cost a lot. Whenever you split on a condition, split is when you, like, put a collateral and you redeem yes and no, you again have to read from storage. Same with convert and same with redeem. And in the V1, which is the Gnosis version of the protocol, every market is tied to the oracle.

市場一旦建成、要由 UMA 結算,就只有 UMA 能給答案。若 UMA 或任何第三方依賴掛了,或發生我們控制不了的事,使用者的抵押就卡住,贖不回來,手上等於是沒價值的代幣。V2 我們把它拆開。首先把架構模組化:有 markets 模組管所有市場,再允許 oracle aggregator 聚合多個 oracle 來源來做結算。可以換掉 UMA,可以讓 Chainlink 提供資料,任何能上鏈給資料的 oracle,都能用來結算市場。So once we create a market that UMA is going to resolve, only UMA can provide an answer. And if UMA or any third-party dependency, for that matter, they go down or something happens which is not under our control, users are stuck with the collateral. Users cannot redeem it, and users are, you know, basically left holding a token that's worthless. So in V2, we try to split it up. We, firstly, we modularize the whole architecture in such a way that, hey, we have a markets module that controls all our markets, and then we allow the possibility of an oracle aggregator that can aggregate multiple oracle sources for us to provide a resolution. So we can switch UMA, we can have Chainlink provide some data. We can have any kind of oracle on-chain which provides us data, which we can use to resolve our markets.

markets 模組定義我們有哪些模組,也就定義預測合約的規則。例如 binary 模組告訴你這是 yes 或 no 市場。neg-risk 模組,也就是 negative risk,告訴你這是多結果市場。combinatorial 模組則是可以做 parlays,把兩筆或更多賭注湊在一起。例如兩個預測同時成立才算贏,賠付會高很多。directional 模組比較偏方向:例如賭 X 隊這場會不會拿超過五分、超過六分、超過七分。And the markets module defines all the modules that we have, which will define the rules of the prediction contract. For example, a binary module will tell you, hey, this is a yes or no market. A neg risk module, which is a negative risk module, will tell you, hey, this is a market with multiple outcomes. A combinatorial module will have markets where you can take parlays, which is essentially combining two or more bets together. For example, I can win on two predictions coming true at the same time, and the payout would be much higher. The directional module is more of a directional thing where I can bet on the direction of something. For example, I can bet on will— will Team X score more than five, more than six, more than seven points in a game?

依你押的方向,賠付會變,希望能拿到更好的賠付,市場的資金效率也會改善。幕後有 position manager 真正記錄餘額,抵押代幣是 PUSD。一切都模組化,鏈上效率比較好。我們盡量不把所有東西存上鏈,而是在鏈上推導。意思是:position ID 我們設法全部塞進一個 256-bit word。模組佔前 8 bit。base hash 才是市場本體。例如市場識別是「ETH 2.0 會不會在今年九月發生」,可以雜湊成 128 bit,其餘欄位再告訴你這個市場的其他事。So depending on my direction of the market, the payout will vary, and I can hopefully score a better payout, and it improves the capital efficiency for the market. But behind the scenes, there's a position manager which actually records all your balances, and we have the collateral token, which is PUSD. So everything is very modularized, and it allows us to, you know, have better on-chain efficiencies. Instead of storing everything on-chain, we try to derive everything on-chain. So what that means is a position ID here is everything we try to pack it in a 256-bit word. The module is the first 8 bits. The base hash actually contains the actual crux of the market. So, for example, I can have a market identifier, like will ETH 2.0 happen this September, and I can hash it and I can hash it into 128 bits, and everything else will tell me everything about the market.

把市場資訊塞進 256-bit,讀寫少很多

例如 arity:這個市場有幾個 condition。若是 yes 或 no,arity 就是 2。若有多個結果,arity 就是結果數。然後是結算鏈。我們現在在 Polygon,那就會是 Polygon 的 chain ID。condition index 是你持有的部位代幣索引。持有該市場的 yes 是 0,no 是 1。全部塞進一個 word,鏈上讀寫少很多,我們才能擴大規模、又不太把鏈撐爆。V2 從 position ID 看很單純。Like, arity would be, like, how many conditions does this market have? For example, is it a yes or no? In that case, arity would be two. If there are multiple outcomes in that market, the arity would be the number of the outcomes that we have. Then the resolution chain. For example, right now we are based on Polygon, so that would be the Polygon chain ID. The condition index would be the index of the actual position token that you're holding. For example, are you holding yes of that market? That would be zero. Are you holding no of that market? That would be one. So if we try to pack everything into one word, it reduces the reads and writes for our chain a lot, and that's— primarily how we are able to, you know, scale without bloating up the chain, essentially. So, for example, in V2, it's very simple from a position ID.

position ID 就是你持有的 yes 或 no 代幣 ID。憑這個代幣,可以在鏈下推導你持有哪個市場、這個市場有幾個 condition、依合約會拿到什麼賠付。讀取很單純:看模組。例如 neg-risk 部位會落在第二個模組,賠付直接從那個模組拿。一次讀,而不是三次。以前要先讀:依你的部位,市場是哪個;依市場,賠付是多少;再怎麼贖回。V1 要 prepare condition,得在鏈上寫。V2 在鏈下推導 condition,立刻就能 split。A position ID is just the ID of your yes or no token that you hold. Based on that token, we can derive off-chain what exactly is the market that you're holding, how many conditions this market has. And what kind of payout will this market get based on the contract? So it's a very simple read. We just check the module. For example, a neg risk position will have the second module, and we can just get the payout from that module. So it's just one read instead of having three reads. Earlier, we had to read, hey, depending on the position that you have, what is the market of your position? Based on the market, what is the payout of your position? And then how to redeem that payout. Right. So in V1, we had to prepare the condition. So we had to write on-chain. In V2, we just derive the condition off-chain, and we start splitting on it immediately.

我們甚至……對,oracle 可以晚很多再設。不必立刻告訴 UMA 我們在開市場,也不必先問 Chainlink 有沒有這個市場的價格餵價。可以直接對 condition 做 split,等到要結算,再延遲推導 oracle 那一側,再去 oracle 上設定:這個市場已經在交易,我們要結算。這個例子裡由 UMA 提供結算,我們只要在 UMA 登記問題,市場可結算時 UMA 再給結果。neg-risk、也就是多結果市場,以前每個結果都要建問題。We don't even... So yeah, oracles can be set up way, way later. We don't have to immediately tell UMA that, hey, we are creating a market. We don't have to go to Chainlink and check, do you have a price feed for this market? We can just start splitting on the condition, and whenever the time comes to resolve the market, then we can lazily derive the oracle side of things, and we can configure that on the oracles that, hey, we have this market already being traded on. We want a resolution for this market, and let's say, in this case, UMA will provide us the resolution. So we just register the question on UMA, and UMA can provide us with the result whenever the market is resolvable. In case of the neg-risk markets, which is like the multiple-outcome markets, earlier we had to create questions for all of the outcomes.

假設有 20 個結果,就要在 UMA 建 20 個問題。現在有延遲初始化,若已知道贏家,可以只請求那一個結果。答案由 UMA 協議以樂觀方式保證,也可以爭議結算,對我們夠安全。我們可以只問:這個市場的結果是什麼?若就是這個結果,存上鏈,其餘自動推導,因為只有一個結果能是 yes。拿到 yes 之後,其他全部結算成 no。不必在鏈上寫 20 個結果,寫一個、其餘推導即可。這裡也一樣:若 B 贏,我們把 event total 存成 1。If we had, let's say, 20 outcomes, we had to create 20 questions on UMA. Now, with this, especially with the lazy initialization, if we know who's the winner, we can just request that particular outcome. And if we get the answer for that, which is guaranteed by the UMA protocol to be optimistic, and it's like they can dispute the resolution, so it's pretty safe for us to use it. And we can just request, hey, what is the outcome of this market? If this is the outcome, yeah, we can just store that on-chain, and everything else just derives automatically because— only one outcome can be the yes. So once we get the yes, everything else resolves to no. So this way we don't have to write 20 results on-chain. We can just write one and derive the rest. Yeah. So same thing here. If B wins, we store the event total as one.

每天約開 3 萬個市場,等到要結算才上鏈

A 與 C 自動被推導成 no。若你持有 no,每個都可以贖回 1 份抵押,因為這是 neg-risk 市場:負風險的意思是,持有某市場的 no 仍可能贏。例如候選人 H 贏了,你持有的是候選人 B 的 no,仍可贖回抵押。oracle 這一側我們接了很多種。UMA 是老牌,負責真實世界事件。開始接 Chainlink,5 分鐘與 15 分鐘加密貨幣市場用 Chainlink 價格餵價。很快也會加實體資產,之後可以對原油、天然氣等實體資產價格開預測市場。A and C automatically get derived as no. If you're holding the no, you can redeem it for one collateral each, because it's a neg-risk market, so it's negative risk in the sense that if I'm holding no of a market, I can still win, because let's say candidate H won, and I was holding no of candidate B, I can still redeem my collateral. On the oracle side, we have added support for many, many different oracles. We have UMA as the OG, which provides us all the real-world events. We started integrating Chainlink, so we have Chainlink price feeds for the 5- and 15-minute crypto markets. We'll also add real-world assets pretty soon, so you will be able to create prediction markets on the prices of real-world assets, oil, gas, etc.

機構與 OTC 市場也有授權帳戶,aggregator 再全部併進 market 模組。所以需要時,可以從 oracle 視角延遲初始化市場。oracle aggregator 這一側我們也盡量保持無需信任、去中心化,讓人仍能爭議。例如你認為 Chainlink 報錯價、出事了,雖然我們不預期會發生,但若 Chainlink 錯了,仍可到合約爭議 Chainlink 做了什麼,爭議對了會得到報酬。V2 仍會儲存你的抵押與部位餘額。We also have authorized accounts for institutionals and OTC markets, and the aggregator combines everything into the market module. So we have, like, an easy way to just lazily initialize the market from the oracle perspective whenever we need to. And on the oracle aggregator side as well, we made sure to keep it trustless and decentralized to the point where people still can go dispute. For example, if you think Chainlink reported a wrong price, something bad happened, although that's— we don't expect that to happen, but in case Chainlink went wrong, you can still come to the contracts and you can dispute how Chainlink did something, and you will be paid for disputing it if you turn out to be right. So V2 still stores the balances of your collateral and positions.

結果仍會存,但比舊協議輕很多。規則與進度仍會存。市場進度:是否已初始化、是否等待結算。還有 combined definition。例如我在兩個連在一起的市場上做 combinatorial parlay,仍要 prepare condition:我要押 X 對且 Y 對。這裡的 parlay 會是 A 為 yes 且 B 為 yes。我們把 condition 雜湊在一起,存在 combinatorial 模組底層。但這只針對組合部位。一般部位完全不必存,幫我們省很多 gas。It still stores the results, but as I said, the results are much, much less heavier to store compared to our previous protocol. The rules and progress is still stored. The progress of the market: is it still initialized? Is it pending resolution? And the combined definition. So combined definition is, let's say I'm taking a combinatorial parlay on two markets being connected together. In that case, yeah, I would still prepare the condition that says, hey, I want to place a bet on X being right and Y being right. Yeah, so the parlay here will be A being yes and B being yes. The parlay here will be A being yes and B being yes. We hash the conditions together, and we will store this condition underlying in the combinatorial module. But this is only for, like, again, combined positions. For regular positions, we don't need to store that at all, and that saves a lot of gas for us. So.

整體來說 V2 存的資料少很多。結構化 ID 可以直接從代幣 ID 讀出來,不必上鏈查。有代幣 ID,我就能告訴你是哪個市場。延遲設定的意思是:我們可以一直開市場。以 Polymarket 的規模,每天大約開 3 萬個市場,不必在鏈上初始化。要結算時才需要把市場初始化上鏈。我可以今天開一個關於十二月才發生的事的市場,鏈上交易可以等到十二月才出現,執行端就有很多餘裕。單一事件贏家:依市場類型,多結果市場我們只需存一個結果。Generally, V2 stores much less data. The structured IDs is something that we can read right from the token IDs. We don't need to look up on-chain. If you have a token ID, I can tell you what market you have. In case of the lazy setup, as I said, we can keep spinning markets. We can, so for example, at Polymarket scale, we create about 30,000 markets every day, and we don't need to initialize them on-chain. We only need to initialize the market on-chain whenever it's time to resolve. So I can create a market today about something happening in December, but on-chain transactions can only go in December, and that gives us a lot of headroom to actually do our chain executions. One event winner, yeah, based on the markets, we just need to store one result for multiple outcome markets.

問答:V1 與 V2 並行,區塊空間估從 70% 降到 30%

這一個結果就能推出市場上其他結果。oracle aggregator 讓我們把 oracle 綁定拆開,也比較容易支援多種 oracle。我這邊先到這裡。有問題嗎?Alan,抱歉。講得很好。兩個短問題。第一,V1 和 V2 怎麼遷移?是同時支援,還是把 V1 轉成 V2?對,現在是同時跑。And that provides us the result for every other outcome on the market. And then the oracle aggregator provides us an easy way to separate our oracle bindings and, you know, have support for multiple types of oracles. Yeah, that's it from me, guys. Any questions? Yes, Alan. Sorry. Hey, great talk. I have two short questions. First one is, how did you manage the migration of, like, V1 and V2? Did you, like, simultaneously support V1 and V2, or did you convert the V1s into V2? Yeah, it's simultaneous right now.

現有的 V1 市場會繼續跑。同時我們很快會推出 V2 市場。所以長存續的市場仍在 V1?對。好。第二題,gas 大概省多少?這顯然該省很多 gas。你們在 Polygon 上贊助所有鏈上交易,想知道 gas 足跡長什麼樣子。現在 V1 加 V2,跟以前只有 V1 比,支出有沒有下降?高峰時我們大約吃掉 Polygon 全部區塊空間的 70%,目前估計能降到大約 30%。30%?對。謝謝。還有一點時間,最後一題。有人要舉手嗎?So V1 markets that are present, they will keep on ongoing. Meanwhile, we are rolling out V2 markets pretty soon. I see. So the long-lived markets are still in V1, right? Yeah. Okay. And second question is, do you have any rough sense of the gas savings? Because clearly this should save a lot of gas. So, like, you guys sponsor all the on-chain transactions on Polygon. So I'm wondering, like, what the gas footprint looks like. Today with V1 and V2 versus, like, when you only had V1 markets, has it decreased the expenses there? Right. So on our peak, we ended up consuming about 70% of all the block space on Polygon, and our current estimate is we will be able to reduce it to about 30%. 30%? Yeah. Thank you. All right, we still have some time for the last question. Anyone want to raise your hand?

我從十數到一。十、九。謝謝。沒有?好,謝謝。Let me count down from ten to one. Ten, nine. Thanks, guys. No? Okay, thank you.

更多來自 ETHTaipei 2026

訂閱