Implementation

We present and discuss the algorithms for implementing the blockchain-based COVID-19 tracking system, that captures the working principles of our proposed solution leading to the development of the smart contract. The smart contracts were written in Solidity which is a widely used language for Ethereum smart contracts. Compilation and execution of the contract were achieved through the use of Remix IDE which is a browser-based compiler with an embedded debugger used for alerting and alarming the user with error notifications and warnings accordingly.
Firstly, oracles are assigned Ethereum addresses to be able to interact with the smart contracts as they act as a gateway between the blockchain platform and external data. This data will comprise of the statistics related to the number of infected and recovered cases and deaths obtained from reliable resources. This registration process is handled by the Registration smart contract.
The aggregator smart contract has the additional functionality of the registration smart contract that is necessary to register oracles. Firstly, oracles are assigned Ethereum addresses to be able to interact with the smart contract as they act as a gateway between the blockchain platform and external data. This data will comprise of the statistics related to the number of infected and recovered cases and deaths obtained from reliable resources.
Algorithm 1 describes how only trustworthy sources are used by registering oracles under the function registerOracle() to check whether the address is registered or not. If the oracle is not registered, then this function is responsible for registering the oracles by appending its Ethereum Address to the list of the oracles of different resources. After the process of registration, the oracle is then given an initial credibility score of 80, which can later vary based on the data provided by this oracle. After, the successful registration of oracles, they are now eligible to feed the smart contract with data extracted from online sources such as IHME, CDC etc using the oraclInput() function as shown in Algorithm 1. Then the process of data aggregation begins by incrementing the infected, recovered, and the dead counts corresponding to that oracle.