Research Article

PrivCrowd: A Secure Blockchain-Based Crowdsourcing Framework with Fine-Grained Worker Selection

Algorithm 2

The smart contract: CollectSol.
Input: This contract’s address ; worker’s public key ; workers’s certificate ; workers’s deposit ; task identifier ; solution evaluation function ; deadline of submission ; total reword ; reward per solution .
1: while (getBalance() ) and is not expired do
2: Upon receiving a signed submission from , parses the submission as ();
3: ifthen
4:  continue; Certificate invalid or worker unregister
5: end if
6: ifthen
7:  continue; Submission's signature invalid
8: end if
9: if is not sufficient then
10:  continue; Worker's deposit is not sufficient
11: end if
12: if SNARK.Verifythen
13:  Send to the request ; Forward the solution to the requester
14:  transfer(); Pay the reward and refund the deposit
15:  UpdateProf();Invoke the smart contract UpdateProf
16: end if
17: end while
18: if getBalance() then Refund residue money to the request
19: transfer(
20: );
21: end if
22: return;