Introduction

At present, a lot of research has been carried out on the distributed data transmission of underwater sensor networks, but it is still not perfect. The ocean is a constantly changing fluid, and many observed data need to be transmitted to the data center in real-time to maximize the value of the data, such as the observation data of ocean disaster early warning and so on Han et al. (2021). However, traditional satellite communication or multi-hop transmission to the base station generates high energy consumption. In addition, if the energy of intermediate nodes is exhausted during multi-hop transmission, the multi-hop network may be interrupted.

In the second decade of the 21st century, the Ocean Internet of Things (OIoT) was proposed. The OIoT is a comprehensive ocean information network that integrates various functions such as ocean monitoring, information transmission, data mining, and result feedback (Huo et al. 2020). Using the related technologies of the OIoT, the data transmission equipment on the water can be interconnected with the underwater sensing equipment. And realize the deep mining of ocean data (Periola et al. 2022).

In the entire OIoT system, the operation perception and data transmission by underwater nodes are the premises of system operation. The underwater acoustic channel has the remarkable characteristics of high time delay, high bit error rate and low communication bandwidth, which poor the traditional transmission efficiency of underwater sensor network data. Therefore, studying underwater sensor networks’ data transmission is of great significance.

As shown in Fig. 1, each green dot represents a ship. The number of ships in the ocean already covers the offshore. If the data collected by the underwater node is transmitted to the data center by the ship, the efficiency of OIoT data transmission will be significantly improved. Due to the comprehensive coverage of the underwater node and a large number of ships in the ocean, how to reasonably allocate the tasks of transferring data has become the primary problem. Since ships must follow the fixed route on the sea, if no ships pass through the current coverage area of the underwater node, but the data is about to expire, how to solve the data transmission task of this underwater node has become the second problem. In the face of OIoT environment, using an aggregable encryption algorithm to ensure the scheme’s security and the aggregability of ciphertexts is the third problem that needs to be solved.

Fig. 1
figure 1

Distribution map of current surface ships from ships66.com

We propose a spatial crowdsourcing task assignment scheme to address the first problem. The scheme uses passing ships to achieve distributed transmission of data collected by underwater nodes, avoiding multi-hop transmission of underwater nodes, thereby reducing communication costs. Moreover, we propose a spatial crowdsourcing task assignment algorithm based on ship confidence (ShipCon-SCTA), which can avoid communication costs caused by low-quality ships. We propose the second spatial crowdsourcing task publisher scheme (SecPub-SCTS) to address the second problem. If no ship accepts the task within the threshold time, the task information or data will be transmitted to adjacent nodes, and adjacent nodes will publish tasks or assist in the data transmission. For the third problem, this paper uses a homomorphic encryption algorithm to encrypt the data collected by the underwater nodes. Adjacent nodes can use the homomorphic encryption algorithm to aggregate ciphertext data from other nodes and directly transmit the aggregated ciphertext to the data center without decryption.

The remainder of this paper is organized as follows. “Related work” section introduces the related work, including current problems encountered in the OIoT and the current research results of spatial crowdsourcing. “Problem definition” section introduces the distributed spatial crowdsourcing model. “Algorithm design” section details our ShipCon-SCTS. In “Experiment” section, we conducted comparative experiments to evaluate the algorithm. We conclude the paper in “Conclusion” section.

Related work

OIoT

The OIoT evolved from the traditional cabled and cableless observation networks in the ocean. It mainly includes three parts: data reception, transmission, and processing. This paper mainly studies the data transmission part of the OIoT. As early as the end of the last century, relevant institutions already started to develop underwater sensor networks. In 1993, the underwater acoustic local area network project supported by the National Science Foundation of the United States proposed an underwater sensor collection model for long-term seabed data collection. Model planned to deploy a 1–5 year deep-sea data collection network in the Monterey submarine canyon (Josko and Etchemendy 1993).

