1 Introduction

With the commercialization of 5G and the rapid development of emerging wireless applications, the wireless communication traffic and demands for spectrum resources are growing explosively [1, 2]. In order to meet the spectrum resources demand of future mobile communication system, it is urgent to adopt dynamic spectrum sharing (DSS) [3]. While DSS facilitates efficient utilization of current spectrum resources, spectrum sensing is required to make optimal spectrum allocation strategy with active users’ frequency and location information. Considering the large-scale and dynamic characteristics of the spectrum sharing system, it is costly to deploy wide area spectrum sensing networks.

Different from traditional sensing methods, by using existing mobile intelligent devices to collect large-scale sensing data, crowd sensing is a new data aggregation paradigm with good mobility and scalability [4, 5], and can greatly reduce the construction and maintenance costs of the sensing network [6, 7]. Applying crowd sensing to spectrum sensing can achieve efficient large-scale and dynamic spectrum data collection.

However, the traditional crowd sensing system mostly adopts a centralized architecture, which makes the system vulnerable to single point of failure, and also faces the risks of malicious attacks such as man in the middle attack, and distributed-denial-of-service (DDoS) attack, etc., which affects the reliability and security of the system [8, 9]. On the other hand, data collection in crowd sensing will consume power, computing, and storage resources of mobile devices, which must be compensated with reasonable rewards. Otherwise, rational users may not participate in crowd sensing [10, 11]. More importantly, the spectrum sensing results contain time and location information of the users, through which the behaviors of participating users may be infered and thus the privacy information is disclosed. Therefore, it is necessary to design a secure and reasonable crowd sensing system.

Blockchain provides a solution to the issues existed in the conventional crowd sensing system. Based on a distributed ledger, blockchain has the advantages of tamper-proof, and improved integrity, traceability, and security [12,13,14]. With the blockchain technology, a distributed spectrum sensing system can be established without a trusted central server or a third-party organization.

In this paper, we propose a blockchain based crowd spectrum sensing (BCSS) system, where the server publishes sensing tasks in the blockchain network. Users can obtain the tasks and corresponding rewards from the blockchain, and thus determine whether to participate the task. The interactions and spectrum sensing results are recorded in the blockchain after being verified by the verification nodes, which effectively prevents the collusion attack initiated by the sensing platform and overcomes the security risks faced by the trusted third party. In this way, the reliability and security of the system can be effectively improved. Besides, considering the constraint of sensing task, a pricing method of sensing task is designed to encourage users to participate in the sensing task and maximize the utility of both parties. The main contributions are summarized as follows.

  • We propose a blockchain-based crowd spectrum sensing mechanism and describe the flow of blockchain based crowd spectrum sensing, where the transactions and spectrum sensing results are recorded in the blockchain, such that the security and privacy issues in conventional sensing systems can be avoided.

  • We formulate the interaction between the server and users into a Stackelberg game under the constraints of task requirement, and proposed a pricing method, which encourages users to participate in the sensing task, and maximize the utility of all parties to guarantee the completion of the sensing task.

  • We consider both uniform pricing scheme and non-uniform pricing scheme, and derive the optimal pricing and task allocation under two schemes. When the task requirement is small, the performance of two schemes is the same. But the utility of the server under the non-uniform pricing scheme is higher than that under the uniform pricing scheme when the task requirement increases gradually.

The remainder of this paper is organized as follows. Section 2 reviews related work, Sect. 3 introduces the model of the blockchain-based crowd spectrum sensing system. Pricing and sensing task allocation method based on the game model is presented in Sect. 4. Simulation results and discussions are given in Sect. 5. Section 6 concludes this paper. Future work is introduced in Section 7.

2 Related work

2.1 Crowdsensing and spectrum sensing

