A Hybrid Opportunistic IoT Secure Routing Strategy Based on Node Intimacy and Trust Value

Routing strategy is one of the most important researches in Opportunistic Internet of Things (IoT), and it highly inﬂuences the eﬃciency of data transmission. In this paper, a hybrid Opportunistic IoTsecure routing strategy based on node intimacy and trust value (HIRouter) is proposed to resolve the problem of unbalanced transmission eﬃciency and security in the message delivery process. According to the records of node encounter and message forwarding, the strategy proposed in this paper can calculate nodes’ intimacy and trust value. The messages are then forwarded based on the intimacy and trust value between nodes. Experimental results verify that HIRouter algorithm we proposed can improve the message delivery rates and reduce the overhead rate in the Opportunistic IoT with dense nodes and frequent interactions between nodes.


Introduction
IoT is a network that uses sensing devices to connect objects and networks and enable objects to interact and exchange information, then achieve intelligent identification and management. It is mainly used in fields such as intelligent transportation, intelligent logistics, and smart cities. Opportunistic IoT is a kind of information interactive IoT characterized by temporary, opportunistic, and mobile selforganization. Opportunistic IoT enables intelligent objects to interact with each other by contact opportunity during the node moving [1][2][3]. Figure 1 shows an application scenario of the opportunistic IoT. An opportunistic network is derived from the delay-tolerant network [4][5][6][7]. ere are no specific links between nodes in opportunistic networks, and messages are propagated in a "store-carry-forward" manner [8][9][10]. Research hotspots related to opportunistic networks include routing strategies, congestion control [11][12][13][14], energy consumption [15][16][17][18], and incentive mechanisms [19][20][21][22][23]. Among these, routing strategies are the key points of opportunistic network research. Currently, several routing algorithms have been proposed. e most prominent routing algorithm is the epidemic algorithm. In the algorithm, nodes can forward their information to every node they encounter in the network before reaching the destination node [24]. e node of the spray and wait (S&W) algorithm produces L message copies for L neighboring nodes; then the L nodes that receive the copies seek the destination node [25][26][27][28]. e PROPHET algorithm forwards messages based on the historical information of node encounters 29. Messages are forwarded in a "storage-carry-forward" manner in mobile Opportunistic IoT; in other words, messages are placed in intermediate node buffers [30]. Data transmission and distribution are completed through the encounter and contact opportunities created by node movements, and data eventually reach the destination node. e performance related to forwarding basis, such as message delivery success rate, transmission latency, and network resource consumption, determine the efficiency of message transmission in the data transmission process. Using the historical encounter information between nodes, the PROPHET routing algorithm formulates message-forwarding strategies; however, updating the message-forwarding efficiency in real-time with changes in the operating environment is difficult. A trusted routing scheme based on social similarity (TRSS) incorporates social trust into the routing decision process [31]. In the TRSS scheme, nodes move and associate with each other based on their common interests or social similarities and the next-hop forwarding node is assumed to be the node exhibiting common social characteristics with the destination node.
is scheme mainly targets untrustworthy nodes, i.e., greedy or malicious nodes. e schema is not universal. In this paper, a hybrid Opportunistic IoT secure routing strategy based on node intimacy and trust value is proposed. e mixed utility value of node intimacy and trust value is determined by the historical data information of nodes and successful message-forwarding records. Moreover, messages are forwarded from nodes with low mixed utility values to nodes with high mixed utility values until the destination node is reached. e probability of messages being forwarded to selfish and malicious nodes is reduced, which laterally improves the security of messages in the network.

Related Works
Ma reviewed the research progress on mobile opportunistic network routing and described the main research content of mobile opportunistic networks in detail [9]. Li proposed a trust-based opportunistic routing (TOR) method by exploiting the trust mechanism, which improves the forwarding efficiency and information security of nodes in the opportunistic network [32]. e TOR method is suitable for networks with more malicious and greedy nodes. Although the bundling and carrying mechanism of the method improves security, it also increases the information storage consumption under this mechanism.
In order to solve the problem that the selfishness of the node due to the energy consumption of the message transmission leads to the serious degradation of the message transmission process and the increase of the network delay, N. Gupta proposed an incentive design mechanism based on contract theory to reward intermediate nodes appropriately to forward the messages [30]. is mechanism appropriately encourages intermediate nodes to forward messages. According to their ability to forward the message, the mechanism divides nodes into a finite number of types and model the service transaction between the forwarding node and the forwarding node. e necessary and sufficient conditions are further derived to provide incentives for nodes participating in message forwarding so that the nodes are more active in the process of message transmission.
Based on the temporal and spatial constraints of node movement in a social-based opportunistic network, Yao proposed an energy-efficient message-forwarding algorithm in community-based opportunistic networks [33]. e algorithm divides the nodes in the network into communities and uses different transmission strategies for intracommunity and intercommunity. e algorithm balances the efficiency of data forwarding on the opportunistic network with the energy consumption of the network. However, high message-forwarding efficiency cannot be achieved using this algorithm.
Based on the connection time, Duan proposed a probabilistic routing algorithm named PROPHET-CT, which resolved the problem of heavy network loads when the PROPHET routing algorithm calculated the node encounter probability [34]. e algorithm achieves a high message delivery success rate in the node-intensive scenario, but the delivery success rate is lower in a network with sparse nodes.
A trust-based data forwarding algorithm was proposed by Yuan [35]. e node trust value is determined by the three social attributes, and messages are forwarded in the network based on the trust value. However, this algorithm does not consider the influence of the message-forwarding path on the node trust value and the subsequent effect on the forwarding efficiency.
Since nodes in opportunistic networks have a large autonomy, there are many nodes that exhibit selfishness or even malicious behavior. For these nodes, Liu proposed an Node Node T1 T2 T3 Figure 1: IoT application scenario.
alert system for bins based on opportunistic networks [36]. e system primarily evaluates whether the nodes are trustworthy for information transmission and forwards the message to the trusted nodes. is system is only applicable to networks in which the nodes have greater node autonomy and are not universal.
For the problem of inefficient message transmission due to unreliable link quality between nodes in the network, Yang proposed an opportunistic routing algorithm based on node connectivity [37]. e algorithm defines a set of forwarding candidates and the priority of each candidate node ensures efficient data transmission and reduces energy consumption during data transmission. e algorithm determines the reliability between nodes only based on node connectivity, which is always slightly incomplete, and the relationship between nodes should be fully considered.
Since the independence maintained by nodes in the process of motion will have a certain impact on data transmission, Zhang proposed an opportunistic network routing algorithm based on node motion for the motion characteristics of nodes [38]. e algorithm's data forwarding priority evaluation model and differential copy transfer policy guarantee message group delivery and lower delivery latency while limiting system overhead. e algorithm does not achieve a high delivery rate in networks with sparse nodes, so the algorithm is only suitable for networks with a certain node density.
A routing strategy for ad hoc networks based on node degree estimation and static game forwarding strategy is proposed for the broadcast storm problem caused by broadcast route grouping in the route discovery process of ad hoc networks [39]. e node degree estimation method and static game forwarding strategy of the strategy greatly reduce the network consumption caused by broadcasting Hello messages to obtain node degree information and also reduce a large amount of redundancy, competition, and conflicts generated during the route request packet broadcasting process, and improve the efficiency of route request packet broadcasting in the route discovery process. e strategy is currently only applicable to scenarios where the number of network nodes is large, and the nodes are evenly distributed in the network.
To address unreliable transmission in the network, Prashant Kumar proposed a reliability strategy [40]. In this strategy, the source node can recognize the message status. If an error in message transmission occurs, the source node can respond appropriately to resend the message. e strategy is instrumental because even if a message is lost, the message-forwarding success rate will not decrease.
T. Spyropoulos proposed an efficient routing scheme for intermittently connected mobile networks (S&W) [28]. S&W routing is divided into two phases, the node distributes the message to their neighbor nodes during the spraying phase, and the waiting phase carries the message nodes to the destination node. is scheme controls the number of copies of the message to be delivered in the network and solves the disadvantages of contagion routing. In the scheme, the control of the number of copies of messages is a very important issue.
In order to solve the problem of how to transmit messages when there is no linking path between the source node and the destination node, A Vahdat proposed epidemic routing for partially connected ad hoc networks (epidemic) [41]. e nodes in this route deliver the messages to all the encounter nodes, so ideally the delivery rate of this algorithm is the highest as long as the cache of the node is large enough.
is is an extreme situation. In fact, the size of the node buffer is not enough to receive all the messages from other nodes, so the delivery rate of this route is not high due to the cache problem.
Lindgren proposed probabilistic routing in intermittently connected networks (Prophet) [42]. Prophet routing uses the historical encounter information between nodes to dynamically update the predicted value of the node's delivery. e message is delivered according to the predicted delivery value. If the predicted delivery value of the encountering node is higher than the node currently carrying the message, the message is copied and forwarded. e route is more suitable in areas with high node density and frequent encounters and is not suitable for remote areas where nodes are sparse.
To solve the problem of uneven energy consumption of nodes due to excessive calculation of key nodes and the loss of important messages due to limited remaining cache of nodes, Chen proposed an energy balance and cache optimization routing algorithm based on communication willingness (EC_CW) [43]. Based on the PROPHET algorithm, this algorithm forwards messages according to the multicopy mechanism and the willingness to communicate between nodes. In a sparse node network environment, it reduces the average delay and overhead rate, and in a node dense network environment, it improves the delivery rate. Although the delivery rate of the algorithm has been improved, its delivery rate is still at a relatively low level.
In summary, the existing opportunistic network routing algorithms do not consider the forwarding efficiency when data security is guaranteed. To this end, a hybrid opportunistic IoT secure routing strategy based on node intimacy and the trust value is proposed. e routing strategy mainly calculates the mixed utility value between nodes based on the encounters between the nodes and the message-forwarding path. e mixed utility value is used as the basis for message forwarding. is strategy considers the encounter situations between the nodes and successful message-forwarding records to ensure that messages are forwarded to the nodes with high intimacy and trust value thereby the strategy balances the efficiency and security of data forwarding.

Intimacy
In this work, a double hash table is used to simulate the relevant information between nodes in a matrix, which is stored under each node. en, the nodes update the hash When two nodes are connected, each node updates its EncounterNumber information in the hash tables.
Definition 2. EncounterDuration (ED) represents the duration of node encounter [44], i.e., the length of time from when the communication link between two nodes is connected to when the communication link is disconnected.
Time Value indicates the connection time. e calculation of node encounter duration is shown as follows: (1) Definition 3. AverageEncounterDuration (TI) denotes the average encounter duration of each encounter between nodes [44], i.e., the ratio of the total encounter duration to the number of encounters between two nodes during network operation. Generally, if the node encounter duration is short, network bandwidth is small, or transmission data are large, then complete data delivery may not be guaranteed. erefore, forwarding messages to nodes with a longer average encounter duration can more effectively improve the message-forwarding success rate. To avoid forwarding messages to nodes with a short meeting duration, we need to calculate the average encounter duration TI (avg,i,j) of the node. When two nodes are disconnected, the encounter time and average encounter duration between the two nodes are calculated and stored. e average encounter duration is calculated as shown below: TI k is the duration of the kth encounter between node i and j, and n k�1 TI k represents the sum of n encounter time.

Intimacy Information
Definition 4. Intimacy Value (I) signifies the frequency of contact between nodes during network operation. More closely related nodes will meet frequently, while less closely related nodes will meet with a low probability. e node intimacy can be calculated using their meeting information, as follows: Let I (i,j) denote the intimacy between nodes i and j, let EN (i,j) denote the number of encountering nodes, and let TI (avg,i,j) denote the average encounter time between nodes i and j. e variable w represents a weight value, 0 < w < 1; the w is determined to be 0.57 based on the ratio of the encounter duration and the number of encounters in the experiment.

Trust Degree
Definition 5. Trust degree (T) between the destination and current nodes is defined as the ability of the current node to forward messages to the destination node. Based on successful message-forwarding records, the trust reward of the node forwarding data to the destination node is calculated.
Based on the forwarding path of the node successfully forwarding the message to the destination node, the trust degree of the destination node to other nodes on the successful path is determined.