In 2005, the Broadband and Wireless Networking Lab at Georgia Tech hosted the underwater sensor network project. The project provides an in-depth study of underwater sensor networks and analyzes and discusses underwater routing protocols (Akyildiz et al. 2005). In 2022, Lilhore et al. (2022) propose a depth controlled with an energy-balanced routing protocol, which will be able to adjust the depth of lower energy nodes and be able to swap the lower energy nodes with higher energy nodes to ensure consistent energy utilization.

Most of the current research focuses on multi-hop networks of underwater nodes, but multi-hop networks still have significant limitations: if a node fails, the network may be paralyzed; each data transmission needs to consume the energy of multiple nodes, which is bound to reduce the overall runtime of the system. Scholars have studied ships in the ocean. Liang et al. (2020) proposed a combination of software-defined networks and edge computing, which will meet the rapidly growing demands of marine ships for fast computing and communication capabilities, and it is imminent to realize the interconnection between marine endpoints.

In recent years, auxiliary facilities such as underwater autonomous vehicles (AUVs) have gradually become hot spots, and underwater sensor networks are developing towards distributed development. Gao et al. (2022) proposed an AE (A*-Energy) algorithm for multi-AUV task assignment and path planning for the energy consumption of multi-AUV data acquisition systems in underwater acoustic cluster networks. Khan et al. (2022) proposed a Novel AUV-based Routing Protocol for Reliable Data Collection for Underwater Wireless Sensor Networks, the protocol employs a route planning mechanism to collect data using AUVs. They all put forward proposals for assisting the deployment of facility AUVs, but there are still problems with large-scale deployment due to the energy and path constraints of AUVs.

In this paper, we introduce the passing ships into the OIoT system. The underwater nodes communicate directly with the passing ships to realize the distributed collection and transmission of data.

Spatial crowdsourcing

With the development of communication technology, communication equipment has rapidly popularized, and the Internet of Things has developed quickly. People can use various sensors to participate in various and location-related tasks, such as real-time weather monitoring, road condition monitoring, etc. (Hu et al. 2015; Pankratius et al. 2014; Wang et al. 2015). In this context, the concept of spatial crowdsourcing (Alt et al. 2010; Chen and Shahabi 2016; Kazemi and Shahabi 2012) was proposed. Spatial crowdsourcing requires workers to actually arrive at a specified location in space to complete the task within a time limit (Kazemi and Shahabi 2012).

According to Tong et al. (2020), traditional spatial crowdsourcing algorithm requires the use of a central server (Han et al. 2020; Liu et al. 2017) for task allocation, such as the classic Hungarian algorithm (Burkard et al. 2012). Based on tree decomposition technology, Li et al. (2018) propose a heuristic depth-first search algorithm to maximize the total number of tasks completed. Wang et al. (Jiao et al. 2022) proposed a spatial crowdsourcing task assignment method based on integrating genetic algorithm and ant colony optimization to solve the task assignment problem of maximum quality and minimum cost. Zhang et al. (2019) study a reliable task assignment problem for spatial crowdsourcing in a large worker market and use worker confidence to represent the reliability of successfully completing the assigned sensing tasks. Cheng et al. (2016) consider that each worker has a set of qualified skills, and each spatial task requires a set of skills to complete that task. Moreover, they propose three effective heuristic approaches, including greedy, g-divide-and-conquer and cost-model-based adaptive algorithms to solve the multi-skill spatial crowdsourcing problem. Abdullah et al. (2020) introduce the use of Bayesian Network in modelling and selecting optimal workers, and use k-medoids partitioning technique for tasks clustering and scheduling to address the task assignment problem in heterogeneous task environment. Sun et al. (2021) proposed a Dynamic Task Assignment Framework based on Prediction and Adaptive Batching to address the problem of adaptive and dynamic batching for task assignment.

Their proposed schemes address the different scenarios of land-space crowdsourcing. However, due to the limitations of underwater nodes, these schemes cannot be directly applied in OIoT scenarios.

Currently, the application scenarios of spatial crowdsourcing are becoming more extensive. Many schemes are developing towards distributed and regionalized development. Li et al. (2021), for fully distributed spatial crowdsourcing, present an online framework for assigning tasks to workers without compromising location privacy in a fully distributed manner. According to the characteristics of the OIoT environment, this paper proposes a distributed spatial crowdsourcing model based on the OIoT environment to realize distributed collection and transmission of data by underwater nodes.

