Summary of the invention
The embodiment of the present application purpose is to provide a kind of data record method based on block chain, device and electronic equipment, dress
Set and electronic equipment, can using the database of decentralization possessed by block chain, realize it is a kind of never lose, objective and nothing
The data recording schemes that method is distorted.
To achieve the goals above, the embodiment of the present application is achieved in that
In a first aspect, providing a kind of data record method based on block chain, comprising:
Target block chain node responds the cochain request of target data, initiates to be directed to the target to other block chain nodes
The multi-party common recognition of data, wherein the target data includes the history event data of the life process of target user;
If the multi-party common recognition for the target data successfully completes at the appointed time, the target block chain node
Addition record has the block of the target data in local block chain;
If the multi-party common recognition for the target data completes failure, or exists for the multi-party common recognition of the target data
It is not completed in the stipulated time, then target block chain node refusal addition record in local block chain has the target
The block of data.
Second aspect provides a kind of data recording equipment based on block chain, comprising:
Multi-party common recognition module, target block chain node respond the cochain request of target data, send out to other block chain nodes
Play the multi-party common recognition for the target data, wherein the target data includes the history thing of the life process of target user
Number of packages evidence;
Block adding module, it is described if the multi-party common recognition for the target data successfully completes at the appointed time
Target block chain node adds the block that record has the target data in local block chain;
Cochain processing module if the multi-party common recognition for the target data completes failure, or is directed to the number of targets
According to multi-party common recognition do not completed within the stipulated time, then target block chain node refusal adds in local block chain
Record has the block of the target data.
The third aspect provides a kind of electronic equipment and includes: memory, processor and be stored on the memory and can be
The computer program run on the processor, the computer program are executed by the processor:
Target block chain node responds the cochain request of target data, initiates to be directed to the target to other block chain nodes
The multi-party common recognition of data, wherein the target data includes the history event data of the life process of target user;
If the multi-party common recognition for the target data successfully completes at the appointed time, the target block chain node
Addition record has the block of the target data in local block chain;
If the multi-party common recognition for the target data completes failure, or exists for the multi-party common recognition of the target data
It is not completed in the stipulated time, then target block chain node refusal addition record in local block chain has the target
The block of data.
Fourth aspect provides a kind of calculation machine readable storage medium storing program for executing, is stored with calculating on the computer readable storage medium
Machine program, the computer program realize following steps when being executed by processor:
Target block chain node responds the cochain request of target data, initiates to be directed to the target to other block chain nodes
The multi-party common recognition of data, wherein the target data includes the history event data of the life process of target user;
If the multi-party common recognition for the target data successfully completes at the appointed time, the target block chain node
Addition record has the block of the target data in local block chain;
If the multi-party common recognition for the target data completes failure, or exists for the multi-party common recognition of the target data
It is not completed in the stipulated time, then target block chain node refusal addition record in local block chain has the target
The block of data.
The scheme of the embodiment of the present application records the history event data of the life process of target user using block chain.It goes
The block chain of centralization has numerous block chain nodes, and number can be guaranteed by carrying out cochain to data by way of knowing together in many ways
According to authenticity and objectivity.Meanwhile the time known together in many ways is further limited, if block chain node is at the appointed time
Do not reach the common recognition of data, then refuse data cochain, to reduce the risk being tampered before data cochain to a certain extent.
In addition, data after cochain, need to destroy could be distorted more than half block chain node, or destroy all
Block chain node could complete deletion, can not accomplish theoretically, therefore data are recorded in that can guarantee in block chain will not
It is maliciously tampered and never loses.
Specific embodiment
In order to make those skilled in the art better understand the technical solutions in the application, below in conjunction with the application reality
The attached drawing in example is applied, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described implementation
Example is merely a part but not all of the embodiments of the present application.Based on the embodiment in the application, this field is common
The application protection all should belong in technical staff's every other embodiment obtained without creative efforts
Range.
The data (such as historical data, traffic violations data) required as previously mentioned, for authenticity, objectivity, note
The reliability of record is highly important factor.The mechanism for only relying on people and centralization carries out data record, it is difficult to guarantee data not
It can lose or be maliciously tampered.The application is intended to realize one kind using the database of decentralization possessed by block chain thus
It never loses, the objective and data recording schemes that can not distort.
Fig. 1 is the flow chart of data record method of the embodiment of the present application based on block chain.Method shown in FIG. 1 can be by
Hereafter corresponding device executes, comprising:
Step S102, target block chain node respond the cochain request of target data, initiate needle to other block chain nodes
To the multi-party common recognition of target data, wherein the target data includes the history event data of the life process of target user.
It should be understood that in this step, it can be by distributed block chain without with prejudice and true history event data
Node is reached common understanding, and cochain is obtained.
Step S104, if the multi-party common recognition for target data successfully completes at the appointed time, target block chain link
Point addition record in local block chain has the block of target data.
Specifically, in this step, if target block chain node is accounting nodes, generating record has target data
Block, and the block is added in local block chain, and the block is broadcasted to other block chain nodes.If target block
Chain node is non-accounting nodes, then the record for receiving other block chain node broadcasts has the block of target data, and in this area
The block is added in block chain.
Step S106, if the multi-party common recognition for target data completes failure, or for the multi-party common recognition of target data
It does not complete at the appointed time, then target block chain node refusal addition record in local block chain has the area of target data
Block.
Wherein, during multi-party common recognition, there are the risks being tampered before cochain for target data, in order to avoid this problem hair
Raw, not Ying Taijiu of above-mentioned stipulated time is advisable with being greater than or equal to 1 hour and being less than or equal to 24 hours.
It can see that the scheme of the embodiment of the present application is recorded using block chain based on data record method shown in FIG. 1
The history event data of the life process of target user.The block chain of decentralization has numerous block chain nodes, by more
The mode of Fang Gongshi, which carries out cochain to data, can guarantee the authenticity and objectivity of data.Meanwhile it further limiting multi-party
The time of common recognition refuses data cochain if block chain node does not reach the common recognition of data at the appointed time, thus one
Determine to reduce the risk being tampered before data cochain in degree.In addition, data after cochain, need to destroy more than half area
Block chain node could be distorted, or destroy all block chain nodes ability complete deletions, be that can not do theoretically
Arrive, thus data be recorded in block chain can guarantee will not be maliciously tampered and never lose.
It describes in detail below to the method for the embodiment of the present application.
The method of the embodiment of the present application using block chain decentralization, go trust, anti-tamper Distributed Storage
Technology, the record of Lai Shixian data.
Wherein, the main flow of data record method includes:
Step S201, the target block chain of block chain receive the cochain request of history event data.
Wherein, history event data record has the event of human mind's process.Cochain request can be mankind's activity into
What the event of journey was initiated after occurring.Under normal circumstances, event instantly is not aware that following influence after just occurring, so
Each side has no reason and prepares to distort event, and one of original intention that history event data is stored in block chain is exactly anti-
Only following the distorting and misreading to event instantly.
Step S202, target block chain node respond cochain request, initiate to be directed to historical events to other block chain nodes
The multi-party common recognition of data.
Wherein, in order to provide the authenticity and fairness of common recognition, can specify that target block chain node to same level its
His block chain node initiates multi-party common recognition, for example national history is known together by global every country mechanism, provincial history
It is known together by national mechanism, each province.
Step S203 judges that the multi-party common recognition of history event data successfully completes at the appointed time.It is to then follow the steps
S204, it is no to then follow the steps S207.
As previously mentioned, the stipulated time was advisable with 1 hour to 24 hours, need to be determined according to the property of the event of record.For
Guarantee event can be recorded really, it is specified that the time can be using the time of origin of event as the initial time of timing.
Through practice discovery, it is specified that the time is set as 3 hours, the common recognition demand of most history event datas can satisfy, while 3 small at this
Mechanism, Shi Nei each side is difficult to generate the motivation and preparation distorted.
Step S204, target block chain node judge whether itself is accounting nodes, are to then follow the steps S205, otherwise
Execute step S206.
Step S205, target block chain node generate the block that record has history event data, and in local block chain
The block is added, and block is broadcasted to other block chain nodes.
Wherein, preferably, the recording address of target data within a block and the content of target data are uniquely corresponding.
For example, in this step, target block chain node can be based on hashing algorithm (such as Message Digest 5, secure hash algorithm
Deng), at least partly content of target data is compiled, the recording address of target data within a block is obtained.
It should be understood that in above-mentioned preferred embodiment, the content of target data, which changes, will lead to recording address and also becomes therewith
It is dynamic.
Therefore, the recording address that each block chain node is corresponded to by comparing target data, can effectively determine target data
Content whether occurred to distort, and then judge the accuracy of target data.For example, working as the mesh that a small number of block chain nodes are recorded
When the recording address for the target data that the recording address and most block chain nodes for marking data are recorded is inconsistent, then it can indicate
The target data that a small number of block chain nodes are recorded is (in practical applications, breaking to distort target data of being tampered with
The bad block chain node more than half is the thing that it is almost impossible).
Step S206, the record that target block chain node receives other block chain node broadcasts have the block of target data,
And the block of broadcast acquisition is added in local block chain.
Step S207, target block chain node refuse cochain request, and not in local block chain, addition record has number of targets
According to block.
It is the introduction to the method for the embodiment of the present application above.It should be understood that not departing from hereinbefore basis,
Variation appropriate can also be carried out, these variations also should be regarded as the protection scope of the embodiment of the present application.For example, the embodiment of the present application
Data record method be applicable in record any data, however it is not limited to be above-mentioned history event data.
Ground is corresponded to the above method, as shown in figure 3, the embodiment of the present application also provides a kind of data note based on block chain
Recording device 300, comprising:
Multi-party common recognition module 310, target block chain node responds the cochain request of target data, to other block chain nodes
Initiate the multi-party common recognition for being directed to the target data, wherein the target data includes the history of the life process of target user
Event data.
Block adding module 320, if the multi-party common recognition for the target data successfully completes at the appointed time, institute
It states target block chain node and adds the block that record has the target data in local block chain.
Cochain processing module 330 if the multi-party common recognition for the target data completes failure, or is directed to the target
The multi-party common recognition of data does not complete within the stipulated time, then the target block chain node refusal adds in local block chain
Record is added to have the block of the target data.
It can see that the scheme of the embodiment of the present application is recorded using block chain based on data recording equipment shown in Fig. 3
The history event data of the life process of target user.The block chain of decentralization has numerous block chain nodes, by more
The mode of Fang Gongshi, which carries out cochain to data, can guarantee the authenticity and objectivity of data.Meanwhile it further limiting multi-party
The time of common recognition refuses data cochain if block chain node does not reach the common recognition of data at the appointed time, thus one
Determine to reduce the risk being tampered before data cochain in degree.In addition, data after cochain, need to destroy more than half area
Block chain node could be distorted, or destroy all block chain nodes ability complete deletions, be that can not do theoretically
Arrive, thus data be recorded in block chain can guarantee will not be maliciously tampered and never lose.
Optionally, the recording address of target data within a block and the content of target data are uniquely corresponding, i.e. target data
Content change and will lead to recording address and also change therewith.Obviously, the comparison of the recording address based on target data, can be with
Judge whether the content of target data distorts, and then determines the accuracy of target data.For example, a small number of block chain nodes institute
The recording address of the target data of record and the recording address for the target data that most block chain nodes are recorded are inconsistent, then table
The target data for showing that a small number of block chain nodes are recorded is distorted.
Wherein, the recording address can be is compiled based at least partly content of the hashing algorithm to the target data
It translates.
As exemplary introduction, above-mentioned hashing algorithm include it is following any one:
Message Digest 5 and secure hash algorithm.
Optionally, if the target block chain node is accounting nodes, the generation record of block adding module 320 has described
The block of target data, and the block is added in local block chain, and the block is broadcasted to other block chain links
Point.
Optionally, if the target block chain node is non-accounting nodes, block adding module 320 receives other blocks
The record of chain node broadcasts has the block of the target data, and adds the block in local block chain.
Optionally, the target data includes the history event data of mankind's activity process.
Optionally, the stipulated time is greater than or equal to 1 hour and is less than or equal to 24 hours.
Optionally, the stipulated time starts timing when the target data generates.
Obviously, the data recording equipment of the embodiment of the present application can be used as holding for above-mentioned data record method shown in FIG. 1
Row main body, therefore the data recording equipment can be realized the function that data record method is realized in Fig. 1 and Fig. 2.Due to principle
Identical, repeats no more herein.
Fig. 4 is the structural schematic diagram of one embodiment electronic equipment of the application.Referring to FIG. 4, in hardware view, the electricity
Sub- equipment includes processor, optionally further comprising internal bus, network interface, memory.Wherein, memory may be comprising interior
It deposits, such as high-speed random access memory (Random-Access Memory, RAM), it is also possible to further include non-volatile memories
Device (non-volatile memory), for example, at least 1 magnetic disk storage etc..Certainly, which is also possible that other
Hardware required for business.
Processor, network interface and memory can be connected with each other by internal bus, which can be ISA
(Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral
Component Interconnect, Peripheral Component Interconnect standard) bus or EISA (Extended Industry Standard
Architecture, expanding the industrial standard structure) bus etc..The bus can be divided into address bus, data/address bus, control always
Line etc..Only to be indicated with a four-headed arrow in Fig. 4, it is not intended that an only bus or a type of convenient for indicating
Bus.
Memory, for storing program.Specifically, program may include program code, and said program code includes calculating
Machine operational order.Memory may include memory and nonvolatile memory, and provide instruction and data to processor.
Processor is from the then operation into memory of corresponding computer program is read in nonvolatile memory, in logical layer
Data recording equipment is formed on face.Processor executes the program that memory is stored, and is specifically used for executing following operation:
Target block chain node responds the cochain request of target data, initiates to be directed to the target to other block chain nodes
The multi-party common recognition of data, wherein the target data includes the history event data of the life process of target user.
If the multi-party common recognition for the target data successfully completes at the appointed time, the target block chain node
Addition record has the block of the target data in local block chain.
If the multi-party common recognition for the target data completes failure, or exists for the multi-party common recognition of the target data
It is not completed in the stipulated time, then target block chain node refusal addition record in local block chain has the target
The block of data.
Electronic equipment based on shown in Fig. 4 can see that the scheme of the embodiment of the present application records target using block chain
The history event data of the life process of user.The block chain of decentralization has numerous block chain nodes, by many ways total
The mode of knowledge, which carries out cochain to data, can guarantee the authenticity and objectivity of data.Meanwhile further limiting multi-party common recognition
Time refuse data cochain if block chain node does not reach the common recognition of data at the appointed time, thus in certain journey
The risk being tampered before data cochain is reduced on degree.In addition, data after cochain, need to destroy more than half block chain
Node just can be carried out and distort, or destroy all block chain nodes ability complete deletions, can not accomplish theoretically,
Therefore data be recorded in block chain can guarantee will not be maliciously tampered and never lose.
The data record method based on block chain disclosed in the above-mentioned embodiment illustrated in fig. 1 such as the application can be applied to handle
In device, or realized by processor.Processor may be a kind of IC chip, the processing capacity with signal.It is realizing
In the process, each step of the above method can pass through the integrated logic circuit of the hardware in processor or the instruction of software form
It completes.Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processor, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device are divided
Vertical door or transistor logic, discrete hardware components.It may be implemented or execute and is in the embodiment of the present application disclosed each
Method, step and logic diagram.General processor can be microprocessor or the processor is also possible to any conventional place
Manage device etc..The step of method in conjunction with disclosed in the embodiment of the present application, can be embodied directly in hardware decoding processor and execute
At, or in decoding processor hardware and software module combination execute completion.Software module can be located at random access memory,
This fields such as flash memory, read-only memory, programmable read only memory or electrically erasable programmable memory, register maturation
In storage medium.The storage medium is located at memory, and processor reads the information in memory, completes above-mentioned side in conjunction with its hardware
The step of method.
It should be understood that above-mentioned data recording equipment may be implemented in Fig. 1 and shown in Fig. 2 in the electronic equipment of the embodiment of the present application
The function of embodiment, repeats no more herein.
Certainly, other than software realization mode, other implementations are not precluded in the electronic equipment of the application, for example patrol
Collect device or the mode of software and hardware combining etc., that is to say, that the executing subject of following process flow is not limited to each patrol
Unit is collected, hardware or logical device are also possible to.
In addition, the embodiment of the present application also proposed a kind of computer readable storage medium, the computer readable storage medium
One or more programs are stored, which includes instruction, and it is included the portable of multiple application programs which, which works as,
When formula electronic equipment executes, the method that the portable electronic device can be made to execute embodiment illustrated in fig. 1, and be specifically used for executing
Following methods:
Target block chain node responds the cochain request of target data, initiates to be directed to the target to other block chain nodes
The multi-party common recognition of data, wherein the target data includes the history event data of the life process of target user.
If the multi-party common recognition for the target data successfully completes at the appointed time, the target block chain node
Addition record has the block of the target data in local block chain.
If the multi-party common recognition for the target data completes failure, or exists for the multi-party common recognition of the target data
It is not completed in the stipulated time, then target block chain node refusal addition record in local block chain has the target
The block of data.
It can see that the scheme of the embodiment of the present application is recorded using block chain based on above-mentioned computer readable storage medium
Data.The block chain of decentralization has numerous block chain nodes, and carrying out cochain to data by way of knowing together in many ways can
To guarantee the authenticity and objectivity of data.Meanwhile the time known together in many ways is further limited, if block chain node is being advised
The common recognition for not reaching data in fixing time, then refuse data cochain, to be usurped before reducing data cochain to a certain extent
The risk changed.In addition, data after cochain, need to destroy could be distorted more than half block chain node, either
All block chain nodes ability complete deletions are destroyed, can not be accomplished theoretically, therefore data are recorded in block chain
Can guarantee will not be maliciously tampered and never lose.
It should be understood that above-metioned instruction can make above when the portable electronic device for being included multiple application programs executes
The data recording equipment realizes the function of Fig. 1 and embodiment illustrated in fig. 2, and repeats no more herein.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or implementation combining software and hardware aspects can be used in this specification
The form of example.Moreover, it wherein includes the computer of computer usable program code that this specification, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
The above is only the embodiments of this specification, are not limited to this specification.For those skilled in the art
For, this specification can have various modifications and variations.All any modifications made within the spirit and principle of this specification,
Equivalent replacement, improvement etc., should be included within the scope of the claims of this specification.