CN113407981A - Energy consumption data processing method based on zero knowledge proof - Google Patents

Energy consumption data processing method based on zero knowledge proof Download PDF

Info

Publication number
CN113407981A
CN113407981A CN202110954361.XA CN202110954361A CN113407981A CN 113407981 A CN113407981 A CN 113407981A CN 202110954361 A CN202110954361 A CN 202110954361A CN 113407981 A CN113407981 A CN 113407981A
Authority
CN
China
Prior art keywords
energy consumption
proof
consumption data
energy
vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110954361.XA
Other languages
Chinese (zh)
Other versions
CN113407981B (en
Inventor
戴铁潮
陈建
黄建平
张旭东
毛冬
冯珺
梅峰
潘司晨
刘瀚琳
沈桂竹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Zhejiang Electric Power Co Ltd
Information and Telecommunication Branch of State Grid Zhejiang Electric Power Co Ltd
Original Assignee
State Grid Zhejiang Electric Power Co Ltd
Information and Telecommunication Branch of State Grid Zhejiang Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Zhejiang Electric Power Co Ltd, Information and Telecommunication Branch of State Grid Zhejiang Electric Power Co Ltd filed Critical State Grid Zhejiang Electric Power Co Ltd
Priority to CN202110954361.XA priority Critical patent/CN113407981B/en
Publication of CN113407981A publication Critical patent/CN113407981A/en
Application granted granted Critical
Publication of CN113407981B publication Critical patent/CN113407981B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明提出了一种基于零知识证明的能源消费数据处理方法,包括:基于预设频率获取耗能企业的原始能源消费数据;基于哈希算法计算原始能源消费数据的散列值,将所述散列值作为第一证明问题;根据能源大数据中心的业务需求确定不可逆函数,基于不可逆加密算法得到原始能源消费数据的第二证明问题;验证原始能源消费数据是否完整,若验证通过,分别计算第一证明问题和第二证明问题的零知识证明,若零知识证明均满足能源大数据中心规定的验证条件,则将第二证明问题存储到能源大数据中心。本发明在不泄露耗能企业的原始能源消费数据的同时,采集到真实的能源消费数据的相关信息,并能够直接被能源大数据中心用于后续的分析业务。

Figure 202110954361

The present invention provides a method for processing energy consumption data based on zero-knowledge proof, comprising: obtaining original energy consumption data of an energy-consuming enterprise based on a preset frequency; calculating a hash value of the original energy consumption data based on a hash algorithm, The hash value is used as the first proof problem; the irreversible function is determined according to the business requirements of the energy big data center, and the second proof problem is to obtain the original energy consumption data based on the irreversible encryption algorithm; to verify whether the original energy consumption data is complete, if the verification passes, calculate separately For the zero-knowledge proofs of the first proof problem and the second proof problem, if the zero-knowledge proofs both meet the verification conditions specified by the Energy Big Data Center, the second proof problem will be stored in the Energy Big Data Center. The invention collects the relevant information of the real energy consumption data without leaking the original energy consumption data of the energy-consuming enterprise, and can be directly used by the energy big data center for the subsequent analysis business.

Figure 202110954361

Description

一种基于零知识证明的能源消费数据处理方法An energy consumption data processing method based on zero-knowledge proof

技术领域technical field

本发明属于数据隐私保护技术领域,尤其涉及一种基于零知识证明的能源消费数据处理方法。The invention belongs to the technical field of data privacy protection, and in particular relates to a method for processing energy consumption data based on zero-knowledge proof.

背景技术Background technique

现阶段,耗能企业能源消费数据的采集与分析过程中缺少了必要的验证流程,并且以明文的方式收集各耗能企业的能源消费数据,上述过程不仅存在耗能企业数据隐私泄露的风险,还存在从耗能企业传输至能源大数据中心的数据真实性有待商榷的问题,影响了能源大数据中心对耗能企业能源消费的宏观分析结果。因此,零知识证明逐渐被运用到验证能源消费数据的应用场景下。零知识证明是一种能够保护隐私的密码学算法,能够在不向验证者提供任何隐私信息的情况下,使验证者相信某个论断是正确的。At this stage, the collection and analysis of energy consumption data of energy-consuming enterprises lacks the necessary verification process, and the energy consumption data of each energy-consuming enterprise is collected in plain text. The above process not only has the risk of data privacy leakage of energy-consuming enterprises, There is also the question of the authenticity of the data transmitted from the energy-consuming enterprises to the energy big data center, which affects the macro-analysis results of the energy consumption enterprises' energy consumption by the energy big data center. Therefore, zero-knowledge proofs are gradually being applied to the application scenarios of verifying energy consumption data. Zero-knowledge proof is a cryptographic algorithm that can protect privacy, which can make the verifier believe that a certain assertion is correct without providing any private information to the verifier.

在能源消费领域,现有的零知识证明通常是用于验证能源交易的真实性,证明者通过向验证者发送的证明信息通常是由哈希算法计算的哈希值,零知识证明通过便确认交易成立。由于能源大数据中心需要根据耗能企业的能源消费数据进行一系列能源消费情况的分析,而哈希值是无法直接用于上述分析业务的,即使通过了现有的零知识证明机制,能源大数据中心仍然需要获取耗能企业的原始能源消费数据来进行后续的分析业务,也就无法真正实现不透露耗能企业隐私的要求,因此现有的零知识证明无法直接应用到能源消费数据真实性的验证。In the field of energy consumption, existing zero-knowledge proofs are usually used to verify the authenticity of energy transactions. The proof information sent by the prover to the verifier is usually the hash value calculated by the hash algorithm, and the zero-knowledge proof is confirmed when passed. Transaction established. Because the energy big data center needs to analyze a series of energy consumption situations based on the energy consumption data of energy-consuming enterprises, the hash value cannot be directly used for the above analysis business, even if the existing zero-knowledge proof mechanism is passed, the energy consumption The data center still needs to obtain the original energy consumption data of energy-consuming enterprises for subsequent analysis business, so it cannot truly realize the requirement of not revealing the privacy of energy-consuming enterprises. Therefore, the existing zero-knowledge proof cannot be directly applied to the authenticity of energy consumption data. 's verification.

发明内容SUMMARY OF THE INVENTION

为了解决现有技术中存在的缺点和不足,本发明提出了一种基于零知识证明的能源消费数据处理方法,包括:In order to solve the shortcomings and deficiencies existing in the prior art, the present invention proposes a method for processing energy consumption data based on zero-knowledge proof, including:

S100:基于预设频率获取耗能企业的原始能源消费数据;S100: Obtain the raw energy consumption data of the energy-consuming enterprise based on the preset frequency;

S200:基于哈希算法计算原始能源消费数据的散列值,将所述散列值作为第一证明问题;S200: Calculate a hash value of the original energy consumption data based on a hash algorithm, and use the hash value as the first proof problem;

S300:根据能源大数据中心的业务需求确定不可逆函数,不可逆函数的输出结果为根据原始能源消费数据计算的能够满足业务需求的数据,由不可逆函数、S200中的哈希算法以及随机定义的拼接规则构成不可逆加密算法,基于所述不可逆加密算法得到原始能源消费数据的第二证明问题;S300: Determine the irreversible function according to the business requirements of the energy big data center. The output result of the irreversible function is the data calculated according to the original energy consumption data that can meet the business requirements. The irreversible function, the hash algorithm in S200 and the randomly defined splicing rule Constitute an irreversible encryption algorithm, and obtain the second proof problem of the original energy consumption data based on the irreversible encryption algorithm;

S400:根据第一证明问题和第二证明问题的重复部分验证原始能源消费数据是否完整,若验证通过则执行S500,否则拒绝进行零知识证明;S400: Verify whether the original energy consumption data is complete according to the repeated part of the first proof problem and the second proof problem, and if the verification passes, execute S500, otherwise, refuse to perform zero-knowledge proof;

S500:基于傅里叶逆变换将第一证明问题和第二证明问题转换为多项式向量,结合能源大数据中心生成的随机数,分别计算第一证明问题和第二证明问题的零知识证明,将零知识证明和第二证明问题发送给能源大数据中心;S500: Convert the first proof problem and the second proof problem into a polynomial vector based on the inverse Fourier transform, and combine the random numbers generated by the Energy Big Data Center to calculate the zero-knowledge proofs of the first proof problem and the second proof problem, respectively. The zero-knowledge proof and the second proof problem are sent to the energy big data center;

S600:若零知识证明均满足能源大数据中心规定的验证条件,则将第二证明问题存储到能源大数据中心,否则判定原始能源消费数据未通过真实性验证,拒绝将第二证明问题存储到能源大数据中心。S600: If the zero-knowledge proofs all meet the verification conditions specified by the energy big data center, store the second proof questions in the energy big data center, otherwise determine that the original energy consumption data fails the authenticity verification, and refuse to store the second proof questions in the energy big data center. Energy Big Data Center.

可选的,所述S100包括:Optionally, the S100 includes:

确定耗能企业中水、电、气计量仪表的数据端口,获取数据端口的量纲参数;Determine the data ports of water, electricity, and gas metering instruments in energy-consuming enterprises, and obtain the dimensional parameters of the data ports;

基于预设频率向所述数据端口发送数据采集请求,获取水、电、气计量仪表的计量数据,根据量纲参数对计量数据进行量纲统一处理,将处理后的计量数据作为原始能源消费数据。Send a data collection request to the data port based on the preset frequency to obtain the metering data of the water, electricity, and gas metering instruments, perform dimensional unified processing on the metering data according to the dimensional parameters, and use the processed metering data as the original energy consumption data .

可选的,所述S200中的哈希算法为SHA-256算法。Optionally, the hash algorithm in the S200 is the SHA-256 algorithm.

可选的,所述S300包括:Optionally, the S300 includes:

获取预先存储在能源大数据中心的函数库,所述函数库中包含若干个自定义的不可逆函数,根据能源大数据中心的业务需求在函数库中选取一个不可逆函数;Obtain the function library pre-stored in the energy big data center, the function library contains several self-defined irreversible functions, and select an irreversible function in the function library according to the business requirements of the energy big data center;

随机确定第一证明问题与原始能源消费数据的拼接顺序规则,结合选取的不可逆函数、S200中的哈希算法共同组成不可逆加密算法;Randomly determine the splicing sequence rules of the first proof problem and the original energy consumption data, and combine the selected irreversible function and the hash algorithm in S200 to form an irreversible encryption algorithm;

将原始能源消费数据输入S200中的哈希算法,得到第一字符串,将原始能源消费数据输入不可逆函数,得到第二字符串;Input the raw energy consumption data into the hash algorithm in S200 to obtain the first character string, and input the raw energy consumption data into the irreversible function to obtain the second character string;

按照不可逆加密算法中的拼接顺序规则将第一字符串与第二字符串进行拼接,得到第二证明问题。The first string and the second string are spliced according to the splicing sequence rule in the irreversible encryption algorithm to obtain the second proof problem.

可选的,所述S400包括:Optionally, the S400 includes:

将第一证明问题和第二证明问题进行比对,若经过比对得到的重复部分与第一证明问题一致,则原始能源消费数据的完整性通过校验。The first proof problem and the second proof problem are compared, and if the repeated part obtained by the comparison is consistent with the first proof problem, the integrity of the original energy consumption data passes the verification.

可选的,所述S500包括:Optionally, the S500 includes:

基于zkSNARKs零知识协议,将第一证明问题和第二证明问题分别转化为若干个二元赋值式;Based on the zkSNARKs zero-knowledge protocol, the first proof problem and the second proof problem are respectively transformed into several binary assignment expressions;

将二元赋值式中的变量组合为向量u,根据二元赋值式和向量u分别将第一证明问 题和第二证明问题转化为R1CS实例

Figure 64007DEST_PATH_IMAGE001
,其中N为第一证明问题或第二证明问 题的变量个数,M为二元赋值式的个数,a、b、c分别为R1CS实例中的向量序列,使
Figure 590934DEST_PATH_IMAGE002
; Combine the variables in the binary assignment expression into a vector u, and convert the first proof problem and the second proof problem into R1CS instances according to the binary assignment expression and the vector u, respectively
Figure 64007DEST_PATH_IMAGE001
, where N is the number of variables in the first proof problem or the second proof problem, M is the number of binary assignments, and a, b, and c are the vector sequences in the R1CS instance, so that
Figure 590934DEST_PATH_IMAGE002
;

将R1CS实例转化为QAP实例

Figure 573934DEST_PATH_IMAGE003
,其中A、B、C依次为R1CS实例中的 向量序列的傅里叶逆变换; Convert R1CS instance to QAP instance
Figure 573934DEST_PATH_IMAGE003
, where A, B, and C are in turn the inverse Fourier transform of the vector sequence in the R1CS instance;

获取能源大数据中心生成的随机数t、

Figure 234722DEST_PATH_IMAGE004
Figure 376991DEST_PATH_IMAGE005
Figure 465032DEST_PATH_IMAGE006
Figure 935328DEST_PATH_IMAGE007
Figure 399807DEST_PATH_IMAGE008
Figure 147315DEST_PATH_IMAGE009
Figure 406258DEST_PATH_IMAGE010
Figure 363849DEST_PATH_IMAGE011
,其中t为随机 选取的采样点,计算中间向量
Figure 366441DEST_PATH_IMAGE012
Figure 217722DEST_PATH_IMAGE013
Figure 913145DEST_PATH_IMAGE014
,计算过程如下: Obtain the random number t generated by the energy big data center,
Figure 234722DEST_PATH_IMAGE004
,
Figure 376991DEST_PATH_IMAGE005
,
Figure 465032DEST_PATH_IMAGE006
,
Figure 935328DEST_PATH_IMAGE007
,
Figure 399807DEST_PATH_IMAGE008
,
Figure 147315DEST_PATH_IMAGE009
,
Figure 406258DEST_PATH_IMAGE010
,
Figure 363849DEST_PATH_IMAGE011
, where t is a randomly selected sampling point, and the intermediate vector is calculated
Figure 366441DEST_PATH_IMAGE012
,
Figure 217722DEST_PATH_IMAGE013
and
Figure 913145DEST_PATH_IMAGE014
, the calculation process is as follows:

Figure 358033DEST_PATH_IMAGE015
Figure 358033DEST_PATH_IMAGE015
;

其中,

Figure 898736DEST_PATH_IMAGE016
Figure 617906DEST_PATH_IMAGE017
、…、
Figure 218651DEST_PATH_IMAGE018
为预设可信域D中的元素,j为
Figure 150835DEST_PATH_IMAGE014
的元素标号,j的取值范围为0至M-2之间的正整数,
Figure 495229DEST_PATH_IMAGE019
表示t采样点下向量A的第一个元 素,
Figure 321103DEST_PATH_IMAGE020
表示t采样点下向量B的第一个元素,
Figure 92749DEST_PATH_IMAGE021
表示t采样点下向量C的第一个元素,
Figure 308967DEST_PATH_IMAGE022
表示t采样点下向量A的第
Figure 394735DEST_PATH_IMAGE023
个元素,
Figure 12798DEST_PATH_IMAGE024
表示t采样点下向量B的第
Figure 33975DEST_PATH_IMAGE023
个元素,
Figure 737489DEST_PATH_IMAGE025
表示t采样点下向量C的第
Figure 158106DEST_PATH_IMAGE023
个元素,i的取值范围为1至N-1之间的正整数; in,
Figure 898736DEST_PATH_IMAGE016
,
Figure 617906DEST_PATH_IMAGE017
, …,
Figure 218651DEST_PATH_IMAGE018
is the element in the preset trusted domain D, and j is
Figure 150835DEST_PATH_IMAGE014
The element label of , the value of j is a positive integer between 0 and M-2,
Figure 495229DEST_PATH_IMAGE019
represents the first element of the vector A at the t sampling point,
Figure 321103DEST_PATH_IMAGE020
represents the first element of the vector B at the t sampling point,
Figure 92749DEST_PATH_IMAGE021
represents the first element of the vector C at the t sampling point,
Figure 308967DEST_PATH_IMAGE022
Represents the th
Figure 394735DEST_PATH_IMAGE023
elements,
Figure 12798DEST_PATH_IMAGE024
represents the th
Figure 33975DEST_PATH_IMAGE023
elements,
Figure 737489DEST_PATH_IMAGE025
represents the th
Figure 158106DEST_PATH_IMAGE023
elements, the value range of i is a positive integer between 1 and N-1;

计算

Figure 833938DEST_PATH_IMAGE026
Figure 212966DEST_PATH_IMAGE027
Figure 466093DEST_PATH_IMAGE028
以及
Figure 955980DEST_PATH_IMAGE029
,计算过程如下: calculate
Figure 833938DEST_PATH_IMAGE026
,
Figure 212966DEST_PATH_IMAGE027
,
Figure 466093DEST_PATH_IMAGE028
as well as
Figure 955980DEST_PATH_IMAGE029
, the calculation process is as follows:

Figure 220740DEST_PATH_IMAGE030
Figure 220740DEST_PATH_IMAGE030
;

其中,

Figure 505090DEST_PATH_IMAGE031
Figure 183196DEST_PATH_IMAGE032
的第j项系数,
Figure 289824DEST_PATH_IMAGE033
Figure 736986DEST_PATH_IMAGE034
表示向量u的第i个元 素,
Figure 129921DEST_PATH_IMAGE035
表示中间向量
Figure 295323DEST_PATH_IMAGE036
的第i个元素,
Figure 189330DEST_PATH_IMAGE037
表示中间向量
Figure 756577DEST_PATH_IMAGE014
的第j个元素,r、s 为耗能企业作为证明方选取的随机数; in,
Figure 505090DEST_PATH_IMAGE031
for
Figure 183196DEST_PATH_IMAGE032
The jth coefficient of ,
Figure 289824DEST_PATH_IMAGE033
,
Figure 736986DEST_PATH_IMAGE034
represents the ith element of the vector u,
Figure 129921DEST_PATH_IMAGE035
represents the intermediate vector
Figure 295323DEST_PATH_IMAGE036
the ith element of ,
Figure 189330DEST_PATH_IMAGE037
represents the intermediate vector
Figure 756577DEST_PATH_IMAGE014
The jth element of , r and s are random numbers selected by the energy-consuming enterprise as the prover;

根据计算结果组成向量

Figure 117151DEST_PATH_IMAGE038
作为零知识证明。 Form a vector according to the calculation result
Figure 117151DEST_PATH_IMAGE038
as a zero-knowledge proof.

可选的,所述向量u的第一个元素恒为1。Optionally, the first element of the vector u is always 1.

可选的,所述S600包括:Optionally, the S600 includes:

确定双线性配对映射

Figure 707533DEST_PATH_IMAGE039
Figure 342913DEST_PATH_IMAGE040
Figure 312138DEST_PATH_IMAGE041
为映射e的输入变量,
Figure 374771DEST_PATH_IMAGE042
为映射e 的输出变量; Determining Bilinear Pairwise Mapping
Figure 707533DEST_PATH_IMAGE039
,
Figure 342913DEST_PATH_IMAGE040
,
Figure 312138DEST_PATH_IMAGE041
is the input variable of mapping e,
Figure 374771DEST_PATH_IMAGE042
is the output variable of mapping e;

根据能源大数据中心接收到的零知识证明

Figure 186870DEST_PATH_IMAGE043
验证
Figure 360362DEST_PATH_IMAGE044
是否正确,若正确则判定第一证明问 题和第二证明问题通过真实性验证。 According to the zero-knowledge proof received by the energy big data center
Figure 186870DEST_PATH_IMAGE043
verify
Figure 360362DEST_PATH_IMAGE044
Whether it is correct, if it is correct, it is determined that the first proof problem and the second proof problem pass the authenticity verification.

本发明提供的技术方案带来的有益效果是:The beneficial effects brought by the technical scheme provided by the invention are:

(1)在zkSNARKs零知识协议的基础上,作为验证者的能源大数据中心能够根据自身业务需要生成不可逆加密算法并发送给耗能企业,在不泄露耗能企业的原始能源消费数据的同时,使能源大数据中心采集到真实的能源消费数据的相关信息,同时耗能企业通过不可逆加密算法生成的证明问题能够直接被能源大数据中心用于后续的分析业务,解决了通过传统的零知识证明无法满足能源分析需求的问题。(1) Based on the zkSNARKs zero-knowledge protocol, the energy big data center as a verifier can generate irreversible encryption algorithms according to their own business needs and send them to energy-consuming enterprises. The energy big data center can collect the relevant information of real energy consumption data, and the proof problem generated by the energy-consuming enterprise through the irreversible encryption algorithm can be directly used by the energy big data center for the subsequent analysis business. The problem of inability to meet energy analysis needs.

(2)作为证明者的耗能企业分别根据两种不同的加密方法生成两个证明问题,其中利用哈希算法得到的证明问题能够验证原始能源消费数据的完整性,利用自定义的不可逆加密算法得到的证明问题能够验证原始能源消费数据的真实性,结合了零知识证明的特点,能够在不泄露耗能企业隐私数据的情况下,检验传输至能源大数据中心的数据是否被篡改,提高了数据的真实性。(2) The energy-consuming enterprise as the prover generates two proof problems according to two different encryption methods. The proof problem obtained by using the hash algorithm can verify the integrity of the original energy consumption data, and the self-defined irreversible encryption algorithm is used. The obtained proof problem can verify the authenticity of the original energy consumption data. Combined with the characteristics of zero-knowledge proof, it can verify whether the data transmitted to the energy big data center has been tampered without revealing the private data of energy-consuming enterprises, which improves the authenticity of the data.

附图说明Description of drawings

为了更清楚地说明本发明的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention, which are of great significance to the art For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.

图1为本发明一实施例提出的一种基于零知识证明的能源消费数据处理方法的流程示意图;FIG. 1 is a schematic flowchart of a method for processing energy consumption data based on zero-knowledge proof provided by an embodiment of the present invention;

图2为耗能企业向能源大数据中心发送零知识证明的流程示意图。Figure 2 is a schematic diagram of the process of sending a zero-knowledge proof to an energy big data center by an energy-consuming enterprise.

具体实施方式Detailed ways

为使本发明的结构和优点更加清楚,下面将结合附图对本发明的结构作进一步地描述。In order to make the structure and advantages of the present invention clearer, the structure of the present invention will be further described below with reference to the accompanying drawings.

实施例一Example 1

如图1所示,本实施例提出了一种基于零知识证明的能源消费数据处理方法,包括:As shown in FIG. 1 , this embodiment proposes a method for processing energy consumption data based on zero-knowledge proof, including:

S100:基于预设频率获取耗能企业的原始能源消费数据;S100: Obtain the raw energy consumption data of the energy-consuming enterprise based on the preset frequency;

S200:基于哈希算法计算原始能源消费数据的散列值,将所述散列值作为第一证明问题;S200: Calculate a hash value of the original energy consumption data based on a hash algorithm, and use the hash value as the first proof problem;

S300:根据能源大数据中心的业务需求确定不可逆函数,不可逆函数的输出结果为根据原始能源消费数据计算的能够满足业务需求的数据,由不可逆函数、S200中的哈希算法以及随机定义的拼接规则构成不可逆加密算法,基于所述不可逆加密算法得到原始能源消费数据的第二证明问题;S300: Determine the irreversible function according to the business requirements of the energy big data center. The output result of the irreversible function is the data calculated according to the original energy consumption data that can meet the business requirements. The irreversible function, the hash algorithm in S200 and the randomly defined splicing rule Constitute an irreversible encryption algorithm, and obtain the second proof problem of the original energy consumption data based on the irreversible encryption algorithm;

S400:根据第一证明问题和第二证明问题的重复部分验证原始能源消费数据是否完整,若验证通过则执行S500,否则拒绝进行零知识证明;S400: Verify whether the original energy consumption data is complete according to the repeated part of the first proof problem and the second proof problem, and if the verification passes, execute S500, otherwise, refuse to perform zero-knowledge proof;

S500:基于傅里叶逆变换将第一证明问题和第二证明问题转换为多项式向量,结合能源大数据中心生成的随机数,分别计算第一证明问题和第二证明问题的零知识证明,将零知识证明和第二证明问题发送给能源大数据中心;S500: Convert the first proof problem and the second proof problem into a polynomial vector based on the inverse Fourier transform, and combine the random numbers generated by the Energy Big Data Center to calculate the zero-knowledge proofs of the first proof problem and the second proof problem, respectively. The zero-knowledge proof and the second proof problem are sent to the energy big data center;

S600:若零知识证明均满足能源大数据中心规定的验证条件,则将第二证明问题存储到能源大数据中心,否则判定原始能源消费数据未通过真实性验证,拒绝将第二证明问题存储到能源大数据中心。S600: If the zero-knowledge proofs all meet the verification conditions specified by the energy big data center, store the second proof questions in the energy big data center, otherwise determine that the original energy consumption data fails the authenticity verification, and refuse to store the second proof questions in the energy big data center. Energy Big Data Center.

现阶段,能源公司常常需要获取各耗能企业的能源消费数据以分析能源消耗情况,并针对能耗情况及时调整能源营销计划以及能源定价策略,本实施例中能源消费数据主要包括各个耗能企业的水、电、气以及其他新能源的实时消耗数据以及购买上述能源的实时费用。本实施例为了实现上述目的,建立能源大数据中心并在各家耗能企业内部安装仪表进行能源消费监控,首先确定耗能企业中水、电、气计量仪表的数据端口,获取数据端口的量纲参数,再基于预设频率向所述数据端口发送数据采集请求,本实施例中按照十五分钟每次的频率进行水、电、气计量仪表的计量数据的采集,根据量纲参数对计量数据进行量纲统一处理,具体为获取预先建立的对应不同量纲的量纲转换模型,将计量数据输入量纲转换模型,使同类能源消费数据具有相同的量纲,便于能源大数据中心后续对能源消费情况进行统一分析,将处理后的计量数据作为原始能源消费数据。At this stage, energy companies often need to obtain the energy consumption data of each energy-consuming enterprise to analyze the energy consumption, and adjust the energy marketing plan and energy pricing strategy in time according to the energy consumption. In this embodiment, the energy consumption data mainly includes each energy-consuming enterprise The real-time consumption data of water, electricity, gas and other new energy and the real-time cost of purchasing the above energy. In order to achieve the above purpose, in this embodiment, an energy big data center is established and meters are installed in each energy-consuming enterprise to monitor energy consumption. First, the data ports of the water, electricity, and gas metering instruments in the energy-consuming enterprises are determined, and the quantity of the data port is obtained. dimensional parameters, and then send a data collection request to the data port based on the preset frequency. In this embodiment, the measurement data of water, electricity, and gas metering instruments are collected at a frequency of fifteen minutes each time. The data is subjected to unified dimension processing. Specifically, the pre-established dimension conversion models corresponding to different dimensions are obtained, and the measurement data is input into the dimension conversion model, so that the energy consumption data of the same type have the same dimension, which is convenient for the energy big data center to follow-up. The energy consumption is analyzed uniformly, and the processed metering data is used as the original energy consumption data.

常规的处理方法是直接将原始能源消费数据传输至能源大数据中心进行分析和处理。然而该过程存在两个主要的问题,首先通过明文的方式传输耗能企业的能源消费数据的过程存在隐私泄露的风险,其次从耗能企业传输至能源大数据中心的数据真实性有待进一步商榷。以上问题的存在,一定程度上阻碍了能源大数据中心的服务质量,进而影响了政企之间的数据共享与深度融合。因此,本实施例采用零知识证明解决上述问题。零知识证明是一种能够保护隐私的密码学算法,能够在不向验证者提供任何隐私信息的情况下,使验证者相信某个论断是正确的。The conventional processing method is to directly transmit the raw energy consumption data to the energy big data center for analysis and processing. However, there are two main problems in this process. First, there is a risk of privacy leakage in the process of transmitting energy consumption data of energy-consuming enterprises in plaintext. Secondly, the authenticity of the data transmitted from energy-consuming enterprises to the energy big data center needs to be further discussed. The existence of the above problems hinders the service quality of the energy big data center to a certain extent, and then affects the data sharing and deep integration between the government and enterprises. Therefore, this embodiment adopts zero-knowledge proof to solve the above problem. Zero-knowledge proof is a cryptographic algorithm that can protect privacy, which can make the verifier believe that a certain assertion is correct without providing any private information to the verifier.

本实施例在常规零知识证明算法的基础上,分别生成两个证明问题进行零知识证明,其证明流程如图2所示,能耗生成模块和能耗加密模块均部署在耗能企业内部的服务器中,能耗验证模块部署在能源大数据中心上,能耗生成模块能够汇集耗能企业中各个仪表采集到的计量数据,能耗加密模块将原始能源消费数据X加密处理为第一证明问题和第二证明问题,并生成一个证明方法"π" 发送给能耗验证模块,其中,采用哈希算法对X进行数据加密得到第一证明问题Y=Hash(X),本实施例中哈希算法为SHA-256算法,位于能源大数据中心的能耗验证模块将自定义的不可逆加密函数F发送给能耗加密模块,能耗加密模块对X进行数据加密得到第二证明问题Z=F(X),其中Z能够用于能源大数据中心进行后续处理。In this embodiment, based on the conventional zero-knowledge proof algorithm, two proof problems are respectively generated for zero-knowledge proof. The proof process is shown in Figure 2. Both the energy consumption generation module and the energy consumption encryption module are deployed in the energy consumption enterprise In the server, the energy consumption verification module is deployed on the energy big data center, the energy consumption generation module can collect the measurement data collected by various meters in the energy-consuming enterprise, and the energy consumption encryption module encrypts the original energy consumption data X as the first proof problem and the second proof problem, and generate a proof method "π" and send it to the energy consumption verification module, wherein the first proof problem Y=Hash(X) is obtained by using the hash algorithm to encrypt the data of X. In this embodiment, the hash algorithm The algorithm is the SHA-256 algorithm. The energy consumption verification module located in the energy big data center sends the custom irreversible encryption function F to the energy consumption encryption module, and the energy consumption encryption module encrypts the data of X to obtain the second proof problem Z=F( X), where Z can be used in the energy big data center for subsequent processing.

本实施例中下面针对不可逆加密函数F的生成过程进行具体阐述:In this embodiment, the generation process of the irreversible encryption function F is specifically described below:

获取预先存储在能源大数据中心的函数库,所述函数库中包含若干个自定义的不可逆函数,根据能源大数据中心的业务需求在函数库中选取一个不可逆函数。例如,能源大数据中心具有预测能源费用的应用业务,其包括一个用于预测未来某一段时间耗能企业能源消费情况的预测模型,需要获取耗能企业在某一时段内各类能源的消费总费用作为预测模型的训练数据,基于此业务需求,选取一个不可逆函数,能源大数据中心将该不可逆函数发送给耗能企业,耗能企业即可将原始能源消费数据输入不可逆函数,输出结果为各类能源对应的原始能源消费数据的消费总费用。由此可见,不可逆函数的主要作用为将能源大数据对数据的需求发送给耗能企业,相当于将能源大数据中心对原始能源消费数据的部分处理操作转移到耗能企业内部进行,由耗能企业对原始能源消费数据进行一定的预处理后直接将满足业务需求的数据处理结果发送给能源大数据中心,这样能源大数据中心即可在不获取耗能企业的原始能源消费数据X的前提下获得其在后续应用中需要的数据,进而使能源大数据中心能够根据这些数据进行能源营销策略的规划。Obtain the function library pre-stored in the energy big data center, the function library contains several self-defined irreversible functions, and select an irreversible function in the function library according to the business requirements of the energy big data center. For example, the energy big data center has the application business of predicting energy costs, which includes a prediction model for predicting the energy consumption of energy-consuming enterprises in a certain period of time in the future. The cost is used as the training data for the prediction model. Based on this business requirement, an irreversible function is selected, and the energy big data center sends the irreversible function to the energy-consuming enterprise. The energy-consuming enterprise can input the original energy consumption data into the irreversible function, and the output result is each The total consumption cost of the original energy consumption data corresponding to the class energy. It can be seen that the main function of the irreversible function is to send the data requirements of energy big data to energy-consuming enterprises, which is equivalent to transferring part of the processing operations of the original energy consumption data by the energy big data center to the energy-consuming enterprises. After preprocessing the original energy consumption data, the energy enterprise directly sends the data processing results that meet the business needs to the energy big data center, so that the energy big data center can obtain the original energy consumption data X of the energy-consuming enterprise on the premise It can obtain the data it needs in subsequent applications, so that the energy big data center can plan energy marketing strategies based on these data.

为了提高第一证明问题的不可逆性,本实施例还会随机确定第一证明问题与原始能源消费数据的拼接顺序规则,结合选取的不可逆函数、S200中的哈希算法共同组成不可逆加密算法。能源大数据中心将不可逆加密算法发送给耗能企业,耗能企业将原始能源消费数据输入不可逆加密算法进行计算的过程如下:In order to improve the irreversibility of the first proof problem, this embodiment also randomly determines the splicing sequence rule of the first proof problem and the original energy consumption data, and combines the selected irreversible function and the hash algorithm in S200 to form an irreversible encryption algorithm. The energy big data center sends the irreversible encryption algorithm to the energy-consuming enterprise, and the energy-consuming enterprise inputs the original energy consumption data into the irreversible encryption algorithm for calculation as follows:

将原始能源消费数据输入S200中的哈希算法,得到第一字符串,将原始能源消费数据输入不可逆函数,得到第二字符串;Input the raw energy consumption data into the hash algorithm in S200 to obtain the first character string, and input the raw energy consumption data into the irreversible function to obtain the second character string;

按照不可逆加密算法中的拼接顺序规则将第一字符串与第二字符串进行拼接,得到第二证明问题。本实施例中所述拼接顺序规则包括第一字符串和第二字符串整体进行拼接的前后顺序,以及将第一字符串在预设字符位置进行分割后与第二字符串拼接的前后顺序。例如,第一字符串为“3a6fed5fc11392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9”,第二字符串为“50000”,第一字符串为一个长度为64的十六进制字符串,拼接顺序规则规定在第8个字符串的位置分割,得到第一字符串的两个子字符串“3a6fed5f”和“c11392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9”,并规定分割后的两个子字符串分别拼接在第二字符串的首尾,拼接后的字符串即为最终生成的第二证明问题,即Z=F(X)=3a6fed5f5000011392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9。The first string and the second string are spliced according to the splicing sequence rule in the irreversible encryption algorithm, and the second proof problem is obtained. The splicing sequence rules in this embodiment include the sequence of splicing the first character string and the second character string as a whole, and the sequence of splicing the second character string after the first character string is divided at the preset character position. For example, the first string is "3a6fed5fc11392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9", the second string is "50000", the first string is a hexadecimal string with a length of 64, and the splicing order rule stipulates that the split is at the position of the 8th string , get the two substrings "3a6fed5f" and "c11392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9" of the first string, and specify that the two substrings after splitting are spliced at the beginning and end of the second string respectively, and the spliced string is the final generated second string. The proof problem is that Z=F(X)=3a6fed5f5000011392b3ee9f81caf017b48640d7458766a8eb0382899a605b41f2b9.

在本实施例中,不可逆加密函数中之所以还包括了S200中使用的哈希算法,是为了确保用于分别生成第一证明问题和第二证明问题的原始能源消费数据一致,实现对原始能源消费数据的完整性校验,避免因输入的原始能源消费数据不完整导致后续能源大数据中心获取的数据不准确的问题。能源大数据中心将第一证明问题和第二证明问题进行比对,若经过比对得到的重复部分与第一证明问题不一致,则未通过完整性校验,能源大数据中心拒绝接收第一证明问题和第二证明问题,不再进行后续的零知识证明步骤。若经过比对得到的重复部分与第一证明问题一致,即两次哈希值相同,说明第一证明问题Y=Hash(X)和第二证明问题Z=F(X)中的X是一致的,原始能源消费数据的完整性通过校验。In this embodiment, the reason why the irreversible encryption function also includes the hash algorithm used in S200 is to ensure that the original energy consumption data used to generate the first proof problem and the second proof problem respectively are consistent, so as to ensure that the original energy consumption data are consistent with each other. The integrity verification of consumption data avoids the problem of inaccurate data obtained by the subsequent energy big data center due to incomplete input of original energy consumption data. The energy big data center compares the first proof problem with the second proof problem. If the repeated part obtained by the comparison is inconsistent with the first proof problem, the integrity check is not passed, and the energy big data center refuses to receive the first proof. problem and the second proof problem, no subsequent zero-knowledge proof steps are performed. If the repeated part obtained by comparison is consistent with the first proof problem, that is, the two hash values are the same, it means that X in the first proof problem Y=Hash(X) and the second proof problem Z=F(X) are consistent Yes, the integrity of the original energy consumption data passed the verification.

在本实施例中,不可逆加密函数中之所以还规定了拼接顺序规则,是为了提高第二证明问题在由耗能企业发送至能源大数据中心过程中的数据安全性,避免第三方恶意窃取相关信息。In this embodiment, the splicing sequence rule is also specified in the irreversible encryption function, in order to improve the data security of the second proof problem in the process of sending it from the energy-consuming enterprise to the energy big data center, and to avoid malicious theft by a third party. information.

通过完整性校验后,图2所示能耗验证模块中的基于Groth版本的 zkSNARKs零知识证明协议对第一证明问题和第二证明问题分别进行零知识证明。zkSNARKs是“Zero-Knowledge Succinct Non-Interactive Argument of Knowledge”的简称,指一种非交互式的、可以证明某人拥有某些信息的证明结构。本实施例中具体零知识证明过程包括:After passing the integrity check, the zkSNARKs zero-knowledge proof protocol based on the Groth version in the energy consumption verification module shown in Figure 2 respectively performs zero-knowledge proof for the first proof problem and the second proof problem. zkSNARKs is short for "Zero-Knowledge Succinct Non-Interactive Argument of Knowledge", which refers to a non-interactive proof structure that can prove that someone has certain information. The specific zero-knowledge proof process in this embodiment includes:

基于zkSNARKs零知识协议,将第一证明问题和第二证明问题分别转化为若干个二元赋值式,所述二元赋值式即将Y=Hash(X)和Z=F(X)分别转化为仅有二元变量且仅具有加、减、乘、除等基本运算组成的单步骤;Based on the zkSNARKs zero-knowledge protocol, the first proof problem and the second proof problem are transformed into several binary assignments, which transform Y=Hash(X) and Z=F(X) into only A single step consisting of binary variables and only basic operations such as addition, subtraction, multiplication, and division;

将二元赋值式中的变量组合为向量u,为了能够表达二元赋值式中的常数,所述向 量u的第一个元素恒为1,根据二元赋值式和向量u分别将第一证明问题和第二证明问题转 化为R1CS实例

Figure 636623DEST_PATH_IMAGE001
,其中N为第一证明问题或第二证明问题的变量个数,M为二 元赋值式的个数,a、b、c分别为R1CS实例中的向量序列,使
Figure 932475DEST_PATH_IMAGE002
; The variables in the binary assignment are combined into a vector u. In order to express the constants in the binary assignment, the first element of the vector u is always 1. According to the binary assignment and the vector u, the first proof is The problem and the second proof problem are transformed into R1CS instances
Figure 636623DEST_PATH_IMAGE001
, where N is the number of variables in the first proof problem or the second proof problem, M is the number of binary assignments, and a, b, and c are the vector sequences in the R1CS instance, so that
Figure 932475DEST_PATH_IMAGE002
;

将R1CS实例转化为QAP实例

Figure 294186DEST_PATH_IMAGE045
,其中A、B、C依次为R1CS实例中的向 量序列的傅里叶逆变换,本领域技术人员应当连接如何将R1CS实例转化为QAP实例,此处不 再赘述; Convert R1CS instance to QAP instance
Figure 294186DEST_PATH_IMAGE045
, wherein A, B, and C are the inverse Fourier transform of the vector sequence in the R1CS instance in turn, and those skilled in the art should connect the R1CS instance into a QAP instance, which will not be repeated here;

获取能源大数据中心生成的随机数t、

Figure 209052DEST_PATH_IMAGE004
Figure 339819DEST_PATH_IMAGE005
Figure 554376DEST_PATH_IMAGE006
Figure 403383DEST_PATH_IMAGE007
Figure 856361DEST_PATH_IMAGE008
Figure 841634DEST_PATH_IMAGE009
Figure 416972DEST_PATH_IMAGE010
Figure 815593DEST_PATH_IMAGE011
,其中t为随机 选取的采样点,计算中间向量
Figure 134578DEST_PATH_IMAGE046
Figure 177621DEST_PATH_IMAGE013
Figure 923860DEST_PATH_IMAGE014
,计算过程如下: Obtain the random number t generated by the energy big data center,
Figure 209052DEST_PATH_IMAGE004
,
Figure 339819DEST_PATH_IMAGE005
,
Figure 554376DEST_PATH_IMAGE006
,
Figure 403383DEST_PATH_IMAGE007
,
Figure 856361DEST_PATH_IMAGE008
,
Figure 841634DEST_PATH_IMAGE009
,
Figure 416972DEST_PATH_IMAGE010
,
Figure 815593DEST_PATH_IMAGE011
, where t is a randomly selected sampling point, and the intermediate vector is calculated
Figure 134578DEST_PATH_IMAGE046
,
Figure 177621DEST_PATH_IMAGE013
and
Figure 923860DEST_PATH_IMAGE014
, the calculation process is as follows:

Figure 294930DEST_PATH_IMAGE047
Figure 294930DEST_PATH_IMAGE047
;

其中,

Figure 152027DEST_PATH_IMAGE016
Figure 111893DEST_PATH_IMAGE017
、…、
Figure 966716DEST_PATH_IMAGE018
为预设可信域D中的元素,j为
Figure 277612DEST_PATH_IMAGE014
的元素标号,j的取值范围为0至M-2之间的正整数,
Figure 717DEST_PATH_IMAGE019
表示t采样点下向量A的第一个元 素,
Figure 18352DEST_PATH_IMAGE020
表示t采样点下向量B的第一个元素,
Figure 371973DEST_PATH_IMAGE021
表示t采样点下向量C的第一个元素,
Figure 717635DEST_PATH_IMAGE022
表示t采样点下向量A的第
Figure 916535DEST_PATH_IMAGE023
个元素,
Figure 585414DEST_PATH_IMAGE024
表示t采样点下向量B的第
Figure 313198DEST_PATH_IMAGE023
个元素,
Figure 395424DEST_PATH_IMAGE025
表示t采样点下向量C的第
Figure 398015DEST_PATH_IMAGE023
个元素,i的取值范围为1至N-1之间的正整数; in,
Figure 152027DEST_PATH_IMAGE016
,
Figure 111893DEST_PATH_IMAGE017
, …,
Figure 966716DEST_PATH_IMAGE018
is the element in the preset trusted domain D, and j is
Figure 277612DEST_PATH_IMAGE014
The element label of , the value of j is a positive integer between 0 and M-2,
Figure 717DEST_PATH_IMAGE019
represents the first element of the vector A at the t sampling point,
Figure 18352DEST_PATH_IMAGE020
represents the first element of the vector B at the t sampling point,
Figure 371973DEST_PATH_IMAGE021
represents the first element of the vector C at the t sampling point,
Figure 717635DEST_PATH_IMAGE022
Represents the th
Figure 916535DEST_PATH_IMAGE023
elements,
Figure 585414DEST_PATH_IMAGE024
Represents the th
Figure 313198DEST_PATH_IMAGE023
elements,
Figure 395424DEST_PATH_IMAGE025
represents the th
Figure 398015DEST_PATH_IMAGE023
elements, the value range of i is a positive integer between 1 and N-1;

计算

Figure 124662DEST_PATH_IMAGE026
Figure 898714DEST_PATH_IMAGE027
Figure 140340DEST_PATH_IMAGE028
以及
Figure 884305DEST_PATH_IMAGE029
,计算过程如下: calculate
Figure 124662DEST_PATH_IMAGE026
,
Figure 898714DEST_PATH_IMAGE027
,
Figure 140340DEST_PATH_IMAGE028
as well as
Figure 884305DEST_PATH_IMAGE029
, the calculation process is as follows:

Figure 793355DEST_PATH_IMAGE048
Figure 793355DEST_PATH_IMAGE048
;

其中,

Figure 456418DEST_PATH_IMAGE031
Figure 450918DEST_PATH_IMAGE032
的第j项系数,
Figure 529733DEST_PATH_IMAGE033
Figure 230973DEST_PATH_IMAGE034
表示向量u的第i个元 素,
Figure 2620DEST_PATH_IMAGE035
表示中间向量
Figure 294536DEST_PATH_IMAGE036
的第i个元素,
Figure 442621DEST_PATH_IMAGE037
表示中间向量
Figure 998367DEST_PATH_IMAGE014
的第j个元素,r、s 为耗能企业作为证明方选取的随机数; in,
Figure 456418DEST_PATH_IMAGE031
for
Figure 450918DEST_PATH_IMAGE032
The jth coefficient of ,
Figure 529733DEST_PATH_IMAGE033
,
Figure 230973DEST_PATH_IMAGE034
represents the ith element of the vector u,
Figure 2620DEST_PATH_IMAGE035
represents the intermediate vector
Figure 294536DEST_PATH_IMAGE036
the ith element of ,
Figure 442621DEST_PATH_IMAGE037
represents the intermediate vector
Figure 998367DEST_PATH_IMAGE014
The jth element of , r and s are random numbers selected by the energy-consuming enterprise as the prover;

根据计算结果组成向量

Figure DEST_PATH_IMAGE049
作为零知识证明。 Form a vector according to the calculation result
Figure DEST_PATH_IMAGE049
as a zero-knowledge proof.

最后,由能源大数据中心根据根据接收到的零知识证明

Figure 534391DEST_PATH_IMAGE049
验 证
Figure 972325DEST_PATH_IMAGE050
是否正确,其中,e为双线性配对映射, 可表示为
Figure 658521DEST_PATH_IMAGE039
Figure 334353DEST_PATH_IMAGE040
Figure 447803DEST_PATH_IMAGE041
为映射e的输入变量,
Figure 451662DEST_PATH_IMAGE042
为映射e的输出变量,本实施 例中映射e由能源大数据中心自行确定。若正确则判定第一证明问题和第二证明问题通过 真实性验证。由此可见,若第一证明问题和第二证明问题均证明成功,则能源大数据中心作 为验证者认证耗能企业具有真实的原始能源消费数据,同时存储Z=f(X)进行后续的能耗综 合运算;若第一证明问题和第二证明问题中任一项证明失败,则能源大数据中心作为验证 者认为耗能企业的原始能源消费数据不具有真实性,拒绝存储Z=f(X),并发出警报。 Finally, according to the zero-knowledge proof received by the energy big data center
Figure 534391DEST_PATH_IMAGE049
verify
Figure 972325DEST_PATH_IMAGE050
Is it correct, where e is a bilinear pairing map, which can be expressed as
Figure 658521DEST_PATH_IMAGE039
,
Figure 334353DEST_PATH_IMAGE040
,
Figure 447803DEST_PATH_IMAGE041
is the input variable of mapping e,
Figure 451662DEST_PATH_IMAGE042
In order to map the output variable of e, in this embodiment, the map e is determined by the energy big data center itself. If it is correct, it is determined that the first proof problem and the second proof problem pass the authenticity verification. It can be seen that if both the first proof problem and the second proof problem are proved successful, the energy big data center, as a verifier, certifies that the energy-consuming enterprise has real original energy consumption data, and stores Z=f(X) for subsequent energy consumption. Consumption comprehensive calculation; if any one of the first proof problem and the second proof problem fails, the energy big data center, as a verifier, believes that the original energy consumption data of the energy-consuming enterprise is not authentic, and refuses to store Z=f(X ), and an alarm is issued.

因此通过上述过程生成的不可逆加密函数能够实现对原始能源消费数据的特殊加密,在保证零知识证明有效性的基础上,使其加密过的原始能源消费数据能够用于进一步的能耗计算,能源大数据中心在后续能够直接利用Z进行能源消费分析等应用业务。Therefore, the irreversible encryption function generated by the above process can realize the special encryption of the original energy consumption data. On the basis of ensuring the validity of the zero-knowledge proof, the encrypted original energy consumption data can be used for further energy consumption calculation. In the future, the big data center can directly use Z for energy consumption analysis and other application services.

上述实施例中的各个序号仅仅为了描述,不代表各部件的组装或使用过程中的先后顺序。The serial numbers in the above-mentioned embodiments are only for description, and do not represent the order in which the components are assembled or used.

以上所述仅为本发明的实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only the embodiments of the present invention and are not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention. Inside.

Claims (8)

1. A zero-knowledge proof-based energy consumption data processing method is characterized by comprising the following steps:
s100: acquiring original energy consumption data of an energy consumption enterprise based on a preset frequency;
s200: calculating a hash value of the original energy consumption data based on a hash algorithm, and taking the hash value as a first certification problem;
s300: determining an irreversible function according to the service requirement of the energy big data center, wherein the output result of the irreversible function is data which can meet the service requirement and is calculated according to original energy consumption data, the irreversible encryption algorithm is formed by the irreversible function, the Hash algorithm in S200 and a randomly defined splicing rule, and a second certification problem of the original energy consumption data is obtained based on the irreversible encryption algorithm;
s400: verifying whether the original energy consumption data is complete according to the repeated part of the first certification problem and the second certification problem, if the original energy consumption data is complete, executing S500, and if not, refusing to perform zero knowledge certification;
s500: converting the first proof problem and the second proof problem into polynomial vectors based on Fourier inversion transformation, respectively calculating zero knowledge proofs of the first proof problem and the second proof problem by combining random numbers generated by the energy big data center, and sending the zero knowledge proofs and the second proof problem to the energy big data center;
s600: and if the zero knowledge proofs meet the verification conditions specified by the energy big data center, storing the second proof problem in the energy big data center, otherwise, judging that the original energy consumption data does not pass the authenticity verification, and refusing to store the second proof problem in the energy big data center.
2. The method for processing energy consumption data based on zero knowledge proof according to claim 1, wherein the S100 comprises:
determining a data port of a water, electricity and gas metering instrument in an energy consumption enterprise, and acquiring dimension parameters of the data port;
and sending a data acquisition request to the data port based on a preset frequency, acquiring the metering data of the water, electricity and gas metering instrument, carrying out dimension unified processing on the metering data according to dimension parameters, and taking the processed metering data as original energy consumption data.
3. The zero-knowledge-proof-based energy consumption data processing method according to claim 1, wherein the hash algorithm in the S200 is SHA-256 algorithm.
4. The method for processing energy consumption data based on zero knowledge proof according to claim 1, wherein the step S300 comprises:
the method comprises the steps of obtaining a function library pre-stored in an energy big data center, wherein the function library comprises a plurality of self-defined irreversible functions, and selecting one irreversible function from the function library according to the service requirement of the energy big data center;
randomly determining a splicing sequence rule of the first certification problem and the original energy consumption data, and combining the selected irreversible function and the Hash algorithm in the S200 to form an irreversible encryption algorithm;
inputting the original energy consumption data into a Hash algorithm in S200 to obtain a first character string, and inputting the original energy consumption data into an irreversible function to obtain a second character string;
and splicing the first character string and the second character string according to a splicing sequence rule in the irreversible encryption algorithm to obtain a second certification problem.
5. The method for processing energy consumption data based on zero knowledge proof according to claim 1, wherein the S400 comprises:
and comparing the first certification problem with the second certification problem, and if the repeated part obtained by comparison is consistent with the first certification problem, verifying the integrity of the original energy consumption data.
6. The method for processing energy consumption data based on zero knowledge proof according to claim 1, wherein the step S500 comprises:
based on zkSNARKs zero-knowledge protocol, respectively converting the first certification problem and the second certification problem into a plurality of binary assignment formulas;
combining variables in the binary assignment into a vector u, and respectively converting the first certification problem and the second certification problem into R1CS instances according to the binary assignment and the vector u
Figure 635691DEST_PATH_IMAGE001
Where N is the number of variables of the first proof question or the second proof question, and M is binaryThe number of the assignment formulas, a, b and c are vector sequences in the example of R1CS respectively, so that
Figure 168303DEST_PATH_IMAGE002
Conversion of R1CS instance to QAP instance
Figure 445832DEST_PATH_IMAGE001
Wherein A, B, C is in turn the inverse fourier transform of the vector sequence in the R1CS example;
obtaining random numbers generated by energy big data center
Figure 114711DEST_PATH_IMAGE003
Wherein t is a randomly selected sampling point, calculating a middle vector
Figure 576916DEST_PATH_IMAGE004
Figure 331245DEST_PATH_IMAGE005
And
Figure 333836DEST_PATH_IMAGE006
the calculation process is as follows:
Figure 185118DEST_PATH_IMAGE007
wherein,
Figure 880541DEST_PATH_IMAGE008
is an element in a predetermined trusted domain D, j is
Figure 59850DEST_PATH_IMAGE006
The value of j is a positive integer ranging from 0 to M-2,
Figure 866132DEST_PATH_IMAGE009
representing the first element of vector a at the sample point t,
Figure 588231DEST_PATH_IMAGE010
representing the first element of vector B at the sample point t,
Figure 188977DEST_PATH_IMAGE011
representing the first element of the vector C at the sample point t,
Figure 121161DEST_PATH_IMAGE012
represents the i +1 th element of vector a at the sample point t,
Figure 465554DEST_PATH_IMAGE013
represents the i +1 th element of vector B at the sample point t,
Figure 291428DEST_PATH_IMAGE014
the i +1 th element of the vector C under the sampling point t is represented, and the value range of i is a positive integer between 1 and N-1;
computing
Figure 63075DEST_PATH_IMAGE015
And
Figure 279293DEST_PATH_IMAGE016
the calculation process is as follows:
Figure 365060DEST_PATH_IMAGE017
wherein,
Figure 983123DEST_PATH_IMAGE018
is composed of
Figure 1371DEST_PATH_IMAGE019
The coefficient of the j-th term of (1),
Figure 704884DEST_PATH_IMAGE020
Figure 125501DEST_PATH_IMAGE021
Figure 801333DEST_PATH_IMAGE022
Figure 914783DEST_PATH_IMAGE023
respectively vector A, B, C at the sample point t,
Figure 167910DEST_PATH_IMAGE024
the i-th element of the vector u is represented,
Figure 657797DEST_PATH_IMAGE025
representing intermediate vectors
Figure 188135DEST_PATH_IMAGE026
The (i) th element of (a),
Figure 738065DEST_PATH_IMAGE027
representing intermediate vectors
Figure 150592DEST_PATH_IMAGE028
The jth element of (1), r and s are random numbers selected by energy-consuming enterprises as proving parties;
forming a vector according to the calculation result
Figure 991640DEST_PATH_IMAGE029
As proof of zero knowledge.
7. The method of claim 6, wherein the first element of the vector u is always 1.
8. The method for processing energy consumption data based on zero knowledge proof according to claim 6, wherein the S600 comprises:
determining bilinear pairing mappings
Figure 438802DEST_PATH_IMAGE030
In order to map the input variables of e,
Figure 97317DEST_PATH_IMAGE031
is the output variable of map e;
according to zero knowledge proof received by energy big data center
Figure 262719DEST_PATH_IMAGE032
Authentication
Figure 828829DEST_PATH_IMAGE033
And if the first certification question and the second certification question are correct, judging that the first certification question and the second certification question pass authenticity verification.
CN202110954361.XA 2021-08-19 2021-08-19 Energy consumption data processing method based on zero knowledge proof Active CN113407981B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110954361.XA CN113407981B (en) 2021-08-19 2021-08-19 Energy consumption data processing method based on zero knowledge proof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110954361.XA CN113407981B (en) 2021-08-19 2021-08-19 Energy consumption data processing method based on zero knowledge proof

Publications (2)

Publication Number Publication Date
CN113407981A true CN113407981A (en) 2021-09-17
CN113407981B CN113407981B (en) 2021-11-09

Family

ID=77688909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110954361.XA Active CN113407981B (en) 2021-08-19 2021-08-19 Energy consumption data processing method based on zero knowledge proof

Country Status (1)

Country Link
CN (1) CN113407981B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064993A (en) * 2021-11-16 2022-02-18 瀚云科技有限公司 Energy data acquisition method and energy balance diagram construction method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102446329A (en) * 2010-10-08 2012-05-09 微软公司 Privacy-preserving metering
CN110795767A (en) * 2019-11-12 2020-02-14 阳光电源股份有限公司 Electric power transaction method, device and system and trusted cloud platform
CN113037479A (en) * 2021-03-25 2021-06-25 支付宝(杭州)信息技术有限公司 Data verification method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102446329A (en) * 2010-10-08 2012-05-09 微软公司 Privacy-preserving metering
CN110795767A (en) * 2019-11-12 2020-02-14 阳光电源股份有限公司 Electric power transaction method, device and system and trusted cloud platform
CN113037479A (en) * 2021-03-25 2021-06-25 支付宝(杭州)信息技术有限公司 Data verification method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064993A (en) * 2021-11-16 2022-02-18 瀚云科技有限公司 Energy data acquisition method and energy balance diagram construction method and device

Also Published As

Publication number Publication date
CN113407981B (en) 2021-11-09

Similar Documents

Publication Publication Date Title
CN108683669B (en) Data verification method and secure multi-party computing system
TWI452533B (en) Privacy-preserving metering
CN111886829A (en) Computer-implemented system and method for distrusting zero knowledge or paid
Weng et al. pvcnn: Privacy-preserving and verifiable convolutional neural network testing
Xu et al. Catch you if you deceive me: Verifiable and privacy-aware truth discovery in crowdsensing systems
Zhao et al. Blockchain-based auditable privacy-preserving data classification for Internet of Things
CN115760399A (en) Data privacy transaction method based on zero knowledge proof
CN112291062A (en) Voting method and device based on block chain
CN112104609A (en) Method for verifiable privacy-aware true phase discovery in a mobile crowd-sourcing awareness system
CN115174091A (en) Homomorphic encryption privacy protection method for distributed digital identity
CN112434026A (en) Secure intellectual property pledge financing method based on Hash chain
CN113407981B (en) Energy consumption data processing method based on zero knowledge proof
CN115150057A (en) Integrity verification method for block chain cross-chain interactive data calculation result
CN117454431A (en) Verifiable data privacy protection system and method for computing service outsourcing
Wang et al. zkfl: Zero-knowledge proof-based gradient aggregation for federated learning
CN113078993A (en) Smart grid third-party privacy protection method based on improved homomorphic encryption algorithm
Yang et al. Accountable and verifiable secure aggregation for federated learning in IoT networks
Liang et al. Decentralized crowdsourcing for human intelligence tasks with efficient on-chain cost
Zhang et al. A blockchain-based privacy-preserving scheme for sealed-bid auction
CN116414875A (en) Data processing apparatus and data processing method
Zhou et al. Overview of zero-knowledge proof and its applications in Blockchain
Zhang et al. Understanding privacy-preserving techniques in digital cryptocurrencies
Guo et al. A Novel Biometric Identification Scheme Based on Zero‐Knowledge Succinct Noninteractive Argument of Knowledge
Xu et al. Efficient privacy-preserving electronic voting scheme based on blockchain
Zhu Operation mechanism for G2B system based on blockchain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant