CN111259428A - Data processing method and device based on block chain, node equipment and storage medium - Google Patents

Data processing method and device based on block chain, node equipment and storage medium Download PDF

Info

Publication number
CN111259428A
CN111259428A CN202010076711.2A CN202010076711A CN111259428A CN 111259428 A CN111259428 A CN 111259428A CN 202010076711 A CN202010076711 A CN 202010076711A CN 111259428 A CN111259428 A CN 111259428A
Authority
CN
China
Prior art keywords
random number
terminal
encrypted
target
block chain
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
CN202010076711.2A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010076711.2A priority Critical patent/CN111259428A/en
Publication of CN111259428A publication Critical patent/CN111259428A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the invention discloses a data processing method, a device, node equipment and a storage medium based on a block chain, wherein the method comprises the following steps: acquiring an encrypted random number from a trusted server, uploading the encrypted random number to a block chain, receiving a random number prediction request sent by a second terminal, acquiring a target key corresponding to the encrypted random number when a processing condition is detected to be met, and decrypting the encrypted random number stored in the block chain by adopting the target key to obtain the target random number; and comparing the prediction number in the random number prediction request with the target random number, and if the comparison is consistent, determining the second terminal as the target terminal. By implementing the method, the block chain can be adopted to control the random number prediction process, so that the transparency of the random number prediction process and the authenticity of the prediction result are improved.

Description