Problem definition

This section introduces the nonredundant task assignment mode based on the voluntary form of ships and under the task assignment mode of the underwater node task publisher (Kazemi and Shahabi 2012). In a time instance set P = {1,2,…,p,…}, the entity’s definitions are as follows.

Definition 1 (Spatial task t)

Represented as t = 〈t.s,t.l,t.e,t.v〉 is a task generated by an underwater node at location t.l and time t.s. The task is accepted and completed before time t.e is considered valid, and t.v values will be generated after completing the task. Where t.l is the coordinate (x,y) in the ocean space, which is regarded as a point in the two-dimensional data space in the experiment.

Definition 2 (Crowdsourced workers w)

Denoted as w = 〈w.lp,w.v,w.c〉, it represents a ship worker at the position of w.lp at time p. The speed of the ship is w.v and the course is fixed. w.c is the confidence. This paper assumes that the ship can assist the underwater node to transmit data by accepting the task within the communication range.

Definition 3 (Task publisher n)

Denoted as n = 〈n.l,n.r,n.t1,n.t2,n.t3〉 is an underwater node at n.l position. n.r is the communication range radius of the node. Only within the communication range with n.l as the center and n.r as the radius, the worker w can perform the task of data transfer. Different task publishers n within the communication range can assist in publish tasks. At the same time, in order to avoid energy cost due to too long waiting for communication, we set n.t1, n.t2 and n.t3 as the longest waiting time for three communications.

Definition 4 (Maximum value and minimum communication cost problem)

Tp is the spatial task requirement at time p; tp is a space task in the system at time p, and the task range of tp is the communication range of the publisher ni; Wp is the ship that can communicate with the underwater node n in the system at time p; The underwater node ni needs to select a ship wj in the ship set Wp as the task assignment object, and the ship wj chooses whether to accept the task tp within a certain period of time and stably complete the task tp after accepting it; Ip is the task assignment set at time p, which consists of a group of valid 〈t,w〉 allocation composition, where tTp, wWp. The allocation pair 〈t,w〉 is generally a task issued by adjacent underwater nodes. Whether the ship within the communication range of the adjacent underwater node can reach the position of the task before the task deadline according to its own route calculation. Within the communication range of the adjacent underwater nodes, the ship calculates whether its own route meets the task position before the task deadline. Based on the relevant definitions of tasks, workers and task publishers, the maximum value and minimum communication cost problem can be defined as: in a given task set Tp, the goal of the maximum value and minimum communication cost problem as follow:

$$ \begin{array}{@{}rcl@{}} &&maxmize \sum\limits_{\langle w_{j},t_{j}\rangle}t_{j}.v \end{array} $$
(1)
$$ \begin{array}{@{}rcl@{}} &&{minimize E(n_{i}.l,w_{j}.l)} \end{array} $$
(2)

Among them, E(n.l,w.l) represents the energy loss from node n to ship w. In real OIoT scenarios, we can calculate the communication energy loss by modelling (Sozer et al. 2000). Assuming the data packet size is Tp, the minimum power for the receiver to receive the signal correctly is P0, then the transmit power E of the sender can be expressed by the following formula:

$$ {E=P_{0} T_{p} A(d)=P_{0} T_{p} d^{k} 10^{d\cdot a(f)}} $$
(3)

In the formula, d is the distance between the sender and the receiver; k is the wavefront expansion loss factor, generally k = 1.5; f is the underwater acoustic propagation frequency; a(f) is the Throp[] frequency absorption coefficient (dB/km):

$$ a(f)= \frac{0.1f^{2}}{1+f^{2}}+\frac{44f^{2}}{4100+f^{2}}+2.75 \cdot 10^{-4}f^{2}+0.03 $$
(4)

Considering the computational performance of underwater nodes and the need for task stability, we propose an allocation scheme based on worker confidence w.c to solve the problem of minimum communication cost and propose a second crowdsourcing task publisher scheme to solve the problem of Maximum assignment of tasks.

