Fair and verifiable intelligent contract matrix outsourcing calculation method

Through smart contracts and blockchain technology, auxiliary blinding matrix is ​​generated and blindly processed, the problems of transaction fairness and verifiability in cloud outsourcing matrix calculation are solved, and fair and verifiable matrix outsourcing calculation is realized, reducing the difficulty of verification , ensuring the security and fairness of the transaction.

CN119232434AActive Publication Date: 2024-12-31HANGZHOU POST QUANTUM CRYPTOGRAPHY TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411257464.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-31
Estimated Expiration
2044-09-09

AI Technical Summary

Technical Problem

Existing cloud outsourcing matrix calculations cannot guarantee the fairness and verifiability of transactions, and users cannot effectively verify the matrix calculation results returned by cloud computing service providers, resulting in frequent dishonest behaviors and the verifier's dilemma leads to transaction delays or errors.

Method used

Using smart contracts and blockchain technology, by generating auxiliary blinding matrices and de-blind processing, users outsource matrix computing tasks to cloud computing service providers, and verify the correctness of the results through smart contracts to ensure that only the correct results are rewarded and reduce The time complexity of verification was achieved.

Benefits of technology

It realizes fair and verifiable matrix outsourcing computing, reduces the difficulty of verification, avoids the verifier dilemma of blockchain workers, ensures the fairness and security of transactions, and protects the interests of users and cloud service providers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119232434A_ABST
    Figure CN119232434A_ABST
Patent Text Reader

Abstract

The invention discloses a fair and verifiable intelligent contract matrix outsourcing calculation method. The method comprises the steps that a user inputs initial data; generating a plurality of auxiliary blinding matrixes according to the initial data; according to the auxiliary blinding matrix, constructing a plurality of blinding matrixes, and determining contents needing to be calculated by a cloud computing service provider; inputting a smart contract, applying for a calculation request from the smart contract by a cloud calculation service provider, and performing calculation according to the blind matrix to obtain a matrix result; the matrix result is returned to the smart contract; the verifier performs blind removal processing on the matrix result to obtain a blind removal result; comparing the blind removing result to judge whether the matrix result is correct or not; if the matrix result is correct, the smart contract sends the matrix result to the user and awards the cloud computing service provider; if the matrix result is incorrect, determining that the matrix result is invalid; according to the method, the calculation difficulty of verification is remarkably reduced, and the verifier difficulty of a block chain worker is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain matrix computing technology, and in particular to a fair and verifiable smart contract matrix outsourcing computing method. Background Art

[0002] Matrix calculation plays an important role in the fields of scientific computing and cryptography. Many cryptographic protocols, scientific computing, and numerical computing problems involve matrix calculation. However, for users with limited computing power, it is difficult to complete matrix calculations independently due to the large data scale and complex calculations. Therefore, outsourcing services for matrix calculations have emerged. Users outsource matrix calculation tasks to cloud computing service providers, and then the cloud calculates the results and sends them to users to complete the transaction. However, there are various motivations for the parties to the transaction to be dishonest. In a simple outsourcing model, users cannot verify whether the matrix calculation results returned by the cloud computing service provider are absolutely correct, so dishonest cloud servers may return a random result to save resources. Under the current "pay first, use later" cloud computing operation model, even if the cloud computing service provider returns an incorrect calculation result, the user has already paid the corresponding fee for the service. At the same time, the cloud server may return the correct calculation result, but dishonest users can claim that they did not receive the correct answer and refuse to pay. We classify this series of dishonest behaviors as unfair phenomena, and the current cloud outsourcing matrix calculation cannot meet this requirement.

