Establish on-chain consensus over predictions from multiple oracles that can evolve over time.
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 repository is splitted in three main folders :
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.