Algorithm design

This section will introduce the specific scheme of distributed spatial crowdsourcing in the OIoT.

Task assignment

Considering the constraints of the communication conditions of underwater nodes, we propose the ShipCon-SCTA. In addition, to adapt to the scenario of the OIoT, we propose the scheme of the second crowdsourcing task publisher (SecPub-SCTS).

Overview

As shown in Fig. 2, if somewhere node wants to transmit data to the data center, it will consume the energy of multiple nodes to complete one communication. Therefore, proposing an efficient data transmission scheme to adapt to the complex ocean environment has become an urgent need for the development of the OIoT. Thus, we introduce distributed spatial crowdsourcing based on the OIoT to solve this problem.

Fig. 2
figure 2

Traditional node communication diagram

In distributed spatial crowdsourcing, we regard underwater nodes as task publishers. Task publishers can publish tasks and restrain the effective time of the task. As workers, ships can accept tasks on their route during the voyage and get incentives for the tasks. Assuming that the ship sails in a straight line, If the ship wants to complete the task, it must arrive at the designated place within the valid time. Ships are willing to take on as many tasks as possible for more incentives.

As shown in Fig. 3, assume that there are six nodes in the deployment area to publish tasks, and three ships with fixed routes pass through the area. The route of ship A passes through the communication range of n1, and then ship A can accept the relevant tasks of this node. Similarly, ship B accepts the task of n2 and n3, and ship C accepts the task of n4. n5 is located on the trajectories of ship B and ship C at the same time. Since ship C arrives at n5 before ship B, ship C accepts the task of n5.

Fig. 3
figure 3

Example of task assignment based on ship route

Within the predetermined time, no ships pass by n6, n6 communicates with neighbour nodes and transfers its task information to n3 with ships passing by. After arriving at n3, ship B executes the task of n3 and also executes the task of n6. Thus, completing all tasks.

ShipCon-SCTA

If no ship accepts the task, we use the ship and its adjacent nodes as the secondary task publisher to finish the task allocation. As shown in Fig. 4, it consists of three times of communication as follows.

Fig. 4
figure 4

ShipCon-SCTA communication process

First communication: Request confidence

When the underwater node ni has data to transmit, it will broadcast a confidence request to the ships on the sea surface. After receiving the request from the underwater node ni, the ship wj sends its own confidence wj.c to the node ni.

In ShipCon-SCTA, we set the ship’s initial confidence w.c as the average of all ships’ confidence. This paper is set to 0.865 (confidence ranges from 0 to 1). After each task, the data center will update the ship’s confidence according to the completion of the task. The calculation formula for the ship’s confidence is as follows:

$$ {\ w.c =a \cdot w.c + b \cdot \frac{c \cdot t.v + d}{e}} $$
(5)

In the formula, a and b is the confidence update factor. w.c is the current confidence. d is the success value of previous tasks, and d is the total value of accepted tasks. e contains the value of delivery failure. If the current task fails after acceptance, c is 0, and if it succeeds, c is 1, to achieve dynamic update ship’s confidence. In this formula, tasks with high-value content have high confidence.

Second communication: Assignment task

After receiving the confidence wj.c, the underwater node ni checks wj.c whether higher than the threshold. If the ship’s confidence wj.c is higher than the threshold, ni will send a task request. The ship considers whether to accept the task according to its situation, and the longest consideration time is ni.t1. If the waiting time is exceeded, ni will communicate the next ship. If wj.c is lower than the threshold, ni will add the ship wj to the list low_threshold. If those ships with confidence w.c above the threshold reject the task request, ni will traverse the list low_threshold and send task requests to low-confidence ships. The threshold is calculated as follows:

Algorithm 1
figure a

GetThreshold.

The server will count the confidence of the ships that accept the mission. The confidence statistics list is from 0 to 1, with a step size of 0.05. In this algorithm, we will determine whether the confidence is currently calculated. If not calculated, set the threshold to the mean of the confidence. If it already exists, take the most accepted confidence as the threshold.

Third communication: Transfer data