There has been a lot of research works on the combination of crowd sensing and spectrum sensing. Most of them aim to integrate the incentive mechanism in crowd sensing with spectrum sensing [15,16,17,18]. Lv and Zhu considered detection probability and sensing time, and proposed a cooperative spectrum sensing algorithm based on multi-task crowd sensing by combining crowd sensing incentive mechanism and cooperative spectrum sensing, so as to improve secondary user participation and cooperative spectrum detection probability [15]. Li et al. proposed an incentive mechanism based on social selfishness, which solves the problem that selfish secondary users only interest in their personal interests, and encourages them to participate in cooperative spectrum sensing [17]. Meanwhile, game theory is often used to solve problems in this respect [19,20,21,22]. In [19], Nie et al. used a two-stage Stackelberg game to analyze the participation level of the mobile users and the optimal incentive mechanism of the crowdsensing service provider. They investigated two types of incentive mechanism respectively for the crowdsensing platform with complete and incomplete information on social network effects, then proposed the optimal incentive mechanism in terms of discriminatory reward and uniform reward. Yang et al. designed an incentive mechanism using a Stackelberg game for the crowdsourcer-centric model. In the model, the crowd-sourcer announces a total reward and each user is rewarded according to the proportion of their sensing time. The authors analyzed the Stackelberg game between crowd-sourcer and users, then presented an efficient algorithm to compute the unique Stackelberg equilibrium [21]. Besides, in [23], the authors described the crowd-sensing based spectrum monitoring architecture, and proposed a privacy-preserving protocol with a secure trust mechanism.

2.2 Blockchain-based crowd sensing

The emergence of blockchain provides an opportunity to solve the issues of the conventional crowd sensing system. Recently, blockchain based crowd sensing system has attracted more research attentions [24,25,26,27,28]. Li et al. proposed a decentralized crowdsourcing framework based on blockchain, named CrowdBC, and presented a concrete framework, in which smart contract is used to perform crowdsourcing task, and the feasibility of the proposed scheme was verified through a software prototype and real data set on Ethereum [24]. Wei et al. constructed a standard blockchain-based mobile crowd sensing model, designed a smart contract suitable for its operation, and formulated the incentive problem as an optimization problem [25]. The privacy of crowd sensing has also been considered [29,30,31,32]. In [29], Wang et al. proposed a secure crowd sensing incentive mechanism based on blockchain, and designed a node cooperative verification method, which uses intragroup negotiation and group transaction verification to realize k-anonymity privacy protection. In [32], Zou et al. proposed an effective blockchain-based location-privacy-preserving crowdsensing model, to improve the data sensing quality and protect worker’s privacy through a two-stage approach.

It is worth noting that existing works consider crowd sensing and spectrum sensing jointly, which focus the incentive mechanism and crowd spectrum sensing algorithm. Considering the challenges in existing crowd sensing schemes, in this paper, we propose a blockchain based crowd spectrum sensing (BCSS) system, which can effectively improve the reliability and security of the system.

Fig. 1
figure 1

The blockchain-based crowd spectrum sensing system model

3 System model and problem formulation

As shown in Fig. 1, we consider a BCSS system where a server and N users participate in the spectrum sensing based on the blockchain system. The server collects sensing tasks which can be completed by users, and then publishes tasks and corresponding rewards on the blockchain network. Users on the blockchain receive the task and decide whether to perform the sensing task, given the reward and their own cost. To ensure that the sensing tasks are completed and users are encouraged to contribute to the sensing tasks, the server needs to set a reasonable reward for the task.

For the server, we assume that the required minimum workload is D, otherwise, the sensing task cannot be completed. Define the task price, i.e., the reward per unit workload given by the server to uesr \(w_i\) is \(p_i\), and let \(v_i\) represent the workload completed by user \(w_i\). When the task is completed, the server’s revenue is GD, where G is the revenue coefficient of the server. Therefore, the utility function of the server is expressed as

$$\begin{aligned} U_{S}(\varvec{p}, \varvec{v})=G D-\sum _{i=1}^{N} p_i v_{i}, \end{aligned}$$
(1)

where \(\varvec{v}=\left[ v_{1}, v_{2}, \cdots , v_{N}\right]\) is the vector of the workload completed by the users and \(\varvec{p}=\left[ p_{1}, p_{2}, \cdots , p_{N}\right]\) is the vector of reward per unit workload given by the server to uesrs.

Each user gets rewards by performing sensing tasks, at the same time, also incurs a certain cost. Since users are limited by resources, time and other aspects such as energy, the maximum workload that each user can contribute is limited. Therefore, the utility function of user \(w_i\) is given by

$$\begin{aligned} U_{i}\left( v_{i}, p_i\right) =p_i v_{i}-c_{i} \log _{2}\left( 1+\frac{v_{i}^{2}}{d_{i}^{2}}\right) . \end{aligned}$$
(2)

