CN110135909A - Data processing method, system, equipment and storage medium based on zero-knowledge proof - Google Patents

Data processing method, system, equipment and storage medium based on zero-knowledge proof Download PDF

Info

Publication number
CN110135909A
CN110135909A CN201910410797.5A CN201910410797A CN110135909A CN 110135909 A CN110135909 A CN 110135909A CN 201910410797 A CN201910410797 A CN 201910410797A CN 110135909 A CN110135909 A CN 110135909A
Authority
CN
China
Prior art keywords
data
random number
hash
consumer
time range
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.)
Pending
Application number
CN201910410797.5A
Other languages
Chinese (zh)
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.)
Shandong Ice Chain Network Information Technology Co Ltd
Shandong Technology and Business University
Original Assignee
Shandong Ice Chain Network Information Technology Co Ltd
Shandong Technology and Business University
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 Shandong Ice Chain Network Information Technology Co Ltd, Shandong Technology and Business University filed Critical Shandong Ice Chain Network Information Technology Co Ltd
Priority to CN201910410797.5A priority Critical patent/CN110135909A/en
Publication of CN110135909A publication Critical patent/CN110135909A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/01Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0212Chance discounts or incentives
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0225Avoiding frauds

Abstract

The invention discloses a kind of data processing method based on zero-knowledge proof, system, equipment and storage mediums, and the present invention is by first determining the first preset time range and the second preset time range;The first cryptographic Hash, the first default random number and identity data that consumer sends are received in the first preset time range, the second default random number are obtained from intelligent contract, and determine and participate in movable total number of persons;The constant and the first random number that consumer sends are received in the second preset time range, and Hash verifying is carried out to the first cryptographic Hash according to constant and the first random number after being verified to identity data;Preset open rule determines lottery winner in the data sent when the quantity that Hash is verified is not more than total number of persons according to consumer and intelligent contract, guarantee that all data can not be changed by block chain technology, prize drawing person is determined by the fair rule of intelligent contract, constant or random number simultaneously, other factors interference is eliminated, has ensured the fairness and credibility of prize drawing.

Description

