A data processing method and device
By using blockchain technology during the car lottery process to generate and verify lottery blocks, the problems of opacity and data reliability of the lottery process are solved, and fair and transparent lottery results are achieved.
Patent Information
- Application Number
- CN201911205424.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-29
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2040-01-05
AI Technical Summary
The car lottery process is opaque, which makes it impossible to guarantee the data reliability of the lottery results, and is easily tampered with by criminals.
By obtaining the user information of the lottery user, assigning the corresponding lottery information, and sending the user information and lottery information to the blockchain node, generating the lottery block, and using the blockchain's timestamp and hash value to determine the hit number, ensuring that each The hit probability of individual users is the same, which improves data reliability.
Ensure the transparency and reliability of the car lottery results, prevent tampering, and improve the fairness of user participation.
Smart Images

Figure CN110968644B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a data processing method and device. Background Art
[0002] With the development of society, the number of cars has increased year by year, especially in first-tier cities. The rapid growth of car ownership has led to traffic jams in cities, causing great trouble to people's travel. In order to curb the increase in the number of motor vehicles, relevant departments have introduced a car lottery policy to ease traffic pressure. The car lottery is essentially a lottery method, and everyone has equal opportunities. However, in actual operations, due to the opacity of the operation process and the opacity of the lottery rules, lottery users cannot view the specific process of the lottery, resulting in illegal elements conducting secret operations to interfere with the lottery results, and the data reliability of the lottery results cannot be guaranteed. Summary of the invention
[0003] The embodiments of the present application provide a data processing method and device, which can improve the data reliability of car lottery results.
[0004] On the one hand, an embodiment of the present application provides a data processing method, which may include:
[0005] Obtain user information of lottery users, and assign corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery users;
[0006] Sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain;
[0007] Obtain a block from the blockchain whose block generation timestamp is later than the lottery deadline as the target block, and determine the winning number based on the hash value of the target block;
[0008] According to the hitting number, the target lottery information is determined from the lottery block, and the user information corresponding to the target lottery information is determined as the hitting user.
[0009] The steps of obtaining user information of lottery users and assigning corresponding lottery information to the user information include:
[0010] Obtain the user information of the lottery user. If the lottery user is the first lottery user, determine the initial number as the lottery information corresponding to the user information;
[0011] If the user who draws the lottery is not the first one, the lottery information corresponding to the user information is generated based on the lottery information of the previous user who drew the lottery.
[0012] The step of sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node includes:
[0013] Using a lottery private key, encrypt at least one user information and at least one lottery information associated with the user information to generate a lottery ciphertext;
[0014] The lottery ciphertext is sent to the blockchain node in the blockchain so that the blockchain node generates a lottery block based on the lottery ciphertext.
[0015] Among them, a block with a block generation timestamp later than the lottery deadline is obtained from the blockchain as the target block, and the hit number is determined according to the hash value of the target block, including:
[0016] Obtain a block from the blockchain whose block generation timestamp is later than the lottery deadline as the target block, and obtain the hash value corresponding to the target block;
[0017] Determine the number of users participating in the lottery based on all user information in the lottery block;
[0018] Through numerical conversion, the hash value is converted into a decimal number corresponding to the hash value, and the hit number is determined based on the decimal number and the number of users.
[0019] Among them, through numerical conversion, the hash value is converted into a decimal number corresponding to the hash value, and the hit number is determined according to the decimal number and the number of users, including:
[0020] Through numerical conversion, the decimal number corresponding to the generated hash value is converted;
[0021] The target value is determined according to the decimal number, and the target value is modulo operation is performed according to the number of users to generate a hit number; the hit number is less than or equal to the number of users.
[0022] Among them, according to the hit number, the target lottery information is determined from the lottery block, and the user information corresponding to the target lottery information is determined as the hit user, including:
[0023] Obtaining a lottery block storing at least one user information and at least one lottery information from the blockchain, and obtaining at least one lottery information from the lottery block;
[0024] The lottery information identical to the winning number is determined as the target lottery information, and the user information associated with the target lottery information is determined as the winning user.
[0025] The method of obtaining a lottery block storing at least one user information and at least one lottery information from a blockchain, and obtaining at least one lottery information from the lottery block includes:
[0026] Obtain a lottery public key corresponding to a lottery private key, and obtain a lottery block storing at least one user information and at least one lottery information from the blockchain according to the address information corresponding to the lottery public key;
[0027] Obtain lottery ciphertext from the lottery block, decrypt the lottery ciphertext using the lottery public key, and generate lottery information associated with at least one user information and at least one user information.
[0028] On the one hand, an embodiment of the present application provides a data processing device, which may include:
[0029] An information allocation unit is used to obtain user information of lottery users and allocate corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery users;
[0030] An information sending unit, used to send at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain;
[0031] A block acquisition unit is used to acquire a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and determine the winning number according to the hash value of the target block;
[0032] The information confirmation unit is used to determine the target lottery information from the lottery block according to the hit number, and determine the user information corresponding to the target lottery information as the hit user.
[0033] The information distribution unit is specifically used for:
[0034] Obtain the user information of the lottery user. If the lottery user is the first lottery user, determine the initial number as the lottery information corresponding to the user information;
[0035] If the user who draws the lottery is not the first one, the lottery information corresponding to the user information is generated based on the lottery information of the previous user who drew the lottery.
[0036] The information sending unit is specifically used for:
[0037] Using a lottery private key, encrypt at least one user information and at least one lottery information associated with the user information to generate a lottery ciphertext;
[0038] The lottery ciphertext is sent to the blockchain node in the blockchain so that the blockchain node generates a lottery block based on the lottery ciphertext.
[0039] The block acquisition unit includes:
[0040] The block acquisition subunit is used to obtain a block whose block generation timestamp is later than the lottery deadline from the blockchain as the target block, and obtain the hash value corresponding to the target block; according to all the user information in the lottery block, determine the number of users participating in the lottery;
[0041] The numerical conversion subunit is used to convert the hash value into a decimal number corresponding to the hash value through numerical conversion, and determine the hit number according to the decimal number and the number of users.
[0042] The numerical conversion subunit is specifically used for:
[0043] Through numerical conversion, the decimal number corresponding to the generated hash value is converted;
[0044] The target value is determined according to the decimal number, and the target value is modulo operation is performed according to the number of users to generate a hit number; the hit number is less than or equal to the number of users.
[0045] The information confirmation unit includes:
[0046] An information acquisition subunit, used to acquire a lottery block storing at least one user information and at least one lottery information from the blockchain, and acquire at least one lottery information from the lottery block;
[0047] The information confirmation subunit is used to determine the lottery information that is the same as the winning number as the target lottery information, and determine the user information associated with the target lottery information as the winning user.
[0048] The information acquisition subunit is specifically used for:
[0049] Obtain a lottery public key corresponding to a lottery private key, and obtain a lottery block storing at least one user information and at least one lottery information from the blockchain according to the address information corresponding to the lottery public key;
[0050] Obtain lottery ciphertext from the lottery block, decrypt the lottery ciphertext using the lottery public key, and generate lottery information associated with at least one user information and at least one user information.
[0051] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0052] On the one hand, an embodiment of the present application provides a computer device, including a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0053] In an embodiment of the present application, by obtaining user information of a lottery user, assigning corresponding lottery information to the user information, sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain; obtaining a block from the blockchain with a block generation timestamp later than the lottery deadline as a target block, and determining the hit number according to the hash value of the target block; according to the hit number, determining the target lottery information from the lottery block, and determining the user information corresponding to the target lottery information as the hit user. The target block with a timestamp later than the lottery deadline is unpredictable and cannot be tampered with for the lottery user, and the hit user is obtained according to the hash value of the target block, and the probability of each user being hit is the same, which improves the data reliability of the car lottery result. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1a It is a system architecture diagram of data processing provided by an embodiment of the present application;
[0056] Figure 1b This is a schematic diagram of a distributed system scenario provided by an embodiment of the present application;
[0057] Figure 1c It is a structural diagram of a block structure provided in an embodiment of the present application;
[0058] Figure 2 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0059] Figure 3 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0060] Figure 4 It is a schematic diagram of a data processing scenario provided by an embodiment of the present application;
[0061] Figure 5 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0062] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0064] See also Figure 1a , is a system architecture diagram of data processing provided by an embodiment of the present invention. The blockchain network 10h establishes a connection with a user terminal cluster through a communication bus 10d, and the user terminal cluster may include: user terminal 10a, user terminal 10b, ..., user terminal 10c. The blockchain network 10h includes blockchain nodes 10f, ..., and blockchain nodes 10g. The server 10e obtains user information of lottery users through user terminals, assigns corresponding lottery information to the user information, and sends at least one user information and at least one lottery information respectively associated with the user information to the blockchain node. The blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain; the server 10e obtains a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and determines the hit number according to the hash value of the target block; according to the hit number, the server 10e determines the target lottery information from the lottery block, and determines the user information corresponding to the target lottery information as the hit user.
[0065] The server involved in the embodiments of the present application may include a server with data processing and storage functions, specifically a background server of a lottery platform, and the user terminals include: tablet computers, smart phones, personal computers (PCs), laptop computers, PDAs and other terminal devices.
[0066] The blockchain involved in the embodiments of this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. The blockchain can include the blockchain underlying platform, platform product service layer and application service layer.
[0067] The underlying blockchain platform can include processing modules such as user management, basic services, and smart contracts. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, supervises and audits the transaction of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records the valid requests to the storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate the request (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management), and transmits it to the shared account book in a complete and consistent manner after encryption (network communication), and records and stores it; the smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a certain programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, call the key or other events to trigger the execution and complete the contract logic. At the same time, it also provides the function of contract upgrade and cancellation.
[0068] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.
[0069] The following will be combined Figure 1b and Figure 1c , which is a specific implementation scenario provided by the embodiment of the present application. The blockchain network involved in the embodiment of the present invention can be a distributed system formed by connecting a client and multiple nodes (any form of computing devices in the access network, such as a server, a user terminal) through network communication.
[0070] Take the distributed system as the blockchain system as an example, see Figure 1b , Figure 1b This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system, which is formed by multiple nodes (any form of computing devices in the access network, such as servers, user terminals) and clients, and the nodes form a peer-to-peer (P2P, PeerTo Peer) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP, Transmission Control Protocol) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0071] See also Figure 1b The functions of each node in the blockchain system shown include:
[0072] 1) Routing: a basic function of a node, used to support communication between nodes.
[0073] In addition to the routing function, the node can also have the following functions:
[0074] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0075] For example, the services implemented by the application include:
[0076] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0077] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.
[0078] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0079] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0080] See also Figure 1c , Figure 1cThis is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. The blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0081] See also Figure 2 , which is a flow chart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps S101-S104.
[0082] S101, obtaining user information of a lottery user, and assigning corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery user;
[0083] Specifically, the data processing device obtains the user information of the lottery user and assigns corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery user. It can be understood that the lottery user is a user participating in a lottery activity, and the lottery activity can specifically be a car license plate lottery, or other lottery activities. The user information is the user name corresponding to the lottery user. The user information is registered by the lottery user before the lottery activity, and has a one-to-one correspondence with the lottery user. Specifically, it can be the user's ID card information. The lottery information is the information assigned to the user when the user participates in the lottery activity and corresponds to the user information. Specifically, it can be a digital number. The lottery information is generated according to the lottery order of the lottery user, and can specifically be numbered according to the time sequence of the user's participation in the lottery activity. For example, the user logs in to the lottery official website to participate in the lottery activity. The system will assign the lottery information according to the time when the user makes an appointment for the lottery. Specifically, if the user is the first to make an appointment for the lottery, the lottery information assigned to the user is "0"; if the user is not the first to make an appointment for the lottery, and the lottery information of the previous user is "5", the lottery information assigned to the user is "6".
[0084] S102, sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain;
[0085] Specifically, the data processing device sends at least one user information and at least one lottery information respectively associated with the user information to the blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain. It can be understood that one user information is associated with one lottery information, that is, the user information and the lottery information are one-to-one corresponding. The data processing device sends multiple user information and the lottery information respectively corresponding to the multiple user information to the blockchain node. The blockchain node is a server in the blockchain that processes data and maintains the normal operation of the blockchain. The blockchain can include multiple nodes, and the information between the nodes can be shared. It should be noted that the data processing device can send all the user information and lottery information to the blockchain node at one time, or it can send the user information and the lottery information corresponding to the user information to the blockchain node multiple times. After the blockchain node receives the user information and the node information, it will send the user information and the lottery information corresponding to the user information to the blockchain node based on the information to A lottery block is generated with at least one user information and at least one lottery information, and the lottery block is added to the blockchain. The lottery block is used to store user information and lottery information corresponding to the user information. Specifically, if the data processing device sends all user information and lottery information to the blockchain node at one time, the generated lottery block includes all user information and lottery information corresponding to the user information. If the data processing device sends one user information and the lottery information corresponding to the above user information to the blockchain node each time, the lottery block generated based on this user information and lottery information includes one user information and lottery information. There is no limit to the amount of user information sent by the data processing device each time. Sending user information and lottery information multiple times at the same time will generate multiple corresponding lottery blocks. The lottery block includes a block header and a block body. The block header includes the version number, timestamp and hash address of the previous block of the blockchain, and the block body is used to store user information and lottery information.
[0086] S103, obtaining a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and determining the winning number according to the hash value of the target block;
[0087] Specifically, the data processing device obtains a block whose block generation timestamp is later than the lottery deadline from the blockchain as the target block, and determines the winning number based on the hash value of the target block. It can be understood that the lottery deadline is the deadline of the lottery activity, and the target block is a block whose generation time is later than the lottery deadline. Because the generation time of the target block is later than the lottery deadline, when the lottery user signs up to participate in the lottery, the target block has not been generated yet, so the hash value of the target block cannot be known in advance, and thus the lottery result cannot be known in advance, which improves the data reliability of the lottery result; the timestamp is stored in the block header of the block, and when the lottery result is announced At a certain time, a block with a block generation timestamp later than the lottery deadline is obtained from the blockchain as the target block. For example, the lottery deadline is eight o'clock in the morning, and the lottery result is announced at nine o'clock, then a block with a block generation timestamp between eight and nine o'clock is obtained from the blockchain as the target block. It should be noted that the blocks that meet the timestamp later than the lottery deadline may include multiple blocks, and one can be randomly selected from the multiple blocks as the target block, or one can be selected as the target block in the order of timestamps, and the hash value of the target block is obtained, and the hit number is determined according to the hash value. The hit number is a digital number, and the hit number corresponds to a lottery information.
[0088] S104, according to the hit number, determine the target lottery information from the lottery block, and determine the user information corresponding to the target lottery information as the hit user.
[0089] Specifically, the data processing device determines the target lottery information from the lottery block according to the hitting number, and determines the user information corresponding to the target lottery information as the hit user. It can be understood that the hitting number and the lottery information have the same format, which can be specifically a digital number corresponding to the lottery information. The data processing device obtains multiple lottery information participating in the lottery activity and the user information corresponding to the multiple lottery information from the lottery block, and determines the target lottery information from the multiple lottery information according to the hitting number. Specifically, the lottery information identical to the hitting number can be determined as the target lottery information, and the user information corresponding to the target lottery information can be determined as the hit user.
[0090] In an embodiment of the present application, by obtaining user information of a lottery user, assigning corresponding lottery information to the user information, sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain; obtaining a block from the blockchain with a block generation timestamp later than the lottery deadline as a target block, and determining the hit number according to the hash value of the target block; according to the hit number, determining the target lottery information from the lottery block, and determining the user information corresponding to the target lottery information as the hit user. The target block with a timestamp later than the lottery deadline is unpredictable and cannot be tampered with for the lottery user, and the hit user is obtained according to the hash value of the target block, and the probability of each user being hit is the same, which improves the data reliability of the car lottery result.
[0091] See also Figure 3 , which is a flow chart of a data processing method provided in an embodiment of the present application. Figure 3 As shown, the method of the embodiment of the present application may include the following steps S201-S207.
[0092] S201, obtaining the user information of the lottery user. If the lottery user is the first lottery user, determining the initial number as the lottery information corresponding to the user information; if the lottery user is not the first lottery user, generating the lottery information corresponding to the user information based on the lottery information of the previous lottery user.
[0093] Specifically, the data processing device obtains the user information of the lottery user. If the lottery user is the first lottery user, the initial number is determined as the lottery information corresponding to the user information; if the lottery user is not the first lottery user, the lottery information corresponding to the user information is generated according to the lottery information of the previous lottery user. It can be understood that within a lottery registration cycle, the data processing device numbers the lottery users participating in the lottery. The number refers to a series of codes with a pre-set numbering rule, which can be numbers or letters, etc. The numbers can also correspond to data in other bases, such as binary data, decimal data, hexadecimal data, etc., and continuous numbers are usually used for numbering. Specifically, the data processing device obtains the user information of the lottery user. If If the lottery user is the first user to participate in the lottery during the lottery registration period, the initial number will be determined as the lottery information corresponding to the user information. The initial number refers to the first code in the pre-set series code. Specifically, if numbers are selected to number the lottery users, the initial number is "0", that is, the lottery information assigned to the first participating lottery user is "0"; if letters are selected to number the lottery users, the initial number is "a", that is, the lottery information assigned to the first participating lottery user is "a"; if the lottery user is not the first lottery user, the lottery information corresponding to the user information will be generated based on the lottery information of the previous lottery user. Specifically, the lottery information corresponding to the user information can be generated based on the numbering rules and the previous lottery information. For example, if the user currently participating in the lottery is not the first user, and numbers are used for numbering, the number of the previous user is "3", and the numbering rule is numerical sorting, then the lottery information generated for the current user is "4"; if letters are used for numbering, the number of the previous user is "c", and the numbering rule is alphabetical sorting, then the lottery information generated for the current user is "d".
[0094] S202, using a lottery private key to encrypt at least one user information and at least one lottery information associated with the user information to generate a lottery ciphertext;
[0095] Specifically, the data processing device uses a lottery private key to encrypt at least one user information and at least one lottery information respectively associated with the user information to generate a lottery ciphertext. It can be understood that the lottery private key is a non-public key in the asymmetric key cryptographic system, and is generated by an asymmetric encryption algorithm. The encryption algorithm includes: RSA encryption algorithm, elliptic curve encryption algorithm, etc. The data processing device uses a lottery private key to encrypt at least one user information and at least one lottery information respectively associated with the user information. The encryption process uses a preset encryption method to generate lottery ciphertext information from the user information and the lottery information. The lottery ciphertext information can be decrypted by the lottery public key corresponding to the lottery private key to generate user information and lottery information.
[0096] S203, sending the lottery ciphertext to the blockchain node in the blockchain, so that the blockchain node generates a lottery block based on the lottery ciphertext.
[0097] Specifically, the data processing device sends the lottery ciphertext to the blockchain node in the blockchain, so that the blockchain node generates a lottery block based on the lottery ciphertext. It can be understood that the data processing device sends the lottery ciphertext to the blockchain node in the blockchain, and the blockchain node generates a lottery block based on the lottery ciphertext, time information and the hash value of the previous block, and adds the lottery block as a new block to the blockchain.
[0098] S204, obtaining a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and obtaining a hash value corresponding to the target block; determining the number of users participating in the lottery based on all user information in the lottery block;
[0099] Specifically, the data processing device obtains a block whose block generation timestamp is later than the lottery deadline from the blockchain as the target block, and obtains a hash value corresponding to the target block; based on all the user information in the lottery block, the number of users participating in the lottery is determined. It can be understood that the lottery deadline is the deadline for the lottery activity. At the time point when the lottery result is announced, a block whose block generation timestamp is later than the lottery deadline is obtained from the blockchain as the target block. It should be noted that the blocks that meet the timestamp requirement later than the lottery deadline may include multiple blocks, and one can be randomly selected from the multiple blocks as the target block, or one can be selected in order of timestamps as the target block, and the hash value of the target block is obtained. All user information is obtained from the lottery block that stores user information, the amount of user information is counted, and the number of users participating in the lottery is determined. Specifically, the user data can be determined based on the largest lottery number corresponding to the user information. For example, if the largest lottery number is 99, it can be determined that the number of users participating in the lottery is 100.
[0100] S205, converting the hash value into a decimal number corresponding to the hash value, and determining the winning number according to the decimal number and the number of users.
[0101] Specifically, the data processing device generates a decimal number corresponding to the hash value from the hash value through numerical conversion, and determines the hit number according to the decimal number and the number of users. It can be understood that the data processing device generates a decimal number corresponding to the hash value through numerical conversion, that is, converts the binary number corresponding to the hash value into a decimal number, and determines the hit number according to the decimal number and the number of users;
[0102] The specific process of determining the winning number based on the decimal number and the number of users is as follows:
[0103] The target value is determined according to the decimal number. Specifically, a part of the decimal number segment can be selected as the target value. For example, when there is only one target block, the last ten digits of the decimal number corresponding to the target block can be selected as the target value. When there are multiple target blocks, the last ten digits of the decimal number corresponding to each target block in the multiple target blocks can be selected. The target value is generated according to multiple decimal numbers. For example, multiple decimal numbers can be added to generate the target value; the data processing device performs a modulo operation on the target value according to the number of users to generate a hit number. The hit number is less than or equal to the number of users, that is, the hit number can be used to determine the hit user. For example, the number of users is 99, and the target value is modulo 100 to generate the hit number, then the hit number is any number from 0 to 99.
[0104] S206, obtaining a lottery block storing at least one user information and at least one lottery information from the blockchain, and obtaining at least one lottery information from the lottery block;
[0105] Specifically, the data processing device obtains the lottery public key corresponding to the lottery private key, and obtains the lottery block corresponding to at least one user information and at least one lottery information from the blockchain according to the address information corresponding to the lottery public key; obtains the lottery ciphertext from the lottery block, uses the lottery public key to decrypt the lottery ciphertext, and generates at least one user information and at least one lottery information associated with the user information. It can be understood that the lottery public key is the secret key corresponding to the lottery private key. The lottery public key is a secret key disclosed in the asymmetric key cryptographic system and is generated by an asymmetric encryption algorithm. The encryption algorithm includes: RSA encryption algorithm, elliptic curve encryption algorithm, etc. The data processing device obtains the lottery public key corresponding to the lottery private key. The lottery public key can generate the address information corresponding to the lottery public key. According to the address information corresponding to the lottery public key, obtain the lottery block corresponding to the user information and the lottery information from the blockchain, and obtain the lottery ciphertext from the lottery block. The lottery ciphertext is generated by encrypting the lottery public key. The lottery ciphertext is decrypted by the lottery public key to generate at least one user information and at least one lottery information associated with the user information.
[0106] S207, determining the lottery information identical to the winning number as the target lottery information, and determining the user information associated with the target lottery information as the winning user.
[0107] Specifically, the data processing device determines the lottery information identical to the winning number as the target lottery information, and determines the user information associated with the target lottery information as the winning user. It can be understood that the winning number and the lottery information have the same format, which can be specifically a digital number corresponding to the lottery information. The data processing device obtains multiple lottery information participating in the lottery activity and the user information corresponding to the multiple lottery information from the lottery block, determines the lottery information identical to the winning number as the target lottery information, and determines the user information corresponding to the target lottery information as the winning user. Please refer to Figure 4 , which provides a schematic diagram of a data processing scenario for an embodiment of the present application. Figure 4 As shown, the data processing device obtains user information of the lottery user, assigns corresponding lottery information to the user information, the lottery information is a digital number, and the user information corresponds to the lottery information one-to-one, and sends at least one user information and at least one lottery information respectively associated with the user information to the blockchain node. For example, user information 1 and lottery information 1 corresponding to user information 1, user information 2 and lottery information 2 corresponding to user information 2,..., user information n and lottery information n corresponding to user information n are sent to the blockchain node, the blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain. The data processing device obtains a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, determines the hit number according to the hash value of the target block, the hit number is the same as the lottery information, and according to the hit number, determines the target lottery information from the lottery block, and determines the user information corresponding to the target lottery information as the hit user.
[0108] In an embodiment of the present application, by obtaining user information of a lottery user, assigning corresponding lottery information to the user information, sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain; obtaining a block from the blockchain with a block generation timestamp later than the lottery deadline as a target block, and determining the hit number according to the hash value of the target block; according to the hit number, determining the target lottery information from the lottery block, and determining the user information corresponding to the target lottery information as the hit user. The target block with a timestamp later than the lottery deadline is unpredictable and cannot be tampered with for the lottery user, and the hit user is obtained according to the hash value of the target block, and the probability of each user being hit is the same, which improves the data reliability of the car lottery result.
[0109] See also Figure 5 , which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. Figure 5As shown, the data processing device 1 of the embodiment of the present application may include: an information distribution unit 11, an information sending unit 12, a block acquisition unit 13, and an information confirmation unit 14.
[0110] The information allocation unit 11 is used to obtain user information of the lottery user and allocate corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery user;
[0111] Specifically, the information allocation unit 11 obtains the user information of the lottery user and allocates corresponding lottery information to the user information; the lottery information is generated according to the lottery order of the lottery user. It can be understood that the lottery user is a user participating in a lottery activity, and the lottery activity can specifically be a car license plate lottery, or other lottery activities. The user information is the user name corresponding to the lottery user. The user information is registered by the lottery user before the lottery activity, and has a one-to-one correspondence with the lottery user. Specifically, it can be the user's ID card information. The lottery information is the information allocated to the user when the user participates in the lottery activity and corresponds to the user information. Specifically, it can be a digital number. The lottery information is generated according to the lottery order of the lottery user, and can specifically be numbered according to the time sequence of the user's participation in the lottery activity. For example, the user logs in to the lottery official website to participate in the lottery activity. The system will allocate the lottery information according to the time when the user makes an appointment for the lottery. Specifically, if the user is the first to make an appointment for the lottery, the lottery information allocated to the user is "0"; if the user is not the first to make an appointment for the lottery, and the lottery information of the previous user is "5", the lottery information allocated to the user is "6".
[0112] An information sending unit 12, configured to send at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain;
[0113] See also Figure 5 , the information sending unit 12 of the embodiment of the present application may include: a block acquisition subunit 121, a value conversion subunit 122;
[0114] The block acquisition subunit 121 is used to obtain a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and obtain a hash value corresponding to the target block; according to all user information in the lottery block, determine the number of users participating in the lottery;
[0115] The numerical conversion subunit 122 is used to convert the hash value into a decimal number corresponding to the hash value through numerical conversion, and determine the hit number according to the decimal number and the number of users.
[0116] Specifically, the information sending unit 12 sends at least one user information and at least one lottery information respectively associated with the user information to the blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain. It can be understood that one user information is associated with one lottery information, that is, the user information and the lottery information are one-to-one corresponding. The data processing device sends multiple user information and the lottery information respectively corresponding to the multiple user information to the blockchain node. The blockchain node is a server that processes data in the blockchain and maintains the normal operation of the blockchain. The blockchain can include multiple nodes, and the information between the nodes can be shared. It should be noted that the data processing device can send all the user information and lottery information to the blockchain node at one time, or it can send the user information and the lottery information corresponding to the user information to the blockchain node multiple times. After the blockchain node receives the user information and the node information, based on At least one user information and at least one lottery information generate a lottery block, and the lottery block is added to the blockchain. The lottery block is used to store user information and lottery information corresponding to the user information. Specifically, if the data processing device sends all user information and lottery information to the blockchain node at one time, the generated lottery block includes all user information and lottery information corresponding to the user information. If the data processing device sends one user information and the lottery information corresponding to the above user information to the blockchain node each time, the lottery block generated according to this user information and lottery information includes one user information and lottery information. There is no limit to the amount of user information sent by the data processing device each time. Sending user information and lottery information multiple times will generate multiple corresponding lottery blocks. The lottery block includes a block header and a block body. The block header includes the version number, timestamp and hash address of the previous block of the blockchain, and the block body is used to store user information and lottery information.
[0117] The block acquisition unit 13 acquires a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and determines the winning number according to the hash value of the target block;
[0118] Specifically, the block acquisition unit 13 acquires a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and determines the hit number according to the hash value of the target block. It can be understood that the lottery deadline is the deadline of the lottery activity, and the target block is a block whose block generation time is later than the lottery deadline. The timestamp is stored in the block header of the block. At the time point when the lottery result is announced, a block whose block generation timestamp is later than the lottery deadline is acquired from the blockchain as the target block. For example, the lottery deadline The time is eight o'clock in the morning, and the time for announcing the lottery result is nine o'clock. Then, a block with a block generation timestamp between eight and nine o'clock is obtained from the blockchain as the target block. It should be noted that the blocks that meet the timestamp later than the lottery deadline may include multiple blocks. One can be randomly selected from the multiple blocks as the target block, or one can be selected as the target block in the order of timestamps. The hash value of the target block is obtained, and the hit number is determined according to the hash value. The hit number is a digital number, and the hit number corresponds to a lottery information.
[0119] The information confirmation unit 14 determines the target lottery information from the lottery block according to the hit number, and determines the user information corresponding to the target lottery information as the hit user.
[0120] See also Figure 5 , the information confirmation unit 14 of the embodiment of the present application may include: an information acquisition subunit 141, an information confirmation subunit 142;
[0121] The information acquisition subunit 141 is used to acquire a lottery block storing at least one user information and at least one lottery information from the blockchain, and acquire at least one lottery information from the lottery block;
[0122] The information confirmation subunit 142 is used to determine the lottery information that is the same as the winning number as the target lottery information, and determine the user information associated with the target lottery information as the winning user.
[0123] Specifically, the information confirmation unit 14 determines the target lottery information from the lottery block according to the hitting number, and determines the user information corresponding to the target lottery information as the hitting user. It can be understood that the hitting number and the lottery information have the same format, which can be specifically a digital number corresponding to the lottery information. The data processing device obtains multiple lottery information participating in the lottery activity and the user information corresponding to the multiple lottery information from the lottery block, and determines the target lottery information from the multiple lottery information according to the hitting number. Specifically, the lottery information identical to the hitting number can be determined as the target lottery information, and the user information corresponding to the target lottery information can be determined as the hitting user.
[0124] In an embodiment of the present application, by obtaining user information of a lottery user, assigning corresponding lottery information to the user information, sending at least one user information and at least one lottery information respectively associated with the user information to a blockchain node, so that the blockchain node generates a lottery block based on at least one user information and at least one lottery information, and adds the lottery block to the blockchain; obtaining a block from the blockchain with a block generation timestamp later than the lottery deadline as a target block, and determining the hit number according to the hash value of the target block; according to the hit number, determining the target lottery information from the lottery block, and determining the user information corresponding to the target lottery information as the hit user. The target block with a timestamp later than the lottery deadline is unpredictable and cannot be tampered with for the lottery user, and the hit user is obtained according to the hash value of the target block, and the probability of each user being hit is the same, which improves the data reliability of the car lottery result.
[0125] See also Figure 6 , which is a schematic diagram of the structure of a computer device according to an embodiment of the present application. Figure 6 As shown, the computer device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally be at least one storage device located away from the aforementioned processor 1001. As shown in FIG. Figure 6 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a data processing application program.
[0126] exist Figure 6 In the computer device 1000 shown in the figure, the network interface 1004 can provide a network communication function, the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the data processing application stored in the memory 1005 to implement the above Figure 2-Figure 4 The description of the data processing method in any corresponding embodiment will not be repeated here.
[0127] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 2-Figure 4The description of the data processing method in any corresponding embodiment can also be performed as described above. Figure 5 The description of the data processing device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here.
[0128] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above-mentioned Figure 2-Figure 4 The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0129] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0130] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: Obtain user information of lottery users, and assign corresponding lottery information to the user information; The lottery information is generated according to the lottery order of the lottery users; Sending at least one user information and lottery information respectively associated with the at least one user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain; Obtain a block whose block generation timestamp is later than the lottery deadline from the blockchain as the target block, and obtain a hash value corresponding to the target block; When the blocks satisfying the requirement that the generation timestamp is later than the lottery deadline include multiple blocks, the target block is randomly selected from the multiple blocks, and the target block is a block stored in the blockchain; Determine the number of users participating in the lottery according to the largest lottery number corresponding to the user information stored in the lottery block; The lottery number is determined based on the time sequence in which users participate in the lottery activity; Convert the hash value into a decimal number, select a part of the decimal number as a target value, and perform a modulo operation on the target value and the number of users to generate a hit number; the hit number is any number less than or equal to the number of users; Obtain the lottery block stored in the blockchain, determine target lottery information from the lottery block according to the winning number, and determine the user information corresponding to the target lottery information as the winning user; the winning number has the same format as at least one lottery information stored in the lottery block.
2. The method according to claim 1, characterized in that The obtaining user information of the lottery user and assigning corresponding lottery information to the user information includes: Obtain user information of the lottery user, and if the lottery user is the first lottery user, determine the initial number as the lottery information corresponding to the user information; If the user who draws the lottery is not the first user who draws the lottery, the lottery information corresponding to the user information is generated according to the lottery information of the previous user who drew the lottery.
3. The method according to claim 1, characterized in that The sending the at least one user information and the lottery information respectively associated with the at least one user information to the blockchain node includes: Using a lottery private key, encrypting the at least one user information and the lottery information respectively associated with the at least one user information to generate a lottery ciphertext; The lottery ciphertext is sent to a blockchain node in the blockchain so that the blockchain node generates the lottery block based on the lottery ciphertext.
4. The method according to claim 1, characterized in that: The obtaining of the lottery block stored in the blockchain, determining target lottery information from the lottery block according to the hit number, and determining user information corresponding to the target lottery information as a hit user, includes: Obtaining a lottery block corresponding to the at least one user information and the at least one lottery information from the blockchain, and obtaining the at least one lottery information from the lottery block; The lottery information identical to the winning number is determined as the target lottery information, and the user information associated with the target lottery information is determined as the winning user.
5. The method according to claim 4, characterized in that The obtaining, from the blockchain, a lottery block storing the at least one user information and the at least one lottery information, and obtaining the at least one lottery information from the lottery block includes: Obtaining a lottery public key corresponding to a lottery private key, and obtaining a lottery block storing the at least one user information and the at least one lottery information from the blockchain according to the address information corresponding to the lottery public key; Obtain a lottery ciphertext from the lottery block, decrypt the lottery ciphertext using the lottery public key, and generate the at least one user information and the lottery information associated with the at least one user information.
6. A data processing device, characterized in that: include: An information allocation unit, used to obtain user information of lottery users and allocate corresponding lottery information to the user information; The lottery information is generated according to the lottery order of the lottery users; An information sending unit, configured to send at least one user information and lottery information respectively associated with the at least one user information to a blockchain node, so that the blockchain node generates a lottery block based on the at least one user information and the at least one lottery information, and adds the lottery block to the blockchain; A block acquisition unit, used to acquire a block whose block generation timestamp is later than the lottery deadline from the blockchain as a target block, and acquire a hash value corresponding to the target block; When the blocks satisfying the requirement that the generation timestamp is later than the lottery deadline include multiple blocks, the target block is randomly selected from the multiple blocks, and the target block is a block stored in the blockchain; The block acquisition unit is further used to determine the number of users participating in the lottery according to the largest lottery number corresponding to the user information stored in the lottery block; the lottery number is determined according to the time sequence of the users participating in the lottery activity; The block acquisition unit is further used to convert the hash value into a decimal number, select a part of the decimal number as a target value, and perform a modulo operation on the target value and the number of users to generate a hit number; the hit number is any number less than or equal to the number of users; An information confirmation unit is used to obtain the lottery block stored in the blockchain, determine the target lottery information from the lottery block according to the hitting number, and determine the user information corresponding to the target lottery information as the hitting user; the hitting number has the same format as at least one lottery information stored in the lottery block.
7. A computer-readable storage medium, characterized in that: The computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 5 is executed.
8. A computer device, characterized in that: It is characterized in that it comprises: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 5.
