Introduction

GuessWise is a platform for prediction markets using the chain link Price feeds. This will make use of the Chainlink's aggregator contracts on-chain to create markets, at a time to be forecasted at(based on aggregator's heartbeat).

Each market represents forecast of a particular price feed and shall have option ranges to choose the answers from. Users can stake any amount into the option they think would represent the price and can win if the prediction turns out to be fruitful.

Features

The platform has three features listed as of now:

  • Homepage listing the markets active right now
  • Leaderboard
  • History detailing the all the participations of a user and their corresponding outcomes

Also it costs zero fees to participate in any prediction market.

Technologies involved

  • React.js
  • Metamask, Walletconnect as browser wallets
  • Solidity smart contracts

Challenges I ran into

APIs to fetch the historical price feeds Initially, it was thought to query historical API of popular CeFi platforms, to fetch the price feed of the market pairs in concern. However, most do not directly provide the historical price feed API. Some like Coingecko has an option to get the historical data. But the response is not parseable by the chainlink jobs/any other oracles, owing to a search inside an array of [timestamps, prices] with an offset of +- 500ms from the forecast time.

Therefore the historical price feed is not reliable at least for now. This leaves resolving the market immediately at the forecastTime. In case of high traffic conditions, like the recent DeFi events, an immediate resolution might not be possible. Even if so, it comes a high gas price as the cost. Owing to the senisitivity of price feeds, such a job might need to be handled by a few high reputation resolvers/centrally altogether. In both the cases, a dispute process needs to be established as well.

Given all of these complexities, querying the historical price APIs is left out. Instead, Chainlink aggregators were chosen as the resolvers.

Aggregators seems to solve most concerns.

  • Each aggregator have a pre-known heartbeat(3 hrs or so) and the aggregator contract guarantees a price feed at that time, albeit minor time differences arising from on chain transaction confirmations.
  • Also each aggregator accepts an answer/price only after multiple confirmations.

All of this means, a decentralized way to serve automatic resolutions for the prediction markets.

There are a few trade offs in creating markets with aggregators as well:

  • Markets cannot be created at random times, but only in the heartbeat ranges(3 hrs or so). But this felt like an acceptable trade-off for reliability.

What's next for Not yet decided

  • Allow predictions not just in ETH but ERC-20 tokens as well
  • Decide if the users can create the markets as well
  • Allow users to stake any amount. Not just a fixed amount.

Built With

Share this project:

Updates