Data processing method and device based on block chain, node equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method and apparatus based on a block chain, a node device, and a storage medium.
Background
At present, random number prediction becomes an entertainment mode which is more and more favored by people, and in the existing random number prediction process, an executor can store a target random number in a secret manner in advance and input a prediction number by a participant for prediction.
However, in the above manner, since the random number is secret, a participant cannot know whether the target random number preset in the participation process is changed, and the authenticity of the target random number cannot be finally determined due to the opacity of the random number in the participation process, so that the transparency of the random number prediction process is improved during the random number prediction, and the authenticity of the prediction result is further improved.
Disclosure of Invention
The embodiment of the invention provides a data processing method, a data processing device, node equipment and a storage medium based on a block chain, which can adopt the block chain to control the random number prediction process and improve the transparency of the random number prediction process and the authenticity of a prediction result.
In one aspect, an embodiment of the present invention provides a data processing method based on a block chain, where the method includes:
acquiring an encrypted random number from a trusted server, and uploading the encrypted random number to a block chain, wherein the encrypted random number is obtained by encrypting a target random number by the trusted server;
receiving a random number prediction request sent by a second terminal, wherein the random number prediction request carries a prediction number;
when the condition that the processing condition is met is detected, a target key corresponding to the encrypted random number is obtained, and the encrypted random number stored in the block chain is decrypted by adopting the target key to obtain the target random number;
and comparing the predicted number with the target random number, and if the comparison is consistent, determining the second terminal as a target terminal.
In another aspect, an embodiment of the present invention provides a data processing apparatus based on a block chain, where the apparatus includes:
the acquisition module is used for acquiring the encrypted random number from the trusted server;
the uploading module is used for uploading the encrypted random number to a block chain, wherein the encrypted random number is obtained by encrypting a target random number by the trusted server;
the receiving module is used for receiving a random number prediction request sent by a second terminal, wherein the random number prediction request carries a prediction number;
the obtaining module is further configured to obtain a target key corresponding to the encrypted random number when it is detected that a processing condition is satisfied;
the encryption module is used for decrypting the encrypted random number stored in the block chain by adopting the target key to obtain the target random number;
a comparison module for comparing the predicted number with the target random number;
and the determining module is used for determining the second terminal as a target terminal if the comparison is consistent.
In another aspect, an embodiment of the present invention provides a node device, including a processor, an input interface, an output interface, and a memory, where the processor, the input interface, the output interface, and the memory are connected to each other, where the memory is used to store a computer program, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method for processing data based on a blockchain.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the method for processing data based on a block chain.
In the embodiment of the invention, node equipment acquires an encrypted random number from a trusted server and uploads the encrypted random number to a block chain, the node equipment receives a random number prediction request sent by a second terminal, and when a processing condition is detected to be met, a target key corresponding to the encrypted random number is acquired, and the encrypted random number stored in the block chain is decrypted by adopting the target key to obtain the target random number; and the node equipment compares the prediction number in the random number prediction request with the target random number, and if the comparison is consistent, the second terminal is determined as the target terminal. By implementing the method, the block chain can be adopted to control the random number prediction process, so that the transparency of the random number prediction process and the authenticity of the prediction result are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a schematic structural diagram of a block chain according to an embodiment of the present invention;
FIG. 1b is a block chain-based data processing system according to an embodiment of the present invention;
fig. 1c is an interaction flow diagram of a data processing method based on a block chain according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data processing method based on a block chain according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another data processing method based on a blockchain according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a node device according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
At present, random number prediction becomes an entertainment mode which is more and more favored by people, and in the existing random number prediction process, an executor can store a target random number in a secret manner in advance and input a prediction number by a participant for prediction. However, in the above manner, since the target random number is secret, the participant cannot know whether the target random number preset in the participation process is changed, and the authenticity of the target random number cannot be finally determined due to the opacity of the target random number in the participation process, so that the transparency of the random number prediction process is improved during the random number prediction, and the authenticity of the prediction result is further improved.
Based on the above description, an embodiment of the present invention provides a data processing method based on a blockchain, where the data processing method is mainly implemented based on a blockchain technology, where a blockchain is a novel application of distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm, and other computer technologies, and is essentially a decentralized database, that is, a string of data blocks generated by using a cryptography method in association, and each data block contains a batch of transaction information for verifying the validity of the transaction information and generating a next block. The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and the identity information management comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like. Taking the block chain structure diagram shown in fig. 1a as an example, when new data needs to be written into the block chain, the data is collected into a block (block) and added to the end of the existing block chain, and the newly added block of each node is ensured to be identical through a consensus algorithm. The platform protocol data and/or the activity announcement data are recorded in each block, and the hash (hash) value of the previous block is also included, and all blocks store the hash value of the previous block in the way, and are connected in sequence to form a block chain. The hash value of the previous block is stored in the block head of the next block in the block chain, and when the data in the current block changes, the hash value of the current block also changes, so that the data uploaded to the block chain is difficult to tamper, the random number prediction is performed on the block chain, the public transparency of the prediction process is realized, and the reliability of the prediction result is improved.
Referring to fig. 1b, as shown in fig. 1b, a data processing system architecture based on a block chain according to an embodiment of the present invention includes a first terminal, a second terminal, a node device, and a block chain, where the block chain may specifically be composed of a plurality of block chain nodes, the first terminal may be a terminal used by a random number prediction executor, the second terminal may be a terminal used by a random number prediction participant, and the node device may specifically be a node in the block chain. The first terminal, the second terminal and the node device can be connected through a network. The first terminal, the second terminal, and the node device may be a client or a server, which is not limited in the embodiment of the present invention. Wherein, the client can be any one of the following: a terminal, a separate Application, an API (Application programming interface), or an SDK (Software Development Kit). Among others, the terminal may include but is not limited to: smart phones (such as Android phones, iOS phones, etc.), tablet computers, portable personal computers, Mobile Internet Devices (MID for short), and the like, which are not limited in the embodiments of the present invention.
Based on the data processing system based on the block chain described in fig. 1b, an embodiment of the present invention provides a method for performing interaction among devices in the data processing system, as shown in fig. 1c, which is an interaction flow diagram of the data processing method based on the block chain provided in the embodiment of the present invention, 101, a first terminal sends a random number acquisition request to a node device, where the random number acquisition request carries a public key of the first terminal; 102. the node equipment sends a random number acquisition request to a trusted server; 103. the trusted server generates a target random number and encrypts the target random number by adopting a target key to obtain an encrypted random number; 104. the trusted server sends the encrypted random number to the node equipment; 105. the node equipment uploads the encrypted random number to a block chain; 106. the second terminal sends a random number prediction request to the node equipment, wherein the random number prediction request carries a prediction number; 107. a first terminal sends a key acquisition request to node equipment; 108. the node equipment sends the key acquisition request to a trusted server; 109. the trusted server encrypts the target key by adopting the public key of the first terminal to obtain an encrypted target key, and sends the encrypted target key to the node equipment; 110. a first terminal sends a random number public request to node equipment, wherein the random number public request carries a private key of the first terminal; 111. the node equipment decrypts the encrypted target key by adopting a private key to obtain a target key, decrypts the encrypted random number by adopting the target key to obtain a target random number, and compares the random number with the predicted number to obtain a comparison result; 112. and the node equipment sends the comparison result to the first terminal and the second terminal.
In the above manner, before the random number is disclosed, no matter the random number prediction executor, the node device or the random number prediction participant can not know the random number, so that the confidentiality of the random number is ensured, and the encrypted random number is uploaded to the block chain at the beginning of prediction, so that the transparency of the random number prediction process is also ensured.
Based on the above description, an embodiment of the present invention provides a data processing method based on a block chain, please refer to fig. 2, where the data processing process based on the block chain may include the following steps S201 to S204:
s201, the node equipment acquires the encrypted random number from the trusted server and uploads the encrypted random number to the block chain.
In the embodiment of the invention, the encrypted random number is obtained by encrypting a target random number by a trusted server, the node device can be any node in a block chain, the trusted server can be specifically any one or more servers in a server cluster, and the server cluster forms a trusted execution environment, so that the execution environment of each server in the server cluster is a trusted execution environment, for example, the server cluster can be a server cluster with a safety coefficient higher than a preset threshold value and authenticated by an authority, and the node device can select one or more servers from the server cluster as the trusted server based on a load balancing principle and obtain the encrypted random number from the trusted server.
In a specific implementation, the node device may receive a random number acquisition request sent by the first terminal, and send the random number acquisition request to the trusted server in response to the random number acquisition request sent by the first terminal, where the random number acquisition request carries a public key of the first terminal. The method comprises the steps that after a trusted server receives a random number acquisition request, a random number and a target key used for encrypting the random number are generated, the server encrypts the random number by adopting the target key to obtain an encrypted random number, further, the server establishes a mapping relation between a received public key and the target key, and stores the target key, the public key and the mapping relation, so that the server can find the corresponding target key when receiving the public key again, further, the server returns the generated encrypted random number to node equipment, and the node equipment receives the encrypted random number returned by the server. It should be noted that the first terminal may specifically be a terminal used by a random number prediction executor, and when the first terminal sends a random number acquisition request to the node device, it is determined that random number prediction starts.
Further, after receiving the encrypted random number sent by the server, the node device may upload the encrypted random number to the block chain, where a specific manner for the node device to upload the encrypted random number to the block chain may be that the node device broadcasts the encrypted random number, so that a node in the block chain performs consensus check on the encrypted random number; if the node in the block chain checks the encrypted random number, the node equipment packs the encrypted random number into a first block and links the first block into the block chain.
S202, the node equipment receives a random number prediction request sent by the second terminal.
In the embodiment of the present invention, after uploading the encrypted random number to the block chain, the node device may receive random number prediction requests sent by a plurality of random number prediction participants using terminals, where each random number prediction request carries a prediction number, and the second terminal may be a terminal used by any one of the plurality of random number prediction participants.
And S203, when the condition that the processing condition is met is detected, the node equipment acquires a target key corresponding to the encrypted random number, and decrypts the encrypted random number stored in the block chain by adopting the target key to obtain the target random number.
In the embodiment of the present invention, after receiving the random number prediction request sent by the second terminal, the node device may detect whether the processing condition is currently satisfied, and if so, obtain the encrypted random key from the trusted server.
Specifically, the processing condition may include that the number of the random number prediction requests received by the node device is greater than a preset number, where the preset number may be specifically sent to the node device by the first terminal, for example, a random number prediction executor preset a random number prediction activity that can be performed by 100 people and sends the number 100 to the node device through the first terminal, and then after the node device receives 100 random number prediction requests, it is determined that the processing condition is currently satisfied. Or, the processing condition may include that the time length for the node device to receive the random number prediction request is longer than a preset time length, where the preset time length may be specifically sent to the node device by the first terminal, for example, the random number prediction executor sets an activity time length of a random number prediction activity to be 1 hour in advance, and sends the 1 hour to the node device through the first terminal, and then when the time length for the node device to receive the prediction request reaches 1 hour, it is determined that the processing condition is currently satisfied. Or, the node device may also receive a prediction end request sent by the first terminal, and when the prediction end request sent by the first terminal is received, detect whether the number of second blocks linked after the first block in the block chain is greater than a first preset number, and if the number of second blocks is greater than the first preset number, determine that the processing condition is satisfied. By the method, the block chain can be prevented from influencing the authenticity of the encrypted random number due to the bifurcation.
When the node device determines that the processing condition is currently satisfied, the node device may obtain a target key corresponding to the encrypted random number, and specifically, the node device may send a key obtaining request to the trusted server, where the key obtaining request is used to obtain the target key stored in the trusted server, and the key obtaining request carries the public key of the first terminal. After receiving the key acquisition request, the trusted server queries a target key corresponding to a public key based on the public key in the request and a pre-stored mapping relation, encrypts the target key by using the public key of the first terminal to obtain an encrypted target key, sends the encrypted target key to the node equipment, and receives the encrypted target key returned by the trusted server and uploads the encrypted target key to the block chain. Specifically, the node device broadcasts the encrypted target key, so that the node in the block chain performs consensus verification on the encrypted target key; and if the node in the block chain passes the verification of the encrypted target key, the node equipment packs the encrypted target key into a third block and links the third block into the block chain. Further, the node device obtains a private key of the first terminal, and decrypts the encrypted target key by using the private key of the first terminal to obtain the target key. In the specific implementation, the node device receives a random number disclosure request sent by a first terminal, responds to the random number disclosure request sent by the first terminal, and detects whether a random number disclosure condition is currently met, wherein the random number disclosure condition includes whether the number of fourth blocks linked behind the third block is greater than a second preset number, if so, the node device determines that the random number disclosure condition is met, and decrypts the encrypted target key by using a private key of the first terminal to obtain the target key. And then, the node equipment decrypts the encrypted random number stored in the block chain by adopting the target key to obtain the target random number. Further, the node device may upload the obtained target random number to the block chain, so that the first terminal and the second terminal access the target random number in the block chain.
And S204, the node equipment compares the predicted number with the target random number, and if the predicted number is consistent with the target random number, the second terminal is determined as the target terminal.
In the embodiment of the invention, after the node equipment acquires the target random number, the prediction number carried in the random number prediction request sent by the second terminal is compared with the target random number, and if the comparison is consistent, the node equipment determines the second terminal as the target terminal. Further, the node device may put the identification information of the target terminal into a target set, where the target set stores an identification of a terminal that inputs a correct prediction number, where the correct prediction number is the target random number, and further, the node device sends the target set to the first terminal, so that the first terminal sends reward information to terminals corresponding to each identification in the target set, where the reward information may specifically be a corresponding token, a congratulatory word, or the like.
In the embodiment of the invention, node equipment acquires an encrypted random number from a trusted server and uploads the encrypted random number to a block chain, the node equipment receives a random number prediction request sent by a second terminal, and when a processing condition is detected to be met, a target key corresponding to the encrypted random number is acquired, and the encrypted random number stored in the block chain is decrypted by adopting the target key to obtain the target random number; and the node equipment compares the prediction number in the random number prediction request with the target random number, and if the comparison is consistent, the second terminal is determined as the target terminal. By implementing the method, the target random number is uploaded to the block chain in advance in an encryption mode, so that a participant does not need to worry about the target random number being changed in the random number prediction process, the truth and effectiveness of the prediction process are ensured, and the transparency of the random number prediction process and the authenticity of a prediction result are improved.
Based on the above description, an embodiment of the present invention provides a data processing method based on a block chain, please refer to fig. 3, where the data processing process based on the block chain may include the following steps S301 to S309:
s301, the node device responds to the random number acquisition request sent by the first terminal and sends the random number acquisition request to the trusted server.
In the embodiment of the present invention, a first terminal may send a random number acquisition request to a node device, where the random number acquisition request carries a public key of the first terminal, and the node device receives the random number acquisition request, and sends the random number acquisition request to a trusted server in response to the random number acquisition request sent by the first terminal, so that the trusted server generates an encrypted random number according to the random number acquisition request, and establishes a mapping relationship between a target key for encryption and the public key of the first terminal.
In a specific implementation, the trusted server may be specifically any one or more servers in a server cluster, the server cluster constitutes a trusted execution environment, and the specific manner in which the node device determines the trusted server from the server cluster may be that the node device obtains a task amount corresponding to the random number obtaining request and load information of each server in the server cluster, where the load information includes at least one of a load amount, a memory, and a remaining load amount, where the load amount is a task amount corresponding to a task currently being processed by the server, and determines one or more servers from the server cluster as the trusted servers for generating the random number according to the task amount and the load information of each server. For example, after the node device obtains the task amount, it detects whether there is a server with a remaining load amount greater than the task amount in the server cluster, if there is a server with a remaining load amount greater than the task amount, then selects a server with a minimum load amount from the servers with a remaining load amount greater than the task amount as a trusted server, or selects a server with a maximum memory from the servers with a remaining load amount greater than the task amount as a trusted server, or selects a server with a maximum remaining load amount from the servers with a remaining load amount greater than the task amount as a trusted server, if there is no server with a remaining load amount greater than the task amount, then splits the random number generation request, and selects multiple servers as the trusted server based on a load balancing principle.
And S302, the node equipment receives the encrypted random number returned by the trusted server, establishes a mapping relation between the encrypted random number and the public key of the first terminal and stores the mapping relation.
In the embodiment of the invention, the node equipment can receive the encrypted random number returned by the trusted server, establish a mapping relation between the encrypted random number and the public key of the first terminal and then store the mapping relation, so that the encrypted random number can be conveniently inquired through the public key of the first terminal, and the encrypted random number is obtained by encrypting the target random number by the trusted server.
And S303, the node equipment uploads the encrypted random number to a block chain.
In the embodiment of the invention, after the node equipment acquires the encrypted random number, the node equipment can broadcast the encrypted random number so as to enable the node in the block chain to carry out consensus verification on the encrypted random number; if the node in the block chain checks the encrypted random number, the node equipment packs the encrypted random number into a first block and links the first block into the block chain.
S304, the node equipment receives the random number prediction request sent by the second terminal.
In the embodiment of the present invention, after uploading the encrypted random number to the block chain, the node device may receive a random number prediction request sent by the second terminal.
S305, when the condition that the processing condition is met is detected, the node device sends the public key of the first terminal to the trusted server, so that the trusted server returns the encryption target key based on the public key of the first terminal.
In the embodiment of the present invention, after receiving a random number prediction request sent by a second terminal, a node device may detect whether a processing condition is currently satisfied, and if so, obtain an encrypted random key from a trusted server, where a specific implementation manner of detecting whether the processing condition is currently satisfied by the node device includes detecting, when receiving a prediction end request sent by a first terminal, whether the number of second blocks linked after a first block in a block chain is greater than a first preset number, and if the number of second blocks is greater than the first preset number, determining that the processing condition is satisfied. By the method, the block chain can be prevented from influencing the authenticity of the encrypted random number due to the bifurcation. And if so, the node equipment sends the public key of the first terminal to the trusted server so that the trusted server returns the encryption target key based on the public key of the first terminal. Specifically, the trusted server queries a target key corresponding to the public key based on the received public key and a pre-stored mapping relationship, encrypts the target key by using the public key of the first terminal to obtain an encrypted target key, and sends the encrypted target key to the node device.
S306, the node equipment receives the encrypted target key returned by the trusted server and uploads the encrypted target key to the block chain.
In the embodiment of the invention, after receiving the encrypted target key returned by the trusted server, the node equipment can broadcast the encrypted target key so as to enable the node in the block chain to perform consensus verification on the encrypted target key; if the node in the block chain passes the verification of the encrypted target key, the node device packages the encrypted target key into a third block and links the third block into the block chain, that is, the encrypted target key is stored in the block chain in the form of the third block.
S307, the node equipment acquires the private key of the first terminal, and decrypts the encrypted target key by adopting the private key of the first terminal to obtain the target key.
In the embodiment of the invention, after uploading the encrypted target key to the block chain, the node device can receive a random number disclosure request sent by the first terminal, the random number disclosure request carries a private key of the first terminal, the node device responds to the random number disclosure request sent by the first terminal, whether the random number disclosure condition is met currently is detected, and if the random number disclosure condition is met, the node device decrypts the encrypted target key by adopting the private key of the first terminal to obtain the target key. Wherein the random number disclosure condition includes that the number of the fourth blocks linked after the third block is greater than a second preset number.
S308, the node equipment decrypts the encrypted random number stored in the block chain by adopting the target key to obtain the target random number.
In the embodiment of the present invention, after the node device obtains the target key, the target key may be used to decrypt the encrypted random number stored in the block chain to obtain the target random number. Further, the node device may upload the obtained target random number to the block chain, so that the first terminal and the second terminal access the target random number in the block chain.
S309, the node equipment compares the predicted number with the target random number, and if the comparison is consistent, the second terminal is determined to be the target terminal.
In the embodiment of the invention, after the node equipment acquires the target random number, the prediction number carried in the random number prediction request sent by the second terminal is compared with the target random number, and if the comparison is consistent, the node equipment determines the second terminal as the target terminal, wherein the target terminal is the terminal with successful prediction.
In the embodiment of the invention, node equipment acquires an encrypted random number from a trusted server and uploads the encrypted random number to a block chain, the node equipment receives a random number prediction request sent by a second terminal, and when a processing condition is detected to be met, a target key corresponding to the encrypted random number is acquired, and the encrypted random number stored in the block chain is decrypted by adopting the target key to obtain the target random number; and the node equipment compares the prediction number in the random number prediction request with the target random number, and if the comparison is consistent, the second terminal is determined as the target terminal. In the above manner, before the random number is disclosed, no matter the random number prediction executor, the node device or the random number prediction participant can not know the random number, so that the confidentiality of the random number is ensured, and the encrypted random number is uploaded to the block chain at the beginning of prediction, so that the transparency of the random number prediction process is also ensured.
In an implementation scenario, a first terminal is a terminal used by a random number prediction executor, a second terminal is a terminal used by a random number prediction participant, after the random number prediction executor determines that a prediction activity starts, a random number acquisition request is sent to a node device through the first terminal, the request carries a public key of the first terminal, the node device sends the random number acquisition request to a trusted server, the trusted server generates a target random number and encrypts the target random number by using a target key to obtain an encrypted random number, the encrypted random number is sent to the node device, the node device uploads the encrypted random number to a block chain, and then the node device can receive the prediction number sent by the random number prediction participant through the second terminal. When the random number prediction executor determines that the prediction activity is finished, a key acquisition request can be sent to the node device, the node device can send the key acquisition request to the trusted server, the trusted server encrypts the target key by using the public key of the first terminal to obtain an encrypted target key, and sends the encrypted target key to the node device. When the random number prediction executor determines to publish the prediction result, a random number public request is sent to the node device through the first terminal, the random number public request carries a private key of the first terminal, so that the node device decrypts the target encryption key according to the private key to obtain a target key, decrypts the encrypted random number through the target key to obtain a target random number, and then verifies whether the prediction number is the same as the random number, and if the prediction number is the same as the random number, the prediction success is determined. In the above manner, before the random number is disclosed, no matter the random number prediction executor, the node device or the random number prediction participant can not know the random number, so that the confidentiality of the random number is ensured, and the encrypted random number is uploaded to the block chain at the beginning of prediction, so that the transparency of the random number prediction process is also ensured.
Based on the above description of the embodiment of the data processing method based on the blockchain, the embodiment of the present invention further discloses a data processing apparatus based on the blockchain, where the data processing apparatus based on the blockchain may be a computer program (including a program code) running in the node device, or may be an entity apparatus included in the node device. The blockchain based data processing apparatus may perform the methods shown in fig. 2-3. Referring to fig. 4, the block chain-based data processing apparatus 40 includes: the device comprises an acquisition module 401, an uploading module 402, a receiving module 403, an encryption module 404, a comparison module 405 and a determination module 406.
An obtaining module 401, configured to obtain an encrypted random number from a trusted server;
an uploading module 402, configured to upload the encrypted random number to a block chain, where the encrypted random number is obtained by encrypting a target random number by the trusted server;
a receiving module 403, configured to receive a random number prediction request sent by a second terminal, where the random number prediction request carries a prediction number;
the obtaining module 401 is further configured to obtain a target key corresponding to the encrypted random number when it is detected that a processing condition is met;
an encryption module 404, configured to decrypt the encrypted random number stored in the block chain by using the target key to obtain the target random number;
a comparison module 405 for comparing the predicted number with the target random number;
a determining module 406, configured to determine the second terminal as a target terminal if the comparison is consistent.
In an implementation manner, the obtaining module 401 is specifically configured to:
responding to a random number acquisition request sent by a first terminal, wherein the random number acquisition request carries a public key of the first terminal;
sending the random number acquisition request to a trusted server so that the trusted server generates an encrypted random number according to the random number acquisition request, and establishing a mapping relation between a target key for encryption and a public key of the first terminal, wherein the encrypted random number is obtained by encrypting the target random number by the trusted server;
and receiving the encrypted random number returned by the trusted server, establishing a mapping relation between the encrypted random number and the public key of the first terminal, and storing the mapping relation.
In an implementation manner, the obtaining module 401 is specifically configured to:
when the condition that the processing condition is met is detected, sending a public key of the first terminal to the trusted server, so that the trusted server returns an encrypted target key based on the public key of the first terminal, wherein the encrypted target key is obtained by encrypting the target key by the trusted server by adopting the public key of the first terminal;
receiving an encrypted target key returned by the trusted server, and uploading the encrypted target key to a block chain;
and acquiring a private key of the first terminal, and decrypting the encrypted target key by adopting the private key of the first terminal to obtain the target key.
In an implementation manner, the uploading module 402 is specifically configured to:
broadcasting the encrypted random number so that a node in the block chain performs consensus check on the encrypted random number;
and if the node in the block chain passes the verification of the encrypted random number, packaging the encrypted random number into a first block, and linking the first block into the block chain.
In an implementation manner, the determining module 406 is specifically configured to:
when a prediction end request sent by the first terminal is received, detecting whether the number of second blocks linked after the first block in the block chain is greater than a first preset number;
and if the number of the second blocks is larger than the first preset number, determining that a processing condition is met.
In an implementation manner, the encryption target key is stored in a third block form in a block chain, and the obtaining module 401 is specifically configured to:
responding to a random number disclosure request sent by the first terminal, and detecting whether a random number disclosure condition is met currently, wherein the random number disclosure request carries a private key of the first terminal, and the random number disclosure condition comprises that the number of fourth blocks linked behind the third block is larger than a second preset number;
and if so, decrypting the encrypted target key by using the private key of the first terminal to obtain the target key.
In an implementation manner, the obtaining module 401 is specifically configured to:
acquiring a task amount corresponding to the random number acquisition request and load information of each server in a server cluster, wherein the server cluster comprises at least one server, an execution environment of each server in the server cluster is a trusted execution environment, and the load information comprises at least one of a load amount, a memory and a residual load amount;
determining one or more servers from the server cluster as trusted servers for random number generation according to the task amount and the load information of each server;
and sending the random number acquisition request to the trusted server for random number generation.
In the embodiment of the present invention, an obtaining module 401 obtains an encrypted random number from a trusted server, an uploading module 402 uploads the encrypted random number to a block chain, a receiving module 403 receives a random number prediction request sent by a second terminal, when it is detected that a processing condition is met, the obtaining module 401 obtains a target key corresponding to the encrypted random number, and an encrypting module 404 decrypts the encrypted random number stored in the block chain by using the target key to obtain the target random number; the comparison module 405 compares the prediction number in the random number prediction request with the target random number, and if the comparison is consistent, the determination module 406 determines the second terminal as the target terminal. By implementing the method, the block chain can be adopted to control the random number prediction process, so that the transparency of the random number prediction process and the authenticity of the prediction result are improved.
Fig. 5 is a schematic structural diagram of a node device according to an embodiment of the present invention. As shown in fig. 5, the node apparatus includes: at least one processor 501, an input node device 503, an output node device 504, a memory 505, at least one communication bus 502. Wherein a communication bus 502 is used to enable connective communication between these components. The memory 505 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 505 may alternatively be at least one memory device located remotely from the processor 501. Wherein the processor 501 may be combined with the apparatus described in fig. 4, the memory 505 stores a set of program codes, and the processor 501, the input node device 503 and the output node device 504 call the program codes stored in the memory 505. For performing the following operations:
a processor 501, configured to obtain an encrypted random number from a trusted server;
the processor 501 is configured to upload the encrypted random number to a block chain, where the encrypted random number is obtained by encrypting a target random number by the trusted server;
a processor 501, configured to receive a random number prediction request sent by a second terminal, where the random number prediction request carries a prediction number;
the processor 501 is further configured to, when it is detected that a processing condition is met, obtain a target key corresponding to the encrypted random number;
a processor 501, configured to decrypt the encrypted random number stored in the block chain by using the target key to obtain the target random number;
a processor 501, configured to compare the predicted number with the target random number;
and the processor 501 is configured to determine the second terminal as a target terminal if the comparison is consistent.
In one implementation, the processor 501 is specifically configured to:
responding to a random number acquisition request sent by a first terminal, wherein the random number acquisition request carries a public key of the first terminal;
sending the random number acquisition request to a trusted server so that the trusted server generates an encrypted random number according to the random number acquisition request, and establishing a mapping relation between a target key for encryption and a public key of the first terminal, wherein the encrypted random number is obtained by encrypting the target random number by the trusted server;
and receiving the encrypted random number returned by the trusted server, establishing a mapping relation between the encrypted random number and the public key of the first terminal, and storing the mapping relation.
In one implementation, the processor 501 is specifically configured to:
when the condition that the processing condition is met is detected, sending a public key of the first terminal to the trusted server, so that the trusted server returns an encrypted target key based on the public key of the first terminal, wherein the encrypted target key is obtained by encrypting the target key by the trusted server by adopting the public key of the first terminal;
receiving an encrypted target key returned by the trusted server, and uploading the encrypted target key to a block chain;
and acquiring a private key of the first terminal, and decrypting the encrypted target key by adopting the private key of the first terminal to obtain the target key.
In one implementation, the processor 501 is specifically configured to:
broadcasting the encrypted random number so that a node in the block chain performs consensus check on the encrypted random number;
and if the node in the block chain passes the verification of the encrypted random number, packaging the encrypted random number into a first block, and linking the first block into the block chain.
In one implementation, the processor 501 is specifically configured to:
when a prediction end request sent by the first terminal is received, detecting whether the number of second blocks linked after the first block in the block chain is greater than a first preset number;
and if the number of the second blocks is larger than the first preset number, determining that a processing condition is met.
In one implementation, the encryption target key is stored in a third block form in the block chain, and the processor 501 is specifically configured to:
responding to a random number disclosure request sent by the first terminal, and detecting whether a random number disclosure condition is met currently, wherein the random number disclosure request carries a private key of the first terminal, and the random number disclosure condition comprises that the number of fourth blocks linked behind the third block is larger than a second preset number;
and if so, decrypting the encrypted target key by using the private key of the first terminal to obtain the target key.
In one implementation, the processor 501 is specifically configured to:
acquiring a task amount corresponding to the random number acquisition request and load information of each server in a server cluster, wherein the server cluster comprises at least one server, an execution environment of each server in the server cluster is a trusted execution environment, and the load information comprises at least one of a load amount, a memory and a residual load amount;
determining one or more servers from the server cluster as trusted servers for random number generation according to the task amount and the load information of each server;
and sending the random number acquisition request to the trusted server for random number generation.
In the embodiment of the present invention, a processor 501 obtains an encrypted random number from a trusted server, the processor 501 uploads the encrypted random number to a block chain, the processor 501 receives a random number prediction request sent by a second terminal, when it is detected that a processing condition is met, the processor 501 obtains a target key corresponding to the encrypted random number, and the processor 501 decrypts the encrypted random number stored in the block chain by using the target key to obtain the target random number; the processor 501 compares the predicted number in the random number prediction request with the target random number, and if the comparison is consistent, the processor 501 determines the second terminal as the target terminal. By implementing the method, the block chain can be adopted to control the random number prediction process, so that the transparency of the random number prediction process and the authenticity of the prediction result are improved.
The module in the embodiment of the present invention may be implemented by a general-purpose integrated circuit, such as a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC).
It should be understood that, in the embodiment of the present invention, the Processor 501 may be a Central Processing Unit (CPU), and the Processor may also be other general processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The bus 502 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like, and the bus 502 may be divided into an address bus, a data bus, a control bus, or the like, and fig. 5 illustrates only one thick line for convenience of illustration, but does not illustrate only one bus or one type of bus.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The computer-readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (10)