After receiving the task confirmation information from the ship, the underwater node will send the data to the task ship. The ship transmits the data to the data center to complete the task.

The ShipCon-SCTA details are as follows:

Algorithm 2
figure b

ShipCon-SCTA.

In this algorithm, we use insertion sort to add the list of low-confidence ships and remove the traversed ship information when traversing the low-confidence vessels. We can be seen from the above that ShipCon-SCTA can allow ships with higher task confidence to obtain tasks preferentially and ensure stable data transmission.

SecPub-SCTS

The SecPub-SCTS is divided into two parts: underwater node and ships. Underwater node as the second publisher has three states:

  1. 1.

    If no ships pass through the communication range of the task node, the task node will send the task information to the adjacent node with ships passing through, and the adjacent node acts as the second task publisher to publish the task.

  2. 2.

    If no ships pass the communication range of the adjacent node, the node will continue to search its adjacent node to transmit this task information.

  3. 3.

    The underwater node will set the effective time threshold ni.t2 for the data. If the time exceeds the threshold ni.t2, the node will send the collected data to the adjacent nodes. Adjacent nodes are responsible for data transfer.

The specific details are shown in Fig. 5. The underwater node n1 will search the ship in its communication around when it has data want to transfer. If n1 does not have receive feedback from the ship, n1 will send the task information to adjacent nodes, such as n2 and n3.

Fig. 5
figure 5

Underwater node task transfer

The underwater node n2 receives the assistance request from the n1. It will publish the task. If the underwater node gets the response of the ship accepting the task, it will reply to n1 that agrees to assist and inform n1 of the ship’s arrival time wt.

The underwater node compares the ship’s arrival time with the task deadline and assigns the task if it is less than that. The underwater n3 also received the assistance request and responded. Since the ship arrived at n2 first, so n1 will send the task to n2.

If no ship passes by within the communication range of one hop adjacent node, the adjacent node will continue to forward the task to the next hop adjacent node until the task is accepted. In Fig. 5, assuming that n4 has a task to transfer, n4 first sends the task to the adjacent n5. But when the waiting time of n5 exceeds the threshold, no ship passes by, so n5 will continue to forward task information to n6. When n6 receives the confirmation message that the ship agrees to the task, it will send the feedback to the original task node n4.

As shown in Fig. 6, suppose n3 assists n1 to publish task information, n3 can communicate directly with ship A, but ship B and C will pass through n1. If we forward data from n1 to n3 through multiple hops and then use ship A to forward to the data center, transferring data will consume the energy of multiple nodes together. So, we must use ship B or C to transfer the data of n1.

Fig. 6
figure 6

Ship as the second task publisher

In Algorithm 3, t1 is the threshold for using adjacent nodes to transmit tasks, t2 is the threshold for nodes to transmit data to adjacent nodes, and t3 is the threshold for data transmission using multi-hop networks.

Algorithm 3
figure c

SecPub-SCTA.

In the scheme of the ship as the second task publisher, when ship A receives the task information of n3, ship A does not meet the task requirements after calculating the route, and ship A will release the task again and broadcast the task information using the ship’s communication capabilities. After ship B and ship C receive the mission information, the two ships check whether the route passes the position required by the mission. The two ships then calculate the time to arrive at the mission location and send the arrival time to Ship A. Ship A compares the arrival times of the two ships and selects the fastest ship to return to n1. Ships calculate arrival time as follows:

First, to facilitate the calculation, we project the position of the underwater node to the sea surface using projection and convert the three-dimensional operation into a two-dimensional operation, as shown in Fig. 7.

Fig. 7
figure 7

Schematic diagram of ship arrival time calculation

The ship is located at position A and sails along the route. When it reaches position B, the distance from the underwater node n1 is the communication radius n1.r of the underwater node. That is to say, when the ship travels to position B, it can start to execute the task, and the time to reach position B is calculated as follows:

$$ w_{1}.t =\frac{AB}{w_{1}.v} $$
(6)

In the formula, AB is the distance between points A and B.