[0003] Fortunately, distributed ledger technology blockchain can solve this problem. Due to the decentralized consensus characteristics of blockchain, participants can achieve fair and just transactions without any third-party intervention. In addition, the smart contract technology supported by Ethereum provides blockchain with more scenarios and larger-dimensional applications. Ethereum supports Turing-complete cryptocurrency scripting language through smart contracts and provides Ethereum Virtual Machine (EVM) as the execution environment of smart contracts. Users call contracts by sending transactions to the interface provided by the contract with specified parameters. After receiving the transaction request, the smart contract triggers the execution of the specified code logic and facilitates subsequent execution. The execution process and results of the contract are agreed on at each node and recorded as transactions on the blockchain. Correspondingly, workers also need to verify all transactions executed by smart contracts. In our example, workers need to verify the matrix calculation results sent by the cloud server. A simple verification method is to re-execute the complex calculation process. However, due to the large amount of data in the matrix calculation, the opportunity may face a very large amount of verification calculation, and performing the verification calculation may delay the opportunity to compete for PoW (Proof-of-Work) calculation in the next block. At this time, the workers are faced with a dilemma. The first option is to skip the verification of complex transactions to ensure that they will not fall behind in the block competition. However, the result of this option is that there may be incorrect transactions in the block. Once the block contains incorrect transaction data, not only will the legitimacy of the incorrect block be cancelled, but the block revenue will also be withdrawn, and more seriously, the reputation of the entire blockchain ecosystem will be affected. The second option for workers is to continue to conduct honest verification. Then, compared with workers who skip verification, they will fall behind in the block competition. They may be subject to resource consumption attacks, that is, attackers maliciously delay the mining efficiency of competitors by sending large-scale transactions, thereby winning the mining competition. This is the Ethereum validator dilemma problem.

[0004] Although the existing verifiable outsourcing matrix calculation method can prevent malicious cloud computing service providers from cheating, reduce the computational complexity, and meet the verifiability, it still cannot guarantee the fairness of the transaction. Based on the current "pay first, use later" cloud service operation model, even if users discover the dishonest behavior of the cloud service, they have already paid for the transaction. Blockchain-based smart contracts can outsource matrix calculations and realize real-time synchronous transactions to solve this problem. However, there are still many problems with the solution based on smart contracts. The large amount of data and calculation involved in matrix operations will cause workers to suffer from the verifier's dilemma, resulting in transactions being delayed, rejected, or even containing erroneous calculation results. Therefore, in response to the problems in the above-mentioned matrix outsourcing calculation process, a safe, fair, verifiable, and anti-verifier's dilemma smart contract outsourcing matrix calculation method is provided to help the safe implementation of matrix outsourcing calculation. Summary of the invention

[0005] The purpose of the present invention is to provide a fair and verifiable smart contract matrix outsourcing calculation method to overcome the deficiencies in the prior art.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] This application discloses a fair and verifiable smart contract matrix outsourcing calculation method, including smart contracts, users and cloud computing service providers, and specifically includes the following steps:

[0008] S1. The user inputs initial data; the initial data includes a matrix to be calculated, a number of random permutation arrays, and a number of non-zero random arrays; a number of auxiliary blinding matrices are generated according to the random permutation arrays, the non-zero random arrays, and the Kronecker function; a number of blinding matrices are constructed according to the auxiliary blinding matrices, and the content that needs to be calculated by the cloud computing service provider is determined;

[0009] S2: The user inputs the content in S1 that needs to be calculated by the cloud computing service provider into the smart contract, and the smart contract waits for the cloud computing service provider to initiate a calculation request;

[0010] S3. The cloud computing service provider applies for a computing request to the smart contract, and the smart contract hands the blinded matrix to the cloud computing service provider.

[0011] S4. The cloud computing service provider obtains the matrix result based on the blinded matrix calculation and returns the matrix result to the smart contract.

[0012] S5. After the smart contract receives the matrix result, the verifier deblinds the matrix result to obtain the deblinded result; compares the deblinded result to determine whether the matrix result is correct; if the matrix result is correct, the smart contract sends the matrix result to the user and rewards the cloud computing service provider; if the matrix result is incorrect, the matrix result is deemed invalid.

[0013] Preferably, the initial data in step S1 includes two matrices M1 and M2 to be calculated, the number of rows of matrix M1 is m and the number of columns is n; the number of rows of matrix M2 is n and the number of columns is k; three random permutation arrays π1, π2, ρ, where π1∈{1,…,n}, π2∈{1,…,n}, ρ∈{1,…,m}; three non-zero random arrays {a1,…,a n}, {b1,…,b n} and {p1,…,p m}.

[0014] Preferably, in step S2, according to the random permutation arrays π1, π2, ρ, the non-zero random array {a1, ..., a n}, {b1,…,b n}, {p1,…,p m} and Kronecker function Generate three auxiliary blinding matrices P1, P2, P3, where Ρ3(i,j)=p i δ ρ(i),j , where i and j belong to the row and column sizes of the three matrices respectively.

[0015] Preferably, in step S2, four matrices X1, X2, X3, and X4 are constructed according to the auxiliary blinding matrices P1, P2, and P3, wherein X2=P1M2, X4=P2M2; the content that needs to be calculated by the cloud computing service provider is C1=X1×X2, C2=X3×X4.

[0016] Preferably, in step S5, the verifier performs a deblinding process on the matrix result to obtain deblinding results Y1 and Y2, where Y2=P3C2.

[0017] Preferably, the deblinding result is compared to determine whether the matrix result is correct. The specific operation is: determine the size of the deblinding results Y1 and Y2; if Y1 is equal to Y2, the matrix result is correct; otherwise, the matrix result is incorrect.

[0018] Preferably, the initial data also includes a result specific value res, wherein Where x and y are random numbers specified by the user; in step S5, the deblinding result is compared to determine whether the matrix result is correct. The specific operation is: determine the size of the deblinding results Y1 and Y2. If Y1 is equal to Y2, then further determine c xy Is it equal to Y1(x,y)? If c xy is equal to Y1(x,y), the matrix result is correct; if c xy If Y1 is not equal to Y2, the matrix result is incorrect.

[0019] Beneficial effects of the present invention:

[0020] Compared with existing solutions, this invention does not rely on any trusted third party or encryption assumptions; as an outsourcing carrier, it uses smart contracts to ensure the security and public verifiability of OMC; it proposes a fair and verifiable smart contract matrix outsourcing calculation method, which reduces the time complexity of verification from O(n 3 ) is reduced to O(n 2 ), thereby significantly reducing the computational difficulty of verification and avoiding the verifier dilemma of blockchain workers; other challenges in the implementation and execution of smart contracts, including principal restrictions and parameter exposure, are also considered and corresponding solutions are given.

[0021] The features and advantages of the present invention will be described in detail through embodiments in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a schematic diagram of the relationship between this smart contract, users and cloud computing service providers; DETAILED DESCRIPTION

[0023] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below through the accompanying drawings and embodiments. However, it should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the scope of the present invention. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0024] See also Figure 1 , the user submits a smart contract, starts a matrix outsourcing calculation task on the blockchain, and waits for the calculation result. The cloud that is willing to receive the reward performs the matrix calculation and sends the transaction result to the smart contract. After receiving the calculation result, the worker needs to check its correctness and choose whether to recognize the transaction. If the verification is passed, the smart contract automatically executes the following process to send the matrix calculation result to the user and the reward to the cloud at the same time. Based on the security of the blockchain, attackers cannot tamper with the results unless their computing power exceeds half of the blockchain system, which is impossible in our model. In addition, since the reward is sent to the chain together with the outsourcing request transaction, the user cannot violate the contract or terminate the contract early, thereby protecting the interests of the server. On the other hand, only after the server sends a transaction with the correct answer can the contract check the correctness of the result and reward the server. It protects the interests of users and forces the server to be rewarded only by sending the correct calculation results.

[0025] This smart contract matrix outsourcing computing system involves three parties: the problem provider, the cloud that performs the calculation, and the worker responsible for execution and verification. The user is the initiator and demander of the matrix calculation, and its purpose is to obtain the correct matrix calculation result. However, due to insufficient computing power, the user cannot complete the calculation by himself, so he chooses to outsource the calculation task. Specifically, in the outsourcing computing model of the present invention, the user is responsible for providing matrix A and matrix B as calculation inputs, and providing the address where the calculation result is returned and the corresponding calculation reward. In the model of the present invention, the user is rational, which means that the user is not completely honest. He may honestly abide by the transaction rules or betray. He will choose the current optimal strategy based on the principle of maximizing benefits. The cloud is the calculator of the matrix calculation and plays the role of the task solver to obtain the corresponding reward. It is assumed that the cloud server will never refuse to calculate, but may return any result. A dishonest cloud may maliciously tamper with a value in the result, or return two equal but incorrect random results. As a working node in the blockchain, the worker should not be a party in our model, but considering the impact of the verifier dilemma brought about by large-scale matrix computing transactions, the worker is regarded as a virtual, trusted, but vulnerable third party. They will honestly verify the correctness of transactions without affecting the mining process. However, they may be overwhelmed when faced with the validator's dilemma.

[0026] The business process of smart contract matrix outsourcing calculation is as follows: the user publishes a matrix outsourcing calculation smart contract on the Ethereum blockchain, initiates a matrix outsourcing calculation task, and waits for the calculation result. The cloud that is willing to receive the reward obtains the relevant parameters, performs the matrix calculation, and sends the result transaction to the smart contract. After receiving the calculation result, the worker needs to check its correctness and choose whether to pass the transaction. If the verification is passed, the smart contract automatically executes the process, sends the matrix calculation result to the user, and sends the reward to the cloud. If the verification fails, it will be displayed that the transaction failed, and the subsequent process of the smart contract cannot be continued. Therefore, the cloud can only pass the verification if it sends the correct calculation result, which ensures the correctness and reliability of the data. At the same time, the automatic execution of the contract also ensures that the cloud can get the due calculation reward as long as the correct calculation result is returned, and there will be no default and other behaviors, which also protects the interests of the cloud and protects the fairness of the transaction between the two parties as a whole.

[0027] The initiator of the matrix calculation calls the smart contract and calls the function of initializing parameters, and stores the parameters in the smart contract. Since there are no real random numbers in Ethereum, only pseudo-random numbers are provided, and the random numbers are determined by the timestamp of the current time. In order to prevent malicious users from choosing to guess blind random numbers by timestamps. First, we need to obtain matrices M1 and M2, where the number of rows of M1 is m, the number of columns of M1 and M2 is n, and the number of columns of M2 is k. The initiator of the matrix calculation is required to provide two random permutations π1, π2, where π1, π2∈{1,…,n}, two non-zero random number sets {a1,…,a n},{b1,…,b n} and a random permutation ρ, where the elements ρ in ρ i ∈{1,…,m} and a set of non-zero random numbers {p1,…,p m}.

[0028] First use the Kronecker delta function:

[0029] Combining random permutations and non-zero random number sets to obtain three matrices P1, P2, P3, where Ρ3(i,j)=p i δ ρ(i),j , where i and j belong to the row and column sizes of the three matrices respectively.

[0030] Next, we will generate the blinded matrices X1, X2, X3, and X4. The user uses the generated P1, P2, and P3 to construct four matrices X2=P1M2, X4=P2M2. The four matrices obtained are sent to the smart contract. The cloud computing service provider can obtain the four matrices from the contract and needs to calculate C1=X1×X2, C2=X3×X4. After the calculation is completed, the cloud computing service provider needs to call the data storage function in the smart contract to return the calculated matrix results to the smart contract. C1=P3M1M2, If the cloud computing server performs the calculation correctly, then C1=M1M2,Y2=P3C2=M1M2,then Y1=Y2. In the algorithm design, Y1 and Y2 are given to a specific function that receives data for input storage and verification. In order to increase the correctness of the matrix result and prevent malicious clouds from providing a set of results that can satisfy Y1=Y2 but C1 and C2 are not correct results (for example, multiplying C1 and C2 by a constant c at the same time), the user needs to select a specific value of the result at the beginning.