1. A method for processing data based on a blockchain, the method comprising:
acquiring an encrypted random number from a trusted server, and uploading the encrypted random number to a block chain, wherein the encrypted random number is obtained by encrypting a target random number by the trusted server;
receiving a random number prediction request sent by a second terminal, wherein the random number prediction request carries a prediction number;
when the condition that the processing condition is met is detected, a target key corresponding to the encrypted random number is obtained, and the encrypted random number stored in the block chain is decrypted by adopting the target key to obtain the target random number;
and comparing the predicted number with the target random number, and if the comparison is consistent, determining the second terminal as a target terminal.
2. The method of claim 1, wherein obtaining the encrypted random number from the trusted server comprises:
responding to a random number acquisition request sent by a first terminal, wherein the random number acquisition request carries a public key of the first terminal;
sending the random number acquisition request to a trusted server so that the trusted server generates an encrypted random number according to the random number acquisition request, and establishing a mapping relation between a target key for encryption and a public key of the first terminal, wherein the encrypted random number is obtained by encrypting the target random number by the trusted server;
and receiving the encrypted random number returned by the trusted server, establishing a mapping relation between the encrypted random number and the public key of the first terminal, and storing the mapping relation.
3. The method according to claim 2, wherein the obtaining a target key corresponding to the encrypted random number when it is detected that a processing condition is satisfied comprises:
when the condition that the processing condition is met is detected, sending a public key of the first terminal to the trusted server, so that the trusted server returns an encrypted target key based on the public key of the first terminal, wherein the encrypted target key is obtained by encrypting the target key by the trusted server by adopting the public key of the first terminal;
receiving an encrypted target key returned by the trusted server, and uploading the encrypted target key to a block chain;
and acquiring a private key of the first terminal, and decrypting the encrypted target key by adopting the private key of the first terminal to obtain the target key.
4. The method of claim 1, wherein uploading the encrypted random number into a blockchain comprises
Broadcasting the encrypted random number so that a node in the block chain performs consensus check on the encrypted random number;
and if the node in the block chain passes the verification of the encrypted random number, packaging the encrypted random number into a first block, and linking the first block into the block chain.
5. The method of claim 4, further comprising:
when a prediction end request sent by the first terminal is received, detecting whether the number of second blocks linked after the first block in the block chain is greater than a first preset number;
and if the number of the second blocks is larger than the first preset number, determining that a processing condition is met.
6. The method according to claim 3, wherein the storing the encrypted target key in a third block form in a blockchain, and the obtaining the private key of the first terminal and decrypting the encrypted target key with the private key of the first terminal to obtain the target key comprises:
responding to a random number disclosure request sent by the first terminal, and detecting whether a random number disclosure condition is met currently, wherein the random number disclosure request carries a private key of the first terminal, and the random number disclosure condition comprises that the number of fourth blocks linked behind the third block is larger than a second preset number;
and if so, decrypting the encrypted target key by using the private key of the first terminal to obtain the target key.
7. The method of claim 2, wherein sending the nonce acquisition request to a trusted server comprises:
acquiring a task amount corresponding to the random number acquisition request and load information of each server in a server cluster, wherein the server cluster comprises at least one server, an execution environment of each server in the server cluster is a trusted execution environment, and the load information comprises at least one of a load amount, a memory and a residual load amount;
determining one or more servers from the server cluster as trusted servers for random number generation according to the task amount and the load information of each server;
and sending the random number acquisition request to the trusted server for random number generation.
8. An apparatus for data processing based on a blockchain, the apparatus comprising:
the acquisition module is used for acquiring the encrypted random number from the trusted server;
the uploading module is used for uploading the encrypted random number to a block chain, wherein the encrypted random number is obtained by encrypting a target random number by the trusted server;
the receiving module is used for receiving a random number prediction request sent by a second terminal, wherein the random number prediction request carries a prediction number;
the obtaining module is further configured to obtain a target key corresponding to the encrypted random number when it is detected that a processing condition is satisfied;
the encryption module is used for decrypting the encrypted random number stored in the block chain by adopting the target key to obtain the target random number;
a comparison module for comparing the predicted number with the target random number;
and the determining module is used for determining the second terminal as a target terminal if the comparison is consistent.
9. A node device comprising a processor, an input interface, an output interface and a memory, the processor, the input interface, the output interface and the memory being interconnected, wherein the memory is configured to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202010076711.2A 2020-01-22 2020-01-22 Data processing method and device based on block chain, node equipment and storage medium Pending CN111259428A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010076711.2A CN111259428A (en) 2020-01-22 2020-01-22 Data processing method and device based on block chain, node equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010076711.2A CN111259428A (en) 2020-01-22 2020-01-22 Data processing method and device based on block chain, node equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111259428A true CN111259428A (en) 2020-06-09

