CN116739660A - Lottery drawing method and system based on block chain - Google Patents

Lottery drawing method and system based on block chain Download PDF

Info

Publication number
CN116739660A
CN116739660A CN202310866168.XA CN202310866168A CN116739660A CN 116739660 A CN116739660 A CN 116739660A CN 202310866168 A CN202310866168 A CN 202310866168A CN 116739660 A CN116739660 A CN 116739660A
Authority
CN
China
Prior art keywords
hash value
intelligent contract
ciphertext
lottery
blockchain
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
CN202310866168.XA
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.)
Hunan Tianhe Guoyun Technology Co Ltd
Original Assignee
Hunan Tianhe Guoyun Technology 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 Hunan Tianhe Guoyun Technology Co Ltd filed Critical Hunan Tianhe Guoyun Technology Co Ltd
Priority to CN202310866168.XA priority Critical patent/CN116739660A/en
Publication of CN116739660A publication Critical patent/CN116739660A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • 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/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • Bioethics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Strategic Management (AREA)
  • Development Economics (AREA)
  • Accounting & Taxation (AREA)
  • Health & Medical Sciences (AREA)
  • Entrepreneurship & Innovation (AREA)
  • General Business, Economics & Management (AREA)
  • Game Theory and Decision Science (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a lottery method and a lottery system based on a block chain, wherein the method comprises the following steps: randomly generating a pair of public key and private key according to an intelligent contract, disclosing the public key on a blockchain, and initializing a hash value in the intelligent contract; encrypting and hashing the random character strings uploaded to the blockchain by each participant of the lottery activity, and updating the hash value in the intelligent contract according to the result of the hashing operation; encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract. According to the embodiment of the application, the randomness and fairness of lottery drawing can be improved based on the block chain.

Description

Lottery drawing method and system based on block chain
Technical Field
The application belongs to the technical field of block chains, and particularly relates to a lottery drawing method, a lottery drawing system, terminal equipment and a computer readable medium based on a block chain.
Background
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. It is essentially a decentralised database, a series of data blocks generated by cryptographic means, each of which contains a batch of information of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. In a narrow sense, a blockchain is a distributed ledger that combines blocks of data in a sequential manner in time order into a chain data structure, and that is cryptographically secured against tampering and counterfeiting. In broad terms, blockchain technology is a completely new distributed infrastructure and computing method that uses a blockchain data structure to verify and store data, a distributed node consensus algorithm to generate and update data, a cryptographic way to secure data transmission and access, and an intelligent contract consisting of automated script code to program and manipulate data.
At present, the lottery platform basically adopts a centralized mode to conduct lottery, lottery data are stored at the rear end of the system, the lottery data have tamper ability, a user cannot know the lottery process, and the result cannot be verified. Therefore, the fairness and the authenticity of the existing method are difficult to guarantee, and how to use the blockchain technology to conduct lottery activities based on the characteristic that the blockchain is not tamperable becomes a problem to be solved urgently.
Disclosure of Invention
In view of the above, embodiments of the present application provide a blockchain-based lottery method, a blockchain-based lottery system, a blockchain-based lottery terminal device, and a blockchain-based lottery computer readable medium, which can improve randomness and fairness of a lottery.
A first aspect of an embodiment of the present application provides a blockchain-based lottery method, including:
randomly generating a pair of public key and private key according to an intelligent contract, disclosing the public key on a blockchain, and initializing a hash value in the intelligent contract; wherein the intelligent contract corresponds to a lottery activity and is used for guaranteeing the non-falsification of the lottery method;
encrypting and hashing the random character strings uploaded to the blockchain by each participant of the lottery activity, and updating the hash value in the intelligent contract according to the result of the hashing operation;
encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract.
A second aspect of an embodiment of the present application provides a blockchain-based lottery system, comprising:
the generation module is used for randomly generating a pair of public keys and private keys according to the intelligent contract, disclosing the public keys on a blockchain and initializing a hash value in the intelligent contract; wherein the intelligent contract corresponds to a lottery activity and is used for guaranteeing the non-falsification of the lottery method;
the participation module is used for encrypting and hashing the random character strings uploaded to the blockchain by each participant in the lottery, and updating the hash value in the intelligent contract according to the result of the operation;
the determining module is used for encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract.
A third aspect of an embodiment of the present application provides a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the blockchain-based lottery method described above when the computer program is executed.
A fourth aspect of the embodiments of the present application provides a computer readable medium storing a computer program which when processed for execution implements the steps of the blockchain-based lottery method described above.
The random number generation method based on the blockchain provided by the embodiment of the application can randomly generate a pair of public key and private key according to the intelligent contract, disclose the public key on the blockchain, initialize the hash value in the intelligent contract, encrypt and hash the random character string uploaded to the blockchain by each participant in the lottery activity, update the hash value in the intelligent contract according to the result of the operation, encrypt the updated hash value in the intelligent contract by using the private key to obtain the private key encrypted ciphertext, further update the hash value in the intelligent contract according to the result of the hash operation on the private key encrypted ciphertext, and determine the number of the winning participant through the further updated hash value in the intelligent contract, thereby ensuring that the lottery has enough randomness and fairness by using the method of encrypting the information by the random key by all users.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a blockchain-based lottery method provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart of encrypting and hashing random strings uploaded by each participant in a lottery and updating hash values in the smart contract with the result of the hashing operation in a blockchain-based lottery method provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a block chain based lottery system according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a refinement provided by one embodiment of the participation module in FIG. 3;
FIG. 5 is a schematic diagram of a refinement provided by another embodiment of the participation module in FIG. 3;
fig. 6 is a schematic diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to illustrate the technical scheme of the application, the following description is made by specific examples.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating a lottery method based on a blockchain according to an embodiment of the present application. As shown in fig. 1, the blockchain-based lottery method of the present embodiment includes the steps of:
s101: a pair of public key and private key is randomly generated according to the intelligent contract, the public key is disclosed on the blockchain, and the hash value in the intelligent contract is initialized.
In the embodiment of the application, a pair of a public key pk and a private key sk can be generated according to an intelligent contract corresponding to lottery activities, the public key pk is disclosed on a blockchain, and a hash value in the intelligent contract is initialized. The intelligent contract corresponds to lottery activities and is used for realizing the lottery method based on the block chain and guaranteeing the non-falsification of the lottery method. In addition, a lottery may be initiated and the number m of participants of the lottery may be set before the public key pk and the private key sk are generated.
S102: and encrypting and hashing the random character strings uploaded to the blockchain by each participant of the lottery activity, and updating the hash value in the intelligent contract according to the result of the operation.
In one embodiment of the present application, according to the time sequence of participation of the participants in the lottery, the initialized hash value in the smart contract is encrypted by using the random string S1 uploaded to the blockchain by the first participant to obtain a first ciphertext P1, the first ciphertext P1 is subjected to hash operation, and the initialized hash value in the smart contract is replaced by the operation result obtained by carrying out hash operation on the first ciphertext P1 to obtain a first updated hash value in the smart contract; encrypting an ith-1 updated hash value by using a random character string Si uploaded to the block chain by an ith participant to obtain an ith ciphertext Pi, carrying out hash operation on the ith ciphertext Pi, and replacing the ith-1 updated hash value in the intelligent contract by using an operation result obtained after carrying out hash operation on the ith ciphertext Pi to obtain an ith updated hash value; wherein 1< i < m, m is the total number of people participating in the lottery. For example, encrypting the first updated hash value by using a random string S2 uploaded to the blockchain by a second participant to obtain a second ciphertext P2, performing hash operation on the second ciphertext P2, and replacing the first updated hash value in the intelligent contract with an operation result obtained by performing hash operation on the second ciphertext P2 to obtain a second updated hash value; and the method comprises the steps of conducting hash operation on the mth ciphertext Pm until the mth ciphertext Pm is obtained by encrypting the mth-1 updated hash value by using the random character string Sm uploaded to the blockchain by the last participant (i.e. the mth participant), and replacing the mth-1 updated hash value in the intelligent contract by an operation result obtained by conducting hash operation on the mth ciphertext Pm to obtain the mth updated hash value. As shown in fig. 2, in S1021, the ith participant may be passed its custom string (i.e., custom random string) Si onto the blockchain; in S1022, the hash value in the register H (i.e. the i-1 th updated value of the hash value in the smart contract, or referred to as the i-1 th updated hash value) may be encrypted by Si to obtain the i-th ciphertext Pi; s1023, carrying out hash operation on Pi to obtain a new hash value and storing the new hash value into a register H to replace the i-1 updated hash value; in S1024, it is determined whether i is smaller than the set number m of participants in the lottery, and if so, S1021-S1024 are repeatedly executed for the random string transmitted by the participant through the i+1th, until the mth updated hash value is obtained through the random string transmitted by the mth participant.
In another embodiment of the present application, all participants of the lottery may be spliced together with the random strings of the blockchain, the initialized hash value in the smart contract is encrypted using the spliced random strings to obtain a ciphertext P, and the ciphertext P may be subjected to a hash operation, and the initialized hash value in the smart contract may be replaced with an operation result obtained by performing the hash operation on the ciphertext P to obtain an updated hash value in the smart contract. It will be appreciated that this approach may reduce the amount of computation, but requires more memory.
S103: encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract.
In the embodiment of the application, the updated hash value in the intelligent contract can be encrypted by the private key sk to obtain a private key encrypted ciphertext D (namely, a ciphertext D encrypted by the private key); then, hash operation can be performed on the private key encryption ciphertext D, and the hash value in the intelligent contract is further updated by using the result obtained by performing hash operation on the private key encryption ciphertext D (that is, the updated hash value is replaced by using the result obtained by performing hash operation on the private key encryption ciphertext D, so that the hash value in the intelligent contract is further updated); finally, the further updated hash value in the smart contract may be converted into a 256-bit unsigned integer K by which the number of winning participants is modulo the number m of participants of the lottery activity. Further, the hash operation may be, for example, a hash operation performed using an SHA2 function. It is noted that the user on the blockchain can verify whether the private key sk has been tampered with using the public key pk, the hash values of the various stages in the smart contract, and the private key encryption ciphertext D.
According to the block chain-based lottery method provided by the embodiment of the application, the encryption operation and the hash operation are performed by using the incoming value of each lottery participant on the block chain, and all participants can participate in the lottery flow and influence the lottery result. Furthermore, the public-private key pair is generated in advance, the public key is disclosed, and the private key is adopted to carry out encryption operation in the subsequent process, so that the possibility of tampering is avoided, and the fairness and the true randomness of the lottery result can be ensured. In addition, the whole lottery method is characterized in that the flow is linked, the process and the result disclosure can be verified, and the reality, the randomness and the credibility of the result can be ensured.
Referring to fig. 3, fig. 3 is a block diagram illustrating a lottery system based on a blockchain according to an embodiment of the present application. As shown in fig. 3, the blockchain-based lottery system 30 of the present embodiment includes a generation module 301, a participation module 302, and a determination module 303. The generating module 301, the participating module 302 and the determining module 303 are respectively configured to execute the specific methods in S101, S102 and S103 in fig. 1, and details thereof may be referred to in the relevant description of fig. 1, and only a brief description thereof will be provided herein:
a generating module 301, configured to randomly generate a pair of public key and private key according to an intelligent contract, and disclose the public key on a blockchain, and initialize a hash value in the intelligent contract; wherein the smart contract corresponds to a lottery activity for ensuring non-tampering of the lottery method.
A participation module 302, configured to encrypt and hash the random strings uploaded to the blockchain by each participant in the lottery, and update the hash value in the smart contract with the result of the operation.
The determining module 303 is configured to encrypt the updated hash value in the smart contract with the private key to obtain a private key encrypted ciphertext, further update the hash value in the smart contract with a result obtained by performing a hash operation on the private key encrypted ciphertext, and determine the number of the winning participant according to the further updated hash value in the smart contract.
Further, in one embodiment of the present application, referring to fig. 4, the participation module 302 may specifically include a first participation unit 3021, an i-th participation unit 3022, and an m-th participation unit 3023:
the first participation unit 3021 is configured to encrypt the initialized hash value in the smart contract by using the random string S1 uploaded to the blockchain by the first participant according to the time sequence of participation of the participant in the lottery activity, obtain a first ciphertext P1, perform hash operation on the first ciphertext P1, and replace the initialized hash value in the smart contract with an operation result obtained by performing hash operation on the first ciphertext P1, so as to obtain a first updated hash value in the smart contract.
An ith participation unit 3022, configured to encrypt an ith-1 updated hash value by using a random string Si uploaded to the blockchain by an ith participant to obtain an ith ciphertext Pi, perform hash operation on the ith ciphertext Pi, and replace the ith-1 updated hash value in the intelligent contract with an operation result obtained by performing hash operation on the ith ciphertext Pi to obtain an ith updated hash value; wherein 1< i < m, m is the total number of people participating in the lottery.
And an mth participation unit 3023 for encrypting the mth-1 updated hash value by using the random string Sm uploaded to the blockchain by the mth participant to obtain an mth ciphertext Pm, performing hash operation on the mth ciphertext Pm, and replacing the mth-1 updated hash value in the intelligent contract with an operation result obtained by performing hash operation on the mth ciphertext Pm to obtain an mth updated hash value.
Further, in another embodiment of the present application, referring to fig. 5, the participation module 302 may specifically include a splice encryption unit 3024 and an update unit 3025:
and a splicing encryption unit 3024, configured to splice the random strings uploaded to the blockchain by all participants in the lottery, and encrypt the initialized hash value in the smart contract by using the spliced random strings to obtain a ciphertext P.
And the updating unit 3025 is configured to perform a hash operation on the ciphertext P, and replace the initialized hash value in the intelligent contract with an operation result obtained by performing the hash operation on the ciphertext P to obtain an updated hash value in the intelligent contract.
The blockchain-based lottery system provided in fig. 3 may utilize the incoming values on the blockchain of each participant in the lottery to perform encryption and hashing operations, all of which may participate in the flow of the lottery and affect the outcome of the lottery. Furthermore, the public-private key pair is generated in advance, the public key is disclosed, and the private key is adopted to carry out encryption operation in the subsequent process, so that the possibility of tampering is avoided, and the fairness and the true randomness of the lottery result can be ensured. In addition, the whole lottery method is characterized in that the flow is linked, the process and the result disclosure can be verified, and the reality, the randomness and the credibility of the result can be ensured.
Fig. 6 is a schematic diagram of a terminal device according to an embodiment of the present application. As shown in fig. 6, the terminal device 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as a program for conducting a blockchain-based lottery method. The steps in the above-described method embodiments are implemented by the processor 60 when executing the computer program 62, for example, S101 to S103 shown in fig. 1. Alternatively, the processor 60, when executing the computer program 62, performs the functions of the modules/units of the system embodiments described above, such as the functions of the modules 301 to 303 shown in fig. 3.
Illustratively, the computer program 62 may be partitioned into one or more modules/units that are stored in the memory 61 and executed by the processor 60 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used for describing the execution of the computer program 62 in the terminal device 6. For example, the computer program 62 may be partitioned into a generation module 301, a participation module 302 and a determination module 303. (modules in a virtual system), each module specifically functions as follows:
a generating module 301, configured to randomly generate a pair of public key and private key according to an intelligent contract, and disclose the public key on a blockchain, and initialize a hash value in the intelligent contract; wherein the smart contract corresponds to a lottery activity for ensuring non-tampering of the lottery method.
A participation module 302, configured to encrypt and hash the random strings uploaded to the blockchain by each participant in the lottery, and update the hash value in the smart contract with the result of the operation.
The determining module 303 is configured to encrypt the updated hash value in the smart contract with the private key to obtain a private key encrypted ciphertext, further update the hash value in the smart contract with a result obtained by performing a hash operation on the private key encrypted ciphertext, and determine the number of the winning participant according to the further updated hash value in the smart contract.
The terminal device 6 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. Terminal device 6 may include, but is not limited to, a processor 60, a memory 61. It will be appreciated by those skilled in the art that fig. 6 is merely an example of the terminal device 6 and does not constitute a limitation of the terminal device 6, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the terminal device may further include an input-output device, a network access device, a bus, etc.
The processor 60 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used for storing the computer program as well as other programs and data required by the terminal device 6. The memory 61 may also be used for temporarily storing data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the system is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed system/terminal device and method may be implemented in other manners. For example, the system/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (8)

1. A blockchain-based lottery method, comprising:
randomly generating a pair of public key and private key according to an intelligent contract, disclosing the public key on a blockchain, and initializing a hash value in the intelligent contract; wherein the intelligent contract corresponds to a lottery activity and is used for guaranteeing the non-falsification of the lottery method;
encrypting and hashing the random character strings uploaded to the blockchain by each participant of the lottery activity, and updating the hash value in the intelligent contract according to the result of the hashing operation;
encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract;
wherein encrypting and hashing the random string uploaded to the blockchain by each participant of the lottery and updating the hash value in the smart contract with the result of the hashing, comprising: encrypting the initialized hash value in the intelligent contract by using a random character string S1 uploaded to the blockchain by a first participant according to the time sequence of participation of the participant in the lottery activity to obtain a first ciphertext P1, carrying out hash operation on the first ciphertext P1, and replacing the initialized hash value in the intelligent contract by an operation result obtained by carrying out hash operation on the first ciphertext P1 to obtain a first updated hash value in the intelligent contract;
encrypting an ith-1 updated hash value by using a random character string Si uploaded to the blockchain by an ith participant to obtain an ith ciphertext Pi, carrying out hash operation on the ith ciphertext Pi, and replacing the ith-1 updated hash value in the intelligent contract by an operation result obtained after carrying out hash operation on the ith ciphertext Pi to obtain an ith updated hash value; wherein 1< i < m, m is the total number of people participating in the lottery;
and by analogy, encrypting the m-1 updated hash value by using the random string Sm uploaded to the blockchain by the mth participant to obtain an mth ciphertext Pm, carrying out hash operation on the mth ciphertext Pm, and replacing the m-1 updated hash value in the intelligent contract by using an operation result obtained after carrying out hash operation on the mth ciphertext Pm to obtain the mth updated hash value.
2. The blockchain-based lottery method of claim 1, wherein the randomly generating a pair of public and private keys according to a smart contract and disclosing the public key on a blockchain, prior to initializing a hash value in the smart contract, further comprises:
initiating a lottery and setting a number of participants for the lottery.
3. The blockchain-based lottery method of claim 1, wherein the encrypting and hashing the random string uploaded to the blockchain by each participant of the lottery activity and updating the hash value in the smart contract with the result of the hashing may further be:
uploading all participants of the lottery to the random character string of the block chain for splicing, and encrypting the initialized hash value in the intelligent contract by using the spliced random character string to obtain a ciphertext P;
and carrying out hash operation on the ciphertext P, and replacing the initialized hash value in the intelligent contract with an operation result obtained by carrying out hash operation on the ciphertext P to obtain an updated hash value in the intelligent contract.
4. A blockchain-based lottery method as in any of claims 1-3, wherein encrypting the updated hash value in the smart contract using the private key to obtain a private key encrypted ciphertext and further updating the hash value in the smart contract with the result of the hash operation on the private key encrypted ciphertext D, determining the number of winning participants from the further updated hash value in the smart contract comprises:
encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext;
performing hash operation on the private key encryption ciphertext to obtain a result obtained by performing hash operation on the private key encryption ciphertext, and further updating a hash value in the intelligent contract;
and converting the further updated hash value in the intelligent contract into 256-bit unsigned integer K, and obtaining the number of winning participants by modulo the number m of the participants of the lottery activity through the unsigned integer K.
5. A blockchain-based lottery system, comprising:
the generation module is used for randomly generating a pair of public keys and private keys according to the intelligent contract, disclosing the public keys on a blockchain and initializing a hash value in the intelligent contract; wherein the intelligent contract corresponds to a lottery activity and is used for guaranteeing the non-falsification of the lottery method;
the participation module is used for encrypting and hashing the random character strings uploaded to the blockchain by each participant in the lottery, and updating the hash value in the intelligent contract according to the result of the operation;
the determining module is used for encrypting the updated hash value in the intelligent contract by using the private key to obtain a private key encrypted ciphertext, further updating the hash value in the intelligent contract by using a result obtained by carrying out hash operation on the private key encrypted ciphertext, and determining the number of the winning participant by the further updated hash value in the intelligent contract;
wherein the participation module comprises:
the first participation unit is used for encrypting the initialized hash value in the intelligent contract by using the random character string S1 uploaded to the blockchain by the first participant according to the time sequence of participation of the participant in the lottery activity to obtain a first ciphertext P1, carrying out hash operation on the first ciphertext P1, and replacing the initialized hash value in the intelligent contract by an operation result obtained by carrying out hash operation on the first ciphertext P1 to obtain a first updated hash value in the intelligent contract;
the ith participation unit is used for encrypting the ith-1 updated hash value by using the random character string Si uploaded to the blockchain by the ith participant to obtain an ith ciphertext Pi, carrying out hash operation on the ith ciphertext Pi, and replacing the ith-1 updated hash value in the intelligent contract by using an operation result obtained after carrying out hash operation on the ith ciphertext Pi to obtain an ith updated hash value; wherein 1< i < m, m is the total number of people participating in the lottery;
and the mth participation unit is used for analogically encrypting the mth-1 updated hash value by using the random character string Sm uploaded to the blockchain by the mth participant to obtain an mth ciphertext Pm, carrying out hash operation on the mth ciphertext Pm, and replacing the mth-1 updated hash value in the intelligent contract by using an operation result obtained after carrying out hash operation on the mth ciphertext Pm to obtain an mth updated hash value.
6. The blockchain-based lottery system of claim 5, wherein the participation module may further be:
the splicing encryption unit is used for splicing the random character strings uploaded to the blockchain by all participants of the lottery activities, and encrypting the initialized hash value in the intelligent contract by using the spliced random character strings to obtain a ciphertext P;
and the updating unit is used for carrying out hash operation on the ciphertext P, and replacing the initialized hash value in the intelligent contract with an operation result obtained by carrying out hash operation on the ciphertext P to obtain an updated hash value in the intelligent contract.
7. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1-4 when the computer program is executed.
8. A computer readable medium storing a computer program, characterized in that the computer program when executed by a process implements the steps of the method according to any one of claims 1-4.
CN202310866168.XA 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain Pending CN116739660A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310866168.XA CN116739660A (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911191570.2A CN111008863B (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain
CN202310866168.XA CN116739660A (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201911191570.2A Division CN111008863B (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain

Publications (1)

Publication Number Publication Date
CN116739660A true CN116739660A (en) 2023-09-12

Family

ID=70112332

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201911191570.2A Active CN111008863B (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain
CN202310866168.XA Pending CN116739660A (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201911191570.2A Active CN111008863B (en) 2019-11-28 2019-11-28 Lottery drawing method and system based on block chain

Country Status (1)

Country Link
CN (2) CN111008863B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113761586A (en) * 2020-06-28 2021-12-07 北京同邦卓益科技有限公司 Method and device for randomly sampling and inspecting articles based on block chain
CN111884807B (en) * 2020-07-13 2021-10-26 腾讯科技(深圳)有限公司 Article reservation method, apparatus, device and medium based on block chain
CN111865587B (en) * 2020-08-07 2021-08-31 腾讯科技(深圳)有限公司 Data processing method, block link point device, electronic device, and computer program
CN112118107B (en) * 2020-08-12 2021-08-27 北京大学 Self-adaptive execution method for realizing data credibility
CN112712632B (en) * 2020-11-17 2022-03-15 中科扶云(杭州)科技有限公司 Random shaking number processing method and device, electronic device and storage medium
CN112527244A (en) * 2020-12-18 2021-03-19 上海万向区块链股份公司 Distributed lottery system and method based on verifiable delay function
CN113269570B (en) * 2021-06-11 2024-04-09 深圳番多拉信息科技有限公司 Extraction result verification method and related device
CN114726534A (en) * 2022-03-28 2022-07-08 海南格子山网络科技有限公司 Method for realizing intelligent contract drawing based on Solana block chain technology
CN115953199B (en) * 2023-03-10 2023-05-23 青岛网信信息科技有限公司 Marketing campaign method, medium and system for user packaging prize

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201620691D0 (en) * 2016-12-05 2017-01-18 Quanta Tech Ltd Random number generation
CN109360091B (en) * 2018-08-30 2020-09-01 阿里巴巴集团控股有限公司 Random object selection method and device based on block chain
CN109389399A (en) * 2018-10-18 2019-02-26 深圳前海乐寻坊区块链科技有限公司 Lottery industry method, apparatus, computer equipment and storage medium based on block chain
US20190057572A1 (en) * 2018-10-20 2019-02-21 R. Jay Carpenter Method of selecting a contest winner
CN109767271B (en) * 2019-01-18 2023-07-04 众安信息技术服务有限公司 Lottery method and equipment based on block chain
CN109847365B (en) * 2019-01-24 2022-08-12 湖南天河国云科技有限公司 Anti-cheating method and system for block chain application
CN110164021B (en) * 2019-06-13 2019-11-12 北京艾摩瑞策科技有限公司 A kind of random lottery drawing method and equipment of application block chain
CN110445603B (en) * 2019-06-28 2022-08-26 成都鹰翔天际科技有限公司 Decentralized random number generation method
CN110445616B (en) * 2019-07-15 2022-03-04 杭州复杂美科技有限公司 Block packing node packing sequence determining method, equipment and storage medium

Also Published As

Publication number Publication date
CN111008863B (en) 2023-09-05
CN111008863A (en) 2020-04-14

Similar Documents

Publication Publication Date Title
CN111008863B (en) Lottery drawing method and system based on block chain
WO2021046668A1 (en) Blockchain system, information transmission method, system and apparatus, and computer medium
CN112152794A (en) Efficient post-quantum anonymous attestation with signature-based join protocol and infinite signatures
EP3857814A1 (en) Computer-implemented system and method for transferring access to digital resource
CN111950030A (en) Data sharing storage method based on block chain, terminal equipment and storage medium
CN112769548B (en) Block chain numerical information transmission method, system, device and computer medium
CN109361508A (en) Data transmission method, electronic equipment and computer readable storage medium
CN110224984A (en) A kind of multi-party authorization method and device based on block chain technology
CN111488134B (en) Public random number generation method and device based on block chain
CN112101944A (en) Efficient privacy payment implementation method and device, computer equipment and storage medium
US20230237437A1 (en) Apparatuses and methods for determining and processing dormant user data in a job resume immutable sequential listing
CN111538479A (en) Random parameter generation method and device in label opening process
CN110210591A (en) A kind of wiring method, computer installation and the computer readable storage medium of intellective IC card personal data
CN112100144A (en) Block chain file sharing method and device, storage medium and electronic equipment
CN113939821A (en) System and method for non-parallel mining on a workload justification blockchain network
US11784822B2 (en) System and method for transmitting a notification to a network
CN110515591B (en) Random number generation method and device based on block chain
CN112487464A (en) Encrypted data sharing method and device based on block chain
CN111949737A (en) Block chain-based data integrity verification method, terminal device and storage medium
WO2013153628A1 (en) Calculation processing system and calculation result authentication method
CA3011477A1 (en) Method, system, and device for selecting a winner of a raffle based on content from raffle tickets
CN113055178B (en) Block chain system, and method, system, device and medium for transmitting numerical information
CN114640463A (en) Digital signature method, computer equipment and medium
US9842086B2 (en) Calculation device, calculation method, and program
EP4111299A1 (en) Method and device for generating random numbers

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