[0031] When verifying smart contracts, workers need to verify whether the transfer results are correct and whether the matrix calculation results are correct. The verification of matrix results requires workers to understand the operation mode of the smart contract implemented in this article in advance. To understand the verification results, they only need to call the corresponding verification function interface to determine whether the returned data results are equal. In order to increase the correctness of the verification, workers can add an additional check bit res = Y1 [x] [y] = Y2 [x] [y] (since theoretically Y1 = Y2, which is the correct calculation result, it is collectively referred to as Y in the future), where x and y are random numbers specified by the user, corresponding to the position in the matrix Y. The correctness of the result is verified by verifying whether res is equal to Y (x, y). The verification process is simplified here. Even users can call the same function to verify the results. By simplifying the calculation verification method, workers are encouraged to execute and verify the smart contract, which can effectively reduce unnecessary calculation waste.

[0032] Example:

[0033] Inits: The user inputs the square matrix M1, M2, random permutation array π1, π2, ρ1, and non-zero random array {a1,…,a n},{b1,…,b n},{p1,…,p n}.

[0034] Create: After receiving the user's input data

[0035] 1. Generate 3 auxiliary blinding matrices P i .

[0036] 2. Generate the auxiliary blinding matrix according to the auxiliary blinding matrix Pi

[0037] 3. Generate the blinding matrix X using the auxiliary blinding matrix i ,in X2=P1M2, X4=P2M2.

[0038] 4. Set state:=Produced.

[0039] Calculate: After receiving a calculation request from a cloud computing service provider

[0040] 1. Check if stat is: = Produced.

[0041] 2. Set rights:=out.

[0042] 3. Set the address of CalculatedUserRole to the address of the cloud computing service provider.

[0043] GetParams: After receiving the Calculate request from the cloud computing service provider

[0044] 1. Check if CalculatedUserRole = sender.address.

[0045] 2. Check if rights is:=out.

[0046] 3. The cloud computing service provider obtains the calculation data C1 = X1 × X2, C2 = X3 × X4.

[0047] 4. Set state:=sended.

[0048] GetAnswer: After receiving the computation completion request from the cloud computing service

[0049] 1. Check if state is: = sent.

[0050] 2. Check if rights is:=out.

[0051] 3. Check if CalculatedUserRole = sender.address.

[0052] 4. The cloud computing server provides calculation results C1, C2.

[0053] 5. Set state:=calculated.

[0054] Verify: After receiving the verification request initiated by the verifier

[0055] 1. Check if CalculatedUserRole !=sender.address.

[0056] 2. Check state:=calculated.

[0057] 3. Deblind the calculation results C1 and C2 to obtain the results Y2=P3C2=M1M2.

[0058] 4. The verifier obtains data Y1 and Y2 and compares whether Y1=Y2.

[0059] 5. The verifier obtains the matrix M1, M2 and the subscripts x, y of the required verification value. The verifier needs to calculate c xy in And check whether Y1(x,y) is equal to c xy .

[0060] The algorithm briefly describes the implementation of a verifiable smart contract based on matrix outsourcing of blinded matrices. In the Create function, the user needs to enter the data required by the corresponding algorithm. The Calculate function requires the cloud computing service provider to provide its address to prevent malicious attackers from calling the GetAnswer function to interfere with the transaction process. The cloud computing service provider can obtain the corresponding calculation data from GetParams and submit the calculation result answer through the GetAnswer function. The worker obtains the data to be verified from Verify, and compares whether Y1=Y2 is established based on the theoretical basis used by this smart contract.

[0061] The security of the present invention is based on smart contracts, that is, the security of blockchain. If an attacker wants to tamper with the data on the contract, he needs more than half of the computing power of the entire blockchain network, which is difficult to achieve in the scenario of the present invention and has no practical significance. Because the user and the cloud conduct transactions through the medium of smart contracts, which are automatically judged and executed by the contract, the fairness of the present invention is based on the fairness of the blockchain. In order to maintain the consistency of the system, the workers will honestly verify each transaction to ensure the correctness of each transaction. If the cloud returns an incorrect calculation answer, the transaction will be considered invalid by the worker, and the cloud will not receive the corresponding reward. If the cloud returns the correct answer, because the user has sent the reward to the contract in advance and cannot retrieve the money, the worker will verify that the transaction is correct, and the money will be automatically transferred to the account of the cloud server, which also avoids the malicious behavior of the user to defraud the calculation results. In general, fairness for both parties is guaranteed.