Family

ID=70949176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010076711.2A Pending CN111259428A (en) 2020-01-22 2020-01-22 Data processing method and device based on block chain, node equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111259428A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111866085A (en) * 2020-06-28 2020-10-30 北京沃东天骏信息技术有限公司 Data storage method, system and device based on block chain
CN111930523A (en) * 2020-09-28 2020-11-13 支付宝(杭州)信息技术有限公司 Load balancing method and system for service cluster
CN117521092A (en) * 2023-10-23 2024-02-06 广州一牧数据有限公司 Block chain data reflow processing method and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1504874A (en) * 2002-12-05 2004-06-16 技嘉科技股份有限公司 Raffling and checking method implemented in computer system
CN101373498A (en) * 2008-09-19 2009-02-25 深圳市卓易网络有限公司 Method for implementing betting and guessing games based on network platform
CN102708532A (en) * 2012-05-11 2012-10-03 深圳市永恒乐彩科技开发有限公司 An automatic lottery drawing system and an automatic lottery drawing method
CN108830714A (en) * 2018-05-28 2018-11-16 拜迪网络科技(上海)有限公司 Block chain foretells machine
CN109559119A (en) * 2018-11-29 2019-04-02 成都捕风数据科技有限公司 By entrusting the block producer to reach the method for the credible endogenous random process of block chain
CN109886750A (en) * 2019-02-25 2019-06-14 浪潮软件集团有限公司 A kind of transparent random prize drawing implementation method based on block chain
CN110601819A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Method for processing random number and related equipment
CN110597489A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Random number generation method, equipment and medium
CN110648447A (en) * 2019-08-08 2020-01-03 杭州复杂美科技有限公司 Game random number generation method, application, device, equipment and storage medium
CN110647311A (en) * 2018-06-27 2020-01-03 厦门本能管家科技有限公司 Uncontrollable random number generation method and system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1504874A (en) * 2002-12-05 2004-06-16 技嘉科技股份有限公司 Raffling and checking method implemented in computer system
CN101373498A (en) * 2008-09-19 2009-02-25 深圳市卓易网络有限公司 Method for implementing betting and guessing games based on network platform
CN102708532A (en) * 2012-05-11 2012-10-03 深圳市永恒乐彩科技开发有限公司 An automatic lottery drawing system and an automatic lottery drawing method
CN108830714A (en) * 2018-05-28 2018-11-16 拜迪网络科技(上海)有限公司 Block chain foretells machine
CN110647311A (en) * 2018-06-27 2020-01-03 厦门本能管家科技有限公司 Uncontrollable random number generation method and system
CN109559119A (en) * 2018-11-29 2019-04-02 成都捕风数据科技有限公司 By entrusting the block producer to reach the method for the credible endogenous random process of block chain
CN109886750A (en) * 2019-02-25 2019-06-14 浪潮软件集团有限公司 A kind of transparent random prize drawing implementation method based on block chain
CN110648447A (en) * 2019-08-08 2020-01-03 杭州复杂美科技有限公司 Game random number generation method, application, device, equipment and storage medium
CN110601819A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Method for processing random number and related equipment
CN110597489A (en) * 2019-09-26 2019-12-20 腾讯科技(深圳)有限公司 Random number generation method, equipment and medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111866085A (en) * 2020-06-28 2020-10-30 北京沃东天骏信息技术有限公司 Data storage method, system and device based on block chain
CN111866085B (en) * 2020-06-28 2021-12-14 北京沃东天骏信息技术有限公司 Data storage method, system and device based on block chain
CN111930523A (en) * 2020-09-28 2020-11-13 支付宝(杭州)信息技术有限公司 Load balancing method and system for service cluster
CN117521092A (en) * 2023-10-23 2024-02-06 广州一牧数据有限公司 Block chain data reflow processing method and system
CN117521092B (en) * 2023-10-23 2024-04-09 广州一牧数据有限公司 Block chain data reflow processing method and system