Data processing method, system, equipment and storage medium based on zero-knowledge proof
Technical field
The present invention relates to block chain technical field more particularly to a kind of data processing method based on zero-knowledge proof, it is System, equipment and storage medium.
Background technique
With internet fast development, in order to attract more consumers, many businessmans promote oneself by preferential activity Product, for example promote, draw a lottery on line at a low price etc..For drawing a lottery on line, consumer is when participating in preferential sweepstake, root This does not know whether the preferential activity of businessman is fair, preferential in order to obtain, and often can only unilaterally trust businessman.
Sweepstake does not take necessary safeguard measure to prevent the behavior of playing tricks during prize drawing on line at present, cannot be from root It is fair and just to solve the problems, such as in sheet, can not obtain the trust of consumer.
Summary of the invention
The main purpose of the present invention is to provide a kind of data processing method based on zero-knowledge proof, system, equipment and Storage medium, it is intended to solve inequitable technical problem of drawing a lottery on prior art middle line.
To achieve the above object, the present invention provides a kind of data processing method based on zero-knowledge proof, at the data Reason method includes:
The activity data that businessman sends is received, and the first preset time range and second is determined in advance according to the activity data If time range, first preset time range is to receive the identity data and the time model for participating in data that consumer sends It encloses, second preset time range is verifying and the time range for determining lottery winner;
The identity data and the participation data are received in the first preset time range, and are obtained from intelligent contract Second default random number, the identity data include consumer's public key and its signing messages, and the participation data include the first Kazakhstan Uncommon value and the first default random number;
It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;
The constant and the first random number that consumer sends are received in the second preset time range, it is public according to the consumer Key carries out authentication to the signing messages, after authentication passes through, according to the constant and first random number pair First cryptographic Hash carries out Hash verifying;
When the quantity that the Hash is verified is less than or equal to total number of persons, according to the constant and the intelligent contract In preset open rule determine lottery winner or according to the first default random number, the second default random number, it is described often Preset open rule determines lottery winner in the several and described intelligent contract.
Preferably, when the quantity being verified in the Hash is less than or equal to total number of persons, according to the constant and In the intelligence contract preset open rule determine lottery winner or according to the first default random number, second default with The step of preset open rule determines lottery winner in machine number, the constant and the intelligent contract, comprising:
When the quantity that the Hash is verified is equal to total number of persons, the corresponding institute of consumer that is verified according to Hash It states preset open rule in constant and the intelligent contract and determines lottery winner;
When the quantity that the Hash is verified is less than total number of persons, according to the corresponding institute of the consumer of Hash authentication failed State the first default random number and the corresponding constant of consumer that the second default random number, the Hash are verified and described Preset open rule determines lottery winner in intelligent contract.
Preferably, when the quantity being verified in the Hash is less than total number of persons, according to disappearing for Hash authentication failed The corresponding institute of consumer that the corresponding first default random number of expense person and the second default random number, Hash are verified State the step of preset open rule determines lottery winner in constant and the intelligent contract, comprising:
It is corresponding according to the consumer of the Hash authentication failed when the quantity that the Hash is verified is less than total number of persons First default random number and it is described second default random number calculate the second cryptographic Hash;
In the corresponding constant of consumer and the intelligent contract being verified according to second cryptographic Hash, Hash Preset open rule determines lottery winner.
Preferably, the corresponding constant of consumer being verified according to second cryptographic Hash, Hash and institute State the step of preset open rule determines lottery winner in intelligent contract, comprising:
The corresponding constant of consumer that is verified according to second cryptographic Hash, the Hash, the total number of persons and pre- If formula calculates remainder;
Lottery winner is determined according to preset open rule in the remainder and the intelligent contract.
Preferably, described according to the identity data and the quantity for participating in data determines and participates in movable total number of persons After step, the method also includes:
Determine that movable minimum participation number and highest participate in number according to the activity data;
When the total number of persons is less than the minimum participation number or the total number of persons is greater than highest participation number, return Tieback receives the activity data that businessman sends, and determines the first preset time range and the second preset time according to the activity data The step of range.
Preferably, first cryptographic Hash is that the constant and first random number are based on the calculating of Merkel's tree algorithm and obtain The root cryptographic Hash obtained.
Preferably, when the quantity being verified in the Hash is less than or equal to total number of persons, according to the constant and In the intelligence contract preset open rule determine lottery winner or according to the first default random number, second default with After the step of preset open rule determines lottery winner in machine number, the constant and the intelligent contract, the method is also wrapped It includes:
Prize-winning voucher is sent to the lottery winner, so that the lottery winner is according to the prize-winning voucher to businessman's prize.
In addition, to achieve the above object, it is described the present invention also provides a kind of data processing system based on zero-knowledge proof Data processing system based on zero-knowledge proof includes consumer end and block chain;Wherein,
Consumer end, for sending identity data to the block chain in the first preset time range and participating in data, And the second default random number is obtained from intelligent contract, the identity data includes consumer's public key and its signing messages, described Participating in data includes the first cryptographic Hash and the first default random number;It is sent often in the second preset time range to the block chain Several and the first random number;
Block chain for receiving the activity data of businessman's transmission, and determines the first preset time according to the activity data Range and the second preset time range, first preset time range are to receive the identity data and the ginseng that consumer sends With the time range of data, second preset time range is verifying and the time range for determining lottery winner;It is default first The identity data and the participation data are received in time range, and the second default random number is obtained from intelligent contract;Root It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;It is inscribed in the second preset time range The constant and the first random number that consumer sends are received, authentication is carried out to the signing messages according to consumer's public key, After authentication passes through, Hash verifying is carried out to first cryptographic Hash according to the constant and first random number;? When the quantity that the Hash is verified is less than or equal to total number of persons, according to preset public affairs in the constant and the intelligent contract It opens rule and determines lottery winner or according to the first default random number, the second default random number, the constant and the intelligence Preset open rule determines lottery winner in energy contract.
In addition, to achieve the above object, it is described the present invention also provides a kind of data processing equipment based on zero-knowledge proof Data processing equipment based on zero-knowledge proof includes: memory, processor and is stored on the memory and can be described The data processor based on zero-knowledge proof run on processor, the data processor based on zero-knowledge proof are matched It is set to the step of realizing the data processing method based on zero-knowledge proof.
In addition, to achieve the above object, the present invention also provides a kind of storage medium, being stored with and being based on the storage medium The data processor of zero-knowledge proof, the data processor based on zero-knowledge proof realize institute when being executed by processor The step of data processing method based on zero-knowledge proof stated.
The activity data that the present invention is sent by receiving businessman, and the first preset time model is determined according to the activity data It encloses and the second preset time range, first preset time range is to receive the identity data and participate in data that consumer sends Time range, second preset time range be verifying and determine lottery winner time range;In the first preset time model The interior reception identity data and the participation data are enclosed, and obtain the second default random number, the identity from intelligent contract Data include consumer's public key and its signing messages, and the participation data include the first cryptographic Hash and the first default random number;Root It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;It is inscribed in the second preset time range The constant and the first random number that consumer sends are received, authentication is carried out to the signing messages according to consumer's public key, After authentication passes through, Hash verifying is carried out to first cryptographic Hash according to the constant and first random number;? When the quantity that the Hash is verified is less than or equal to total number of persons, according to preset public affairs in the constant and the intelligent contract It opens rule and determines lottery winner or according to the first default random number, the second default random number, the constant and the intelligence Preset open rule determines lottery winner in energy contract, guarantees that all data are open and clear by block chain technology, can not change, Prize drawing person is determined by the verifying of Merkel's root, the fair rule of intelligent contract, constant or random number simultaneously, it is dry to eliminate other factors It disturbs, effectively prevents the behavior of playing tricks during prize drawing, ensured the fairness and credibility of prize drawing.
Detailed description of the invention
Fig. 1 is the data processing equipment based on zero-knowledge proof for the hardware running environment that the embodiment of the present invention is related to Structural schematic diagram;
Fig. 2 is the flow diagram of the data processing method first embodiment the present invention is based on zero-knowledge proof;
Fig. 3 is the flow diagram of the data processing method second embodiment the present invention is based on zero-knowledge proof;
Fig. 4 is the system architecture schematic diagram of the data processing system first embodiment the present invention is based on zero-knowledge proof.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
Referring to Fig.1, Fig. 1 is the data based on zero-knowledge proof for the hardware running environment that the embodiment of the present invention is related to Processing equipment structural schematic diagram.
As shown in Figure 1, should data processing equipment based on zero-knowledge proof may include: processor 1001, such as CPU, Communication bus 1002, user interface 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is for realizing this Connection communication between a little components.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 is optional May include standard wireline interface and wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, It is also possible to stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally may be used also To be independently of the storage device of aforementioned processor 1001.
It will be understood by those skilled in the art that structure shown in Fig. 1 is not constituted to the data based on zero-knowledge proof The restriction of processing equipment may include perhaps combining certain components or different components than illustrating more or fewer components Arrangement.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe module, Subscriber Interface Module SIM and the data processor based on zero-knowledge proof.
In data processing equipment based on zero-knowledge proof shown in Fig. 1, network interface 1004 is mainly used for and outside Network carries out data communication;User interface 1003 is mainly used for receiving the input instruction of user;It is described based on zero-knowledge proof Data processing equipment calls the data processor based on zero-knowledge proof stored in memory 1005 by processor 1001, And execute following operation:
The activity data that businessman sends is received, and the first preset time range and second is determined in advance according to the activity data If time range, first preset time range is to receive the identity data and the time model for participating in data that consumer sends It encloses, second preset time range is verifying and the time range for determining lottery winner;
The identity data and the participation data are received in the first preset time range, and are obtained from intelligent contract Second default random number, the identity data include consumer's public key and its signing messages, and the participation data include the first Kazakhstan Uncommon value and the first default random number;
It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;
The constant and the first random number that consumer sends are received in the second preset time range, it is public according to the consumer Key carries out authentication to the signing messages, after authentication passes through, according to the constant and first random number pair First cryptographic Hash carries out Hash verifying;
When the quantity that the Hash is verified is less than or equal to total number of persons, according to the constant and the intelligent contract In preset open rule determine lottery winner or according to the first default random number, the second default random number, it is described often Preset open rule determines lottery winner in the several and described intelligent contract.
Further, processor 1001 can call the data processing based on zero-knowledge proof stored in memory 1005 Program also executes following operation:
When the quantity that the Hash is verified is equal to total number of persons, the corresponding institute of consumer that is verified according to Hash It states preset open rule in constant and the intelligent contract and determines lottery winner;
When the quantity that the Hash is verified is less than total number of persons, according to the corresponding institute of the consumer of Hash authentication failed State the first default random number and the corresponding constant of consumer that the second default random number, the Hash are verified and described Preset open rule determines lottery winner in intelligent contract.
Further, processor 1001 can call the data processing based on zero-knowledge proof stored in memory 1005 Program also executes following operation:
It is corresponding according to the consumer of the Hash authentication failed when the quantity that the Hash is verified is less than total number of persons First default random number and it is described second default random number calculate the second cryptographic Hash;
In the corresponding constant of consumer and the intelligent contract being verified according to second cryptographic Hash, Hash Preset open rule determines lottery winner.
Further, processor 1001 can call the data processing based on zero-knowledge proof stored in memory 1005 Program also executes following operation:
The corresponding constant of consumer that is verified according to second cryptographic Hash, the Hash, the total number of persons and pre- If formula calculates remainder;
Lottery winner is determined according to preset open rule in the remainder and the intelligent contract.
Further, processor 1001 can call the data processing based on zero-knowledge proof stored in memory 1005 Program also executes following operation:
Determine that movable minimum participation number and highest participate in number according to the activity data;
When the total number of persons is less than the minimum participation number or the total number of persons is greater than highest participation number, return Tieback receives the activity data that businessman sends, and determines the first preset time range and the second preset time according to the activity data The step of range.
Further, processor 1001 can call the data processing based on zero-knowledge proof stored in memory 1005 Program also executes following operation:
Prize-winning voucher is sent to the lottery winner, so that the lottery winner is according to the prize-winning voucher to businessman's prize.
The activity data that the present embodiment is sent through the above scheme, by receiving businessman, and it is true according to the activity data Fixed first preset time range and the second preset time range, first preset time range are the body for receiving consumer and sending Part data and the time range for participating in data, second preset time range are verifying and the time range for determining lottery winner; The identity data and the participation data are received in the first preset time range, and the second default is obtained from intelligent contract Random number, the identity data include consumer's public key and its signing messages, and the participation data include the first cryptographic Hash and the One default random number;It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;Second The constant and the first random number that consumer sends are received in preset time range, according to consumer's public key to the A.L.S. Breath carries out authentication, after authentication passes through, according to the constant and first random number to first cryptographic Hash Carry out Hash verifying;When the quantity that the Hash is verified is less than or equal to total number of persons, according to the constant and the intelligence Can in contract preset open rule determine lottery winner or according to the first default random number, the second default random number, Preset open rule determines lottery winner in the constant and the intelligent contract, guarantees that all data are public by block chain technology Open it is transparent, can not change, while prize drawing person is determined by the verifying of Merkel's root, the fair rule of intelligent contract, constant or random number, Other factors interference is eliminated, the behavior of playing tricks during prize drawing is effectively prevented, has ensured the fairness and credibility of prize drawing.
Based on above-mentioned hardware configuration, propose that the present invention is based on the data processing method embodiments of zero-knowledge proof.
It is that the present invention is based on the signals of the process of the data processing method first embodiment of zero-knowledge proof referring to Fig. 2, Fig. 2 Figure.
In the first embodiment, the data processing method based on zero-knowledge proof the following steps are included:
S10: the activity data that businessman sends is received, and the first preset time range and the are determined according to the activity data Two preset time ranges, first preset time range are to receive the identity data and the time for participating in data that consumer sends Range, second preset time range are verifying and the time range for determining lottery winner;
It is understood that the businessman, refer to movable initiator, the activity data, including Merchant ID, merchant signature, Businessman's public key, activity ID, Activity Description, activity intelligent contract address, minimum participation number, highest participate in number, draw times Section (including the first preset time range and second preset time range), prize-winning rule etc., the present embodiment is without restriction to this.
Activity data is written in intelligent contract block chain, and saves intelligent contract, so not only at any time can be from intelligence The relevant data of acquisition activity in contract, can also prevent activity data to be tampered.
S20: the identity data and the participation data are received in the first preset time range, and from intelligent contract The second default random number is obtained, the identity data includes consumer's public key and its signing messages, and the participations data include the One cryptographic Hash and the first default random number;
For the ease of distinguishing and illustrating, the hereinafter referred to as first default random number is DR1, the second default random number is DR2, the One cryptographic Hash is Hash1, the first preset time range is T1, the second preset time range is T2.
In the concrete realization, consumer needs to submit to block chain in T1 participates in data (Hash1 and DR1) and identity data (consumer's public key and its signing messages), consumer can will sign privacy information private key encryption after generating signing messages Information and public key are committed in block chain, are provided privacy information due to consumer and not directly to businessman, can be reduced consumer The risk that privacy information is leaked.
S30: it determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;
It should be noted that being needed movable to participating in after having received the identity data of consumer's transmission and having participated in data Total number of persons is counted, and is less than the minimum participation number of businessman's setting or greater than highest participation number when participating in movable total number of persons When, it needs to reopen activity.
It can be readily appreciated that data are participated in a since each consumer can send a identity data in T1, The number that the quantity that identity data can be counted perhaps participates in the quantity of data or identity data is averaged with participation data Amount, using this quantity as the movable total number of persons of participation.
S40: the constant and the first random number that consumer sends are received in the second preset time range, according to the consumption Person's public key carries out authentication to the signing messages, after authentication passes through, at random according to the constant and described first It is several that Hash verifying is carried out to first cryptographic Hash;
For the ease of distinguishing and illustrating, hereinafter referred to as constant is K, and the first random number is R1.
It can be readily appreciated that consumer provides a K in T2 at random, in order to ensure that fairness, the value of K should be greater than businessman The highest of setting participates in number.
It should be noted that Hash1 is K and R1 by calculating the cryptographic Hash obtained, it can be the Hash of the sum of K and R1 Value, as a preferred embodiment, Hash1 is that K and R1 calculates the root cryptographic Hash obtained based on Merkel's tree algorithm, to prevent Only Hash collides.
In the concrete realization, after the identity data that T1 has received consumer's transmission, in T2 using public key to consumer Carry out authentication;If authentication passes through, the K and R1 sent according to consumer carries out Hash verifying to Hash1, specifically, Third cryptographic Hash is calculated according to K, R1 and corresponding algorithm, and when third cryptographic Hash is identical as Hash1, is verified.
S50: when the quantity that the Hash is verified is less than or equal to total number of persons, according to the constant and the intelligence Preset open rule determines lottery winner or according to the first default random number, the second default random number, institute in contract It states preset open rule in constant and the intelligent contract and determines lottery winner.
It can be readily appreciated that illustrating that all consumers are each provided with K when the quantity that Hash is verified is equal to total number of persons And R1, then it is fair for illustrating to draw a lottery, and can calculate prize-winning by preset open rule in K and intelligent contract or formula Person illustrates have consumer not provide K and R1, then it represents that do not provide disappearing for K and R1 when the quantity being verified is less than total number of persons There are fraud risks by expense person, at this time by preset in the DR2 and intelligent contract in DR1, K of consumer's transmission, intelligent contract Open rule calculates lottery winner, due to determining lottery winner during block chain be not aware that customer identification so that each The winning probability of consumer is consistent, and due to prize-winning rule be it is disclosed, make prize drawing it is more fair.
In the concrete realization, after determining lottery winner, block chain can send prize-winning voucher to the lottery winner, so that described Lottery winner is according to the prize-winning voucher to businessman's prize.Since lottery winner only needs to provide prize-winning voucher to businessman, do not need to mention For privacy information, so that consumer can also protect the crucial privacy information of oneself to be not leaked in fair participation activity.
The activity data that the present embodiment is sent by receiving businessman, and the first preset time is determined according to the activity data Range and the second preset time range, first preset time range are to receive the identity data and participate in number that consumer sends According to time range, second preset time range be verifying and determine lottery winner time range;In the first preset time The identity data and the participation data are received in range, and the second default random number, the body are obtained from intelligent contract Part data include consumer's public key and its signing messages, and the participation data include the first cryptographic Hash and the first default random number; It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;In the second preset time range The constant and the first random number that consumer sends are received, identity is carried out to the signing messages according to consumer's public key and is tested Card carries out Hash verifying to first cryptographic Hash according to the constant and first random number after authentication passes through; When the quantity that the Hash is verified is less than or equal to total number of persons, according to preset in the constant and the intelligent contract Open rule determines lottery winner or according to the first default random number, the second default random number, the constant and described Preset open rule determines lottery winner in intelligent contract, by block chain technology guarantee all data it is open and clear, can not be more Change, while prize drawing person determined by the verifying of Merkel's root, the fair rule of intelligent contract, constant or random number, eliminate other because Element interference, effectively prevents the behavior of playing tricks during prize drawing, has ensured the fairness and credibility of prize drawing.
Further, as shown in figure 3, proposing that the present invention is based on the data processing sides of zero-knowledge proof based on first embodiment Method second embodiment, in the present embodiment, step S50 specifically include:
S51: when the quantity that the Hash is verified is equal to total number of persons, the consumer being verified according to Hash is corresponding The constant and the intelligent contract in preset open rule determine lottery winner;
It should be understood that illustrating that all consumers are each provided with K when the quantity that Hash is verified is equal to total number of persons And R1, lottery winner, such as the consumption that Hash is verified can be calculated by preset open rule in K and intelligent contract It is taken the remainder after the K summation that person provides, calculates lottery winner further according to preset rules.
Specifically, as an implementation, the process for calculating lottery winner can be such that the basis within the scope of draw times Receiving and participating in the timestamp of data is that every consumer ranks;It is asked in the K that the consumer that Hash is verified by T2 provides It is taken the remainder with after, obtains consumer's ranking, corresponding ranking is lottery winner.
S52: corresponding according to the consumer of Hash authentication failed when the quantity that the Hash is verified is less than total number of persons The first default random number and the corresponding constant of consumer that is verified of the second default random number, the Hash and Preset open rule determines lottery winner in the intelligence contract.
It should be understood that when the quantity that Hash is verified is less than total number of persons, illustrate to have consumer do not provide K with R1, the consumer corresponding DR1 and DR2 and intelligence of K, Hash authentication failed that the consumer being verified at this time by Hash sends Preset open rule or formula calculate lottery winner in energy contract.
Specifically, step S52 is specifically included:
S520: when the quantity that the Hash is verified is less than total number of persons, according to the consumption of the Hash authentication failed The corresponding first default random number of person and the second default random number calculate the second cryptographic Hash;
It should be noted that not submitting the consumption of K and R1 in order to prevent when Hash is verified quantity less than total number of persons Person fakes, and the present embodiment is counted jointly by corresponding DR2 in the corresponding DR1 of consumer and intelligent contract by Hash authentication failed The second cryptographic Hash is calculated, the K submitted further according to the consumer that the second cryptographic Hash and Hash are verified determines lottery winner jointly, mentions High fraud difficulty, keeps prize drawing more fair.
S521: the corresponding constant of consumer being verified according to second cryptographic Hash, Hash and the intelligence Preset open rule determines lottery winner in contract.
It specifically, can be according to the corresponding constant of consumer that second cryptographic Hash, Hash are verified, described Total number of persons and preset formula calculate remainder;It is determined and is got the winning number in a bond according to preset open rule in the remainder and the intelligent contract Person.The process for calculating lottery winner can be such that within the scope of draw times be every according to the timestamp for participating in data is received Consumer ranks;After the corresponding K summation of consumer that the second cryptographic Hash for calculating acquisition and Hash are verified by T2 It takes the remainder, obtains consumer's ranking, corresponding ranking is lottery winner.
When the present embodiment is equal to total number of persons by the quantity that is verified in Hash, the consumer that is verified according to Hash The corresponding constant and the intelligent contract determine lottery winner;When the quantity that Hash is verified is less than total number of persons, according to The corresponding first default random number of the consumer of Hash authentication failed and the second default random number obtain the second Hash Value;During the corresponding constant of consumer and the intelligent contract being verified according to second cryptographic Hash, Hash determine Prize person determines prize drawing person by the fair rule of intelligent contract, constant or random number, eliminates other factors interference, ensure that pumping The fairness and fairness of prize process, increase the confidence level of prize drawing.
The present invention further provides a kind of data processing systems based on zero-knowledge proof.
It is that the present invention is based on the system architectures of the data processing system first embodiment of zero-knowledge proof to show referring to Fig. 4, Fig. 4 It is intended to.
In the present embodiment, the data processing system based on zero-knowledge proof includes:
Consumer end 10, for sending identity data to the block chain in the first preset time range and participating in number According to, and the second default random number is obtained from intelligent contract, the identity data includes consumer's public key and its signing messages, institute Stating and participating in data includes the first cryptographic Hash and the first default random number;It is sent in the second preset time range to the block chain Constant and the first random number;
For the ease of distinguishing and illustrating, hereinafter referred to as constant is K, and the first random number is R1, the first default random number is DR1, the second default random number are DR2, the first cryptographic Hash is Hash1, the first preset time range is T1, the second preset time model It encloses for T2.
In the concrete realization, T1 and T2 can be obtained from intelligent contract, T1 is the identity data for receiving consumer and sending With the time range for participating in data, T2 is verifying and the time range for determining lottery winner.Consumer needs to mention to block chain in T1 Hand over participation data (Hash1 and DR1) and identity data (consumer's public key and its signing messages), consumer can be by privacy information With private key encryption, signing messages and public key are committed in block chain after generating signing messages, due to consumer and not directly to Businessman provides privacy information, can reduce the risk that consumer privacy information is leaked.
It can be readily appreciated that consumer provides a K in T2 at random, in order to ensure that fairness, the value of K should be greater than businessman The highest of setting participates in number.
It should be noted that Hash1 is K and R1 by calculating the cryptographic Hash obtained, it can be the Hash of the sum of K and R1 Value, as a preferred embodiment, Hash1 is that K and R1 calculates the root cryptographic Hash obtained based on Merkel's tree algorithm, to prevent Only Hash collides.
After determining lottery winner in block chain, prize-winning voucher can be sent to the lottery winner, lottery winner is according in described Voucher is encouraged to businessman's prize.Since lottery winner only needs to provide prize-winning voucher to businessman, do not need to provide privacy information, so that disappearing The person of expense can also protect the crucial privacy information of oneself to be not leaked in fair participation activity.
Block chain 20, for receive businessman transmission activity data, and according to the activity data determine first it is default when Between range and the second preset time range, first preset time range is the identity data and described for receiving consumer and sending The time range of data is participated in, second preset time range is verifying and the time range for determining lottery winner;It is pre- first If receiving the identity data and the participation data in time range, and the second default random number is obtained from intelligent contract; It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;In the second preset time range The constant and the first random number that consumer sends are received, identity is carried out to the signing messages according to consumer's public key and is tested Card carries out Hash verifying to first cryptographic Hash according to the constant and first random number after authentication passes through; When the quantity that the Hash is verified is less than or equal to total number of persons, according to preset in the constant and the intelligent contract Open rule determines lottery winner or according to the first default random number, the second default random number, the constant and described Preset open rule determines lottery winner in intelligent contract.
It is understood that the businessman, refer to movable initiator, the activity data, including Merchant ID, merchant signature, Businessman's public key, activity ID, Activity Description, activity intelligent contract address, minimum participation number, highest participate in number, draw times Section (including the first preset time range and second preset time range), prize-winning rule etc., the present embodiment is without restriction to this.
Activity data is written in intelligent contract block chain, and saves intelligent contract, so not only at any time can be from intelligence The relevant data of acquisition activity in contract, can also prevent activity data to be tampered.
It should be noted that being needed movable to participating in after having received the identity data of consumer's transmission and having participated in data Total number of persons is counted, and is less than the minimum participation number of businessman's setting or greater than highest participation number when participating in movable total number of persons When, it needs to reopen activity.
It can be readily appreciated that data are participated in a since each consumer can send a identity data in T1, The number that the quantity that identity data can be counted perhaps participates in the quantity of data or identity data is averaged with participation data Amount, using this quantity as the movable total number of persons of participation.
In the concrete realization, after the identity data that T1 has received consumer's transmission, in T2 using public key to consumer Carry out authentication;If authentication passes through, the K and R1 sent according to consumer carries out Hash verifying to Hash1, specifically, Third cryptographic Hash is calculated according to K, R1 and corresponding algorithm, and when third cryptographic Hash is identical as Hash1, is verified.
It can be readily appreciated that illustrating that all consumers are each provided with K when the quantity that Hash is verified is equal to total number of persons And R1, then illustrate that prize drawing is fair, preset disclosure in the K and intelligent contract provided by the consumer that Hash is verified Rule or formula can calculate lottery winner, when the quantity that Hash is verified is less than total number of persons, illustrate have consumer not mention For K and R1, then it represents that not providing the consumer of K and R1, there are fraud risks, are sent out at this time by the consumer that Hash is verified Preset open rule calculates prize-winning in the consumer corresponding DR1 and DR2 and intelligence contract of the K, Hash authentication failed that send Person, due to determine lottery winner during block chain be not aware that customer identification so that the winning probability one of each consumer Cause, and due to prize-winning rule be it is disclosed, make prize drawing it is more fair.
The activity data that the present embodiment is sent by receiving businessman, and the first preset time is determined according to the activity data Range and the second preset time range, first preset time range are to receive the identity data and participate in number that consumer sends According to time range, second preset time range be verifying and determine lottery winner time range;In the first preset time The identity data and the participation data are received in range, and the second default random number, the body are obtained from intelligent contract Part data include consumer's public key and its signing messages, and the participation data include the first cryptographic Hash and the first default random number; It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;In the second preset time range The constant and the first random number that consumer sends are received, identity is carried out to the signing messages according to consumer's public key and is tested Card carries out Hash verifying to first cryptographic Hash according to the constant and first random number after authentication passes through; When the quantity that the Hash is verified is less than or equal to total number of persons, according to preset in the constant and the intelligent contract Open rule determines lottery winner or according to the first default random number, the second default random number, the constant and described Preset open rule determines lottery winner in intelligent contract, by block chain technology guarantee all data it is open and clear, can not be more Change, while prize drawing person determined by the verifying of Merkel's root, the fair rule of intelligent contract, constant or random number, eliminate other because Element interference, effectively prevents the behavior of playing tricks during prize drawing, has ensured the fairness and credibility of prize drawing.
In addition, the embodiment of the present invention also proposes a kind of storage medium, it is stored on the storage medium and is demonstrate,proved based on Zero Knowledge Bright data processor realizes following operation when the data processor based on zero-knowledge proof is executed by processor:
The activity data that businessman sends is received, and the first preset time range and second is determined in advance according to the activity data If time range, first preset time range is to receive the identity data and the time model for participating in data that consumer sends It encloses, second preset time range is verifying and the time range for determining lottery winner;
The identity data and the participation data are received in the first preset time range, and are obtained from intelligent contract Second default random number, the identity data include consumer's public key and its signing messages, and the participation data include the first Kazakhstan Uncommon value and the first default random number;
It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;
The constant and the first random number that consumer sends are received in the second preset time range, it is public according to the consumer Key carries out authentication to the signing messages, after authentication passes through, according to the constant and first random number pair First cryptographic Hash carries out Hash verifying;
When the quantity that the Hash is verified is less than or equal to total number of persons, according to the constant and the intelligent contract In preset open rule determine lottery winner or according to the first default random number, the second default random number, it is described often Preset open rule determines lottery winner in the several and described intelligent contract.
Wherein, the step of computer storage medium is realized can refer to the data processing method the present invention is based on zero-knowledge proof Each embodiment, details are not described herein again.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of data processing method based on zero-knowledge proof, which is characterized in that the data processing method includes:
Receive businessman send activity data, and according to the activity data determine the first preset time range and second it is default when Between range, first preset time range be receive consumer send identity data and participate in data time range, institute Stating the second preset time range is verifying and the time range for determining lottery winner;
The identity data and the participation data are received in the first preset time range, and obtain second from intelligent contract Default random number, the identity data includes consumer's public key and its signing messages, and the participation data include the first cryptographic Hash And first default random number;
It determines according to the identity data and the quantity for participating in data and participates in movable total number of persons;
The constant and the first random number that consumer sends are received in the second preset time range, according to consumer's public key pair The signing messages carries out authentication, after authentication passes through, according to the constant and first random number to described First cryptographic Hash carries out Hash verifying;
When the quantity that the Hash is verified is less than or equal to total number of persons, according to pre- in the constant and the intelligent contract If open rule determine lottery winner or according to the first default random number, the second default random number, the constant and Preset open rule determines lottery winner in the intelligence contract.
2. as described in claim 1 based on the data processing method of zero-knowledge proof, which is characterized in that described in the Hash When the quantity being verified is less than or equal to total number of persons, really according to preset open rule in the constant and the intelligent contract Determine lottery winner or according in the first default random number, the second default random number, the constant and the intelligent contract The step of preset open rule determines lottery winner, comprising:
When the quantity that the Hash is verified is equal to total number of persons, the consumer being verified according to Hash is corresponding described normal Preset open rule determines lottery winner in the several and described intelligent contract;
When the quantity that the Hash is verified is less than total number of persons, according to the consumer of Hash authentication failed corresponding described the The corresponding constant of consumer and the intelligence that one default random number and the second default random number, Hash are verified Preset open rule determines lottery winner in contract.
3. as claimed in claim 2 based on the data processing method of zero-knowledge proof, which is characterized in that described in the Hash The quantity being verified be less than total number of persons when, according to the consumer of Hash authentication failed it is corresponding it is described first default random number and Preset public affairs in the corresponding constant of consumer and the intelligent contract that the second default random number, Hash are verified Open the step of rule determines lottery winner, comprising:
When the quantity that the Hash is verified is less than total number of persons, according to the consumer of the Hash authentication failed corresponding the One default random number and the second default random number calculate the second cryptographic Hash;
It is preset in the corresponding constant of consumer and the intelligent contract being verified according to second cryptographic Hash, Hash Open rule determine lottery winner.
4. as claimed in claim 3 based on the data processing method of zero-knowledge proof, which is characterized in that described according to described Preset open rule determines in the corresponding constant of the consumer that two cryptographic Hash, Hash are verified and the intelligent contract The step of lottery winner, comprising:
The corresponding constant of consumer, the total number of persons and the default public affairs being verified according to second cryptographic Hash, the Hash Formula calculates remainder;
Lottery winner is determined according to preset open rule in the remainder and the intelligent contract.
5. according to any one of claims 1 to 4 based on the data processing method of zero-knowledge proof, which is characterized in that institute It states after determining the step of participating in movable total number of persons according to the identity data and the quantity for participating in data, the method Further include:
Determine that movable minimum participation number and highest participate in number according to the activity data;
When the total number of persons is less than the minimum participation number or the total number of persons is greater than highest participation number, return is connect The activity data that businessman sends is received, and the first preset time range and the second preset time range are determined according to the activity data The step of.
6. according to any one of claims 1 to 4 based on the data processing method of zero-knowledge proof, which is characterized in that institute Stating the first cryptographic Hash is that the constant and first random number calculate the root cryptographic Hash obtained based on Merkel's tree algorithm.
7. according to any one of claims 1 to 4 based on the data processing method of zero-knowledge proof, which is characterized in that institute It states when the quantity that the Hash is verified is less than or equal to total number of persons, is preset according in the constant and the intelligent contract Open rule determine lottery winner or according to the first default random number, the second default random number, the constant and institute After stating the step of preset open rule determines lottery winner in intelligent contract, the method also includes:
Prize-winning voucher is sent to the lottery winner, so that the lottery winner is according to the prize-winning voucher to businessman's prize.
8. a kind of data processing system based on zero-knowledge proof, which is characterized in that the data processing system includes block chain And consumer end;Wherein,
Consumer end, for sending identity data to the block chain in the first preset time range and participating in data, and from The second default random number is obtained in intelligent contract, the identity data includes consumer's public key and its signing messages, the participation Data include the first cryptographic Hash and the first default random number;In the second preset time range to the block chain send constant and First random number;
Block chain for receiving the activity data of businessman's transmission, and determines the first preset time range according to the activity data And second preset time range, first preset time range are the identity data and the participation number for receiving consumer and sending According to time range, second preset time range be verifying and determine lottery winner time range;In the first preset time The identity data and the participation data are received in range, and the second default random number is obtained from intelligent contract;According to institute It states identity data and the quantity for participating in data determines and participates in movable total number of persons;It receives and disappears in the second preset time range The constant and the first random number that the person of expense sends carry out authentication to the signing messages according to consumer's public key, in body After part is verified, Hash verifying is carried out to first cryptographic Hash according to the constant and first random number;Described When the quantity that Hash is verified is less than or equal to total number of persons, according to preset open rule in the constant and the intelligent contract It then determines lottery winner or is closed according to the first default random number, the second default random number, the constant and the intelligence Preset open rule determines lottery winner in about.
9. a kind of data processing equipment based on zero-knowledge proof, which is characterized in that at the data based on zero-knowledge proof Reason equipment includes: memory, processor and is stored on the memory and what can be run on the processor knows based on zero Know the data processor proved, the data processor based on zero-knowledge proof is arranged for carrying out such as claim 1 to 7 Any one of described in the data processing method based on zero-knowledge proof the step of.
10. a kind of storage medium, which is characterized in that be stored with the data processing journey based on zero-knowledge proof on the storage medium Sequence is realized when the data processor based on zero-knowledge proof is executed by processor such as any one of claims 1 to 7 institute The step of data processing method based on zero-knowledge proof stated.
CN201910410797.5A 2019-05-15 2019-05-15 Data processing method, system, equipment and storage medium based on zero-knowledge proof Pending CN110135909A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910410797.5A CN110135909A (en) 2019-05-15 2019-05-15 Data processing method, system, equipment and storage medium based on zero-knowledge proof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910410797.5A CN110135909A (en) 2019-05-15 2019-05-15 Data processing method, system, equipment and storage medium based on zero-knowledge proof

Publications (1)

Publication Number Publication Date
CN110135909A true CN110135909A (en) 2019-08-16

Family

ID=67574778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910410797.5A Pending CN110135909A (en) 2019-05-15 2019-05-15 Data processing method, system, equipment and storage medium based on zero-knowledge proof

Country Status (1)

Country Link
CN (1) CN110135909A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110601819A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Method for processing random number and related equipment
CN112968769A (en) * 2021-03-03 2021-06-15 中国人民银行数字货币研究所 Method and device for generating random number in block chain
CN114726534A (en) * 2022-03-28 2022-07-08 海南格子山网络科技有限公司 Method for realizing intelligent contract drawing based on Solana block chain technology

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060056621A1 (en) * 2004-08-27 2006-03-16 Zulfikar Ramzan Provisional signature schemes
US20060137006A1 (en) * 2004-12-17 2006-06-22 Ramzan Zulfikar A Use of modular roots to perform authentication including, but not limited to, authentication of validity of digital certificates
CN107682151A (en) * 2017-10-30 2018-02-09 武汉大学 A kind of GOST digital signature generation method and system
CN108269099A (en) * 2018-02-05 2018-07-10 桂林金发明科技开发有限公司 A kind of lottery drawing method of decentralization
CN109615422A (en) * 2018-11-29 2019-04-12 哈希未来(北京)科技有限公司 Competing pumping method, system and storage medium based on block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060056621A1 (en) * 2004-08-27 2006-03-16 Zulfikar Ramzan Provisional signature schemes
US20060137006A1 (en) * 2004-12-17 2006-06-22 Ramzan Zulfikar A Use of modular roots to perform authentication including, but not limited to, authentication of validity of digital certificates
CN107682151A (en) * 2017-10-30 2018-02-09 武汉大学 A kind of GOST digital signature generation method and system
CN108269099A (en) * 2018-02-05 2018-07-10 桂林金发明科技开发有限公司 A kind of lottery drawing method of decentralization
CN109615422A (en) * 2018-11-29 2019-04-12 哈希未来(北京)科技有限公司 Competing pumping method, system and storage medium based on block chain

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110601819A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Method for processing random number and related equipment
CN110601819B (en) * 2019-09-26 2023-02-14 腾讯科技(深圳)有限公司 Processing method for random number, block chain link point device and storage medium
CN112968769A (en) * 2021-03-03 2021-06-15 中国人民银行数字货币研究所 Method and device for generating random number in block chain
CN114726534A (en) * 2022-03-28 2022-07-08 海南格子山网络科技有限公司 Method for realizing intelligent contract drawing based on Solana block chain technology

Similar Documents

Publication Publication Date Title
CN110135909A (en) Data processing method, system, equipment and storage medium based on zero-knowledge proof
US20120317034A1 (en) Transparent virtual currency using verifiable tokens
CN109102269A (en) Transfer account method and device, block chain node and storage medium based on block chain
AU2019378253B2 (en) Distributed ledger systems, methods and devices
CN108876369A (en) Data communications method, device and computer readable storage medium based on block chain
CN108985569A (en) A kind of vehicle risk appraisal procedure, server
CN111639932B (en) Offline resource transfer method and device based on block chain
CN110599179B (en) Risk control method and related equipment based on blockchain system
US20140278946A1 (en) Advertisement and actual benefit distribution in a geocaching/treasure hunting environment
US20140364187A1 (en) Real-time betting, drawing and winning system and method thereof
CN109062667A (en) A kind of simulator recognition methods, identification equipment and computer-readable medium
JP3216098U (en) Advertising system in interactive environment
US11687926B2 (en) Privacy protected consumers identity for centralized P2P network services
Lyu et al. An empirical study on ethereum private transactions and the security implications
CN111222885B (en) Data processing request endorsement method and device, computer equipment and storage medium
US20150046285A1 (en) Method and system for providing a lottery ticket using a mobile phone
CN110941680B (en) Data processing method, device and storage medium
Roppelt Security risks surrounding cryptocurrency usage: a study on the security risks of cryptocurrencies and how security perception affects usage
CN109087195A (en) A kind of credit method, user terminal and server based on professional social information
CN114118993A (en) Payment method and electronic equipment
US20040167792A1 (en) Method and management system for gaming management between a gaming management center and at least one gaming terminal, gaming management center and gaming terminal
CN104751398A (en) Fair lottery number drawing method
CN110336853A (en) A kind of block chain horizontal extension solution of big data quantity
CN113763139B (en) Queuing number bidding method based on blockchain, electronic device and storage medium
CN104299156A (en) Real-time betting lottery winning system and method thereof

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190816

RJ01 Rejection of invention patent application after publication