Prediction Market

Inspiration

Prediction market is a marketplace for people to bet on the outcomes of future events. In an active market, many people give opinions about specific events and generate an overall prediction based on the knowledge of all of them. However, traditionally, the process is like a black-box. You don’t know if your dealer is trustworthy. The key factor to obtain precise predictions is to make the marketplace transparent and open to everyone. This is why prediction market is a very good use case for blockchain applications. However, blockchain-based prediction market can lead to very slow order matching, payment and also has a problem to get the result information. Thanks to some awesome projects, we can solve these problems and build a fast and secure off-chain prediction market.

What it does

We built a off-chain prediction market with the help of Celer Network and Chainlink. In our off-chain prediction market, users can submit an event for prediction by providing an oracle contract address. Then all users can place orders to bet on the result with some ethers. These orders will form an online order book. Once YES and NO orders (think about bids and asks in a stock market) match, the corresponding issuers will get noticed and establish a bidirectional conditional payment through Celer Network. Based on the result given by the oracle contract, Celer Network will resolve the condition and settle the payments instantly without touching any on-chain transactions.

How we build it

We use Celer Network for off-chain conditional payment service: first, Celer Network is the only conditional payment solution. Second, Celer Network’s off-chain scaling makes the transactions very fast. I use Go Celer client to interact with Celer service.

We use Chainlink for on-chain oracle service. I use react to build the front end. I use nodejs running as a separate instance to do order matching and sync some data to firebase.

Challenges we ran into

It is not trivial to simplify the matching procedure and make the price of a event meaningful. In order to achieve this, we use a share as the minimal unit of prediction order and normalize the sum of matched bidirectional orders as 1, which makes the price of a share indicate the happening probability of an event. It is hard to make deentralized order matching, so I choose to use a central to process it.

Accomplishments that we're proud of

This is the first off chain state channel based prediction market, and it addresses UX issue for onchain based approach.

What's next

Try to implement decentralized order matching Make functionaliy and implementation more complete

Built With

Celer go client, Chainlink, Node, Infura, Solidity, truffle, React, Firebase

Built With

Share this project:

Updates