Forwarding Path.
In the simulation experiment, the messages are tracked, and the message-forwarding process is recorded. When the message successfully reaches the destination node, the successful message-forwarding path of this message is obtained.
Obtain the message-forwarding path:  By obtaining the message-forwarding record, the nodes on the path on which the message is successfully forwarded are obtained, and these nodes are rewarded with trust.
To reflect the fairness and incentive of rewards for each node, a trust reward mechanism is established: (1) e position of the forwarding node in path(N i ) determines the trust reward value of the forwarding node. If the forwarding node is closer to the destination node, the trust reward value of the forwarding node is higher, and vice versa. e trust reward value represents the trust degree between the destination and forwarding nodes and can be understood as the probability of the node forwarding a message to the destination node again in the future message-forwarding process.
(2) For messages with the same communication link length, a shorter message delay time Δt (reception time -creation time) signifies a greater trust reward value of the forwarding node. e smaller the Δt, the less time it will require for the forwarding node to transmit the message to the destination node, i.e., smaller delay.

Trust
Reward. e currently rewarded node is provided with a trust value for the first time, as follows [32]: T (m) ij represents the trust reward value of node j to node i, and e − λ×(Δt/TTL) represents the time reward function. e smaller Δt is (i.e., the less time it takes for the message to be received from the creation to the destination node), the greater the reward obtained. e value of (Δt/TTL) ranges from 0 to 1, and λ is the message delay reward adjustment factor. φ + (1 − φ) × (path(N i )/|path(m)|) 2 is the trust reward value function, which is determined according to the position of the node in the path, φ is the adjustment factor of trust reward value, |path(m)| represents the length of the entire forwarding path, path(N i ) represents the position of node N i in the forwarding path, and the value of path(N i ) is between 1 and |path(m)|, i.e., (path(N i )/|path(m)|) is between 0 and 1. In the trust mechanism, the closer the node position is to the destination node, the larger the path(N i ) is and the greater the trust reward value is obtained. e message is forwarded from a low-trust-value node to a hightrust-value node. e old trust value of the currently rewarded node is shown in the following: e trust value is updated based on the old trust value and the new reward trust value. e node repeatedly forwards the message to the destination node and gradually improves the trust value reward; in this way, an oriented trust is established between the nodes in the network. erefore, there is a trust-based forwarding mechanism in the network. e mechanism can be expressed as a two-dimensional array. e index of the array is the node address value, and the content of the array is the size of the trust value. When the message reaches the destination node, the Δt of the message is calculated by obtaining message reception time and creation time. en, the time reward function is calculated using Δt and time-to-live (TTL) of the message. e message transmission path and the trust table of the destination node are obtained, and the path is traversed. If a node does not have a trust record in the trust table of the destination node, the trust calculation using the formula (5) is performed.

A Hybrid Opportunistic IoT Routing Algorithm Based on Node Intimacy and Trust Value
In the message-forwarding routing process, the node considers the encounter information with other nodes and the trust value of the two encountering nodes under the destination node. When determining whether the message should be forwarded to the meeting node, the routing mechanism will assign weights to the two forwarding bases to calculate the final forwarding probability. Because the storage structure uses a hash Forwarding probability is the mixed utility value.
Definition 6. e mixed utility value (denoted by FB) is obtained by the weighted summation of the intimacy and trust value of the nodes. It is used to describe the reliability relationship between nodes. is value is calculated using formula equation (6): EN (i,l) is the number of encounters between the meeting node i and destination node l, EN (j,l) is the number of encounters between the current node j and destination node l, TI (avg,i,l) is the average encounter duration between the meeting node i and destination node l, and TI (avg,j,l) is the average encounter duration of the current node j and destination node l. e forwarding probability calculation of the encounter node phase forwarding the message to the destination node consists of three parts: the trust degree of this encounter node under the destination node; the ratio of the number of encounters between the encountered node and the destination node and the number of encounters between the two nodes and the destination node respectively; the ratio of the encounter duration between the encountered node and the destination node and the sum of the encounter duration Security and Communication Networks between the two nodes respectively and the destination node. ese three components are weighted and summed separately to obtain the forwarding probability of the encountered node. Similarly, the forwarding probability of the node currently carrying the message is also calculated in this way. α, β, and c are the weights of the trust, the number of encounters, and the average duration of the encounters, respectively. e values of α, β, and c are experimentally determined to be 0.1, 0.7, and 0.2, respectively. As shown in Figure 3, x, y, and z represent α, β, and c, respectively. A more intense red color signifies a higher delivery success rate.
Step 1. indicates that the message-forwarding node meets the other nodes and establishes a connection. Steps 2-17 signify whether the currently established node performs message transmission. Steps 2-3 mean that if the messageforwarding node meets the destination node, the message is directly forwarded to the destination node. Steps 4-12 reflect that if the message-forwarding node does not meet the destination node, the node information is first obtained, and then the mixed utility value is calculated. Steps 13-16 indicate that if the mixed utility value of the message-forwarding node is less than that of the meeting node, the message is forwarded to the meeting node; otherwise, it is not forwarded.

