# A New Blockchain-Based Multi-Level Location Secure Sharing Scheme
## 4 Our Proposed Scheme
### Our Proposed Scheme
#### 4.2.2 Location Record
After authenticating the identity of the \(LD\), the authority confirms the public attribute recorded by \(LD\) in the smart contract, then the attribute can be recognized. We can specify in the smart contract that some operations can only be executed by the authority, to easily implement the above method. Figure 4: Schematic diagram of \(SC\) recording license. Figure 5: The data formart of \(LD\)’s public attribute and \(LP\)’s policy recorded in the blockchain. ### Incentive and Punishment

In addition to implementing attribute-based access control, in order to drive system users to work honestly, smart-contract SC is also designed to implement an incentive and punishment mechanism, which can be summarized into two parts. First, _Frodes_ can gain benefits from reserving and providing _LPs_' virtual location data for _LD_. Second, _Frodes_ verify _LPs_' virtual location data and report to the network, so as to ensure the authenticity of the location data. Honest _Fnode_ obtains benefits; dishonest _LP_ and _Fnode_ should be punished. The specific method is as follows. The schematic diagram of the mechanism is shown in Figure 7. When _LP_ or _LD_, respectively, calls on _SC_ to record policy or license into the blockchain, they must transfer a small fee _E\({}_{1}\)_ into _SC_. _E\({}_{1}\)_s are distributed to _Frodes_ by _SC_ to motivate them to complete their work. In addition to _E\({}_{1}\)_, _LP_ must transfer a larger amount of the margin into _SC_. If _Fnode_ verifies that _LP_'s virtual location data are false, using the method mentioned in line 17 of Algorithm 3, _Fnode_ calls _SC_ to report _LP_. Within time \(T\), if more than 50% of _Frodes_ report _LP_, the collective believes that _LP_ provides false data, _LP_ is dishonest and _[PERSON]_ reported that _LP_ is honest. Additionally, _LP_'s margin and the fine _E\({}_{2}\)_ of the _[PERSON]_s that have not reported _LPs_ will be confiscated and distributed to the _Frodes_ participating in the report. Within time \(T\), if fewer than 50% of _[PERSON]_ report _LP_, the collective believes that _LP_ is honest, and the _[PERSON]_ report that _LP_ is dishonest. The fine _E\({}_{3}\)_ of _[PERSON]_ participating in the report will be distributed to the _[PERSON]_ that have not reported _LP_, and the margin will be returned to _LP_. Note that the margin must be at least greater than the maximum cost of reporting _LP_, which will be discussed further in Section 5.5. In theory, the bigger the margin, the better. Specifically, the smart contract records a service count variable _Src_ and honesty reward variable _Hr_ for each _Fnode_. Whenever a new policy is recorded by _LP_, _Src_ will increase. We clearly illustrate the change in _Fnode_'s _Hr_ in reporting _LP_ in Algorithm 6. _Fnode_ can redeem incentives in the smart contract based on _Src_ and _Hr_ at any time. In addition, the smart contract records a timestamp _Ti_ for _LP_ and a variable _Ih_ (the initial value is 1) that marks whether _LP_ is honest. If, within time \(T\), more than half of _Frodes_ report _LP_, _Ih_ is 0, which means _LP_ is dishonest. After time \(T\), if _Ih_ is 1, _LP_ can withdraw the margin. Figure 6: The data formant of the license recorded in the blockchain. ```
1:\(nFnode\)s (contains \(Fnode_{1}\)) report \(LP\);
2:\(mFnodes\) (contains \(Fnode_{2}\)) do not report \(LP\);
3:if Within time \(T\), more than 50% of \(Fnodes\) report \(LP\)then
4:\(Hr\) of \(Fnode_{2}\) decreases by \(E_{2}\);
5:\(Hr\) of \(Fnode_{1}\) increases by (\(E_{2}*m\) + margin) / \(n\);
6:endif
7:if Within time \(T\), less than 50% of \(Fnodes\) report \(LP\)then
8:\(Hr\) of \(Fnode_{1}\) decreases by \(E_{3}\);
9:\(Hr\) of \(Fnode_{2}\) increases by \(E_{3}*n\) / \(m\);
10:endif
```

**Algorithm 6** Pseudocode for the change in \(Fnode\)'s \(Hr\) in reporting \(LP\). In most practical application scenarios, such as epidemic case statistics and mobile phone application services, it is LP's obligation to provide real data, or the basis for an LP to obtain services.