Similar Documents

Publication Publication Date Title
CN111506901B (en) Block chain-based data processing method, terminal and storage medium
CN107483419B (en) Method, device and system for authenticating access terminal by server, server and computer readable storage medium
CN111949953A (en) Identity authentication method, system and device based on block chain and computer equipment
US20080083039A1 (en) Method for integrity attestation of a computing platform hiding its configuration information
CN110838063B (en) Transaction processing method based on blockchain, electronic equipment and storage medium
CN111259428A (en) Data processing method and device based on block chain, node equipment and storage medium
CN111698088A (en) Key alternation method, key alternation device, electronic equipment and medium
CN111314172A (en) Data processing method, device and equipment based on block chain and storage medium
CN112036878B (en) Data processing method and device
CN110928880A (en) Data processing method, device, terminal and medium based on block chain
CN111367923A (en) Data processing method, data processing device, node equipment and storage medium
CN112653556A (en) TOKEN-based micro-service security authentication method, device and storage medium
CN111291420B (en) Distributed off-link data storage method based on block chain
CN108846671B (en) Online secure transaction method and system based on block chain
CN108235067B (en) Authentication method and device for video stream address
CN115296807B (en) Key generation method, device and equipment for preventing industrial control network viruses
CN114095165B (en) Key updating method, server device, client device and storage medium
CN113497827B (en) Information sharing method and equipment
CN111324914B (en) File transmission method, device, server, equipment and medium
CN114692124A (en) Data reading and writing method and device and electronic equipment
CN114124515A (en) Bidding transmission method, key management method, user verification method and corresponding device
CN110012319B (en) Authentication method and device for video stream address
CN112699366A (en) Cross-platform login-free secure communication method and device and electronic equipment
CN114595465A (en) Data encryption processing method and device and electronic equipment
CN114500025B (en) Account identifier acquisition method, device, server and storage medium

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40024701

Country of ref document: HK