Experimental Environment
and Configuration e algorithm we proposed was experimentally verified, and performance analysis is conducted on the simulation tool ONE [45]. e simulation tool version 1.4.1 is used in the work. Table 1 shows the design of simulation experiment parameters.
6.1. Performance. Several indicators are often used to determine the performance of the network.
Herein, the five indicators used for network performance evaluation and the importance of the five indicators are listed below. e delivery rate is undoubtedly the most important in Opportunistic IoT. e higher the delivery rate, the more messages successfully forwarded to the destination node. e second is the average delay and overhead rate. e less time the message is delivered in the network and the smaller the cache overhead of the nodes in the network, the better the performance of the network. Finally, the number of relay nodes and the average number of relay nodes. e smaller the number of relay nodes means that the fewer times the message is forwarded by the node in the network, the less the total energy consumed by the node to forward the message, and the more the network performance can be improved.
(1) Success rate is the ratio of the number of messages successfully forwarded to the destination node to the total number of messages. e indicator is denoted as equation (7).
(2) Average hops are the average number of hops required for a message to be successfully forwarded to the destination node. e indicator is denoted as equation (8).
(3) Number of relay nodes is the number of intermediate nodes required for the successful forwarding of a message to the destination node. e indicator is denoted as equation (9).
(4) Average delay is the average time required for a message to be forwarded from the forwarding node to the destination node. e indicator is denoted as equation (10).
(5) Routing overhead is the ratio of the difference between the number of delayed messages and the number of successfully forwarded messages to the number of successfully forwarded messages. e indicator is denoted as equation (11).
6.2. Experiment Analysis. In the experiment, by increasing the number of nodes in the network, the performance of HIRouter is compared with the performance of the epidemic [41], PROPHET [42], EC_CW [43], and S&W algorithms [28]. Figure 4, when the number of nodes is small, the success rates of the four algorithms do not differ considerably. As the number of nodes increases, the success rate of HIRouter significantly increases. Moreover, as the number of nodes increases, the transmission success rate of the epidemic algorithm increases, and the prediction accuracy of the propagation probability of the PROPHET and EC_CW algorithms also improve. erefore, the success rates of the epidemic and PROPHET algorithms are slightly

Security and Communication Networks
improved. e success rates of S&W and HIRouter algorithms are higher than those of the other two algorithms.
Owing to an increase in the number of nodes in the S&W algorithm, the copy of spray's neighbor nodes significantly increases and the success rate also considerably increases. Compared with other routing algorithms, the HIRouter algorithm achieves the best success rate. As the number of mobile nodes increases, more accurate node relationships are estimated to provide a better forwarding strategy for opportunistic networks.

