Polkamarkets Labs
Published in

Polkamarkets Labs

Dispute Courts on Polkamarkets with Kleros

Dispute Courts on Polkamarkets with Kleros

The V1 of the Polkamarkets Protocol uses an Optimistic Oracle mechanism to resolve markets. Developers can customize the default implementation and use Kleros courts to resolve markets. This article walks you through the process of integrating Kleros with Polkamarkets Protocol V1.

One of the greatest challenges that prediction market platforms face is having reliable, trustworthy, and decentralized event resolution. Developers deploying their own products powered by Polkamarkets can decide to leverage Kleros’ proven dispute court protocol to further secure the resolution process if they need to.

We announced our partnership with Kleros last year, and while Kleros is not yet available on Moonbeam nor Moonriver, it is available on other EVM-compatible networks on which developers can also deploy the Polkamarkets Protocol. Kleros is used by many well-known projects such as 1Inch, Hats Finance, Etherscan and Proof of Humanity. It’s also used to curate ERC-20 token lists in major decentralized exchanges like Uniswap and Sushi Swap. Recently, it’s been used to resolve the first on-chain insurance arbitration on Unslashed.

If you haven’t already joined our Discord and Twitter, click here to join the conversation! Please also read this article for more information regarding Kleros partnership for crowdsourced event resolution

Fork away

The Polkamarkets Protocol and associated services are free and open-source software. Developers can leverage it to build new prediction marketplaces or integrate prediction markets in other products. For example, OpenDAO used Polkamarkets tech to launch SOSMarket.

The V1 of Polkamarkets Protocol uses the reality.eth contract for crowd-sourced event resolution. Given that reality.eth supports bond escalation and delegation to third-party arbitrators, it’s fairly simple to integrate dispute courts with Polkamarkets-based prediction markets.

Before you proceed, we recommend that you read up on the Polkamarkets Developer Documentation and deploy a testnet version of Polkamarkets. You’ll then tweak and extend this deployment to use Kleros dispute courts as part of the market resolution process.

Using Kleros with reality.eth

The first thing you’ll want to decide is on what blockchain you’ll be deploying your Kleros-compatible Polkamarkets Protocol-based product. For easier deployment, you can deploy on a network that is natively supported by Kleros. If you do, you’ll avoid having to use a cross-chain proxy/bridge. Since Polkamarkets is EVM-compatible, you can deploy the protocol on any EVM that Kleros is available on. If that is not an option, you can use Kleros’ Cross-chain reality.eth Proxy on any AMB-compatible network (AMB stands for Arbitrary Message Bridge, and can relay any data between two EVM-based chains) to deploy Polkamarkets on one network, and use Kleros Courts on a different network.

For the sake of simplicity and for the scope of this article, we’ll assume that you don’t need to use the cross-chain proxy and that you’re deploying Polkamarkets on a chain that is supported by Kleros. The diagram below shows the four building blocks involved in this implementation.

High-level architecture. Source: How to use Reality.eth + Kleros as an oracle

On Ethereum Mainnet, the Kleros General Court should be sufficient for resolving most disputes, with the option to use the Technical Court for more technical disputes. These two courts are already linked up to Kleros via existing Reality.eth <> Kleros Proxy contracts and are ready to be used right away.

If you believe that you will need to make use of another court or even create a special court for your use case, reach out to Kleros at integrations@kleros.io.

Follow the instructions below to adapt your usage of the Polkamarkets Protocol to use Kleros

Using Kleros with Polkamarkets

From here on, we’ll assume that you’re ready to use Reality.eth with Kleros and are now ready to deploy your own version of the Polkamarkets Protocol to use Kleros.

Here are the logical steps that your application code will follow:

  1. Once a market is closed in Polkamarkets, you can choose to let users start an arbitration process using Kleros in addition to, or instead of, the normal bond escalation process.
  2. To do this, you’ll make your code trigger Reality.eth’s arbitration request, passing the contract address of your Reality.eth <> Kleros Proxy to the right function. In lines 214–225 of the Polkamarkets PredictionMarket contract, you can see that an arbitrator variable can be passed to Reality.eth.
  3. Your Reality.eth <> Kleros Proxy will then create a Kleros court case. The jury in your chosen court will decide on the right outcome.
  4. The jury’s decision is then passed back to the Reality.eth contract, which in turn will tell the Prediction Market contract how the market resolved.

You can expose the arbitration feature in the interface and let users decide whether they want the market to be resolved with Kleros or the normal bond escalation process. Or you can make it the default way to resolve a market. It really is up to you; just make sure you have all the angles covered and follow the guidelines we present in this article.

If you have any questions or need direct assistance, please reach out to the Polkamarkets Labs team. We have a close relationship with the Kleros team and together we can provide you with all the help you need.

Happy coding!

Polkamarkets Labs strives to add value to the prediction markets industry, by providing a fully open-source toolkit and protocol that anyone can leverage. We’re currently focused on the Polkadot, Kusama, and EVM-compatible ecosystems.

You can learn more about our upcoming work in our Public Roadmap, which lists our R&D efforts. We update it every couple of weeks. Stay tuned and up to date by joining our Discord Server.

About Kleros

Kleros is an Ethereum-based autonomous organization that works as a decentralized third party to arbitrate disputes. It relies on game-theoretic incentives to have jurors rule cases correctly. The result is a dispute resolution system that renders ultimate judgments enforced by smart contracts in a fast, inexpensive, transparent, and decentralized way.

Website

Blog

Telegram

Twitter

About Polkamarkets

Polkamarkets is an Autonomous Prediction Market Protocol built for multi-chain information exchange and trading where users take positions on outcomes of real-world events–in decentralized and interoperable EVMs.

Telegram

Discord

Twitter

LinkedIn

Website

--

--

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