# SPIN: A Blockchain-Based Framework for Sharing COVID-19 Pandemic Information across Nations
## 4 Prototype Implementation  
We used Hyperledger Fabric [28] to implement a prototype of SPIN [19], as a permissioned blockchain network. We represented each country as an organization with one peer that maintains a blockchain of transactions, and a database state maintains the current values of ledger states. Multiple peers per country can be created for availability and durability purposes. The peer corresponding to the country issuing a write transaction acts as the endorsing peer that must approve the transaction for it to be considered valid. Each organization has a Membership Service Provider (MSP), which handles identity and authentication issues using PKI. We used Hyperledger Fabric's cryptogen utility tool to generate the public and private keys for all entities in the network. For the purpose of our prototype, we created five organizations with a total of five peers and five clients, i.e., one peer and one client per organization. Additionally, we created a cluster of five orderer instances, colocated with their peers, for the ordering service of Hyperledger Fabric. The ordering service implements Raft as the consensus protocol for the blockchain network. We deployed one channel to facilitate communication among organizations, their peers, and their clients. We implemented two smart contracts for each organization, one for public data and the other for private data. A smart contract is a program that consists of transactions that define the business logic. Invoking a smart contract executes transactions and records them in the blockchain. The smart contract for public data consists of set and get transactions, allowing peers belonging to the same organization to write/modify and retrieve key-value pairs. Other peers are only authorized to get key-value pairs and not to set them. This enables peers and clients belonging to the same organization to write public data (key-value pairs) for the organization. In contrast, other peers, belonging to different organizations, may read the public data without the ability to write/modify it. The smart contract for private data consists of set and get transactions as well. It maintains the private data collection belonging to an organization. It may be read by only peers and clients belonging to the same organization. It allows other peers to execute a set transaction sending private data to that organization and the hash of the data to the blockchain network. This enables one to send COVID-19 certificate and fingerprint templates belonging to a traveler to her destination country, as described in Section 2.2, which will only be accessible to that country. For evaluation, we show screenshots of the execution of SPIN functionalities. The performance and scalability of the underlying blockchain framework (Hyperledger Fabric) have been extensively evaluated in previous work [37; 38; 39], showing superior results. This is attributed to several design decisions, including the fact that Hyperledger Fabric operates in a permissioned blockchain network allowing it to opt for more scalable consensus protocols and avoid protocols with limited performance characteristics, such as proof of work [40; 41]. Therefore, we show the execution steps with screenshots from our prototype implementation using a CloudLab testbed [42]. First, we show an execution of the smart contract for sharing public data of Org1, namely, \"public_record.\" Its client executes \"SetRecord\" transaction via Peer0 of Org1 to share the number of vaccinated people formatted as key-value pairs {key = SA-VAC-COUNT, value = 123,456}, as seen in Figure 4. Next, we show a client belonging to another organization, Org2, which executes a \"GetRecord\" transaction via Peer0 of Org2 to retrieve the value of key= \"SA-VAC-COUNT\", as seen in Figure 5. Alternatively, the client of Org2 may retrieve all public key-value pairs of Org1 by invoking \"GetAll\", as seen in Figure 6. Notice that the client of Org2 is not permitted to invoke a \"SetRecord\" transaction for the smart contract belonging to Org1 (see Figure 7).