Note that \(c_i\) is the user’s cost coefficient, \(d_i\) is the maximum workload that user \(w_i\) can complete, and \(v_i\) is user \(w_i\)’s workload.

Obviously, users can get more rewards from the server by performing more tasks, which, on the other hand, will also incur a higher cost. Therefore, rational users need to generate an optimal strategy to balance the cost and reward to maximize their utility. Since both the server and users are selfish and rational, game theory is suitable to describe the problem mathematically. In this paper, we adopt the Stackelberg game model, where the server acts as the leader to set the optimal reward and users as followers to determine the workload. The leader needs to find the optimal pricing to achieve the maximum utility under the workload demand constraint. Each follower will contribute optimal workload according to the pricing given by the leader to maximize its utility. The optimization problems of the server and users can be formulated as follows [33].

Server’s sensing task pricing:

$$\begin{aligned}&\max _{\varvec{p}} U_{S}(\varvec{p}, \varvec{v}) \\ \nonumber&\text{ s.t. } \sum _{i=1}^{N} v_{i} \ge D , \end{aligned}$$
(3)

and user’s workload choice:

$$\begin{aligned}&\max _{v_{i}} U_{i}(v_{i}, p_i) \\ \nonumber&\text{ s.t. } v_{i} \le d_i. \end{aligned}$$
(4)

4 Optimal pricing and task allocation

For the proposed Stackelberg game, based on the definition of Nash equilibrium in [34], the SE is defined in the following definition.

Definition 1

(Stackelberg Equilibrium) Let \(\varvec{p}^{*}\) be a solution for the sensing task pricing problem and \(v_{i}^{*}\) be a solution for the workload choice problem of the user. Then the point \((\varvec{p}^{*}, \varvec{v}^{*})\) is a SE for the proposed Stackelberg game if for any \((\varvec{p}, \varvec{v})\), the following conditions are satisfied:

$$\begin{aligned} U_{S}\left( \varvec{p}^{*}, \varvec{v}^{*}\right) \ge U_{S}\left( \varvec{p}, \varvec{v}^{*}\right) ,\end{aligned}$$
(5)
$$\begin{aligned} U_{S}\left( v_{i}^{*}, p_{i}^{*}\right) \ge U_{S}\left( v_{i}, p_{i}^{*}\right) . \end{aligned}$$
(6)

In the following, we use the backward induction method to analyze the Stackelberg game. We first consider a uniform pricing scheme, where the reward per unit workload set by the server is the same for all users, i.e., \({p_i} = p, \forall i\).

4.1 Uniform pricing scheme

According to Eq. (4), the user’s optimization problem can be written as:

$$\begin{aligned} \text{ Problem } \text{1: }&\max _{v_{i} \ge 0} p v_{i}-c_{i} \log _{2}\left( 1+\frac{v_{i}^{2}}{d_{i}^{2}}\right) , \\ \nonumber&\text{ s.t. } v_{i} \le d_{i}. \end{aligned}$$
(7)

Then we have the following proposition.

Proposition 1

For a given unit workload price p, the optimal solution for Problem 1 is given by:

$$\begin{aligned} v_{i}^{*}= {\left\{ \begin{array}{ll}d_{i}, &{} \text{ if } p>\frac{c_{i}}{d_{i} \ln 2}, \\ \chi _i ,&{} \text{ if } p \le \frac{c_{i}}{d_{i} \ln 2}.\end{array}\right. } \end{aligned}$$
(8)

Where \(\chi _i=\frac{c_{i}-\sqrt{c_{i}^{2}-\left( p d_{i} \ln 2\right) ^{2}}}{p \ln 2}\).

Proof

According to Eq. (2), the first-order and second-order partial derivatives of \(U_i\) with respect to \(v_i\) are

$$\begin{aligned} \frac{\partial U_{i}}{\partial v_{i}}=p-\frac{2 c_{i} v_{i}}{\left( d_{i}^{2}+v_{i}^{2}\right) \ln 2},\end{aligned}$$
(9)
$$\begin{aligned} \frac{\partial ^{2} U_{i}}{\partial v_{i}^{2}}=-\frac{2 c_{i}\left( d_{i}^{2}-v_{i}^{2}\right) }{\left( d_{i}^{2}+v_{i}^{2}\right) ^{2} \ln 2}. \end{aligned}$$
(10)

According to Eqs. (9) and (10), the second derivative is less than zero when \(v_i\le d_i\) and is larger than zero otherwise. So the first derivative achieves the minimum value when \(v_{i}=d_{i}\). If \(p>\frac{c_{i}}{d_{i}\ln 2}\), \(U_i\) increases monotonically with \(v_i\). If \(p\le \frac{c_{i}}{d_{i}\ln 2}\), the first derivative decreases monotonically with \(v_i\), and Eq. (9) is larger than zero when \(v_i=0\), so there exists a positive value makes \(\frac{\partial U_{i}}{\partial v_{i}} =0\) hold. Hence, \(U_i\) achieves the maximum value when \(\frac{\partial U_{i}}{\partial v_{i}}=0\). Since \(v_i\le d_i\), we can obtain Eq. (8). Thus, Proposition 1 is proved. \(\square\)

From Eq. (8), when \(p\le \frac{c_{i}}{d_{i}\ln 2}\), \(v_{i}^{*}\) increases monotonically with p. In addition, under the same unit workload price, more workload will be completed by user with higher maximum workload for the same cost coefficient. When \(p>\frac{c_{i}}{d_{i}\ln 2}\), \(v_{i}^{*}\) get the maximum, which means that users will choose to complete their own maximum workload. Substitute \(v_{i}^{*}\) into Eq. (3), then the optimization problem of the server can be written as:

$$\begin{aligned} \text{ Problem } 2:&\max _{p \ge 0} G D-p \sum _{i=1}^{N} v_{i}^{*},\\ \nonumber&\text{ s.t. } \sum _{i=1}^{N} v_{i}^{*} \ge D. \end{aligned}$$
(11)

With Eq. (8), we can transform problem 2 into a series of subproblems. Firstly, we sort all users in order \(\frac{c_{1}}{d_{1}}>\frac{c_{2}}{d_{2}}>\cdots >\frac{c_{N}}{d_{N}}\). Consider a special case first, i.e., \(p\le \frac{c_{N}}{d_{N}\ln 2}\). Then, Problem 2 can be converted to a minimization problem as:

$$\begin{aligned} \text{ Problem } 2 a:&\min _{p \ge 0} p \sum _{i=1}^{N} \chi _i, \\ \nonumber&\text{ s.t. } \sum _{i=1}^{N} \chi _i \ge D, \\ \nonumber&\qquad p \le \frac{c_{N}}{d_{N} \ln 2}. \end{aligned}$$
(12)

According to Eq. (12), the derivative of \(\sum _{i=1}^{N} \chi _i\) with respect to p is larger than zero. So \(\sum _{i=1}^{N} \chi _i\) increases monotonically with p. For convenience, let \(\gamma _i^N = \frac{{{c_i} - \sqrt{{c_i}^2 - {d_i}^2{{\left( {\frac{{{c_N}}}{{{d_N}}}} \right) }^2}} }}{{\frac{{{c_N}}}{{{d_N}}}}}\). Since \(p\le \frac{c_{N}}{d_{N}\ln 2}\), the maximum value of \(\sum _{i=1}^{N} \chi _i\) is \(\sum _{i=1}^{N}\gamma _i^N\). If \(D>\sum _{i=1}^{N} \gamma _i^N=d_{N}+\sum _{i=1}^{N-1} \gamma _i^N\), the constraints in Eq. (12) cannot be satisfied when \(p\le \frac{c_{N}}{d_{N}\ln 2}\), i.e., when D satisfies the following conditions, Problem 2a has an optimal solution:

$$\begin{aligned} D\le d_{N}+\sum _{i=1}^{N-1} \gamma _i^N. \end{aligned}$$
(13)

Proposition 2

If the condition in Eq. (13) holds, the optimal solution of Problem 2a \(p^{*}\) satisfies:

$$\begin{aligned} \sum _{i=1}^{N}\left[ c_{i}-\sqrt{c_{i}^{2}-\left( p^{*} d_{i} \ln 2\right) ^{2}}\right] =D p^{*} \ln 2. \end{aligned}$$
(14)

Proof

When D satisfies Eq. (13), there exist a value of p makes \(\sum _{i=1}^{N} \chi _i\ge D\) hold. It is not difficult to see that the objective function increases monotonically with p. In order to minimize it, we should minimize p under the constraint of Eq. (12). Besides, the objective function also increases monotonically with p, so under the condition of \(\sum _{i=1}^{N} \chi _i\ge D\), when \(\sum _{i=1}^{N} \chi _i = D\), p get the minimum value, we obtain the optimal solution of problem 2a. Thus, Proposition 2 is proved. \(\square\)

From proposition 2, can conclude that Problem 2a has an optimal solution \(p^{*}\) satisfiy Eq. (14) when Eq. (13) holds. It means that when D is small, the server can maximize the utility with a small reward p. However, when \(D > d_{N}+\sum _{i=1}^{N-1} \gamma _i^N\), p cannot satisfy the workload requirement. Then, the server needs to improve p to stimulate users to make more contributions.

Next, we further consider the case when \(D > d_{N}+\sum _{i=1}^{N-1} \gamma _i^N\), according to previous analysis, we know that \(p>\frac{c_{N}}{d_{N}\ln 2}\). Suppose \(\frac{c_{N}}{d_{N} \ln 2}<p \le \frac{c_{N-1}}{d_{N-1} \ln 2}\), we have:

$$\begin{aligned} v_{i}^{*}= {\left\{ \begin{array}{ll}d_{N}, &{} \text{ if } i=N, \\ \chi _i,&{} \text{ if } 1 \le i<N.\end{array}\right. } \end{aligned}$$
(15)

Now, Problem 2 can be converted to a minimization problem as:

$$\begin{aligned} \text{ Problem } \text{2a: }&\min _{p>\frac{c_{N}}{d_{N} \ln 2}} p d_{N}+ p \sum _{i=1}^{N-1} \chi _i \\ \nonumber&\text{ s.t. } d_{N}+\sum _{i=1}^{N-1} \chi _i \ge D, \\ \nonumber&\qquad p \le \frac{c_{N-1}}{d_{N-1} \ln 2} . \end{aligned}$$
(16)

It is observed that Problem 2b has similar formation as Problem2a, according to the previous analysis, it is easy to know that when D satisfies the following conditions, Problem 2b has an optimal solution:

$$\begin{aligned} d_{N}+\sum _{i=1}^{N-1} \gamma _i^N< D \le d_{N}+d_{N-1}+\sum _{i=1}^{N-2}\gamma _i^{N-1}. \end{aligned}$$
(17)

Proposition 3

If D satisfies Eq. (17), the optimal solution of Problem 2b satisfies the following equation:

$$\begin{aligned} \sum _{i=1}^{N-1}\frac{c_{i}-\sqrt{c_{i}^{2}-\left( p^{*} d_{i} \ln 2\right) ^{2}}}{ \ln 2}=D p^{*} -d_{N} p^{*}. \end{aligned}$$
(18)

Proof

The proof is similar to that of Proposition 2, and is omitted here.

Then we conclude that When D satisfies Eq. (17), Problem 2 has an optimal solution \(p^{*}\) which satisfies Eq. (18) when \(\frac{c_{N}}{d_{N} \ln 2}<p \le \frac{c_{N-1}}{d_{N-1} \ln 2}\). Because when \(p\le \frac{c_{N}}{d_{N}\ln 2}\), the constraints cannot be satisfied, when \(p > \frac{c_{N-1}}{d_{N-1} \ln 2}\), although it can satisfy the constraints, it needs to give more payment to users, which is not the optimal solution. Similarly, when \(D > d_{N}+d_{N-1}+\sum _{i=1}^{N-2}\gamma _i^{N-1}\), the unit reward \(p^{*}\) given by the server should also be increased.

Based on Proposition 2 and Proposition 3, we further consider the case of D in other intervals, it is easy to obtain the optimal solution of problem 2 with the form of Eq. (19), shown at the top of the this page, with

$$\begin{aligned} {\left\{ \begin{array}{ll}\sum _{i=1}^{N}\left[ c_{i}-\sqrt{c_{i}^{2}-\left( p^{*} d_{i} \ln 2\right) ^{2}}\right] =D p^{*} \ln 2, &{} \text{ if } 0 \le \mathrm {D} \le \mathrm {Y}_{N},\\ \sum _{i=1}^{N-1}\left[ c_{i}-\sqrt{c_{i}^{2}-\left( p^{*} d_{i} \ln 2\right) ^{2}}\right] =D p^{*} \ln 2-d_{N} p^{*} \ln 2, &{} \text{ if } \mathrm {Y}_{N}<\mathrm {D} \le \mathrm {Y}_{N-1},\\ \vdots &{} \vdots \\ c_{1}-\sqrt{c_{1}^{2}-\left( p^{*} d_{1} \ln 2\right) ^{2}}=D p^{*} \ln 2-\sum _{i=2}^{N} d_{i} p^{*} \ln 2, &{} \text{ if } \mathrm {Y}_{2}<\mathrm {D} \le \mathrm {Y}_{1}. \end{array}\right. }\end{aligned}$$
(19)
$$\begin{aligned} Y_{K}=\frac{\sum _{i=1}^{K-1}\left[ c_{i}-\sqrt{c_{i}^{2}-\left( \frac{c_{K}}{d_{K}} d_{i}\right) ^{2}}\right] }{\frac{c_{K}}{d_{K}}}+\sum _{i=K}^{N} d_{i}, 1 \le K \le N. \end{aligned}$$
(20)

According to Eq. (19), we can find that the server should set the price according to the workload demand D. For a given D, the optimal unit reward p is unique. In Eq. (19), the proofs of D in other different intervals are similar to that of Proposition 2 and Proposition 3, which are omitted here.

Now, the Stackelberg game for the optimal sensing task pricing scheme is completely solved. With the optimal solutions of Problem 1 and Problem 2 we can obtain the SE for the proposed Stackelberg game: \(\left( \varvec{p}^{*}, \varvec{v}^{*}\right)\), where \(\varvec{p}^{*}\) is given by Eq. (19), \(\varvec{v}^{*}\) is given by Eq. (8).

Notice that it is difficult to obtain the analytical solutions of the related equations in Eq. (19), so we consider calculating the numerical solutions. Based on Proposition 2 and Proposition 3, we know that when D is in a certain interval, we can not only obtain the equation that the optimal solution \(p^{*}\) satisfies, but also obtain its interval, which is convenient for us to find the numerical solution of \(p^{*}\). Besides, according to Eqs. (12) and (16), given an interval of D, both the objective function and the left-hand side of the constraint condition are monotonically increasing functions of p, when equality holds in constrained condition, the objective function is maximized. Based on this, we can use the bisection method to obtain the numerical solution of \(p^{*}\).

4.2 Non-uniform pricing scheme

We have analyzed the uniform sensing task pricing scheme, where the reward per unit workload is the same for all users. In this subsection, we further investigate the non-uniform pricing scheme, where the unit reward for different users varies.

According to Eq. (8), for user \(w_i\), it will choose to complete the maximum workload \(d_i\) when \(p\ge \frac{c_{i}}{d_{i}\ln 2}\). Even if p is increased, \(w_i\) has reached the upper limit of its capability and cannot contribute more workload. In other words, if \(p\ge \frac{c_{i}}{d_{i}\ln 2}\), i.e., when the reward per unit workload p given by the server to user \(w_i\) exceeds \(\frac{c_{i}}{d_{i}\ln 2}\), the server cannot get more benefits from \(w_i\).

It is easy to know that for those users who have contributed the maximum workload, the unit reward given by the server should just encourage them to complete the maximum workload. In this way, users will not reduce their workload and the server can avoid paying too much. We propose a non-uniform pricing scheme. Specifically, for user \(w_i\), if the unit reward p of uniform pricing scheme exceeds \(\frac{c_{i}}{d_{i}\ln 2}\), then the unit reward given by the server to \(w_i\) is set as \(\frac{c_{i}}{d_{i}\ln 2}\).

$$\begin{aligned} p_{i}= {\left\{ \begin{array}{ll}p^{*}, &{} \text{ if } p^{*}<\frac{c_{i}}{d_{i} \ln 2}, \\ \frac{c_{i}}{d_{i} \ln 2}, &{} \text{ if } p^{*} \ge \frac{c_{i}}{d_{i} \ln 2}.\end{array}\right. } \end{aligned}$$
(21)

Here \(p^{*}\) is given by Eq. (19).

5 Simulation results and discussions

In this section, simulation results are presented to demonstrate the performance of the proposed scheme. We assume that the workload demand D of sensing task will not exceed the sum of the maximum workload of all users, that is, the sensing task can always be completed. Without loss of generality, the maximum workload \(d_i\) of users are assumed to obey a uniform distribution on interval [5, 10], and the cost coefficients \(c_i\) of users are assumed to obey a uniform distribution on interval [15, 20].

First of all, the relationship between the task price p and workload demand D under the proposed optimal pricing method is examined. As shown in Fig. 2, given the number of users, the unit price p of the task increases with the workload demand D. This is because when D increases, each user needs to complete more workload, so the server needs to give a higher price to motivate users. In addition, the relationship between the task price p and number of users is shown in Fig. 3. We can see that the task price decreases as the number of users under the same workload demand. This is because as the number of users increases, the workload that each user needs to complete decreases, so the task price also decreases.

Fig. 2
figure 2

The sensing task price p versus the workload demand D

Fig. 3
figure 3

The sensing task price p versus the number of users

The total utility of all users and the utility of the server under the proposed optimal pricing method are evaluated in Figs. 4 and 5. Given the workload demand, with the increase of the number of users, the total utility of users decrease, while the utility of server increases. This is because as the number of users increases, the price of tasks will decrease, while the total workload completed by users remains unchanged. For the server, the total payment to the users decreases, resulting in an increase in its utility. Besides, the utility of both users and the server increase with the workload demand under the same number of users. It can be seen that the total utility of users and the utility of the server tend to be flat gradually, when the number of users is large enough.

Fig. 4
figure 4

The total utility of users

Fig. 5
figure 5

The utility of the server

The workload completed by users and the workload demand is examined in Fig. 6. We assume three users participate in sensing task and the maximum workload of all users are assumed to be identical with \(d_1=d_2=d_3=10\), and the cost coefficients of these users are different with \([c_1,c_2,c_3]=[20,15,10]\). As shown in Fig. 6, instead of one user completing the task alone, three users contribute the required workload of sensing task together. On one hand, the capability of a single user may not be enough to complete the whole task when the workload demand is large. On the other hand, the server can get larger utility with more users competition. Meanwhile, we can find that users with lower cost coefficients tend to contribute more workload under the same maximum workload. For the server, stimulating these cheaper users to make more contribution for the sensing task can reduce the total reward paid to users and increase its utility.

Fig. 6
figure 6

Workload completed by different users with uniform pricing scheme

The performance between the uniform pricing and non-uniform pricing is compared in Fig. 7. We introduce another pricing method for comparison, i.e., average pricing method. We assume there are five users participate in sensing task. As shown in Fig. 7, under the uniform pricing scheme and non-uniform pricing scheme, the utility of the server are higher than that of the average pricing method. As mentioned above, the uniform pricing and non-uniform pricing schemes both can encourage cheaper users to contribute more workload to reduce the server’s payment. However, the average pricing method makes different users complete the same workload, result in lower utility. Besides, compare uniform pricing and non-uniform pricing schemes, we can find that when D is small, the utility of server is the same under the two schemes. When D gets larger and larger, the utility of the server under non-uniform pricing scheme is higher than that under the uniform pricing scheme.

Fig. 7
figure 7

Comparison of different pricing methods

6 Conclusion

In this paper, we have proposed a blockchain-based crowd spectrum sensing framework, which takes advantage of blockchain to solve the issues of reliability and stability in the conventional crowd sensing system. To encourages users to participate in the sensing task, we consider the constraint of the sensing task and the workload that users contribute to sensing task, a Stackelberg game based formulation is established to study the utility maximization for the server and users. The server’s optimal pricing method under both uniform and non-uniform pricing schemes are developed, the performance of the proposed sensing task pricing method is examined through simulation. The simulation results showed that the proposed sensing task pricing method can ensure the completion of sensing task, while maximizing the utilities of the server and users.

7 Future work

In this work, some of the details in the BCSS system are not fully considered, and we only consider the task allocation and pricing method for a single task. In future work, on the one hand, we will further refine the model and process of blockchain-based crowd spectrum sensing system, by incorporating more details such as smart contract based task auction with reputation. On the other hand, we will consider more complex situations and study the task allocation and pricing method for multiple sensing tasks.