# PINE: Post-Quantum Based Incentive Technique for Non-Cooperating Nodes in Internet of Everything
## 3 Proposed Approach--PINE Protocol
### Protocol Design
#### 3.3.2 Operational Phase
```
1:While\((Session_{0}\_{parentinal}\
eq Time\mid\|Timeout()\
eq True)\)do
2:\(S\) requests for direct and overheard \(NetInfo\)
3:\(S\) computes \(Incentive\) for the relay nodes using \(NetInfo\) in Step 2
4:If\((Incentive\geq Threshold_{\_}{\_}{Incentive})\)
5:If\((ForwardCount\
geq DropCount)\)
6:\(Incentive_{\_}{Current}\gets Incentive_{\_}{Previous}-0.5^{(DropCount-ForwardCount)}* log_{\_}{2}(EnergyStatus)\)
7:Else
8:\(Incentive_{\_}{Current}\gets Incentive_{\_}{Previous}+0.5^{(ForwardCount-DropCount)}* log_{\_}{2}(EnergyStatus)\)
9:EndIf
10:Else
11: Such nodes are tagged as \(NC_{\_}{j}\)
12:EndIf
13:\(S\) chooses \(N_{\_}{S}\in\{Neighbours_{\_}{\_}{j}\}\) by analysing \(InTab\)
14:\(S\) requests direct \(EnergyStatus\) from \(N_{\_}{S}\) and overheard \(NetInfo_{\_}{N_{\_}{S}}\) from neighbours of \(N_{\_}{S}\) to \(Verify_{\_}{N_{\_}{S}}\)
15: Set \(Verify_{\_}{N_{\_}{S}}\) as \(True\) or \(False\) by considering Step 14
16:If\((Verify_{\_}{N_{\_}{S}}==True)\)
17: Set \(j=0\)
18:\(F_{\_}{j}\gets N_{\_}{S}\)
19:While\((R\
otin\{Neighbour_{\_}{\_}{j}\})\)do
20:\(F_{\_}{j}\) selects high-incentive node \(N_{\_}{F_{\_}{j}}\) from \(\{Neighbour_{\_}{F_{\_}{j}}\}\)
21:\(F_{\_}{j}\leftarrow[Location_{\_}{N_{\_}{F_{\_}{j}}}\), \(EnergyStatus_{\_}{N_{\_}{F_{\_}{j}}}\), \(NetInfo_{\_}{N_{\_}{F_{\_}{j}}}]\) to \(Verify_{\_}{N_{\_}{F_{\_}{j}}}\)
22: Set \(Verify_{\_}{N_{\_}{F_{\_}{j}}}\) as \(True\) or \(False\) by considering Step 21
23:if\((Verify_{\_}{N_{\_}{F_{\_}{j}}}==True)\)
24:If\((F_{\_}{j}\
eq Malicious packet\)\(upper)\)
25:\(F_{\_}{j+1}\gets N_{\_}{F_{\_}{j}}\)
26: Transmit \(Enc_{\_}{R}\), \(F_{\_}{j+1}\gets F_{\_}{j}\)
27:Else
28: Set \(Timeout()=True\)
29:EndIf
30:Else
31: Choose new \(N_{\_}{F_{\_}{j}}\), such that \(N_{\_}{F_{\_}{j}}\in\{Neighbour_{\_}{F_{\_}{j}}\}\) till \(F_{\_}{j+1}\gets N_{\_}{F_{\_}{j}}\)
32:EndIf
33:While\((\{Neighbour_{\_}{F_{\_}{j}}\}\
eq Empty())\)do
34: All Overhearing nodes \(\{Neighbour_{\_}{F_{\_}{j}}\}\) stores network activities in \(NetInfo_{\_}{F_{\_}{j}}\)
35:EndWhile
36:\(j=j+1\)
37:EndWhile
38:\(R\) decrypts \(Enc_{\_}{R}\) and transmits \(ACK\)/\(NACK\) via the same bi-directional route to \(S\)
39:Else
40: Choose new \(N_{\_}{S}\), such that \(N_{\_}{S}\in\{Neighbours_{\_}{\_}{S}\}\) till \(F_{\_}{j}\gets N_{\_}{S}\)
41:EndIf
42:If\((Excient\)\(Time()>=Threshold_{\_}{Tim})\)
43:\(S\leftarrow\) Update \(InTab\)
44:EndIf
45:If\((NextPacket==True)\)
46:\(Session_{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_}{\_} \_{\during the network stabilization process, node \(S\) collects \(NetInfo\) from the neighbours and distant neighbours to construct \(InTab\). * Node \(S\) identifies all the active neighbours and selects and nominates one of the neighbour nodes \(N_{S}\in\{Neighbour_{S}\}\) based on the incentive. This selected and nominated \(N_{S}\) is assumed to be free from malicious activities by node \(S\), which may or may not be true even after fixing \(N_{S}\) as \(F_{j}\). * To address the energy-spoofing selfish attack shown in Figure 4 while responding to node \(S\), the activities of \(N_{S}\) are overheard by the neighbour-relays and \(NetInfo_{N_{S}}\) is generated. It should be noted that the overheard information is listened to by all nodes in the set of neighbour nodes \(\{Neighbour_{N_{S}}\}\) to \(N_{S}\). * Node \(S\) compares the \(NetInfo_{N_{S}}\) with the direct \(EnergyStatus_{N_{S}}\) and \(InTab\). If the comparison is found to be _True_, i.e., no traces of energy spoofing, then \(N_{S}\) is finally selected and nominated to be a forwarding node \(F_{j}\).