Draw a vertical line from the underwater node n1 to the sea level, and the vertical foot is C, connecting AC and BC. So, BC is

$$ BC =\sqrt{{n_{1}.r}^{2}-{n_{1}.h}^{2}} $$
(7)

Using the route and the projected connection of the ship to the node, we can calculate the angle A between AB and AC. According to the law of sines, we can get

$$ {\frac{sinA}{BC} = \frac{sinB}{AC}} $$
(8)

We can use (8) to get the angle B, and get the angle C from the sum of the interior angles of the triangle 180.

$$ \frac{sinA}{BC} = \frac{sinC}{AB} $$
(9)

Taking AB into formula (9), the time w1.t of the ship arriving at the task node can be obtained. After the ship calculates the arrival time, it is judged whether w1.t < t.e is satisfied. If satisfied, return the task acceptance information.

Task data encryption

In the OIoT environment, the data collected by underwater nodes often need to have the characteristics of a private transmission. The traditional method of encrypting single-node data is not suitable for OIoT scenarios. Therefore, we propose using a homomorphic encryption algorithm to encrypt the data transmission of underwater nodes in distributed spatial crowdsourcing based on OIoT.

Advantages of homomorphic encryption applications

When a node sends data to an adjacent node, the adjacent node needs to integrate its data with the transmitted data for transmission, so the ciphertext additivity principle of homomorphic encryption can be effectively used to solve this problem. After the data center receives the encrypted data from the underwater nodes, the data center only needs to perform one decryption to obtain all the plaintext data information.

Homomorphic encryption application

The data transmitted by the underwater sensor is the time stamp and the data collected. The data center can calculate the collected data’s location according to the underwater node’s positioning algorithm and time stamp. The central server judges the follow-up action according to the data. Timestamps and data are all digitized and fully compatible with homomorphic encryption algorithms. In this paper, the Paillier encryption algorithm of homomorphic encryption is used, and the specific implementation of the algorithm is as follows:

First, we must generation key:

  1. 1.

    Choose two large prime numbers p,q, and guarantee gcd(pq,(p − 1)(q − 1)) = 1;

  2. 2.

    Calculate n = pq,λ = lcm(p − 1,q − 1);

  3. 3.

    Define L(x) = (x − 1)/n;

  4. 4.

    Randomly select a positive integer g less than n2, and exists μ = (L(gλmodn2))− 1modn;

Obtain the public key as (n,g) and the private key as (λ,μ).

Then, we can encrypt the data of the underwater node:

  1. 1.

    Randomly select r to satisfy 0 < r < n and \(r \epsilon Z_{n^{2}}^{*}\), the plaintext m is a positive integer greater than or equal to 0 and less than n (m is the sum of timestamps and data collected by underwater nodes);

  2. 2.

    Calculate the ciphertext c = gmrnmodn2;

According to the additive homomorphism property of the Paillier encryption algorithm:

$$ D(E(m_{1})E(m_{2}))=m_{1} m_{2} $$
(10)

When the adjacent node transmits the task node data m1, the data m2 of its node can be encrypted and aggregated on the ciphertext. The data center can obtain plaintext data through a decryption algorithm. The decryption algorithm is as follows:

$$ m=L\left( c^{\lambda} mod n^{2}\right )*\mu mod n $$
(11)

After the data center decrypts and obtains the plaintext, it takes relative actions according to the node’s information, updates the ship’s confidence, and gives the ship corresponding remuneration.

Incentive mechanism

We divide the incentives of ships into the following three forms for different degrees of giving:

  1. 1.

    The ship receives the broadcast task information or receives the task request transmitted by the adjacent node, moves to the communication range of the task node, receives the task and completes it;

  2. 2.

    The ship directly accepts the task of the underwater node and completes it;

  3. 3.

    The ship broadcasts the task after receiving the tasks information of other nodes;

Among the three cases, the first has the most incentives, the second is second-class, and the third is the least. The specific rewards are given according to the collection income of underwater nodes.

After the data center obtains the data of the underwater nodes, it will improve the confidence of the ship. If a ship is interrupted while transmitting data or accepts a task but does not execute it, the data center will reduce the confidence of that ship.

