Fig. 3 System overview of a blockchain-based data tracking process using smart contracts and trusted oracles
Registration Contract . This smart contract includes information about web sources and any participating stakeholder.
Reputation Contract . This smart contract deals with assigning a reputation score for an oracle derived from the evaluation of web sources used to retrieve data. The total reputation score of an oracle consists of the credibility of the web source along with the reputation score a user has assigned to it. The reputation is therefore positively affected by honest and reputable websites and negatively affected by malicious ones. The reputation score of an oracle depends on its trustworthiness. If the trustworthiness of an oracle is above the threshold, its reputation score is calculated as shown in Eq.1.
\begin{equation} \text{Cr}\left(A\right)=\ \frac{RepScore\ (A)\times T}{4\times AdjF}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (1)\nonumber \\ \end{equation}
where \(\text{Cr}\left(A\right)\) represents the total reputation of an oracle in which \(A\) is the address of the oracle.\(\text{RepScore\ }\left(A\right)\) is the reputation score of the web source, \(T\) represents the trustworthiness of the oracle, which is the difference between the value reported by the oracle and the value computed by the smart contract. While AdjF is the adjusting factor, i.e., how harsh or lenient we want to be with nodes reporting wrong values.
However, if the trustworthiness of the oracle is below the threshold, the reputation of an oracle is computed using Eq. 2.
\begin{equation} \text{Cr}\left(A\right)=\ \frac{RepScore\ (A)\times T}{4\times(10-AdjF)}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (2)\nonumber \\ \end{equation}
Aggregator Smart Contract. This smart contract is concerned with retrieving the latest updates and sending them to front-end users. It will receive updates only from credible oracles with a high reputation score while it drops updates from oracles with low scores. The reputation scores provided for every oracle are then grouped into clusters. The cluster head can be determined either by taking a member of the cluster that is approximately in the middle or considering the centroid of the values. Once the most reputable cluster is determined, the updates of the latter are sent to the front-end users through the DApps and/or dashboards.

Trusted Oracle Network

Oracles act as third-party services that feed smart contracts with external data as they are unable to fetch external information on their own. Data feeds in web APIs are usually not deterministic like blockchain and smart contracts. Therefore, oracles act as a bridge that is capable of processing external and non-deterministic information into a format that can be understood and executed by smart contracts. It should be noted that obtaining information from a single oracle is not reliable therefore, multiple oracles are needed to report news and information feed to the smart contract. Then smart contract validates and checks the reported data from multiple oracles to verify the trustworthiness of the reported data. This eliminates the need for trusting only one source avoiding the occurrence of a single point of failure.

Message Sequence Diagram

A sequence diagram shows the interactions between different stakeholders while simultaneously showing various events that are triggered in the sequence of functions that are triggered within the smart contract. Each participant in the network holds an Ethereum Address that enables them to interact with each other by calling functions within the smart contract. Fig. 4 illustrates the sequence flow between different stakeholders from extracting data from web sources to providing the latest updates to DApps or dashboards.
Initially, the oracle sources are registered in the registration smart contract to keep information about our stakeholders. This occurs by executing the function called RegisterOracle(Address) . Then, the aggregator smart contract would invoke the functioncomputeReputation(Address) to check the trustworthiness, credibility, and reputation of registered oracles.
Afterwards, the oracles extract data from the registered web sources by executing the function inputOracle(infect, recover, death) . Once the oracles extract the required attributes: number of recoveries, infections, and deaths, the extracted data go to the aggregator smart contract. The contract then approves the most reputable cluster of data that will be provided to the DApp front-end users by invokingCalculateStatistics() function. Through the use of these apps, front-end users would be able to access real-time data about the new recoveries, infections and deaths in a trusted and reliable manner.