CN109660352B - Block chain-based distribution relation recording method and device and terminal equipment - Google Patents

Block chain-based distribution relation recording method and device and terminal equipment Download PDF

Info

Publication number
CN109660352B
CN109660352B CN201811373876.5A CN201811373876A CN109660352B CN 109660352 B CN109660352 B CN 109660352B CN 201811373876 A CN201811373876 A CN 201811373876A CN 109660352 B CN109660352 B CN 109660352B
Authority
CN
China
Prior art keywords
user
signature
hash value
distribution
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.)
Active
Application number
CN201811373876.5A
Other languages
Chinese (zh)
Other versions
CN109660352A (en
Inventor
王义辉
卜筱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Bianshelong Information Technology Co ltd
Original Assignee
Shenzhen Bianshelong Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Bianshelong Information Technology Co ltd filed Critical Shenzhen Bianshelong Information Technology Co ltd
Priority to CN201811373876.5A priority Critical patent/CN109660352B/en
Publication of CN109660352A publication Critical patent/CN109660352A/en
Application granted granted Critical
Publication of CN109660352B publication Critical patent/CN109660352B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Abstract

The application is applicable to the technical field of block chains, and provides a distribution relation recording method and device based on block chains and terminal equipment, wherein the method comprises the following steps: receiving a distribution relation record request sent by a first user; decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, and performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value; and broadcasting the distribution relationship between the first user and the second user, the first user signature and the second user signature into the blockchain when the first hash value and the second hash value are consistent with the third hash value. The method and the device can solve the problems that the existing distribution relation recording method easily causes the data of the distribution relation to be tampered or damaged and lost, and the authenticity of the distribution relation cannot be verified in the distribution relation recording process.

Description

Block chain-based distribution relation recording method and device and terminal equipment
Technical Field
The application belongs to the technical field of block chains, and particularly relates to a distribution relation recording method and device based on a block chain, and terminal equipment.
Background
Distribution means to establish a distribution channel, and distribution relationship means to take ownership of a certain commodity or service and help ownership transfer between all enterprises and individuals in the process of transferring the commodity or service from a producer to a consumer.
The current distribution relationship is mainly recorded through a database, and the data of the distribution relationship is easily tampered or damaged and lost due to factors such as external attacks and machine failures.
In addition, the relationship between the supplier and the distributor related to the distribution relationship can only be responsible for recording the distribution relationship when the distribution relationship is recorded by using the database, and the authenticity of the distribution relationship cannot be verified.
In summary, the existing distribution relation recording method is easy to tamper or damage and lose the data of the distribution relation, and meanwhile, the authenticity of the distribution relation cannot be verified in the distribution relation recording process.
Disclosure of Invention
In view of this, the embodiment of the present application provides a distribution relation recording method and apparatus based on a block chain, and a terminal device, so as to solve the problems that data of a distribution relation is easily tampered or damaged and lost by an existing distribution relation recording method, and authenticity of the distribution relation cannot be verified in a distribution relation recording process.
A first aspect of an embodiment of the present application provides a distribution relation recording method based on a block chain, including:
receiving a distribution relationship record request sent by a first user, wherein the distribution relationship record request comprises the distribution relationship between the first user and a second user, the signature of the first user and the signature of the second user;
decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are both consistent with the third hash value;
and broadcasting the distribution relationship between the first user and the second user, the first user signature and the second user signature into a blockchain when the first hash value and the second hash value are consistent with the third hash value.
A second aspect of the embodiments of the present application provides a distribution relation recording apparatus based on a block chain, including:
a receiving request module, configured to receive a distribution relationship record request sent by a first user, where the distribution relationship record request includes a distribution relationship between the first user and a second user, a signature of the first user, and a signature of the second user;
the hash verification module is used for decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are consistent with the third hash value;
and the verification broadcasting module is used for broadcasting the distribution relationship between the first user and the second user, the first user signature and the second user signature into the blockchain when the first hash value and the second hash value are consistent with the third hash value.
A third aspect of the embodiments of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, which, when executed by a processor, implements the steps of the method as described above.
Compared with the prior art, the embodiment of the application has the advantages that:
in the distribution relationship recording method based on the blockchain, the distribution relationship is recorded through the blockchain, the distribution relationship is guaranteed not to be tampered or damaged and lost through the characteristics that the blockchain can not be tampered and distributed storage, meanwhile, before the distribution relationship of a first user and a second user is recorded, the signature of the first user and the signature of the second user sent by the first user are verified, if the signature of the first user and the signature of the second user are both verified successfully, the distribution relationship is approved by both the first user and the second user and is a real distribution relationship, at the moment, the distribution relationship of the first user and the second user, the signature of the first user and the signature of the second user are broadcasted into the blockchain, the authenticity of the distribution relationship is guaranteed, and the problem that the existing distribution relationship recording method is easy to cause the data of the distribution relationship to be tampered or damaged and lost is solved, and in the process of recording the distribution relationship, the authenticity of the distribution relationship cannot be verified.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart of an implementation of a distribution relation recording method based on a block chain according to an embodiment of the present application;
fig. 2 is a schematic diagram of a distribution relation recording apparatus based on a block chain according to an embodiment of the present application;
fig. 3 is a schematic diagram of a terminal device provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In particular implementations, the mobile terminals described in embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers having touch sensitive surfaces (e.g., touch screen displays and/or touch pads). It should also be understood that in some embodiments, the devices described above are not portable communication devices, but rather are desktop computers having touch-sensitive surfaces (e.g., touch screen displays and/or touch pads).
In the discussion that follows, a mobile terminal that includes a display and a touch-sensitive surface is described. However, it should be understood that the mobile terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
The mobile terminal supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a website creation application, a disc burning application, a spreadsheet application, a gaming application, a telephone application, a video conferencing application, an email application, an instant messaging application, an exercise support application, a photo management application, a digital camera application, a web browsing application, a digital music player application, and/or a digital video player application.
Various applications that may be executed on the mobile terminal may use at least one common physical user interface device, such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and/or changed between applications and/or within respective applications. In this way, a common physical architecture (e.g., touch-sensitive surface) of the terminal can support various applications with user interfaces that are intuitive and transparent to the user.
In addition, in the description of the present application, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
The first embodiment is as follows:
referring to fig. 1, a distribution relationship recording method based on a block chain according to a first embodiment of the present application is described below, where the distribution relationship recording method based on a block chain according to the first embodiment of the present application includes:
step S101, receiving a distribution relation record request sent by a first user, wherein the distribution relation record request comprises the distribution relation between the first user and a second user, the signature of the first user and the signature of the second user;
after the first user establishes a distribution relationship with the second user, the first user may send a distribution relationship recording request to the management platform, and record the distribution relationship of the first user and the second user in the blockchain through the management platform.
The distribution relationship record request may include the distribution relationship between the first user and the second user, the signature of the first user, and the signature of the second user, and the distribution relationship between the first user and the second user may include a distribution superior-superior relationship and a distribution commission allocation scheme.
The signature of the first user and the signature of the second user are used for verifying the authenticity of the distribution relationship, the first user performs hash operation on the distribution relationship related to the first user to obtain a first hash value, the second user performs hash operation on the distribution relationship related to the second user to obtain a second hash value, the signature of the first user can be obtained by encrypting the first hash value by the first user through a private key of the first user, and the signature of the second user can be obtained by encrypting the second hash value by the second user through a private key of the second user.
Step S102, decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are consistent with the third hash value;
the public key of the first user can be used for decrypting the signature of the first user to obtain a first hash value, the public key of the second user is used for decrypting the signature of the second user to obtain a second hash value, and the distribution relationship between the first user and the second user is subjected to hash operation to obtain a third hash value;
the authenticity of the distribution relationship can be judged by judging whether the first hash value and the second hash value are consistent with the third hash value.
Step S103, when the first hash value and the second hash value are both consistent with the third hash value, broadcasting the distribution relationship between the first user and the second user, the first user signature and the second user signature into a blockchain.
In the hash operation, if the operation content changes, even if the change amplitude is small, the difference distance of the hash value calculated last is very large, so that if the first hash value and the second hash value are consistent with the third hash value, the calculation of the first hash value, the second hash value and the third hash value is consistent;
meanwhile, the signature of the first user is encrypted by the private key of the first user, the signature of the second user is encrypted by the private key of the second user, and the private key can indicate the identity of the user.
Therefore, when the first hash value obtained by decrypting the signature of the first user and the second hash value obtained by decrypting the signature of the second user are both consistent with the third hash value, it indicates that both the first user and the second user have viewed and recognized the distribution relationship, and the distribution relationship is a real distribution relationship.
After the authenticity of the distribution relationship between the first user and the second user is confirmed, the management platform broadcasts the distribution relationship between the first user and the second user, the signature of the first user and the signature of the second user to the blockchain for storage, and the situations that the distribution relationship is tampered or lost and the like are avoided.
When any one of the first hash value and the second hash value is not consistent with the third hash value, the management platform may not perform any action, or return a prompt indicating that the recording fails to the first user.
Further, when both the first hash value and the second hash value are consistent with the third hash value, broadcasting the distribution relationship between the first user and the second user, the first user signature, and the second user signature into the blockchain specifically includes:
a1, when the first hash value and the second hash value are consistent with the third hash value, encrypting the distribution relationship between the first user and the second user, the first user signature and the second user signature by using a platform public key;
since the data on the blockchain is disclosed to each node, and the distribution relationship belongs to the content needing to be kept secret for some enterprises, the distribution relationship between the first user and the second user, the signature of the first user and the signature of the second user can be encrypted by using the platform public key before being broadcast to the blockchain.
A2, broadcasting the encrypted distribution relationship between the first user and the second user, the first user signature and the second user signature into a blockchain.
After the platform public key is used for encryption, only the platform private key is used for decrypting the encrypted data, namely, only the management platform can check the encrypted data, and other block chain nodes can receive the encrypted data but cannot know specific content.
Therefore, the distribution relationship between the first user and the second user, the first user signature and the second user signature are encrypted by using the platform public key and then broadcast to the blockchain, so that not only can the confidential contents such as the distribution relationship be ensured to be received and recorded by other nodes of the blockchain, but also the other nodes can be ensured not to know the specific details of the confidential contents, and information leakage is avoided.
Further, the method further comprises:
b1, receiving a distribution relation query instruction and a signature of a third user, and verifying the signature of the third user by using a public key of the third user;
when the inquiry user needs to inquire the distribution relation related to the third user, the inquiry qualification needs to be proved, so that the inquiry user needs to send a distribution relation inquiry instruction and the signature of the third user to the management platform, and the management platform verifies the signature of the third user by using the public key of the third user.
The signature of the third user may be obtained by encrypting, by the third user, the specified content by using the private key of the third user, and the specified content may be determined according to actual needs, for example, the specified content may be a distribution relation query instruction, and may also be a fourth hash value obtained by performing hash operation on the distribution relation query instruction.
B2, when the signature of the third user passes the verification, acquiring the distribution relation related to the third user from the local database, and returning the distribution relation to the inquiry user;
when the signature of the third user passes verification, the third user indicates that the third user has granted the inquiry user the qualification of inquiring about the distribution relationship related to the third user, at this time, the third user and the inquiry user may be the same or different users, for example, user a wants to inquire about his distribution relationship, at this time, the third user and the inquiry user both refer to user a, and user a needs to send his signature to the management platform; or at this time, the user a wants to query the distribution relationship of the user B, the third user refers to the user B, the querying user refers to the user a, the user a needs to apply for the querying qualification to the user B, the user B returns the signature to the user a, the user a can query the distribution relationship of the user B through the signature of the user B, otherwise, the user a cannot query the distribution relationship of the user B.
After the signature verification of the third user is passed, the distribution relationship related to the third user can be obtained from the local database, and the distribution relationship is returned to the inquiring user.
Or when the signature of the third user passes the verification, obtaining the encrypted distribution relation related to the third user from the blockchain, decrypting the distribution relation by using a platform private key, and returning the decrypted distribution relation to the inquiring user.
The distribution relationship can be inquired in the local database and also can be acquired from the blockchain, and because the distribution relationship acquired in the blockchain is the encrypted distribution relationship, the distribution relationship can be decrypted by using the platform private key and then returned to the inquiring user.
If the third user fails to verify the signature, no action may be performed, or a prompt may be returned to the querying user indicating that the verification failed.
Further, the method further comprises:
and C1, receiving a database rebuilding instruction, acquiring the blockchain data of each node in the blockchain according to the database rebuilding instruction, taking the blockchain data approved by the nodes with the ratio larger than the preset ratio as standard blockchain data, and rebuilding the local database according to the distribution relationship in the standard blockchain data.
When the local database is damaged or a worker considers that data updating and reconstruction are needed to be carried out on the local database, a database reconstruction instruction can be sent, and the management platform acquires block chain data of each node in the block chain according to the database reconstruction instruction;
after the blockchain data of each node in the blockchain is acquired, the blockchain data approved by the nodes with the ratio greater than the preset ratio can be used as standard blockchain data, and the local database is reconstructed according to the distribution relation in the standard blockchain data.
The preset proportion can be set according to actual conditions, and can be set to be 50% for example.
Further, the receiving a database rebuilding instruction, obtaining the blockchain data of each node in the blockchain according to the database rebuilding instruction, and rebuilding the local database by using the distribution relationship in the standard blockchain data, where the blockchain data approved by the nodes greater than a preset ratio is used as standard blockchain data, specifically includes:
d1, receiving a database reconstruction instruction, and acquiring a merkle root of the block chain data of each node in the block chain according to the database reconstruction instruction;
and D2, using the blockchain data corresponding to the merkle root approved by the nodes with the ratio larger than the preset ratio as standard blockchain data, and rebuilding the local database by using the distribution relation and commission settlement records in the standard blockchain data.
When comparing the blockchain data of each node, the complete blockchain data can be directly used for comparison, but the calculation is extremely large in data amount and extremely slow, so that the merkle root of the blockchain data of each node in the blockchain can be obtained according to the database reconstruction instruction, the merkle roots of each node can be compared, and the blockchain data corresponding to the merkle root approved by the node with the ratio larger than the preset ratio can be used as the standard blockchain data.
The blockchain data stored by each node can be divided into a plurality of transactions, for example, data of one block is used as one transaction, each transaction can be subjected to hash operation to obtain a hash value, two adjacent hash values can be subjected to hash operation to obtain a hash value of a previous layer, a merkle tree is formed by calculating layer by layer, and when the blockchain data stored by two nodes are consistent, the merkle trees formed by the blockchain data of the two nodes are the same and have the same root node, namely, the merkle root.
Therefore, whether the blockchain data of each node are consistent or not can be judged by comparing the merkle roots of the blockchain data of each node, and the comparison of the complete blockchain data is changed into the comparison of the merkle roots, so that the data amount of the operation can be greatly reduced, and the operation speed can be improved.
In the distribution relationship recording method based on the blockchain provided by this embodiment, the distribution relationship between the first user and the second user is recorded through the blockchain, so that the situation that the distribution relationship is tampered or damaged and lost can be avoided.
Before data such as distribution relations are broadcasted to the blockchain, the platform public key can be used for encryption, only the management platform can use the platform private key for decryption and checking, and leakage of confidential contents is avoided.
When the inquiry user inquires the distribution relation of a third user, the signature of the third user is verified to judge whether the inquiry user has the inquiry qualification, and the distribution relation can be inquired only if the inquiry user has the qualification.
When the local database is damaged or needs to be updated and rebuilt due to other reasons, the block chain data of each node in the block chain can be obtained through the database rebuilding instruction, the block chain data approved by the nodes with the ratio larger than the preset ratio is used as standard block chain data, the local database is rebuilt according to the distribution relation in the standard block chain data, and the comparison process of the block chain data of each node can be compared through a merkle root, so that the data amount of operation is reduced, and the operation speed is improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example two:
The second embodiment of the present application provides a distribution relation recording apparatus based on a blockchain, and for convenience of description, only the parts related to the present application are shown, as shown in fig. 2, the distribution relation recording apparatus based on a blockchain includes,
a receiving request module 201, configured to receive a distribution relationship record request sent by a first user, where the distribution relationship record request includes a distribution relationship between the first user and a second user, a signature of the first user, and a signature of the second user;
a hash verification module 202, configured to decrypt the signature of the first user with the public key of the first user to obtain a first hash value, decrypt the signature of the second user with the public key of the second user to obtain a second hash value, perform a hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and determine whether the first hash value and the second hash value are both consistent with the third hash value;
a verification broadcasting module 203, configured to broadcast the distribution relationship between the first user and the second user, the first user signature, and the second user signature into the blockchain when the first hash value and the second hash value are both consistent with the third hash value.
Further, the verification broadcasting module 203 specifically includes:
the encryption sub-module is used for encrypting the distribution relationship between the first user and the second user, the first user signature and the second user signature by using a platform public key when the first hash value and the second hash value are consistent with the third hash value;
and the broadcast sub-module is used for broadcasting the encrypted distribution relationship between the first user and the second user, the first user signature and the second user signature into the blockchain.
Further, the apparatus further comprises:
the inquiry verification module is used for receiving a distribution relation inquiry instruction and a signature of a third user and verifying the signature of the third user by using a public key of the third user;
the verification return module is used for acquiring the distribution relation related to the third user from a local database when the signature of the third user passes verification, and returning the distribution relation to the inquiry user;
or, the verification returning module is configured to, when the signature of the third user passes verification, obtain the encrypted distribution relationship related to the third user from the blockchain, decrypt the distribution relationship using a platform private key, and return the decrypted distribution relationship to the querying user.
Further, the apparatus further comprises:
the reconstruction instruction module is used for receiving a database reconstruction instruction, acquiring the blockchain data of each node in the blockchain according to the database reconstruction instruction, taking the blockchain data approved by the nodes with the ratio larger than a preset ratio as standard blockchain data, and reconstructing the local database according to the distribution relationship in the standard blockchain data.
Further, the reconstruction instruction module specifically includes:
the data submodule is used for receiving a database reconstruction instruction and acquiring a merkle root of the block chain data of each node in the block chain according to the database reconstruction instruction;
and the comparison submodule is used for reconstructing the local database by using the block chain data corresponding to the merkle root approved by the nodes with the ratio larger than the preset ratio as the standard block chain data and according to the distribution relation and the commission settlement record in the standard block chain data.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Example three:
fig. 3 is a schematic diagram of a terminal device provided in the third embodiment of the present application. As shown in fig. 3, the terminal device 3 of this embodiment includes: a processor 30, a memory 31 and a computer program 32 stored in said memory 31 and executable on said processor 30. The processor 30 implements the steps in the above-mentioned distribution relation recording method embodiment based on the block chain when executing the computer program 32, such as steps S101 to S103 shown in fig. 1. Alternatively, the processor 30, when executing the computer program 32, implements the functions of each module/unit in each device embodiment described above, for example, the functions of the modules 201 to 203 shown in fig. 2.
Illustratively, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the processor 30 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the computer program 32 may be divided into a request receiving module, a hash verification module, and a verification broadcast module, and each module specifically functions as follows:
receiving a distribution relationship record request sent by a first user, wherein the distribution relationship record request comprises the distribution relationship between the first user and a second user, the signature of the first user and the signature of the second user;
decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are both consistent with the third hash value;
and broadcasting the distribution relationship between the first user and the second user, the first user signature and the second user signature into a blockchain when the first hash value and the second hash value are consistent with the third hash value.
The terminal device 3 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 30, a memory 31. It will be understood by those skilled in the art that fig. 3 is only an example of the terminal device 3, and does not constitute a limitation to the terminal device 3, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal device may also include an input-output device, a network access device, a bus, etc.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or a memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal device 3. The memory 31 is used for storing the computer program and other programs and data required by the terminal device. The memory 31 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (8)

1. A distribution relation recording method based on a block chain is characterized by being applied to a management platform and comprising the following steps:
receiving a distribution relation record request sent by a first user, wherein the distribution relation record request comprises the distribution relation between the first user and a second user, the signature of the first user and the signature of the second user, and the distribution relation comprises a distribution superior-subordinate relation and a distribution commission allocation scheme;
decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are both consistent with the third hash value;
broadcasting the distribution relationship of the first user and the second user, the first user signature and the second user signature into a blockchain when the first hash value and the second hash value are both consistent with the third hash value;
the method further comprises the following steps: receiving a database reconstruction instruction, acquiring block chain data of each node in a block chain according to the database reconstruction instruction, taking block chain data approved by nodes with a ratio larger than a preset ratio as standard block chain data, and reconstructing a local database according to a distribution relation in the standard block chain data, wherein the method specifically comprises the steps of receiving the database reconstruction instruction and acquiring a merkle root of the block chain data of each node in the block chain according to the database reconstruction instruction; and rebuilding a local database by using the distribution relation and commission settlement records in the standard blockchain data, wherein the blockchain data corresponding to the merkle root approved by the nodes with the ratio larger than the preset ratio is used as the standard blockchain data.
2. The blockchain-based distribution relationship recording method according to claim 1, wherein the broadcasting the distribution relationship between the first user and the second user, the first user signature, and the second user signature into the blockchain when both the first hash value and the second hash value are consistent with the third hash value specifically comprises:
when the first hash value and the second hash value are consistent with the third hash value, encrypting the distribution relationship between the first user and the second user, the first user signature and the second user signature by using a platform public key;
and broadcasting the encrypted distribution relationship between the first user and the second user, the first user signature and the second user signature into a blockchain.
3. The blockchain-based distribution relationship recording method according to claim 2, further comprising:
receiving a distribution relation query instruction and a signature of a third user, and verifying the signature of the third user by using a public key of the third user;
when the signature of the third user passes the verification, acquiring a distribution relation related to the third user from a local database, and returning the distribution relation to the inquiry user;
or when the signature of the third user passes the verification, obtaining the encrypted distribution relation related to the third user from the blockchain, decrypting the distribution relation by using a platform private key, and returning the decrypted distribution relation to the inquiring user.
4. A distribution relation recording device based on a blockchain is characterized by comprising:
the distribution relation recording request comprises the distribution relation of the first user and a second user, the signature of the first user and the signature of the second user, and the distribution relation comprises a distribution superior-subordinate relation and a distribution commission allocation scheme;
the hash verification module is used for decrypting the signature of the first user by using the public key of the first user to obtain a first hash value, decrypting the signature of the second user by using the public key of the second user to obtain a second hash value, performing hash operation on the distribution relationship between the first user and the second user to obtain a third hash value, and judging whether the first hash value and the second hash value are consistent with the third hash value;
a verification broadcasting module, configured to broadcast the distribution relationship between the first user and the second user, the first user signature, and the second user signature into a blockchain when the first hash value and the second hash value are both consistent with the third hash value;
the device further comprises: the reconstruction instruction module is used for receiving a database reconstruction instruction, acquiring the block chain data of each node in a block chain according to the database reconstruction instruction, taking the block chain data approved by the nodes with the ratio larger than a preset ratio as standard block chain data, and reconstructing a local database according to the distribution relationship in the standard block chain data;
the reconstruction instruction module specifically includes:
the data submodule is used for receiving a database reconstruction instruction and acquiring a merkle root of the block chain data of each node in the block chain according to the database reconstruction instruction;
and the comparison submodule is used for reconstructing the local database by using the block chain data corresponding to the merkle root approved by the nodes with the ratio larger than the preset ratio as the standard block chain data and according to the distribution relation and the commission settlement record in the standard block chain data.
5. The blockchain-based distribution relationship recording apparatus according to claim 4, wherein the verification broadcasting module specifically includes:
the encryption sub-module is used for encrypting the distribution relationship between the first user and the second user, the first user signature and the second user signature by using a platform public key when the first hash value and the second hash value are consistent with the third hash value;
and the broadcast sub-module is used for broadcasting the encrypted distribution relationship between the first user and the second user, the first user signature and the second user signature into the blockchain.
6. The blockchain-based distribution relationship recording apparatus according to claim 5, wherein the apparatus further comprises:
the inquiry verification module is used for receiving a distribution relation inquiry instruction and a signature of a third user and verifying the signature of the third user by using a public key of the third user;
the verification return module is used for acquiring the distribution relation related to the third user from a local database when the signature of the third user passes verification, and returning the distribution relation to the inquiry user;
or, the verification returning module is configured to, when the signature of the third user passes verification, obtain the encrypted distribution relationship related to the third user from the blockchain, decrypt the distribution relationship using a platform private key, and return the decrypted distribution relationship to the querying user.
7. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 3 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 3.
CN201811373876.5A 2018-11-16 2018-11-16 Block chain-based distribution relation recording method and device and terminal equipment Active CN109660352B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811373876.5A CN109660352B (en) 2018-11-16 2018-11-16 Block chain-based distribution relation recording method and device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811373876.5A CN109660352B (en) 2018-11-16 2018-11-16 Block chain-based distribution relation recording method and device and terminal equipment

Publications (2)

Publication Number Publication Date
CN109660352A CN109660352A (en) 2019-04-19
CN109660352B true CN109660352B (en) 2021-12-03

Family

ID=66111353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811373876.5A Active CN109660352B (en) 2018-11-16 2018-11-16 Block chain-based distribution relation recording method and device and terminal equipment

Country Status (1)

Country Link
CN (1) CN109660352B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111144851B (en) * 2019-06-10 2024-01-19 北京云悦共创网络技术有限公司 Block chain distribution system
US10909252B2 (en) 2019-06-11 2021-02-02 Advanced New Technologies Co., Ltd. Blockchain-based relationship binding method, apparatus, and device
CN110334160A (en) * 2019-06-11 2019-10-15 阿里巴巴集团控股有限公司 Relationship binding method, device and equipment based on block chain
CN110597840B (en) * 2019-09-26 2023-09-22 腾讯科技(深圳)有限公司 Partner relationship establishment method, device, equipment and storage medium based on blockchain
CN111371785A (en) * 2020-03-02 2020-07-03 杭州溪塔科技有限公司 Block chain privacy transaction method and device and electronic equipment
CN111402011B (en) * 2020-05-29 2020-09-08 支付宝(杭州)信息技术有限公司 Block chain based commission distribution method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107426170A (en) * 2017-05-24 2017-12-01 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN107657553A (en) * 2017-09-21 2018-02-02 浙江惠码科技有限公司 A kind of electronic contract generation method based on alliance's chain, information anti-fake method of tracing to the source

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10198325B2 (en) * 2016-05-24 2019-02-05 Mastercard International Incorporated Method and system for desynchronization recovery for permissioned blockchains using bloom filters
CN108647361B (en) * 2018-05-21 2021-12-03 中国工商银行股份有限公司 Data storage method, device and system based on block chain

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107426170A (en) * 2017-05-24 2017-12-01 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN107657553A (en) * 2017-09-21 2018-02-02 浙江惠码科技有限公司 A kind of electronic contract generation method based on alliance's chain, information anti-fake method of tracing to the source

Also Published As

Publication number Publication date
CN109660352A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
CN109660352B (en) Block chain-based distribution relation recording method and device and terminal equipment
CN107077557B (en) Method and device for releasing and verifying software application program
US10958436B2 (en) Methods contract generator and validation server for access control of contract data in a distributed system with distributed consensus
US11902601B2 (en) System and techniques for digital data lineage verification
CN109635572B (en) Contract signing method and device based on block chain and terminal equipment
WO2020211496A1 (en) Method, system and apparatus for verifying signature in blockchain ledger, and device
US20220086005A1 (en) System and method for decentralized digital structured data storage, management, and authentication using blockchain
CN109657492B (en) Database management method, medium, and electronic device
CN113472720B (en) Digital certificate key processing method, device, terminal equipment and storage medium
CN109493047A (en) A kind of commission settlement method, device and terminal device based on block chain
CN110851843A (en) Data management method and device based on block chain
CN106156345B (en) Item file deposits card method, deposits card equipment and terminal device
US8972732B2 (en) Offline data access using trusted hardware
EP4092984A1 (en) Data processing method and apparatus, device and medium
CN113486122A (en) Data sharing method and electronic equipment
CN110381114B (en) Interface request parameter processing method and device, terminal equipment and medium
US8706635B2 (en) Use of licensed content without identification thereof
CN110347678B (en) Financial data storage method, system, device and equipment
CN110599176A (en) Data processing method and device based on block chain, storage medium and node equipment
CN115296821B (en) Data processing system for digital collection management
CN112632571B (en) Data encryption method, data decryption device and storage device
CN114780986B (en) Authentication data processing method and device, electronic equipment and medium
CN116095671B (en) Resource sharing method based on meta universe and related equipment thereof
CN111562916B (en) Method and device for sharing algorithm
CN116962445A (en) Data processing system, method and device

Legal Events

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