Experiment

In this paper, we select the ship data from website (Ltd 2022). The geographical range is \(122.1^{\circ } \sim 122.3^{\circ }\) longitude and \(29.9^{\circ } \sim 30.0^{\circ }\) latitude. The ship’s approximate location information is shown in Fig. 8(a). In Fig. 8(b), we describe the ship’s position information as a scatter plot.

Fig. 8
figure 8

Ship position data in ships66.com website

In the simulation experiment, we use PyCharm as an experimental tool. The experiment is run on a desktop with an AMD Ryzen™5 5600 CPU 3.5GHz processor and an 16GB RAM running Windows 10.

The detailed simulation settings of the experiments are shown in Table 1.

Table 1 Caption text

This paper uses the traversal ship algorithm and the ShipCon-SCTA to conduct comparative experiments using the same confidence and acceptance probability. In order to demonstrate the efficiency of the ShipCon-SCTS, we also design a multi-hop network algorithm (MulHop-Net) and traversal algorithm (Tra-Alg) for an energy loss comparison. In the experiment, each task assignment generates new confidence for every ship.

Figure 9 shows the efficiency comparison of the different number of tasks 100, 300, 500, 700, 900 and 1100 in the experiment under the same number of ships. It can be seen that the overhead of ShipCon-SCTA is lower than the traversal algorithm in all test results. Moreover, the gap between the two gradually widens as the number of tasks increases.

Fig. 9
figure 9

Energy consumption comparison of different algorithms

Figure 10 compares the failure situations with different numbers of tasks, and the number of ships is 100, 300, 500, 700, 900 and 1100. When the ShipCon-SCTA cannot complete the assignment, it will traverse all ships again. If there is still no ship accepting the task, the task node will use SecPub-SCTS to reduce the number of task assignment failures.

Fig. 10
figure 10

Failed comparison of different algorithms

Figure 11 shows the overhead of the ShipCon-SCTA with different confidence values. It can be seen from Fig. 11 that the algorithm overhead is higher than the traversal algorithm when the confidence threshold is lower than 0.825. We analyze the specific reasons for this experimental result. When the confidence threshold is lower than 0.825, Underwater nodes will communicate with more low-confidence ships, and many ships refuse to accept the task, resulting in a lot of extra energy consumption. When the confidence threshold is bigger than 0.89, only a few ships whose confidence value is higher than the threshold can be communicated in the ShipCon-SCTA. In this case, the ShipCon-SCTA fails, and finally, the traversal algorithm can only be used for task assignments. The advantage of the confidence algorithm is shown when the confidence threshold is bigger than 0.825 and lower than 0.89. In this interval, the ShipCon-SCTA can largely avoid some ships with a low willingness to accept tasks and reduce the energy loss caused by communication. After comparison, it can be seen that the optimal threshold is 0.865. The confidence threshold for other experiments in this paper defaults to 0.865.

Fig. 11
figure 11

Comparison with different confidence levels thresholds

In addition, we also made performance comparisons for encryption between node data. As shown in Table 2, we use the Python programming language for comparative experiments, and the homomorphic encryption algorithm has the least memory footprint during encryption. Homomorphic encryption takes a relatively long time, but the difference between 0.08s and 0.01s is not very different in the practical sense. Due to the homomorphic advantage of homomorphic encryption, it can be concluded that the homomorphic encryption algorithm can be applied to the OIoT.

Table 2 Comparison of encryption algorithms under Python

Conclusion

This paper proposes a distributed spatial crowdsourcing task allocation scheme for the OIoT, which realizes distributed data collection and transmission of underwater nodes in the ocean. Moreover, we propose the ShipCon-SCTA to reduce the overhead caused by underwater nodes transmitting data. At the same time, to reduce the number of failures when assigning tasks, we propose using the ship and its adjacent nodes as the second task publisher. Experiments show that the algorithm proposed in this paper is effective and feasible. The main goal of the following research is to further test the algorithm in practical applications and conduct in-depth research on spatial crowdsourcing in the OIoT to promote its application.