[0062] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent substitution or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A fair and verifiable smart contract matrix outsourcing computing method, including smart contracts, users and cloud computing service providers, characterized in that: The specific steps include: S1. The user inputs initial data; the initial data includes a matrix to be calculated, a number of random permutation arrays, and a number of non-zero random arrays; a number of auxiliary blinding matrices are generated according to the random permutation arrays, the non-zero random arrays, and the Kronecker function; a number of blinding matrices are constructed according to the auxiliary blinding matrices, and the content that needs to be calculated by the cloud computing service provider is determined; S2: The user inputs the content in S1 that needs to be calculated by the cloud computing service provider into the smart contract, and the smart contract waits for the cloud computing service provider to initiate a calculation request; S3. The cloud computing service provider applies for a computing request to the smart contract, and the smart contract hands the blinded matrix to the cloud computing service provider. S4, the cloud computing service provider obtains the matrix result according to the blind matrix calculation; And return the matrix result to the smart contract; S5. After the smart contract receives the matrix result, the verifier performs deblinding on the matrix result to obtain the deblinding result; Compare the deblinding results to determine whether the matrix result is correct; if the matrix result is correct, the smart contract will send the matrix result to the user and reward the cloud computing service provider; If the matrix result is incorrect, the matrix result is deemed invalid.

2. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 1, characterized in that: The initial data in step S1 includes two matrices M1 and M2 to be calculated, where the number of rows of matrix M1 is m and the number of columns is n; the number of rows of matrix M2 is n and the number of columns is k; three random permutation arrays π1, π2, ρ, where π1∈{1,…,n}, π2∈{1,…,n}, ρ∈{1,…,m}; three non-zero random arrays {a1,…,a n }, {b1,…,b n } and {p1,…,p m }.

3. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 2, characterized in that: In step S2, according to the random permutation arrays π1, π2, ρ, the non-zero random array {a1,…,a n }、 {b1,…,b n }, {p1,…,p m } and Kronecker function , Generate three auxiliary blinding matrices P1, P2, P3, where Ρ3(i,j)=p i δ ρ(i),j , where i and j belong to the row and column sizes of the three matrices respectively.

4. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 3, characterized in that: In step S2, four matrices X1, X2, X3, and X4 are constructed based on the auxiliary blinding matrices P1, P2, and P3, where X4=P2M2; the content that needs to be calculated by the cloud computing service provider is C1=X1×X2, C2=X3×X4.

5. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 4, characterized in that: In step S5, the verifier performs unblinding processing on the matrix results to obtain unblinding results Y1 and Y2, where Y2=P3C2。 6. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 5, characterized in that: Compare the unblinding results to determine whether the matrix results are correct. The specific operation is: determine the size of the unblinding results Y1 and Y2; if Y1 is equal to Y2, the matrix result is correct; otherwise, the matrix result is incorrect.

7. A fair and verifiable smart contract matrix outsourcing calculation method as claimed in claim 1, characterized in that: The initial data also includes a result specific value res, where Where x and y are random numbers specified by the user; in step S5, the deblinding result is compared to determine whether the matrix result is correct. The specific operation is: determine the size of the deblinding results Y1 and Y2. If Y1 is equal to Y2, then further determine c xy Is it equal to Y1(x,y)? If c xy is equal to Y1(x,y), the matrix result is correct; if c xy If Y1 is not equal to Y2, the matrix result is incorrect.

Citation Information

Patent Citations

  • Data outsourcing calculation transaction method based on smart contract

    CN114969815A

  • Block chain-based outsourcing payment calculation transaction implementation method and system

    CN116629865A

  • Privacy protection verifiable polynomial calculation outsourcing method based on block chain

    CN117034334A