project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

Oracle-Consensus

Establish on-chain consensus over predictions from multiple oracles that can evolve over time.

Oracle-Consensus

Created At

StarkHack

Winner of

Starkware - Best use of Starknet Promising Projects

Nethermind - Best Runner Up Integration of AI in transaction simulation

Project Description

The main goal of this project is to propose a smart contract that emulates an oracle based on multiple machine learning oracles' predictions.

The smart contract establish a consensus of the most likely value using the predictions and gives the accuracy of the consensus.

The predictions are real-valued vectors that may have constraints (e.g., component values should be between 0 and 1). For instance, a prediction could be the estimated investors' stress/euphoria level between 0 and 1 at a given time.

It is assumed that there is always a small percentage p of oracles that make wrong predictions (hack, bug, hallucination). Thus, we score the oracles and don't use the oracles with the worst scores when a user asks for the consensus value.

Every time an oracle changes its prediction, the smart contract updates its consensus on the oracle scores and the estimated value.

A dead oracle with sufficiently low score (ie. part of the worst p percentage) can be replaced if some conditions are respected :

  • The contract authorized replacement at creation
  • Enough admins voted to replace the oracle (the minimal number of admin required is also set at the contract creation)

How it's Made

The repository is splitted in three main folders :

  • Documentation on the mathematical assumptions
  • The Smart Contract implementation (on chain)
  • An oracle client that interacts with contract example (off chain)

The core consensus algorithm is tested in python then implemented in Cairo. Float are not natively supported by Cairo, thus I use the alexandria library which implements Wad/Ray technologies to manage fixed-point decimal numbers.

background image mobile

Join the mailing list

Get the latest news and updates