SYSTEM ARCHITECTURE

Overview

Shelter Chain’s underlying architecture includes a user service layer, an open platform layer, a development service layer, a business layer, and a blockchain service layer. The underlying architecture forms an IoT platform without borders based on 5G technology. 
Compared with previous projects, the main advantage of the 5G technology used in Shelter Chain is the data transmission rate, which is much higher at up to 10Gbit/s, faster than the current wired Internet and much better than 4G, with LTE cellular networks being 100 times faster. Another advantage is lower network latency for a faster response time of less than 1 millisecond, were 4G is 30 to 70 milliseconds. Due to this faster data transmission, the data transfer in Shelter Chain will be more rapid, and the data uploaded by patients will reach medical institutions and scientific researchers in various countries in almost real time. 
Shelter Chain system architecture diagram

System architecture

1 Client
To provide optimised client module support, Shelter Chain supports PC-side and mobile connectivity and functionality, allowing all users to participate in the block chain network functions, including registration, connecting to peer-to-peer networks, viewing smart contracts, writing smart contracts, using smart contracts, viewing wallets and forwarding or saving local copies of blockchains.

2 The Block chain browser
The Shelter Chain browser can help the administrator to view channels, block, transactions, view chain code, and access other information about Shelter Chain, allowing them to perform related management operations.
 
3 DAPP market
Shelter Chain provides decentralised applications (DAPPs), allowing third-party partners to develop contract suites on the blockchain to encode business logic and to permit persistent storage to meet strict consensus requirements. This helps the third-party partners to develop in the ecology, and also allows data providers and data consumers access to more useful applications.

1 The OPEN API
Shelter Chain provides OPEN API services based on blockchain, which greatly reduces the threshold for partners’ use of blockchain technology. Using the OPEN API interface in a Restful architecture style means that medical administration departments can view and analyse all medical business data stored on the blockchain by the various medical institutions in real time, strengthening business supervision, and improving the quality of medical management. Insurance institutions can use the medical blockchain to obtain patient medical information, complete online underwriting, process online claims and provide other services. Appointment and registration app manufacturers can obtain doctor scheduling information from the medical blockchain, allowing them to develop appointment, registration, and payment functions.

2 Intelligent routing
The data storage contract is a contract by which the patient and the medical institution jointly authorise Shelter Chain to store the patient's complete medical records. The patient’s data storage contract records the patient's medical record index set with various medical institutions, and whenever a patient generates a medical record in a medical institution, Shelter Chain will update the data to the patient's medical record index set, as soon as the patient and the medical institution jointly authorise this.

1 Registration Contract
The data storage contract is a contract by which the patient and the medical institution jointly authorise Shelter Chain to store the patient's complete medical records. The patient’s data storage contract records the patient's medical record index set with various medical institutions, and whenever a patient generates a medical record in a medical institution, Shelter Chain will update the data to the patient's medical record index set, as soon as the patient and the medical institution jointly authorise this.

2 Data storage contract 
The data storage contract is a contract by which the patient and the medical institution jointly authorise Shelter Chain to store the patient's complete medical records. The patient’s data storage contract records the patient's medical record index set with various medical institutions, and whenever a patient generates a medical record in a medical institution, Shelter Chain will update the data to the patient's medical record index set, as soon as the patient and the medical institution jointly authorise this.

3 Data access contract
With the confirmation of the patient, a third-party organisation can sign a data access contract or other medical health or insurance related service contract on Shelter Chain to obtain the right to access patient data. The health service provider or insurance service provider then obtains the relevant medical data through a data link from Shelter Chain in order to offer personalised medical health or insurance services to the patient.

1 Ledger
The general ledger subsystem of Shelter Chain includes two parts: world status and transaction log. Each participant in the system holds a copy of the ledger, and the world status section describes the state of the ledger at a given point in time, acting as the database of the ledger. The transaction log section records all transactions leading to the current state, creating a historical record of the world status. 
The ledger is a combination of world status and transaction log. The world status section of the ledger is a replaceable data storage area, and Shelter Chain uses the Level DB and file system to store the data set for the blockchain, and thus the overall state of the system, for a long time.

2 Chain code
Shelter Chain implements core business logic through chain code, an instruction that defines and modifies assets. Chain code thus queries or modifies key-value pairs or other database information by executing its own logics. The chain code function is then executed by the current state of the database and initialised by the transaction proposal. The result of chain code execution is a series of key-value writes (write sets) that are submitted to the blockchain network and applied to all nodes.

3 Channel
Shelter Chain provides the ability to create channels, allowing groups of participants to create separate transaction ledgers. This is a particularly important option for networks where some participants may be competitors and thus do not wish to disclose every transaction they make to everyone. If two or more participants form a channel, then only these participants have a copy of that channel's ledger.

1 Authority management
As shown in Figure 4-2, the CA server has a tree structure. The root node of the entire tree structure is the root CA (Root Server), and there are multiple intermediate CAs (Intermediate CA) Each intermediate CA service cluster can be configured on the CA server, and a CA service cluster achieves load balancing through the application of pre-HAProxy. 
Fabric CA provides two access methods to call the server, one called Client and the other SDK. Both calls are in the RESTFUL architectural style, and Shelter Chain currently supports calling via Client. 
Figure 4-2: Shelter Chain CA Architecture

2 CA server
As shown in Figure 4-2, the CA server has a tree structure. The root node of the entire tree structure is the root CA (Root Server), and there are multiple intermediate CAs (Intermediate CA) Each intermediate CA service cluster can be configured on the CA server, and a CA service cluster achieves load balancing through the application of pre-HAProxy. 
Fabric CA provides two access methods to call the server, one called Client and the other SDK. Both calls are in the RESTFUL architectural style, and Shelter Chain currently supports calling via Client. 
Figure 4-2: Shelter Chain CA Architecture

3 Consensus Service
The Sorting Service will process all transaction messages in the Fabric network. It will sort the transaction data received within a certain time, and package it to generate a transaction list. 
Fabric currently supports two sorting types: Solo and Kafka. Shelter Chain uses Kafka distributed message system clusters to sequence transactions across the network, supporting high message concurrency and improving system throughput. The load balancing function of the cluster ensures the stability and reliability of Shelter Chain. The network broadcast sends a packaged transaction list to each participating node, and Shelter Chain uses the Gossip algorithm to ensure the consistency of the transaction list on each participating node.