Disclosure of Invention
The invention provides a distributed computing method and system based on data encryption, aiming at matching a computing terminal according to the characteristics of task types and calling a block chain intelligent contract to finish transaction transfer of computing services on the basis of not revealing original data of a demand terminal.
In order to achieve the above object, the distributed computing method based on data encryption provided by the present invention comprises the following steps:
step S1: the task management module defines a standard calculation model set, defines data input and output formats supported by each standard calculation model in the set, and simultaneously creates a block chain intelligent contract on a block chain; the computing terminal installs a standard computing model adapted to the computing terminal and registers the standard computing model to the task management module;
step S2: the demand terminal initiates a calculation task request, defines the number of data samples of the calculation task, and performs calculation on each data sample djSequentially carrying out secondary encryption to respectively obtain initial encrypted data samples d ″jAnd first transit encrypted data samples D ″j;
Step S3: the task management module acquires the calculation task request information of the demand terminal, adds the calculation task request information into a task queue, and decrypts the first transfer encryption data sample D ″jObtaining initial encrypted data sample d ″j;
Step S4: the computing terminal checks the standard computing model installed therein, selects one or more computing tasks which can be satisfied from the task queue, reports the computing tasks and the d 'to the task management module, and the task management module carries out the computing tasks and the d' according to a preset distribution principlejAfter encryption, distributing the encrypted data to a matched computing terminal;
step S5: the computing terminal decrypts the d' encrypted in the step S4jAnd after the verification is successful, d' is obtainedjProcessing d' according to standard calculation model required in calculation taskjObtaining the processing result rjAnd processing the result r ″jFeeding back to the task management module according to the data input and output format requirement;
step S6: the task management module informs the requirement terminal to confirm the processing result r ″jAfter the confirmation information is acquired, transferring the service cost of the calculation task from the address of the block chain of the demand terminal to the block chain address of the calculation terminal to complete the calculation task;
step S7: and packaging the related information of the calculation task and storing the related information in the intelligent contract of the block chain.
Preferably, in the step S1,
the task management module creates a block chain intelligent contract on a block chain, and main functional functions of the intelligent contract comprise a functional function for executing calculation of task service cost payment and a functional function for calculating task information uplink;
the function of calculating the payment of the task service fee is as follows:
Payment(addrreq,addrsrv,amount)
wherein:
addrreqthe block chain address of the demand terminal;
addrsrvcalculating the block chain address of the terminal;
amount is the service cost of the calculation task;
the information uplink function of the calculation task is:
Record(srvInfo)
the srvInfo comprises calculation task requirement information, block chain address information, requirement terminal confirmation signature information and block chain transaction information.
Preferably, in step S1, the task management module assigns a random identification id to each computing terminal, and each computing terminal sends the installed standard computing model installation information to the task management module for registration, where the registration content includes: the method comprises the steps of identifying id by a computing terminal, calculating a block chain address of the computing terminal and calculating a standard computing model set installed by the computing terminal.
Preferably, in the step S1,
the task management module defines a standard calculation model set as m(1),m(2),…,m(K)And the number collection set of data input and output formats supported by the standard calculation model is { n }(1),n(2),…,n(K)}。
Wherein, K is the number of standard calculation models supported by the task management module, and the kth standard calculation model is m(k)The number of the data input and output formats of the model is n(k),k=1,2,…,K。
Preferably, in step S2, the process of the requirement terminal initiating a calculation task request to the task management module includes:
s21: selecting a standard computing model for use in a computing task request
mreq=m(k)
S22: selecting the data input/output format adopted by the standard calculation model in step S21
freq=i
Wherein, the value of i can be 1, 2, …, n(k);
S23: determining the number N of data samples needing to be processed by the calculation task and the highest service unit price PriceLimit, and according to the number N of the data samples and the highest service unit price PriceLimit, the highest transfer amount of the demand terminal authorization task management module when the calculation service cost is paid is as follows: n + PriceLimit;
s24: selecting a homomorphic encryption function to each data sample d according to the operation characteristics and the calculated amount of the calculation taskjCarrying out homomorphic encryption to obtain initial encrypted data sample d ″j,
d`j=HE(dj)
Wherein:
j=1,2,…,N;
HE () is a homomorphic encryption function;
s25: computing initial encrypted data samples d ″jThe digest H, and the signature Sig,
H=digest(d`j)
Sig=f(H,PrivKeyreq)
wherein:
digest () is a digest calculation function;
f () is an asymmetric cryptographic function;
PrivKeyreqa private key for asymmetric encryption of the demand terminal;
s26: utilizing public key of task management module to make original data sample d ″jAsymmetric encryption to obtain a first transit encrypted data sample D ″j;
D`j=f`(d`j,PubKeytaskmgt)
Wherein:
f' is an asymmetric cryptographic function;
PubKeytaskmgtasymmetrically encrypting a public key for the task management module;
s27: m is to bereq、freq、N、PriceLimit、D`jAnd the Sig and H calculation task request information are all sent to the task management module.
Preferably, in step S3, the task management module uses its private key PrivKeytaskmgtDecrypting D' systemjTo obtain d-jAnd calculating d ″)jThe abstract H' of (1) is obtained by Sig and a public key PubKey of a required terminalreqTo obtain d-jThe abstract of (1) is H;
if H ═ H, the data verification passes, d ″jAnd the data can be transmitted to the computing terminal, otherwise, the data verification fails.
Preferably, in the steps S4 and S5,
the task management module performs task allocation according to the principle of service price priority and application time priority; aiming at the same computing task, if the service price quotation and the application time of a plurality of computing terminals are the same, the task management module selects the computing terminal with high service online rate and system configuration to execute the computing task;
the specific way for the computing terminal to execute the computing task is as follows:
s51: the task management module uses the selected public key of the computing terminal to transmit the d ″)jEncrypting and calculating d ″)jThe corresponding abstract H is signed with a signature Sig' and then is sent to the selected computing terminal; the selected computing terminal uses its private key to decrypt and obtain d ″, againjAnd calculating d ″)jThe abstract H ' of (a) is solved to d ' through Sig ' and the public key of the task management modulejIf H ″ ═ H, the data verification passes, otherwise the data verification fails, i.e., d ″, the digest of (1) passesjA delivery failure;
s52: the computing terminal obtains the d ″)jComputing the function m according to a standard computing model required in the computing taskreqProcessing N initial encrypted data samples d' in a computational taskjObtaining the processing result rj:
r`j=mreq(d`j)
Wherein: j is 1, 2, 3, …, N;
s53: r' is required to be converted according to the data input and output format supported by the standard calculation modeljFeeding back to the task management module, and informing the required terminal of the processing result r ″jAnd (4) confirmation:
s54: the demand terminal decrypts r' by using homomorphic decryption functionjObtaining the original processing result rj
rj=HE-1(r`j)
S55: demand terminalConfirmation of the original processing result rjAfter completion, the processing result r' is calculatedjThe digest and the signature are carried out to obtain signature (r')j) Signature (r' is signedj) And sending the data to a task management module.
The invention also provides a distributed computing system based on data encryption, which comprises:
a demand terminal: the task management module is used for initiating a calculation task request to the task management module;
a task management module: the system comprises a demand terminal, a computing terminal and a block chain intelligent contract, wherein the demand terminal is used for receiving a computing task request of the demand terminal, distributing and managing the computing task request, distributing the computing task to the computing terminal, and calling the block chain intelligent contract to complete transaction transfer of computing service cost and information uplink of computing service after the computing terminal completes the computing task;
a computing terminal: the system is used for applying for and executing the calculation task and obtaining the final payment cost of the calculation task;
block chains: and creating a block chain intelligent contract in the block chain by the task management module, wherein the block chain intelligent contract is used for calculating the cost actually paid to the computing terminal and calculating the uplink of the task information.
Preferably, the demand terminal is configured to encrypt the data sample in the computing task for the second time and send the encrypted data sample to the task management module, the task management module is configured to receive the computing task, decrypt the encrypted data sample for the second time to obtain an initial encrypted file, and after the initial encrypted file is successfully verified, encrypt the computing task and the initial encrypted file again according to information reported by the computing terminal and distribute the encrypted data sample and the initial encrypted file to the matched computing terminal, and after the computing terminal decrypts the encrypted data sample again to obtain the initial encrypted file, and the verification is successful, execute the computing task.
Compared with the prior art, the invention has the beneficial effects that: the invention utilizes homomorphic encryption technology to encrypt the original data sample, and the computing terminal provides computing service based on homomorphic encrypted data, so that the computing terminal can not obtain the actual information of the original data and the processing result, and the information security of the required terminal is ensured.
After the computing terminal completes data processing, the task management module completes account transfer transaction of service cost by calling the intelligent block chain contract, and the intelligent block chain contract has transparency and safety.
By adopting the working modes of the standard computing model and the input and output format, the computing terminal can install and register the model according to the conditions of the system configuration and the like of the computing terminal, and meanwhile, the task management module can update the model in time and keep synchronization with other functional modules.
Detailed Description
The invention provides a distributed computing method based on data encryption, which comprises the following steps:
step S1: the task management module defines a standard calculation model set, defines data input and output formats supported by each standard calculation model in the set and creates a block chain intelligent contract; and the computing terminal installs the standard computing model adapted to the computing terminal and registers the standard computing model with the task management module.
Step S2: the demand terminal initiates a calculation task requestDefining the number of data samples of the calculation task, and for each data sample djSequentially carrying out secondary encryption to respectively obtain initial encrypted data samples d ″jAnd first transit encrypted data samples D ″j。
Step S3: the task management module acquires the calculation task request information of the demand terminal, adds the calculation task request information into a task queue, and decrypts the first transfer encryption data sample D ″jObtaining initial encrypted data sample d ″j。
Step S4: the computing terminal checks the standard computing model installed therein, selects one or more computing tasks which can be satisfied from the task queue, reports the computing tasks and the d 'to the task management module, and the task management module carries out the computing tasks and the d' according to a preset distribution principlejAnd distributing the encrypted data to the matched computing terminal.
Step S5: the computing terminal decrypts the d' encrypted in the step S4jAnd after the verification is successful, d' is obtainedjProcessing d' according to standard calculation model required in calculation taskjObtaining the processing result rjAnd processing the result r ″jAnd feeding back to the task management module according to the data input and output format requirement.
Step S6: the task management module informs the requirement terminal to confirm the processing result r ″jAnd after the confirmation information is acquired, transferring the service cost of the calculation task from the address of the block chain of the demand terminal to the block chain address of the calculation terminal, and completing the calculation task.
Step S7: and packaging the related information of the calculation task and storing the related information in the intelligent contract of the block chain.
Specifically, in step S1, the task management module initializes and defines a standard calculation model set as { m }(1),m(2),…,m(K)And the number collection set of data input and output formats supported by the standard calculation model is { n }(1),n(2),…,n(K)}。
Wherein, K is the number of standard calculation models supported by the task management module, and the kth standard calculation model is m(k)The number of the data input and output formats of the model is n(k),k=1,2,…,K。
In this embodiment, taking an image target recognition calculation task as an example, the task management module defines two standard calculation models, namely a deep learning standard calculation model and a support vector machine standard calculation model, which are respectively denoted as m(1)、m(2)That is, the standard calculation model set defined by the task management module is denoted as { m(1),m(2)}。
The input and output formats of the image data of the two standard calculation models are respectively recorded as f(1)、f(2)Each standard calculation model supports 2 image data input and output formats, namely, the number set of data input and output formats supported by the standard calculation model is {2, 2}, specifically, the data input and output formats of the two models are distributed as shown in table 1,
TABLE 1
In table 1:
fi1 (1)=fi1 (2)=1920*1080,fi2 (1)=fi2 (2)=1280*960;
fo1 (1)、fo2 (1)、fo1 (2)、fo2 (2)are all in the form of { typeNum, obj1,confidence1…, typeNum is the number of identified types, obj1As the type name of the first object, confidence1The confidence coefficient of the first type of object is between 0 and 1, and the higher the value is, the higher the existence probability of the object is.
Meanwhile, the task management module creates a block chain intelligent contract on the block chain, and the main function of the block chain intelligent contract comprises a service charge payment function for executing the calculation task and a calculation task information uplink function;
the service charge payment function of the calculation task is as follows:
Payment(addrreq,addrsrv,amount)
wherein:
addrreqthe block chain address of the demand terminal;
addrsrvcalculating the block chain address of the terminal;
amount is the service cost of the calculation task;
the information uplink function of the calculation task is:
Record(srvInfo)
the srvInfo comprises calculation task requirement information, block chain address information, requirement terminal confirmation signature information and block chain transaction information.
Then, the task management module allocates a random identification id to each computing terminal, in this embodiment, 3 computing terminals and 1 demand terminal are selected, the ids of the 3 computing terminals are respectively recorded as id1, id2 and id3, and the block chain addresses of the 3 computing terminals are respectively recorded as addr1 srv、addr2 srv、addr3 srvThe block chain address of the demand terminal is noted as addrreq。
Each computing terminal is initialized, and a standard computing model set { m } is obtained from the task management module(1),m(2)And sending the installation information of the standard calculation model to a task management module for registration, wherein the registration content comprises the following steps: the computing terminal identifies the id, the block chain address of the computing terminal and a standard computing model set installed on the computing terminal, and reports the block chain address of the computing terminal to the task management module; initializing a demand terminal, and acquiring a standard calculation model set { m ] from a task management module(1),m(2)And the information of the data input and output format reports the block chain address of the demand terminal to the task management module.
And the registered contents of the computing terminal are counted in a computing terminal service capability table, the specific contents are shown in table 2,
TABLE 2
Calculating terminal serial number
|
Computing terminal id
|
Calculating terminal block chain address
|
Service capability srvCap
|
1
|
aIMH…GlsklP
|
0x1a35….2a
|
{m(1),m(2)}
|
2
|
vFn%...sdsaax
|
0xd723…e3
|
{m(1),m(2)}
|
3
|
Kye…ncttlslpq
|
0x8567…7c
|
{m(1),m(2)} |
After the task management module, the demand terminal and the computing terminal are initialized, the demand terminal initiates a computing task request.
In step S2, the process of the demand terminal initiating a calculation task request to the task management module is as follows:
s21: and selecting a standard calculation model adopted by the calculation task request, and selecting a deep learning model as the calculation task request model in the embodiment. Namely:
mreq=m(1)
s22: the data input and output format adopted by the deep learning model is selected as follows:
freq=1
specifically, the data input format adopted by the deep learning model is selected to be fi1 (1)1920 × 1080, data output format fo1 (1)={typeNum,obj1,confidence1,…}。
S23: determining that the number N of data samples needing to be processed by the calculation task is 1000 and the highest service unit price PriceLimit is 10, and according to the number N of the data samples and the highest service unit price PriceLimit, the highest transfer amount of the demand terminal authorization task management module when the calculation service cost is paid is as follows: n × prince limit 1000 × 10 ═ 10000;
s24: selecting a homomorphic encryption function to each data sample d according to the operation characteristics and the calculated amount of the calculation taskjCarrying out homomorphic encryption to obtain initial encrypted data sample d ″j,
d`j=HE(dj)
Wherein:
j=1,2,…,N;
HE () is a homomorphic encryption Fan-Vercauteren algorithm function;
s25: computing initial encrypted data samples d ″jThe digest H, and the signature Sig,
H=digest(d`j)
Sig=f(H,PrivKeyreq)
wherein:
digest () is MD5() digest calculation function;
f () is an ECC () elliptic curve asymmetric cryptographic function;
PrivKeyreqa private key for asymmetric encryption of the demand terminal;
s26: utilizing public key of task management module to make original data sample d ″jAsymmetric encryption to obtain a first transit encrypted data sample D ″j;
D`j=f`(d`j,PubKeytaskmgt)
Wherein:
f' () is an ECC () elliptic curve asymmetric encryption function;
PubKeytaskmgtasymmetrically encrypting a public key for the task management module;
s27: m is to bereq、freq、N、PriceLimit、D`jAnd the Sig and H calculation task request information are all sent to the task management module. Wherein, the initial encrypted data sample d' is processedjAsymmetric encryption is performed, and the digest signature is calculated, so that the initial encrypted data sample d' can be ensuredjAnd the data transmission process is not tampered by a third party.
Task management module utilizes its private key PrivKeytaskmgtDecrypting D' systemjTo obtain d-jAnd calculating d ″)jThe abstract H' of (1) is obtained by Sig and a public key PubKey of a required terminalreqTo obtain d-jThe abstract of (1) is H;
if H ═ H, the data verification passes, d ″jCan be transmitted to the computing terminal, otherwise the data verification fails, i.e. d ″jThe transfer fails.
The task management module adds the calculation task request information of the demand terminal to a task queue, and all the calculation terminals can access the queue to obtain the calculation task information so as to apply and bear the calculation tasks therein to obtain the calculation service cost.
The calculation task of the task queue of the task management module to the current demand terminal is described as follows:
the computing terminal checks the installed standard computing model, selects one or more computing tasks which can be met from the task queue, and reports computing service quotations which can be accepted by the computing terminal to the task management module based on the highest unit price information PriceLimit of the demand terminal.
Assuming that 3 computing terminals all meet the service capability requirement of the computing task TaskSeq1, and respectively give computing service cost quotations as follows:
therefore, the service quotation of the demand terminal TaskSeq1 by the computing terminal with the id of aIMH … GlsklPd is lowest, and the quotation time is earliest.
For a computing terminal which meets the service capability and initiates a computing task to carry out application, a task management module performs task allocation according to the principle of service price priority and application time priority; aiming at the same computing task, if the service price quotation and the application time of a plurality of computing terminals are the same, the task management module selects the computing terminal with high service online rate and system configuration to execute the computing task. According to the application results of the 3 computing terminals, the task management module selects the computing terminal with the id of aIMH … GlsklP as a service terminal, the quotation of the computing service is recorded as srvPrice ═ 6, and the block chain address of the computing terminal is addr1 srv。
The task management module selects a computing terminal with id aIMH … GlsklP to execute a computing task, and the specific execution mode is as follows:
s51: the task management module uses the selected public key of the computing terminal to transmit the d ″)jEncrypting to obtain a second intermediate transfer encrypted data sample D ″j;
D``j=f``(d`j,PubKeycal)
Wherein:
f' is an ECC () elliptic curve asymmetric encryption function;
PubKeycalasymmetrically encrypting and decrypting a public key for a computing terminal;
computing initial encrypted data samples d ″jThe digest H, and the signature Sig',
H=digest(d`j)
Sig`=f(H,PrivKeytaskmgt)
wherein:
digest () is MD5() digest calculation function;
f () is an ECC () elliptic curve asymmetric cryptographic function;
PrivKeytaskmgtan asymmetric encryption private key for the task management module;
the task management module encrypts the second transfer encrypted data sample D ″jInitial encrypted data samples d ″jAnd sending the signed abstract Sig' to the computing terminal.
Computing terminal PrivKey utilizing private key thereofcalDecrypting DjObtaining initial encrypted data sample d ″jAnd calculating d ″)jThe abstract H 'of (1) is used for passing through Sig' and a public key PubKey of a task management moduletaskmgtTo obtain d-jIf H ″ ═ H, the data verification passes, otherwise the data verification fails, i.e., d ″, the digest of (1) passesjThe transfer fails.
S52: the computing terminal obtains the d ″)jThen, the function m is calculated according to the standard calculation model required in the calculation taskreqProcessing N initial encrypted data samples d' in a computational taskjObtaining the processing result rj:
r`j=mreq(d`j)
Wherein: j is 1, 2, 3, …, N;
s53: r' is required to be converted according to the data input and output format supported by the standard calculation modeljAnd feeding the data back to the task management module, and informing the required terminal to confirm the processing result by the task management module:
s54: the demand terminal obtains an original processing result r by using a homomorphic decryption functionj;
rj=HE-1(r`j)
S55: requiring the terminal to confirm the original processing result rjAfter completion, the processing result r' is calculatedjThe digest and the signature are carried out to obtain signature (r')j) Signature (r' is signedj) And sending the transaction data to a task management module to execute the transaction transfer of the calculated service charge.
The task management module receives the processing result r' of the required terminaljConfirmation of (2)Signature (r ″)j) And then, completing the service fee payment from the demand terminal to the computing terminal, and linking the computing task information to the intelligent block chain contract.
The specific service fee payment method comprises the following steps:
firstly, the task management module calls a Payment function of the intelligent contract to complete the addr from the demand terminal addressreqTo the computing terminal address addrsrvTransfer of (2):
Payment(addrreq,addrsrv,amount)
wherein the content of the first and second substances,
and calculating the actual service cost price of the terminal to be 6000.
Then, after the transaction is successfully transferred, the transaction hash value hash and the block height of the transaction are obtained.
The specific mode of calculating the task information uplink is as follows:
first, the task management module packages the uplink information of the current calculation task to obtain srvInfo, whose main contents are shown in table 3.
TABLE 3
Then, the task management module calls Record function of the intelligent contract and stores the related information of the computing service in the block chain intelligent contract:
Record(srvInfo)
the invention adopts the working modes of the standard computing model and the input and output format, the computing terminal can install and register the standard computing model according to the conditions of the system configuration and the like, and meanwhile, the task management module is connected with the block chain, so that the standard computing model can be updated in time and kept synchronous with other functional modules.
The invention also provides a distributed computing system based on data encryption, which comprises a demand terminal, a task management module, a computing terminal and a block chain intelligent contract, as shown in fig. 2.
A demand terminal: the task management module is used for initiating a calculation task request to the task management module;
a task management module: the system comprises a demand terminal, a computing terminal and a block chain intelligent contract, wherein the demand terminal is used for receiving a computing task request of the demand terminal, distributing and managing the computing task request, distributing the computing task to the computing terminal, and calling the block chain intelligent contract to complete transaction transfer of computing service cost and information uplink of computing service after the computing terminal completes the computing task;
a computing terminal: the system is used for applying for and executing the calculation task and obtaining the final payment cost of the calculation task;
block chains: and creating a block chain intelligent contract in the block chain by the task management module, wherein the block chain intelligent contract is used for calculating the cost actually paid to the computing terminal and calculating the uplink of the task information.
When the system runs, the demand terminal, the task management module and the computing terminal are respectively initialized.
Specifically, the task management module initializes and defines a standard calculation model set as { m }(1),m(2),…,m(K)The number collection of data input and output formats supported by the standard computing model is {1, 2, …, n }(K)}。
Wherein, K is the number of standard calculation models supported by the task management module, and the kth standard calculation model is m(k)The number of the data input and output formats of the model is n(k),k=1,2,…,K。
In this embodiment, taking an image target recognition calculation task as an example, the task management module defines two standard calculation models, namely a deep learning standard calculation model and a support vector machine standard calculation model, which are respectively denoted as m(1)、m(2)That is, the standard calculation model set defined by the task management module is denoted as { m(1),m(2)}。
The input and output formats of the image data of the two standard calculation models are respectively recorded as f(1)、f(2)Each standard calculation model supports 2 image data input and output formats, namely the number of the data input and output formats supported by the standard calculation modelThe collection is {2, 2}, and specifically, the data input and output formats of the two models are distributed as shown in table 1.
In table 1:
fi1 (1)=fi1 (2)=1920*1080,fi2 (1)=fi2 (2)=1280*960;
fo1 (1)、fo2 (1)、fo1 (2)、fo2 (2)are all in the form of { typeNum, obj1,confidence1…, typeNum is the number of identified types, obj1As the type name of the first object, confidence1The confidence coefficient of the first type of object is between 0 and 1, and the higher the value is, the higher the existence probability of the object is.
Meanwhile, the task management module creates a block chain intelligent contract on the block chain, and main function functions of the block chain intelligent contract comprise a service charge payment function for executing a calculation task and an information uplink function for executing the calculation task;
the service charge payment function of the calculation task is as follows:
Payment(addrreq,addrsrv,amount)
wherein:
addrreqthe block chain address of the demand terminal;
addrsrvcalculating the block chain address of the terminal;
amount is the service cost of the calculation task;
the information uplink function of the calculation task is:
Record(srvInfo)
the srvInfo comprises calculation task requirement information, block chain address information, requirement terminal confirmation signature information and block chain transaction information.
Then, the task management module allocates a random identification id to each computing terminal, taking the example of selecting 3 computing terminals and 1 demand terminal, the ids of the 3 computing terminals are respectively marked as id1, id2 and id3, and the 3 computing terminalsThe block chain addresses are respectively marked as addr1 srv、addr2 srv、addr3 srvThe block chain address of the demand terminal is noted as addrreq。
Each computing terminal is initialized, and a standard computing model set { m } is obtained from the task management module(1),m(2)And sending the installation information of the standard calculation model to a task management module for registration, wherein the registration content comprises the following steps: the computing terminal identifies id, the computing terminal block chain address and a standard computing model set installed by the computing terminal, and reports the computing terminal block chain address addr to the task management module1 srv、addr2 srv、addr3 srv. And counting the registered contents of the computing terminal in a computing terminal service capability table, wherein the specific contents are shown in table 2.
Initializing a demand terminal, and acquiring a standard calculation model set { m ] from a task management module(1),m(2)And reporting the required terminal block chain address addr to the task management modulereq。
The demand terminal is used for encrypting the data samples in the calculation tasks for the second time and then sending the data samples to the task management module, the task management module is used for receiving the calculation tasks, decrypting the data samples after the second encryption to obtain an initial encryption file and successfully verifying the initial encryption file, distributing the calculation tasks and the initial encryption file to the matched calculation terminals after encrypting the calculation tasks and the initial encryption file again according to the information reported by the calculation terminals, and executing the calculation tasks after decrypting the calculation terminals again to obtain the initial encryption file and successfully verifying the initial encryption file.
Specifically, the manner of cooperation among the demand terminal, the task management module, the computing terminal, and the block chain is as follows.
The demand terminal firstly initiates a calculation task request to the task management module, and the request process is as follows:
the standard calculation model used for the calculation task request is selected first.
For example, a deep learning model is used as the calculation task request model. Namely:
mreq=m(1)
and then selecting a data input and output format adopted by the deep learning model as follows:
freq=1
specifically, the data input format adopted by the deep learning model is selected to be fi1 (1)1920 × 1080, data output format fo1 (1)={typeNum,obj1,confidence1,…}。
Determining that the number N of data samples needing to be processed by the calculation task is 1000 and the highest service unit price PriceLimit is 10, and according to the number N of the data samples and the highest service unit price PriceLimit, the highest transfer amount of the demand terminal authorization task management module when the calculation service cost is paid is as follows: n × prince limit 1000 × 10 ═ 10000;
then selecting a homomorphic encryption function to each data sample d according to the operation characteristics and the calculated amount of the calculation taskjCarrying out homomorphic encryption to obtain initial encrypted data sample d ″j,
d`j=HE(dj)
Wherein:
j=1,2,…,N;
HE () is a homomorphic encryption Fan-Vercauteren algorithm function;
computing initial encrypted data samples d ″jThe digest H, and the signature Sig,
H=digest(d`j)
Sig=f(H,PrivKeyreq)
wherein:
digest () is MD5() digest calculation function;
f () is an ECC () elliptic curve asymmetric cryptographic function;
PrivKeyreqa private key for asymmetric encryption of the demand terminal;
and using the public key of the task management module to match the original data sample d ″jAsymmetric encryption to obtain a first transit encrypted data sample D ″j;
D`j=f`(d`j,PubKeytaskmgt)
Wherein:
f' () is an ECC () elliptic curve asymmetric encryption function;
PubKeytaskmgtasymmetrically encrypting and decrypting a public key for the task management module;
finally, m is putreq、freq、N、PriceLimit、D`jAnd the Sig and H calculation task request information are all sent to the task management module. Wherein, the initial encrypted data sample d' is processedjAsymmetric encryption is performed, and the digest signature is calculated, so that the initial encrypted data sample d' can be ensuredjAnd the data transmission process is not tampered by a third party.
Task management module utilizes its private key PrivKeytaskmgtDecrypting D' systemjTo obtain d-jAnd calculating d ″)jThe abstract H' of (1) is obtained by Sig and a public key PubKey of a required terminalreqTo obtain d-jThe abstract of (1) is H;
if H ═ H, the data verification passes, d ″jCan be transmitted to the computing terminal, otherwise the data verification fails, i.e. d ″jThe transfer fails.
The task management module adds the calculation task request information of the demand terminal to a task queue, and all the calculation terminals can access the queue to obtain the calculation task information so as to apply and bear the calculation tasks therein to obtain the calculation service cost.
The calculation task of the task queue of the task management module to the current demand terminal is described as follows:
the computing terminal checks the installed standard computing model, selects one or more computing tasks which can be met from the task queue, and reports computing service quotations which can be accepted by the computing terminal to the task management module based on the highest unit price information PriceLimit of the demand terminal.
Assuming that 3 computing terminals all meet the service capability requirement of the computing task TaskSeq1, and respectively give computing service cost quotations as follows:
therefore, the service quotation of the demand terminal TaskSeq1 by the computing terminal with the id of aIMH … GlsklPd is lowest, and the quotation time is earliest.
For a computing terminal which meets the service capability and initiates a computing task to carry out application, a task management module performs task allocation according to the principle of service price priority and application time priority; aiming at the same computing task, if the service price quotation and the application time of a plurality of computing terminals are the same, the task management module selects the computing terminal with high service online rate and system configuration to execute the computing task. According to the application results of the 3 computing terminals, the task management module selects the computing terminal with the id of aIMH … GlsklP as a service terminal, the quotation of the computing service is recorded as srvPrice ═ 6, and the block chain address of the computing terminal is addr1 srv。
The task management module selects a computing terminal with id aIMH … GlsklP to execute a computing task, and the specific execution mode is as follows:
the task management module firstly uses the selected public key of the computing terminal to transmit the d ″jEncrypting to obtain a second intermediate transfer encrypted data sample D ″j;
D``j=f``(d`j,PubKeycal)
Wherein:
f' is an ECC () elliptic curve asymmetric encryption function;
PubKeycalasymmetrically encrypting a public key for the computing terminal;
computing initial encrypted data samples d ″jThe digest H, and the signature Sig',
H=digest(d`j)
Sig`=f(H,PrivKeytaskmgt)
wherein:
digest () is MD5() digest calculation function;
f () is an ECC () elliptic curve asymmetric cryptographic function;
PrivKeytaskmgtan asymmetric encryption private key for the task management module;
the task management module encrypts a second transit encrypted data sample D' obtained by encryptionjInitial encrypted data samples d ″jAnd sending the signed abstract Sig' to the computing terminal.
Computing terminal PrivKey utilizing private key thereofcalDecrypting DjObtaining initial encrypted data sample d ″jAnd calculating d ″)jThe abstract H 'of (1) is used for passing through Sig' and a public key PubKey of a task management moduletaskmgtTo obtain d-jIf H ″ ═ H, the data verification passes, otherwise the data verification fails, i.e., d ″, the digest of (1) passesjThe transfer fails.
Then, the computing terminal obtains the d ″jThen, the function m is calculated according to the standard calculation model required in the calculation taskreqProcessing N initial encrypted data samples d' in a computational taskjObtaining the processing result rj:
r`j=mreq(d`j)
Wherein: j is 1, 2, 3, …, N;
then r' is processed according to the data input and output format requirement supported by the standard calculation modeljFeeding back to the task management module, and informing the required terminal of the processing result r ″jAnd (4) confirmation:
the demand terminal decrypts r' by using homomorphic decryption functionjObtaining the original processing result rj;
rj=HE-1(r`j)
Finally, the terminal is required to confirm the original processing result rjAfter completion, the processing result r' is calculatedjThe digest and the signature are carried out to obtain signature (r')j) Signature (r' is signedj) And sending the transaction data to a task management module to execute the transaction transfer of the calculated service charge.
The task management module receives the processing result r' of the required terminaljIs verified as a signature (r ″)j) Then, it is required to finishAnd calculating the payment from the terminal to the computing terminal, and linking the computing task information to the intelligent contract of the block chain.
The specific service fee payment method comprises the following steps:
firstly, the task management module calls a Payment function of a block chain intelligent contract to complete the secondary demand terminal address addrreqTo the computing terminal address addrsrvTransfer of (2):
Payment(addrreq,addrsrv,amount)
wherein the content of the first and second substances,
and calculating the actual service cost price of the terminal to be 6000.
Then, after the transaction is successfully transferred, the transaction hash value hash and the block height of the transaction are obtained.
The specific mode of calculating the task information uplink is as follows:
first, the task management module packages the uplink information of the current calculation task to obtain srvInfo, whose main contents are shown in table 3.
And then, the task management module calls Record function of the intelligent block chain contract and stores the related information of the computing service in the intelligent block chain contract, so that the full-flow information is ensured to be public, transparent and traceable.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.