Average
Hops. In Figure 5, as the number of nodes increases, the number of average hops of the epidemic algorithm increases, owing to the infection mechanism of the algorithm. Nodes will copy their message to forward it to the encountered nodes. e number of average hops of the PROPHET and EC_CW algorithms increases with the number of nodes; however, the increase is lower than that in the epidemic algorithm. e number of average hops of S&W and HIRouter algorithms slightly increases when the nodes are increased; however, the number of average hops of the HIRouter algorithm is relatively few.
is finding demonstrates that the HIRouter algorithm selects the optimal relay nodes during message transmission, reduces the number of relay nodes, and ensures that the message reaches the destination node in as few hops as possible. Figure 6, due to the contagion mechanism of the epidemic algorithm, the number of relay nodes increases with the number of nodes when the epidemic algorithm is used to transmit information. e PROPHET and EC_CW algorithms show an increased number of relay nodes when the number of nodes increases; however, the number of relay nodes is less than that in the epidemic algorithm. When the number of nodes  is small, the number of relay nodes of S&W and HIRouter algorithms is one. However, with an increasing number of nodes, the number of relay nodes of the HIRouter algorithm is minimal. is finding indicates that the HIRouter algorithm selects the optimal relay node during message transmission, thereby reducing the number of relay nodes; i.e., the number of message transmissions is reduced and the message loss rate is reduced. Figure 7, the average delay of the HIRouter algorithm is high. During message transmission, the nodes only forward messages to the nodes with a higher probability of transmission. In the procedure, the nodes may encounter many nodes that are not qualified for forwarding and wait for the relay nodes with a higher possibility of transmitting the message to the destination node or the destination node itself. erefore, the average delay of the HIRouter algorithm is high.

Average Delay. In
6.2.5. Overhead Rate. In Figure 8, as the number of nodes increases, the overhead rate of the epidemic and PROPHET algorithm significantly increases. is is attributed to the infection mechanism of the epidemic algorithm. Messages are copied between the nodes that meet, and the memory  overhead is large. For the PROPHET and EC_CW algorithms, the recording of the forwarding probability and the calculation of the forwarding probability increase with an increasing number of nodes. us, the memory overhead increase. When the S&W algorithm is in the waiting phase, messages are forwarded only when nodes encounter the destination node, and there is no need for excess information recording and calculation. erefore, as the number of nodes increases, the spray efficiency of the S&W algorithm shows no significant changes. As the number of nodes increases, although the overhead rate also increases, the HIRouter algorithm still maintains a low overhead. is is because the HIRouter algorithm selects better relay nodes when the message is forwarded, optimizing the delivery process and reducing overhead.

Conclusion
In this work, a hybrid Opportunistic IoT Secure routing strategy based on node intimacy and trust value is proposed. is strategy fully utilized the movement encounter information and successful message-forwarding information of the nodes in the network to determine the mixed utility value of nodes and identify the optimal relay nodes for message transmission.
From the experimental results, the HIRouter algorithm we proposed achieved a better success rate, a number of relay nodes, the average number of hops, and an overhead rate than the epidemic, PROPHET, EC_CW, and S&W algorithms. e routing algorithm improved the message delivery success rate and decreased the number of relay nodes and the average number of hops required for message transmission in the Opportunistic IoT with dense nodes and frequent interactions between nodes. At the same time, the routing algorithm reduces the information loss rate and the probability of malicious node damage from the side and improves the security of the network. Moreover, the routing algorithm decreases network congestion and resource consumption.
In summary, the HIRouter algorithm we proposed can effectively accomplish data transmission in Opportunistic IoT with high efficiency and quality. Although the HIRouter proposed in this paper has achieved certain results in terms of success rate and overhead rate, the routing algorithm has a high average delay, which has an impact on the network performance of opportunistic IoT. e algorithm determines the forwarding utility value through the encounter between nodes and the successful forwarding record of the message. erefore, the algorithm is suitable for the Opportunistic IoT with dense nodes and frequent interactions between nodes. For the Opportunistic IoT with sparse nodes and less interaction between nodes, this algorithm does not have a better delivery efficiency. In future research, certain replica strategies and incentive mechanisms will be used to promote message forwarding to reduce the average delay and improve network performance and propose an algorithm for the Opportunistic IoT with sparse nodes and less interaction between nodes.

Data Availability
Data are available upon request.

Conflicts of Interest
e authors declare no conflicts of interest related to this paper. under Grant 2019MS06031 and in part by the Self-Open Project of Engineering Research Center of Ecological Big Data, Ministry of Education.