CN110287226A - Data query method and device based on block chain - Google Patents
Data query method and device based on block chain Download PDFInfo
- Publication number
- CN110287226A CN110287226A CN201910390287.6A CN201910390287A CN110287226A CN 110287226 A CN110287226 A CN 110287226A CN 201910390287 A CN201910390287 A CN 201910390287A CN 110287226 A CN110287226 A CN 110287226A
- Authority
- CN
- China
- Prior art keywords
- account book
- block
- newest
- accounting nodes
- node
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
Abstract
The embodiment of the invention provides a kind of data query method and devices based on block chain.On the one hand, this method comprises: receiving the inquiry request for inquiring account book data;It is inquired according to the inquiry request newest block-identified in account book status subsystem, wherein, the account book status subsystem keeps records of the accounting nodes information of newest account book data, the account book status subsystem is the child node of node of knowing together in the either distributed account book system of a node in distributed account book system, the distribution account book system includes: common recognition node, accounting nodes;According to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;Newest account book data are inquired from the target accounting nodes.Through the invention, it solves and inquires the low technical problem of newest account book data age rate in the related technology, improve the efficiency and accuracy of data query.
Description
[technical field]
The present invention relates to computer field more particularly to a kind of data query method and devices based on block chain.
[background technique]
In the related technology for distributed account book system, when a user is by data on some querying node account book
It waits, is very likely to the node and restores or be not synchronized to also newest account book data just from failure.In this case, it looks into
The account book data of inquiry cannot be guaranteed it is newest;If user submits further transaction using the data of the inquiry, due to number
According to inconsistency will lead to Fail Transaction.
In the related technology, in view of the above-mentioned problems, solution in the related technology is that user looks into again after Fail Transaction
Data are ask to carry out next step transaction;Or all nodes in user query distribution account book are required, then according to some machine
It makes and determines which node has newest account book data, then pass through the querying node data.Implementation method in the related technology
Efficiency is lower, needs user to retry or determines which node has been updated to newest account book, user's body by complex logic
It tests poor.
For the above problem present in the relevant technologies, at present it is not yet found that the solution of effect.
[summary of the invention]
In view of this, the embodiment of the invention provides a kind of data query method and device based on block chain, to solve
The low technical problem of newest account book data age rate is inquired in the related technology.
On the one hand, the embodiment of the invention provides a kind of data query methods based on block chain, which comprises connects
Receive the inquiry request for inquiring account book data;The newest block mark in account book status subsystem is inquired according to the inquiry request
Know, wherein the account book status subsystem keeps records of the accounting nodes information of newest account book data, the account book state subgroup
A child node of the system for node of knowing together in the either distributed account book system of a node in distributed account book system, institute
Stating distributed account book system includes: common recognition node, accounting nodes;According to preset strategy inquiry with it is described newest block-identified corresponding
Target accounting nodes;Newest account book data are inquired from the target accounting nodes.
Optionally, according to the inquiry request inquire account book status subsystem in it is newest it is block-identified include: according to institute
It states inquiry request and reads data structure in the account book status subsystem, wherein the data structure includes that a direction is newest
Block-identified pointer;Determine that the pointer is directed toward newest block-identified.
Optionally, being inquired according to preset strategy with the newest block-identified corresponding target accounting nodes includes: inquiry
With newest block-identified corresponding all accounting nodes, and therefrom randomly choose one be used as the target accounting nodes;
Or, inquiry with newest block-identified corresponding all accounting nodes, and therefrom select a network delay minimum as
The target accounting nodes;Or, inquiry with newest block-identified corresponding all accounting nodes, and therefrom select one manage
Area under one's jurisdiction domain includes sending target accounting nodes described in the conduct of the inquiring client terminal position of the inquiry request;Or, inquiry and institute
Newest block-identified corresponding all accounting nodes are stated, and therefrom randomly chooses two and is used as the target accounting nodes.
Optionally, according to the inquiry request inquire account book status subsystem in it is newest it is block-identified before, it is described
Method further include: the account book status subsystem is set in the distributed account book system;Or, in the distributed account book system
The account book status subsystem is set in any common recognition node of system.
Optionally, according to the inquiry request inquire account book status subsystem in it is newest it is block-identified before, it is described
Method further include: determine the newest block that common recognition node is generated according to Transaction Information;The index of the newest block is added to
The account book status subsystem, and the Transaction Information is distributed to multiple accounting nodes, so that each accounting nodes
After verifying the Transaction Information, the Transaction Information is saved to local account book, and by the described newest of the newest block
Block-identified and accounting nodes mark is saved to the account book status subsystem.
Optionally, determine that common recognition node includes: whether monitoring common recognition node connects according to the newest block that Transaction Information generates
New Transaction Information is received, it, will according to preset rules by the common recognition node when node of knowing together receives new Transaction Information
The new Transaction Information is packaged the block generated and is determined as the newest block;Or, monitoring is known together, whether node is distributed new
It is block-identified, in new block-identified of node distribution of knowing together, the new block-identified corresponding block is determined as described
Newest block.
Optionally, monitoring common recognition node whether distribute it is new it is block-identified include: monitoring common recognition node whether distribute it is new
Block serial number, alternatively, whether monitoring common recognition node generates new cryptographic Hash.
On the other hand, the embodiment of the invention provides a kind of data query device based on block chain, described device includes:
Receiving module, for receiving the inquiry request for inquiring account book data;First enquiry module, for according to the inquiry request
It inquires newest block-identified in account book status subsystem, wherein the account book status subsystem has kept records of newest account book
The accounting nodes information of data, the account book status subsystem are that a node in distributed account book system is either distributed
A child node of common recognition node in account book system, the distribution account book system includes: common recognition node, accounting nodes;Second
Enquiry module, for according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;Third inquires mould
Block, for inquiring newest account book data from the target accounting nodes.
Optionally, first enquiry module includes: reading unit, for reading the account book according to the inquiry request
Data structure in status subsystem, wherein the data structure includes one and is directed toward newest block-identified pointer;It determines single
Member, for determining that the pointer is directed toward newest block-identified.
Optionally, second enquiry module includes: the first query unit, for inquire with it is described newest block-identified right
All accounting nodes answered, and therefrom randomly choose one and be used as the target accounting nodes;Or, the second query unit, is used for
Inquiry and newest block-identified corresponding all accounting nodes, and therefrom select a network delay minimum as described in
Target accounting nodes;Or, third query unit, for inquiry and newest block-identified corresponding all accounting nodes, and
Therefrom selecting a compass of competency includes the book keeping operation section of the target as described in for sending the inquiring client terminal position of the inquiry request
Point;Or, the 4th query unit, for inquiry and newest block-identified corresponding all accounting nodes, and therefrom random choosing
It selects two and is used as the target accounting nodes.
Optionally, described device further include: the first setup module is used in first enquiry module according to the inquiry
In request inquiry account book status subsystem it is newest it is block-identified before, the account book is set in the distributed account book system
Status subsystem;Or, the second setup module, for inquiring account book state according to the inquiry request in first enquiry module
In subsystem it is newest it is block-identified before, the account book shape is set in any common recognition node of the distributed account book system
State subsystem.
Optionally, described device further include: determining module is used in first enquiry module according to the inquiry request
Inquire in account book status subsystem it is newest it is block-identified before, determine the most new district that generates according to Transaction Information of common recognition node
Block;Adding module for the index of the newest block to be added to the account book status subsystem, and the transaction is believed
Breath is distributed to multiple accounting nodes, so that each accounting nodes are after verifying the Transaction Information, by the Transaction Information
It saves to local account book, and the newest block-identified and accounting nodes mark of the newest block is saved to the account book
Status subsystem.
Optionally, the determining module includes: the first monitoring unit, for monitoring whether common recognition node receives new friendship
Easy information, when node of knowing together receives new Transaction Information, by the common recognition node according to preset rules by the new friendship
The block that easy information package generates is determined as the newest block;Or, the second monitoring unit, for monitoring whether common recognition node divides
New block-identified of hair determines the new block-identified corresponding block in new block-identified of node distribution of knowing together
For the newest block.
Optionally, second monitoring unit includes: the first monitoring subelement, for monitoring whether common recognition node is distributed newly
Block serial number, alternatively, second monitoring subelement, for monitor know together node whether generate new cryptographic Hash.
According to still another embodiment of the invention, a kind of storage medium is additionally provided, meter is stored in the storage medium
Calculation machine program, wherein the computer program is arranged to execute the step in any of the above-described embodiment of the method when operation.
According to still another embodiment of the invention, a kind of electronic device, including memory and processor are additionally provided, it is described
Computer program is stored in memory, the processor is arranged to run the computer program to execute any of the above-described
Step in embodiment of the method.
Through the invention, after receiving for inquiring the inquiry request of account book data, account is inquired according to the inquiry request
It is newest block-identified in this status subsystem, wherein the account book status subsystem keeps records of newest account book data
Accounting nodes information, according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes, and from the mesh
Newest account book data are inquired in mark accounting nodes.By the way that account book status subsystem is arranged, is saved and divided by account book status subsystem
Newest account book state in cloth account book system can rapidly and accurately find the accounting nodes for storing newest account book data, from
System level solves the problems, such as that inquiry data do not update, solves that inquire newest account book data age rate in the related technology low
Under technical problem, improve the efficiency and accuracy of data query.
[Detailed description of the invention]
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this field
For those of ordinary skill, without any creative labor, it can also be obtained according to these attached drawings other attached
Figure.
Fig. 1 is a kind of hardware block diagram of data query server based on block chain of the embodiment of the present invention;
Fig. 2 is the flow chart of the data query method according to an embodiment of the present invention based on block chain;
Fig. 3 is that the embodiment of the present invention inquires newest block-identified flow diagram;
Fig. 4 is the structural block diagram of the data query device according to an embodiment of the present invention based on block chain.
[specific embodiment]
Hereinafter, the present invention will be described in detail with reference to the accompanying drawings and in combination with Examples.It should be noted that not conflicting
In the case of, the features in the embodiments and the embodiments of the present application can be combined with each other.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, "
Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.
Embodiment 1
Embodiment of the method provided by the embodiment of the present application one can be in server, terminal or similar operation
It is executed in device.For running on the server, Fig. 1 is a kind of data query clothes based on block chain of the embodiment of the present invention
The hardware block diagram of business device.As shown in Figure 1, server 10 may include one or more (only showing one in Fig. 1) processing
Device 102 (processing unit that processor 102 can include but is not limited to Micro-processor MCV or programmable logic device FPGA etc.) and
Memory 104 for storing data, optionally, above-mentioned server can also include the transmission device 106 for communication function
And input-output equipment 108.It will appreciated by the skilled person that structure shown in FIG. 1 is only to illustrate, it is not right
The structure of above-mentioned server causes to limit.For example, server 10 may also include the more or less component than shown in Fig. 1,
Or with the configuration different from shown in Fig. 1.
Memory 104 can be used for storing computer program, for example, the software program and module of application software, such as this hair
The corresponding computer program of data query method based on block chain in bright embodiment, processor 102 are stored in by operation
Computer program in memory 104 realizes above-mentioned method thereby executing various function application and data processing.It deposits
Reservoir 104 may include high speed random access memory, may also include nonvolatile memory, as one or more magnetic storage fills
It sets, flash memory or other non-volatile solid state memories.In some instances, memory 104 can further comprise relative to place
The remotely located memory of device 102 is managed, these remote memories can pass through network connection to server 10.The reality of above-mentioned network
Example includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Transmitting device 106 is used to that data to be received or sent via a network.Above-mentioned network specific example may include
The wireless network that the communication providers of server 10 provide.In an example, transmitting device 106 includes a network adapter
(Network Interface Controller, referred to as NIC), can be connected by base station with other network equipments so as to
It is communicated with internet.In an example, transmitting device 106 can be radio frequency (Radio Frequency, referred to as RF)
Module is used to wirelessly be communicated with internet.
The present embodiment is applied in distributed account book system, and block chain itself is a type of distributed account book, distribution
Formula account book technology is technically decentralization, and the common recognition principle dependent on similar block chain.In distributed account book system
In, the account book data generated can be being saved and record according to time sequencing, when a user passes through some querying node account book number
According to when, the newest account book data recorded on the node can be fed back.
A kind of data query method based on block chain is provided in the present embodiment, and Fig. 2 is according to embodiments of the present invention
The data query method based on block chain flow chart, as shown in Fig. 2, the process includes the following steps:
Step S202 receives the inquiry request for inquiring account book data;
Distributed account book system includes common recognition node, and accounting nodes can further include the block section of storing data
Point, common recognition node, which refers to, is responsible for the node that transaction sorts and Transaction Information is bundled to block in distributed account book network, book keeping operation
Node, which refers to, runs intelligent contract, the Transaction Information in verifying block and the node for updating account book in distributed account book network.
Step S204 is inquired newest block-identified in account book status subsystem, wherein described according to the inquiry request
Account book status subsystem keeps records of the accounting nodes information of newest account book data;
The account book status subsystem of the present embodiment is a software systems, it can be a list of distributed account book network
Only son's system also can be used as a subsystem of node of knowing together in distributed account book network, that is, account book status subsystem can be real
It is now the node of a new type in distributed account book network, can also be used as a subsystem of existing common recognition node, be total
Know a child node of node.
Step S206, according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;
Step S208 inquires newest account book data from the target accounting nodes.
Scheme through this embodiment is asked after receiving for inquiring the inquiry request of account book data according to the inquiry
Ask newest block-identified in inquiry account book status subsystem, wherein the account book status subsystem has kept records of newest account
The accounting nodes information of notebook data, according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes, and
Newest account book data are inquired from the target accounting nodes.By the way that account book status subsystem is arranged, pass through account book state subsystem
Blanket insurance deposits the newest account book state in distributed account book system, can rapidly and accurately find the book keeping operation for storing newest account book data
Node solves the problems, such as that inquiry data do not update from system level, solves and inquire newest account book data in the related technology
When inefficiency the technical issues of, improve the efficiency and accuracy of data query.
In an optional embodiment of the present embodiment, inquired in account book status subsystem according to the inquiry request
It is newest it is block-identified before, further include following one: the account book status subsystem be set in distributed account book system;?
The account book status subsystem is set in any common recognition node of distributed account book system.
In the scheme of the present embodiment, in the newest block mark inquired according to the inquiry request in account book status subsystem
Before knowledge, further includes:
S11 determines the newest block that common recognition node is generated according to Transaction Information;
Optionally, determining common recognition node includes following validation testing according to the newest block that Transaction Information generates:
Mode one: whether monitoring common recognition node receives new Transaction Information, and new transaction letter is received in common recognition node
When breath, by the common recognition node according to preset rules by the new Transaction Information be packaged the block generated be determined as it is described newest
Block;
Mode two: it is new block-identified whether monitoring common recognition node is distributed, in new block-identified of node distribution of knowing together,
The new block-identified corresponding block is determined as the newest block.
Specifically, monitoring common recognition node whether distribute it is new it is block-identified include: monitoring common recognition node whether distribute it is new
Block serial number (ID, the ID cumulative number since 0), alternatively, whether monitoring common recognition node generates new cryptographic Hash, because of block
Each block in chain includes the cryptographic Hash of the previous block of its adjoining.
The index of the newest block is added to the account book status subsystem, and the Transaction Information is divided by S12
Multiple accounting nodes are sent to, so that each accounting nodes save the Transaction Information after verifying the Transaction Information
It saves to local account book, and by the newest block-identified and accounting nodes mark of the newest block to the account book state subsystem
System.
When detecting that the common recognition node in distributed account book system generates new block, add in account book status subsystem
Add the index of newly-increased block, which is equivalent to a catalogue, and rear extended meeting saves corresponding node ID.The sequence of block can be passed through
Number, cryptographic Hash comes whether cycle detection common recognition node has generated new block.Alternatively, whether real-time monitoring common recognition node receives
To the Transaction Information of transaction, when monitoring that common recognition node receives Transaction Information, common recognition node can be generated according to Transaction Information
New block.
Interaction flow between the accounting nodes and common recognition node of the present embodiment includes: that transaction is initiated at transacting customer end, is generated
It trades motion, accounting nodes receive transaction motion, after carrying out corresponding verification step, execute transaction, and by the response of transaction results
Return to transacting customer end;Transaction motion and the transaction results received from different accounting nodes response are packaged by transacting customer end
At a Transaction Information, it is sent to common recognition node.Knowing together node can be (periodically or fixed according to certain rule to the Transaction Information received
Amount) it is packaged, generate new block;New block is distributed to each accounting nodes by common recognition node.Each accounting nodes are tested
The Transaction Information in the new block received is demonstrate,proved, the account book of accounting nodes oneself can be accordingly updated.
When accounting nodes verify the Transaction Information of newly-increased block, account book status subsystem is updated, to update accounting nodes
Current account book state.After generating new block due to common recognition node, each accounting nodes can be synchronized to;Accounting nodes receive newly
Block after, the Transaction Information in new block can be verified, verifying updates the account book of accounting nodes local after completing.Meanwhile remembering
Account node, which can update the account book state (information includes: newest block ID, node ID) of oneself, arrives account book status subsystem, due to
Common recognition node has shifted to an earlier date the index that newly-increased block is saved in account book status subsystem, therefore can be associated with according to index
Block ID.
The process for updating account book state includes: that accounting nodes issue event notice, notice account book status subsystem it
Synchronized complete new block, event notice in include new block ID, the information such as corresponding accounting nodes ID.When account book state subgroup
After system receives event notice, it will be updated the data structure of maintenance, by event notify in information update to corresponding block
In information, if the new block ID in event notice is greater than the block ID that current block pointer is directed toward, account book status subsystem meeting
New block information is created in the data structure of oneself, and current block pointer is directed toward it.Since each block ID is corresponding
One accounting nodes ID, when there is multiple accounting nodes all to verify the Transaction Information, new block ID can correspond to multiple accounting nodes
ID.The information of account book status subsystem physical record is which accounting nodes has recorded newest account book data.Pass through most new district
The accounting nodes list of block, reflects the validity traded in block.
Fig. 3 is that the embodiment of the present invention inquires newest block-identified flow diagram, inquires account according to the inquiry request
Newest in this status subsystem block-identified include:
S302 reads data structure in the account book status subsystem according to the inquiry request, wherein the data knot
Structure includes one and is directed toward newest block-identified pointer;
S304 determines that the pointer is directed toward newest block-identified.
When user query account book data, first passes through account book status subsystem and determine current newest account book state, then
Newest account book data are inquired from the accounting nodes for being updated to newest account book state, to ensure that the newest of inquiry data
And accuracy.
When determining current newest account book state (newest block) by account book status subsystem, due to account book state subsystem
System maintains a data structure, and the information (section for having updated the accounting nodes of a certain block is had recorded in this data structure
Point ID is as mark).There are one pointers in this data structure, are directed toward the newest block for being currently included nodal information always.
When carrying out distributed account book inquiry, it is only necessary to which finding current newest block information from account book status subsystem, (pointer is directed toward
Block ID), then corresponding accounting nodes information (accounting nodes ID) is found from the block information, then according to nodal information
A node is chosen, the information inquired from the accounting nodes is current newest account book information.
When inquiring client terminal inquires account book information, since account book data are potentially stored in multiple accounting nodes,
Can be selected by various strategies need target accounting nodes, according to preset strategy inquiry with it is described newest block-identified right
The target accounting nodes answered include: inquiry and newest block-identified corresponding all accounting nodes, and are therefrom randomly choosed
One is used as the target accounting nodes;Or, inquiry and newest block-identified corresponding all accounting nodes, and are therefrom selected
Select target accounting nodes described in the minimum conduct of network delay;Or, inquiry with it is described it is newest it is block-identified it is corresponding own
Accounting nodes, and therefrom selecting a compass of competency includes the target as described in for sending the inquiring client terminal position of inquiry request
Accounting nodes;Or, inquiry and newest block-identified corresponding all accounting nodes, and two are therefrom randomly choosed as institute
State target accounting nodes.
An accounting nodes information (node ID) is returned at random from the accounting nodes list of reading to inquiring client terminal, is removed
Except this, some accounting nodes is returned to from accounting nodes list by one algorithm of design or rule, can achieve certain in this way
A particular demands.For example, returning to the minimum accounting nodes of network delay to improve inquiry velocity;Or it is looked into for different types of
Client is ask, different accounting nodes are returned, to have the function that load balance returns such as according to the position of inquiring client terminal
The accounting nodes of current region to be administered, or return to two accounting nodes information simultaneously, one of them is used to inquire account book information,
Another is for confirming whether account book information is accurate.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation
The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much
In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to correlation
The part that technology contributes can be embodied in the form of software products, which is stored in a storage
In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate
Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 2
A kind of data query device based on block chain is additionally provided in the present embodiment, and the device is for realizing above-mentioned reality
Example and preferred embodiment are applied, the descriptions that have already been made will not be repeated.As used below, term " module " may be implemented
The combination of the software and/or hardware of predetermined function.Although device described in following embodiment is preferably realized with software,
The realization for being the combination of hardware or software and hardware is also that may and be contemplated.
Fig. 4 is the structural block diagram of the data query device according to an embodiment of the present invention based on block chain, as shown in figure 4,
The device includes:
Receiving module 40, for receiving the inquiry request for inquiring account book data;
First enquiry module 42, for inquiring the newest block mark in account book status subsystem according to the inquiry request
Know, wherein the account book status subsystem keeps records of the accounting nodes information of newest account book data, the account book state subgroup
A child node of the system for node of knowing together in the either distributed account book system of a node in distributed account book system, institute
Stating distributed account book system includes: common recognition node, accounting nodes;
Second enquiry module 44, for being saved according to preset strategy inquiry with the newest block-identified corresponding target book keeping operation
Point;
Third enquiry module 46, for inquiring newest account book data from the target accounting nodes.
Optionally, first enquiry module includes: reading unit, for reading the account book according to the inquiry request
Data structure in status subsystem, wherein the data structure includes one and is directed toward newest block-identified pointer;It determines single
Member, for determining that the pointer is directed toward newest block-identified.
Optionally, second enquiry module includes: the first query unit, for inquire with it is described newest block-identified right
All accounting nodes answered, and therefrom randomly choose one and be used as the target accounting nodes;Or, the second query unit, is used for
Inquiry and newest block-identified corresponding all accounting nodes, and therefrom select a network delay minimum as described in
Target accounting nodes;Or, third query unit, for inquiry and newest block-identified corresponding all accounting nodes, and
Therefrom selecting a compass of competency includes the book keeping operation section of the target as described in for sending the inquiring client terminal position of the inquiry request
Point;Or, the 4th query unit, for inquiry and newest block-identified corresponding all accounting nodes, and therefrom random choosing
It selects two and is used as the target accounting nodes.
Optionally, the first setup module, for inquiring account book shape according to the inquiry request in first enquiry module
In state subsystem it is newest it is block-identified before, the account book status subsystem is set in the distributed account book system;Or,
Second setup module, for first enquiry module according to the inquiry request inquire account book status subsystem in it is newest
Before block-identified, the account book status subsystem is set in any common recognition node of the distributed account book system.
Optionally, described device further include: determining module is used in first enquiry module according to the inquiry request
Inquire in account book status subsystem it is newest it is block-identified before, determine the most new district that generates according to Transaction Information of common recognition node
Block;Adding module for the index of the newest block to be added to the account book status subsystem, and the transaction is believed
Breath is distributed to multiple accounting nodes, so that each accounting nodes are after verifying the Transaction Information, by the Transaction Information
It saves to local account book, and the newest block-identified and accounting nodes mark of the newest block is saved to the account book
Status subsystem.
Optionally, the determining module includes: the first monitoring unit, for monitoring whether common recognition node receives new friendship
Easy information, when node of knowing together receives new Transaction Information, by the common recognition node according to preset rules by the new friendship
The block that easy information package generates is determined as the newest block;Or, the second monitoring unit, for monitoring whether common recognition node divides
New block-identified of hair determines the new block-identified corresponding block in new block-identified of node distribution of knowing together
For the newest block.
Optionally, second monitoring unit includes: the first monitoring subelement, for monitoring whether common recognition node is distributed newly
Block serial number, alternatively, second monitoring subelement, for monitor know together node whether generate new cryptographic Hash.
It should be noted that above-mentioned modules can be realized by software or hardware, for the latter, Ke Yitong
Following manner realization is crossed, but not limited to this: above-mentioned module is respectively positioned in same processor;Alternatively, above-mentioned modules are with any
Combined form is located in different processors.
Embodiment 3
In several embodiments provided by the present invention, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or group
Part can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown
Or the mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, device or unit it is indirect
Coupling or communication connection can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
It is each that device (can be personal computer, server or network equipment etc.) or processor (Processor) execute the present invention
The part steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-
Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. it is various
It can store the medium of program code.
The embodiments of the present invention also provide a kind of storage medium, computer program is stored in the storage medium, wherein
The computer program is arranged to execute the step in any of the above-described embodiment of the method when operation.
Optionally, in the present embodiment, above-mentioned storage medium can be set to store by executing based on following steps
Calculation machine program:
S1 receives the inquiry request for inquiring account book data;
S2 is inquired newest block-identified in account book status subsystem, wherein the account book shape according to the inquiry request
State subsystem keeps records of the accounting nodes information of newest account book data, and the account book status subsystem is distributed account book system
A child node of common recognition node, the distribution account book system packet in the either distributed account book system of a node in system
It includes: common recognition node, accounting nodes;
S3, according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;
S4 inquires newest account book data from the target accounting nodes.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to: USB flash disk, read-only memory (Read-
Only Memory, referred to as ROM), it is random access memory (Random Access Memory, referred to as RAM), mobile hard
The various media that can store computer program such as disk, magnetic or disk.
The embodiments of the present invention also provide a kind of electronic device, including memory and processor, stored in the memory
There is computer program, which is arranged to run computer program to execute the step in any of the above-described embodiment of the method
Suddenly.
Optionally, above-mentioned electronic device can also include transmission device and input-output equipment, wherein the transmission device
It is connected with above-mentioned processor, which connects with above-mentioned processor.
Optionally, in the present embodiment, above-mentioned processor can be set to execute following steps by computer program:
S1 receives the inquiry request for inquiring account book data;
S2 is inquired newest block-identified in account book status subsystem, wherein the account book shape according to the inquiry request
State subsystem keeps records of the accounting nodes information of newest account book data, and the account book status subsystem is distributed account book system
A child node of common recognition node, the distribution account book system packet in the either distributed account book system of a node in system
It includes: common recognition node, accounting nodes;
S3, according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;
S4 inquires newest account book data from the target accounting nodes.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.
Claims (10)
1. a kind of data query method based on block chain, which is characterized in that the described method includes:
Receive the inquiry request for inquiring account book data;
It is inquired according to the inquiry request newest block-identified in account book status subsystem, wherein the account book state subsystem
System keeps records of the accounting nodes information of newest account book data, and the account book status subsystem is in distributed account book system
A child node of common recognition node in the either distributed account book system of one node, the distribution account book system includes: altogether
Know node, accounting nodes;
According to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;
Newest account book data are inquired from the target accounting nodes.
2. the method according to claim 1, wherein being inquired in account book status subsystem according to the inquiry request
Newest block-identified include:
Data structure in the account book status subsystem is read according to the inquiry request, wherein the data structure includes one
It is a to be directed toward newest block-identified pointer;
Determine that the pointer is directed toward newest block-identified.
3. the method according to claim 1, wherein according to preset strategy inquiry with it is described newest block-identified right
The target accounting nodes answered include:
Inquiry with newest block-identified corresponding all accounting nodes, and therefrom randomly choose one as the target note
Account node;Or,
Inquiry with newest block-identified corresponding all accounting nodes, and therefrom select a network delay minimum as
The target accounting nodes;Or,
Inquiry and newest block-identified corresponding all accounting nodes, and therefrom selecting compass of competency includes transmission institute
State target accounting nodes described in the conduct of the inquiring client terminal position of inquiry request;Or,
Inquiry with newest block-identified corresponding all accounting nodes, and therefrom randomly choose two as the targets notes
Account node.
4. the method according to claim 1, wherein inquiring account book status subsystem according to the inquiry request
In it is newest it is block-identified before, the method also includes:
The account book status subsystem is set in the distributed account book system;Or,
The account book status subsystem is set in any common recognition node of the distributed account book system.
5. the method according to claim 1, wherein inquiring account book status subsystem according to the inquiry request
In it is newest it is block-identified before, the method also includes:
Determine the newest block that common recognition node is generated according to Transaction Information;
The index of the newest block is added to the account book status subsystem, and the Transaction Information is distributed to multiple
Accounting nodes, so that each accounting nodes save the Transaction Information to local account after verifying the Transaction Information
This, and the newest block-identified and accounting nodes mark of the newest block is saved to the account book status subsystem.
6. according to the method described in claim 5, it is characterized in that, determining the most new district that common recognition node is generated according to Transaction Information
Block includes:
Whether monitoring common recognition node receives new Transaction Information, will be described when node of knowing together receives new Transaction Information
The new Transaction Information is packaged the block generated according to preset rules and is determined as the newest block by common recognition node;Or,
It is new block-identified whether monitoring common recognition node is distributed, will be described new in new block-identified of node distribution of knowing together
Block-identified corresponding block is determined as the newest block.
7. according to the method described in claim 6, it is characterized in that, whether monitoring common recognition node distributes new block-identified packet
It includes:
Whether monitoring common recognition node distributes new block serial number, alternatively, whether monitoring common recognition node generates new cryptographic Hash.
8. a kind of data query device based on block chain, which is characterized in that described device includes:
Receiving module, for receiving the inquiry request for inquiring account book data;
First enquiry module, it is newest block-identified in account book status subsystem for being inquired according to the inquiry request, wherein
The account book status subsystem keeps records of the accounting nodes information of newest account book data, and the account book status subsystem is point
A child node of common recognition node, the distribution in the either distributed account book system of a node in cloth account book system
Account book system includes: common recognition node, accounting nodes;
Second enquiry module, for according to preset strategy inquiry and the newest block-identified corresponding target accounting nodes;
Third enquiry module, for inquiring newest account book data from the target accounting nodes.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists
In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of computer storage medium, is stored thereon with computer program, which is characterized in that the computer program is located
The step of reason device realizes method described in any one of claims 1 to 7 when executing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910390287.6A CN110287226A (en) | 2019-05-10 | 2019-05-10 | Data query method and device based on block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910390287.6A CN110287226A (en) | 2019-05-10 | 2019-05-10 | Data query method and device based on block chain |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110287226A true CN110287226A (en) | 2019-09-27 |
Family
ID=68001569
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910390287.6A Pending CN110287226A (en) | 2019-05-10 | 2019-05-10 | Data query method and device based on block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110287226A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111339130A (en) * | 2020-02-25 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Data query method, related equipment and readable storage medium |
CN111464539A (en) * | 2020-03-31 | 2020-07-28 | 中国联合网络通信集团有限公司 | Block chain accounting method and accounting node |
CN112100234A (en) * | 2020-08-12 | 2020-12-18 | 北京大学 | Content addressing method and system of graph type account book based on random consensus |
CN113111086A (en) * | 2021-04-09 | 2021-07-13 | 杭州复杂美科技有限公司 | Data storage and query response method and block execution method |
CN113742386A (en) * | 2021-11-03 | 2021-12-03 | 环球数科集团有限公司 | Processing and analyzing method for block data of block chain account book |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790431A (en) * | 2016-12-05 | 2017-05-31 | 同济大学 | Cloud manufacturing service Transaction Information record system and method based on block chain |
CN107451177A (en) * | 2017-03-24 | 2017-12-08 | 北京瑞卓喜投科技发展有限公司 | For the querying method and system of the block chain of the single corrigenda of increase block |
CN108364181A (en) * | 2018-01-08 | 2018-08-03 | 广州中国科学院计算机网络信息中心 | Source tracing method and system based on block chain and Internet of Things mark |
US20180225640A1 (en) * | 2017-02-06 | 2018-08-09 | Northern Trust Corporation | Systems and methods for issuing and tracking digital tokens within distributed network nodes |
KR20180113145A (en) * | 2017-04-05 | 2018-10-15 | 삼성에스디에스 주식회사 | Method for processing blockchain based real-time transaction and system thereof |
CN109325855A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
-
2019
- 2019-05-10 CN CN201910390287.6A patent/CN110287226A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790431A (en) * | 2016-12-05 | 2017-05-31 | 同济大学 | Cloud manufacturing service Transaction Information record system and method based on block chain |
US20180225640A1 (en) * | 2017-02-06 | 2018-08-09 | Northern Trust Corporation | Systems and methods for issuing and tracking digital tokens within distributed network nodes |
CN107451177A (en) * | 2017-03-24 | 2017-12-08 | 北京瑞卓喜投科技发展有限公司 | For the querying method and system of the block chain of the single corrigenda of increase block |
KR20180113145A (en) * | 2017-04-05 | 2018-10-15 | 삼성에스디에스 주식회사 | Method for processing blockchain based real-time transaction and system thereof |
CN108364181A (en) * | 2018-01-08 | 2018-08-03 | 广州中国科学院计算机网络信息中心 | Source tracing method and system based on block chain and Internet of Things mark |
CN109325855A (en) * | 2018-08-16 | 2019-02-12 | 北京京东尚科信息技术有限公司 | Block chain network, dispositions method and storage medium |
Non-Patent Citations (1)
Title |
---|
孙韵秋;王启春;: "基于区块链技术的高校成绩管理系统", 密码学报, no. 05, pages 118 - 128 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111339130A (en) * | 2020-02-25 | 2020-06-26 | 腾讯科技(深圳)有限公司 | Data query method, related equipment and readable storage medium |
CN111464539A (en) * | 2020-03-31 | 2020-07-28 | 中国联合网络通信集团有限公司 | Block chain accounting method and accounting node |
CN111464539B (en) * | 2020-03-31 | 2022-11-04 | 中国联合网络通信集团有限公司 | Block chain accounting method and accounting node |
CN112100234A (en) * | 2020-08-12 | 2020-12-18 | 北京大学 | Content addressing method and system of graph type account book based on random consensus |
CN112100234B (en) * | 2020-08-12 | 2021-09-10 | 北京大学 | Content addressing method and system of graph type account book based on random consensus |
CN113111086A (en) * | 2021-04-09 | 2021-07-13 | 杭州复杂美科技有限公司 | Data storage and query response method and block execution method |
CN113111086B (en) * | 2021-04-09 | 2022-06-24 | 杭州复杂美科技有限公司 | Data storage and query response method and block execution method |
CN113742386A (en) * | 2021-11-03 | 2021-12-03 | 环球数科集团有限公司 | Processing and analyzing method for block data of block chain account book |
CN113742386B (en) * | 2021-11-03 | 2022-02-08 | 环球数科集团有限公司 | Processing and analyzing method for block data of block chain account book |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110287226A (en) | Data query method and device based on block chain | |
CN108874890B (en) | Block chain system with public bibliographic mechanism | |
CN110166409A (en) | Equipment cut-in method, related platform and computer storage medium | |
CN110297766A (en) | Method for testing software and software testing system based on distributed test node cluster | |
CN110011988A (en) | Based on the certification authentication method and device of block chain, storage medium, electronic device | |
CN109741060A (en) | Information inquiry system, method, device, electronic equipment and storage medium | |
CN108470298A (en) | The methods, devices and systems of resource numerical value transfer | |
CN106874361B (en) | Data processing method and device applied to customs declaration | |
CN105677673B (en) | Method for processing business, apparatus and system | |
CN110049087A (en) | A kind of reliability verification method, system, device and the equipment of alliance's chain | |
CN105915343B (en) | A kind of offline Activiation method of registration user and system | |
CN112737782B (en) | Method and apparatus for providing cross-chain messages | |
CN111177800A (en) | Data processing method and device based on block chain and electronic equipment | |
CN112966311A (en) | Intelligent contract checking method and device and electronic equipment | |
CN108897800A (en) | A kind of method, apparatus and system of managing log information | |
CN111813788A (en) | Information query method and device and information synchronization method and device | |
CN110163634A (en) | Withdrawing method and device, electronic equipment based on block chain | |
CN110235162A (en) | The generation method of block catenary system data processing method and block | |
CN109166040A (en) | Transaction auditing method, device, equipment and storage medium based on block chain | |
CN108765142A (en) | Electronic device, multi-tiling chain integral traffic control method and computer readable storage medium | |
CN109150757A (en) | A kind of advertising resource processing method, device and electronic equipment | |
CN104333614B (en) | The method, apparatus and system of terminal recognition | |
CN104486337B (en) | Validation of Data method and device | |
CN106446050A (en) | Method and system for subscription by aiming at changed data of database | |
CN109669807A (en) | The method of calibration and device of business event, processor, 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 |