CN109063016A - Block chain data storage method, device, electronic equipment, storage medium - Google Patents

Block chain data storage method, device, electronic equipment, storage medium Download PDF

Info

Publication number
CN109063016A
CN109063016A CN201810760792.0A CN201810760792A CN109063016A CN 109063016 A CN109063016 A CN 109063016A CN 201810760792 A CN201810760792 A CN 201810760792A CN 109063016 A CN109063016 A CN 109063016A
Authority
CN
China
Prior art keywords
key
block chain
transaction
transaction data
data structure
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810760792.0A
Other languages
Chinese (zh)
Inventor
徐晓旻
兰斯·沃伦·斐根
王欣
黄胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mdt Infotech Ltd (shanghai) Mdt Infotech Ltd
Original Assignee
Mdt Infotech Ltd (shanghai) Mdt Infotech 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 Mdt Infotech Ltd (shanghai) Mdt Infotech Ltd filed Critical Mdt Infotech Ltd (shanghai) Mdt Infotech Ltd
Priority to CN201810760792.0A priority Critical patent/CN109063016A/en
Publication of CN109063016A publication Critical patent/CN109063016A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The present invention provides a kind of block chain data storage method, device, electronic equipment, storage medium.Block chain data storage method, comprising: store transaction data into a transaction data structure, the transaction data includes at least an at least key-value pair;A transaction relationship table is generated in the transaction data structure according to the key in the key-value pair, the transaction relationship table is used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain;To it is newest enter chain transaction data structure in include key-value pair, according to location updating one last sale table of the key and current transaction data structure in the key-value pair in block chain, the last sale table is used for the position of storage key and the associated nearest transaction data structure of the key in block chain.Method and device provided by the invention can accelerate and optimize the inquiry of block chain assets moment and inquiry of tracing to the source.

Description

Block chain data storage method, device, electronic equipment, storage medium
Technical field
The present invention relates to computer application technology more particularly to a kind of block chain data storage methods, device, electronics Equipment, storage medium.
Background technique
2008, assumed name was the scholar of " in this acute hearing " (Satoshi Nakamoto), had delivered a kind of " bit coin: point pair Point-like electron cash system " paper, established the basis of block chain technology.For narrow sense, block chain is a kind of suitable according to the time A kind of linked data structure that data block is combined by sequence in such a way that sequence is connected, and guarantee to usurp in a manner of cryptography Change the distributed account book that can not be forged.For broadly, block chain technology is verified and is stored using block linked data structure Data know together algorithm using distributed node to generate update data, guarantee that data transmission and side are asked in the way of cryptography Safety programs the distributed basis completely new with one kind of operation data using the intelligent contract being made of automatized script code Framework and calculation paradigm.
Block chain can apply intelligent contract, securities trading, e-commerce, Internet of Things, social communication, file storage, Existence proof, authentication, equity crowd such as raise at the relevant field of assets.No matter apply in various fields, is suitable for block chain Application program need to carry out complex query to the transaction data for being stored in block chain, for example, queries asset sometime Status inquiry (remaining sum of inquiry account at some time point);(some account is inquired to the transactions history inquiry of determining assets Designated time period in transactions history) etc..However.The inquiry system of existing block chain needs again temporally sequence execution institute There is transactions history that could complete to inquire, search efficiency is very low.
Summary of the invention
The present invention in order to overcome defect existing for above-mentioned the relevant technologies, provide a kind of block chain data storage method, device, Electronic equipment, storage medium, and then accelerate and optimize the inquiry of block chain assets moment and inquiry of tracing to the source at least to a certain extent.
According to an aspect of the present invention, a kind of block chain data storage method is provided, comprising:
Transaction data is stored into a transaction data structure, the transaction data includes at least an at least key-value pair, institute The key for stating key-value pair is used to indicate the asset identification for participating in this time transaction, and the value of the key-value pair is used to indicate handing over for corresponding keys Status information after easily;
A transaction relationship table, the transaction relationship are generated in the transaction data structure according to the key in the key-value pair Table is used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain, multiple transaction data knots It is configured to a data block, multiple data blocks form the block chain;
To it is newest enter chain transaction data structure in include key-value pair, according in the key-value pair key and current transaction Location updating one last sale table of the data structure in block chain, the last sale table are associated for storage key and the key Position of the nearest transaction data structure in block chain.
Optionally, an at least key-value pair is stored in the transaction data structure in the form of key-value pair table, described Key-value pair table includes at least:
Value list starting location offset amount;
Bond number amount;
Key list, each key include the offset of the value of key length, key content and the corresponding key;
Value list.
Optionally, it includes at least one relation record, every relationship note that the transaction relationship table, which corresponds to the quantity of key-value pair, Record includes at least:
The index of corresponding key-value pair, for reading key content from the key-value pair table;
It is related to transaction ID and offset of the previous transaction data structure of the key in block chain.
Optionally, the transaction data structure further include:
The transaction data structure length;
The transaction ID of the transaction;
The timestamp of the transaction;
The HASH value of a transaction data before the transaction.
Optionally, the block chain includes:
Data block catalogue and index, each to have entered the offset that the data block of chain records data block position in block chain Amount, and from transaction data structure included in the data block all keys being related to transaction data structure in block chain In position offset.
Optionally, the location updating of key and current transaction data structure in block chain according in the key-value pair After one last sale table further include:
The status information of the object key at a time is inquired according to the last sale table in the block chain.
Optionally, the location updating of key and current transaction data structure in block chain according in the key-value pair After one last sale table further include:
The object key is inquired in the status information of certain time period according to the last sale table in the block chain Situation of change.
According to another aspect of the invention, a kind of block chain data memory device is also provided, comprising:
Storage module, for storing transaction data into a transaction data structure, the transaction data is included at least extremely A few key-value pair, the key of the key-value pair are used to indicate the asset identification for participating in this time transaction, and the value of the key-value pair is for referring to Show the status information after the trade of corresponding keys;
Relationship module, for generating a transaction relationship in the transaction data structure according to the key in the key-value pair Table, the transaction relationship table are used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain It sets, multiple transaction data structures form a data block, and multiple data blocks form the block chain;
Update module, for it is newest it is described enter chain transaction data structure in include key-value pair, according to the key It is worth the one last sale table of location updating of the key and current transaction data structure of centering in block chain, the last sale table is used In position of the transaction data structure for being related to modifying to the value of key the last in storage time in block chain.
According to another aspect of the invention, a kind of electronic equipment is also provided, the electronic equipment includes: processor;Storage Medium, is stored thereon with computer program, and the computer program executes step as described above when being run by the processor.
According to another aspect of the invention, a kind of storage medium is also provided, computer journey is stored on the storage medium Sequence, the computer program execute step as described above when being run by processor.
Compared with prior art, the present invention establishes transaction relationship table and key-value pair table when storing data to block chain to remember It records the state currently traded and once trades before each assets can be directed toward, while safeguarding last sale table to realize object key Quick moment inquiry and inquiry of tracing to the source.
Detailed description of the invention
Its example embodiment is described in detail by referring to accompanying drawing, above and other feature of the invention and advantage will become It is more obvious.
Fig. 1 shows the flow chart of block chain data storage method according to an embodiment of the present invention.
Fig. 2 shows the schematic diagrames of the data structure of block chain according to an embodiment of the present invention.
Fig. 3 shows the schematic diagram of transaction data structure according to an embodiment of the present invention.
Fig. 4 shows the schematic diagram of the transaction data structure of specific embodiment according to the present invention.
Fig. 5 shows the schematic diagram that block chain transaction according to an embodiment of the present invention the moment inquiry and traces to the source.
Fig. 6 shows the module map of block chain data memory device according to an embodiment of the present invention.
Fig. 7 schematically shows a kind of computer readable storage medium schematic diagram in exemplary embodiment of the present.
Fig. 8 schematically shows a kind of electronic equipment schematic diagram in exemplary embodiment of the present.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be with a variety of shapes Formula is implemented, and is not understood as limited to example set forth herein;On the contrary, thesing embodiments are provided so that the present invention will more Fully and completely, and by the design of example embodiment comprehensively it is communicated to those skilled in the art.Described feature, knot Structure or characteristic can be incorporated in any suitable manner in one or more embodiments.
In addition, attached drawing is only schematic illustrations of the invention, it is not necessarily drawn to scale.Identical attached drawing mark in figure Note indicates same or similar part, thus will omit repetition thereof.Some block diagrams shown in the drawings are function Energy entity, not necessarily must be corresponding with physically or logically independent entity.These function can be realized using software form Energy entity, or these functional entitys are realized in one or more hardware modules or integrated circuit, or at heterogeneous networks and/or place These functional entitys are realized in reason device device and/or microcontroller device.
Flow chart shown in the drawings is merely illustrative, it is not necessary to including all steps.For example, the step of having It can also decompose, and the step of having can merge or part merges, therefore, the sequence actually executed is possible to according to the actual situation Change.
Fig. 1 shows the flow chart of block chain data storage method according to an embodiment of the present invention.Fig. 1 shows 3 steps altogether It is rapid:
Step S110: transaction data is stored into a transaction data structure, and the transaction data includes at least at least one Key-value pair, the key of the key-value pair are used to indicate the asset identification for participating in this time transaction, and the value of the key-value pair is used to indicate pair The status information after the trade of Ying Jian;
Step S120: a transaction relationship table, institute are generated in the transaction data structure according to the key in the key-value pair It states transaction relationship table and is used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain, it is multiple Transaction data structure forms a data block, and multiple data blocks form the block chain;And
Step S130: to it is newest enter chain transaction data structure in include key-value pair, according to the key in the key-value pair And current location updating one last sale table of the transaction data structure in block chain, the last sale table for storage key and (the last time is related to repairing the value of key on the time for position of the associated nearest transaction data structure of the key in block chain Position of the transaction data structure changed in block chain).
The block data structures of storage method provided by the invention and acquisition will be described below respectively in connection with Fig. 2 to Fig. 5.
Referring first to Fig. 2, Fig. 2 shows the schematic diagrames of the data structure of block chain according to an embodiment of the present invention.Block The data structure 200 of chain includes the data block 210 of multiple chain types storage.Each data block 210 includes one in a period of time Or (such as data block 1 includes transaction data structure TX_1, TX_2, TX_3 to multiple transaction data structures;Data block 1 includes number of deals According to structure TX_4, TX_5).In addition to transaction data structure, each data block 210 can also include head and foot.Each data block 210 Head include the offset of flag bit and the data block in block chain.Flag bit is used to identify the validity of the data block. The foot of each data block 210 includes the signature of the packing person of the data block 210.
The schematic diagram of transaction data structure according to an embodiment of the present invention is shown referring to Fig. 3, Fig. 3.Transaction data Structure 201 may include the length of the transaction data structure, the mark (transaction ID) of the transaction data structure, exchange hour It stabs, the label of the change person of previous trade HASH value, transaction relationship table 202, key-value pair table 203 and the relative keys for being related to the transaction Name.
Key-value pair table 203 includes that (such as the offset in the transaction data structure is used for value list starting location offset amount Be directed toward value list initial position), bond number amount, key list, value list.Key and value reciprocal correspondence form key-value pair.The quantity of key It is identical as the quantity of value.Key list includes one or more keys 205.Each key 205 includes the key length, key content and the key The offset of value.Key content is used to indicate the asset identification (such as user account) for participating in this time transaction.The offset of the value of the key Measure the value for being directed toward the key.The offset of the value of the key can be offset of the value of the key in the transaction data structure. The offset of the value of key is also possible to offset of the value relative to the key of the key.Value list directly stores multiple key-value pairs Value.The value of key-value pair is used to indicate the status informations after the trade of corresponding keys, and (such as user account is after this transaction Remaining sum)
Corresponding to stored one or more pairs of key-value pairs, transaction relationship table 202 includes one or more relation records 204.The quantity of key-value pair is identical as the quantity of relation record 204 that transaction relationship table 202 is included, and relation record 204 with Key-value pair corresponds.Specifically, each relation record 204 of transaction relationship table 202 is used to indicate the key institute of corresponding key-value pair The last transaction of participation.Further, each relation record 204 may include label, key index, be related to the preceding primary transaction of key Identify, be related to the preceding offset (offset in block chain) once traded of key.The purposes of the tag representation relation record It is prev to show the relation record for being related to the transaction data structure of the key in block chain before being directed toward that label, which is arranged, Offset.Key index is used to read the key content in key-value pair table 203.Such as key index is 0 target for indicating the relation record Key is the 1st key recording in the key list of key-value pair table 203;Such as key index be 1 expression the relation record object key be The 2nd key recorded in the key list of key-value pair table 203, and so on, the present invention is not limited thereto.
In some embodiments of the invention, block chain can also include data block catalogue.Data block catalogue is available In storing the relevant information about each data block, such as data block storage file position, data block catalogue is each data block dimension Protect the key index for the key being related to.Key index can use b-tree indexed or any other index structure, and Map Key (uniquely mark by assets Know) it trades position in block chain to being related to key the last time.Data block catalogue and its key index are each to have entered chain Data block records the offset of data block position in block chain, and all from transaction included in the data block relates to And to position offset in block chain of key and transaction data structure, data block catalogue and its key index can be used for quickly Inquire all keys involved by some block.
The schematic diagram of the transaction data structure of specific embodiment according to the present invention is shown referring to Fig. 4, Fig. 4.In Fig. 4 In the offset of each transaction data structure refer both to every offset in the transaction data structure.As shown in figure 4, transaction ID For ... the transaction data structure of ab has recorded the length of the transaction data structure, transaction ID, exchange hour stamp etc..According to friendship Easily be identified as ... the transaction data structure of ab, this time trade involved in there are two keys (asset identification), respectively c1_k1 and c1_k2.It is that aabb (corresponding keys c1_k1) and bbaa are (right that value (Asset State) of two keys after completing this time to trade, which is divided into, Answer key c1_k2).And the relation record of key c1_k1, the preceding transaction ID once traded of key c1_k1 are directed toward according to key index For ... 0a, offset of the transaction data structure in block chain are 0;The relation record of key c1_k2, key are directed toward according to key index The preceding transaction ID once traded of c1_k2 is ... 0b, offset of the transaction data structure in block chain is 46.Fig. 4 is only It is only the embodiment for schematically showing transaction data structure of the present invention, the present invention is not limited thereto.In the concrete realization, root According to the transaction relationship table in each transaction data structure, relation chain can be formed in block chain in order to be associated a certain of key The inquiry of tracing to the source of one period of the inquiry and associated key of the state at moment, specifically, may refer to Fig. 5.
Fig. 5 shows the schematic diagram that block chain transaction according to an embodiment of the present invention the moment inquiry and traces to the source.Such as Fig. 5 institute Show, in the present invention, block chain also safeguards a last sale table, and last sale table is for storing the associated nearest friendship of object key Easy position of the data structure in block chain.Specifically, object key can be specified one or more keys.As shown in figure 5, The key that last sale table currently stores is A, B, C, D, and the position of the last sale of the key within a block indicates respectively number of deals According to structure TX_4 (corresponding keys A), TX_3 (corresponding keys B), TX_2 (corresponding keys C), TX_4 (corresponding keys D).Wherein, TX_1 to TX_4 Transaction data structure for the multiple transaction executed in order, and for the sake of clarity, multiple keys of TX_1 to TX_4 are only shown Value pair.By taking the inquiry to account A as an example, when needing to inquire account A in the account balance at T1 moment, according to last sale table, It determines that the nearest transaction data structure of account A is TX_4, judges whether its timestamp is greater than T1 according to transaction data structure TX_4, If being not more than T1, once trade before indexing account A according to the relation record of interlock account A in transaction data structure TX_4 Data structure TX_2 judges that its timestamp is greater than as T1 according to transaction data structure TX_2, if being not more than T1, according to transaction The relation record of interlock account A indexes the preceding transaction data structure TX_1 of account A in data structure TX_2, according to transaction Data structure TX_1 judges whether its timestamp is not more than T1, if being not more than T1, can directly obtain the account balance of account A It is 50.Similarly, according to timestamp, relation record also to carry out the inquiry of tracing to the source in a period to account A, to obtain account The account balance variation and related multiple transaction of A during this period of time.
The description of above-mentioned combination Fig. 2 to Fig. 5 be only schematically show multiple embodiments of the invention, but the present invention It is not limited thereto, under the premise of without prejudice to present inventive concept, the variation of embodiment, step are replaced all in protection of the invention Within the scope of.
Fig. 6 shows the module map of block chain data memory device according to an embodiment of the present invention.Block chain data storage Device 500 includes storage module 510, relationship module 520 and update module 530.
For storing transaction data into a transaction data structure, the transaction data includes at least storage module 510 An at least key-value pair, the key of the key-value pair are used to indicate the asset identification for participating in this time transaction, and the value of the key-value pair is used for Indicate the status information after the trade of corresponding keys;
Relationship module 520 is used to generate a transaction relationship in the transaction data structure according to the key in the key-value pair Table, the transaction relationship table are used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain It sets, multiple transaction data structures form a data block, and multiple data blocks form the block chain;
Update module 530 be used for it is newest it is described enter chain transaction data structure in include key-value pair, according to described The one last sale table of location updating of key and current transaction data structure in block chain in key-value pair, the last sale table Position of the last transaction data structure for being related to modifying to the value of key in block chain in storage time.
Fig. 6 is only to show schematically block chain data memory device 500 provided by the invention, without prejudice to the present invention Under the premise of design, the fractionation of module, increases all within protection scope of the present invention merging.
In an exemplary embodiment of the present invention, a kind of computer readable storage medium is additionally provided, meter is stored thereon with Calculation machine program, the program may be implemented electronic prescription described in any one above-mentioned embodiment and circulate when being executed by such as processor The step of processing method.In some possible embodiments, various aspects of the invention are also implemented as a kind of program production The form of product comprising program code, when described program product is run on the terminal device, said program code is for making institute It states terminal device and executes described in this specification above-mentioned electronic prescription circulation processing method part various examples according to the present invention The step of property embodiment.
Refering to what is shown in Fig. 7, describing the program product for realizing the above method of embodiment according to the present invention 800, can using portable compact disc read only memory (CD-ROM) and including program code, and can in terminal device, Such as it is run on PC.However, program product of the invention is without being limited thereto, in this document, readable storage medium storing program for executing can be with To be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or It is in connection.
Described program product can be using any combination of one or more readable mediums.Readable medium can be readable letter Number medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or System, device or the device of semiconductor, or any above combination.The more specific example of readable storage medium storing program for executing is (non exhaustive List) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only Memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
The computer readable storage medium may include in a base band or the data as the propagation of carrier wave a part are believed Number, wherein carrying readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetism Signal, optical signal or above-mentioned any appropriate combination.Readable storage medium storing program for executing can also be any other than readable storage medium storing program for executing Readable medium, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or Person's program in connection.The program code for including on readable storage medium storing program for executing can transmit with any suitable medium, packet Include but be not limited to wireless, wired, optical cable, RF etc. or above-mentioned any appropriate combination.
The program for executing operation of the present invention can be write with any combination of one or more programming languages Code, described program design language include object oriented program language-Java, C++ etc., further include conventional Procedural programming language-such as " C " language or similar programming language.Program code can be fully in tenant It calculates and executes in equipment, partly executed in tenant's equipment, being executed as an independent software package, partially in tenant's calculating Upper side point is executed on a remote computing or is executed in remote computing device or server completely.It is being related to far Journey calculates in the situation of equipment, and remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to tenant and calculates equipment, or, it may be connected to external computing device (such as utilize ISP To be connected by internet).
In an exemplary embodiment of the present invention, a kind of electronic equipment is also provided, which may include processor, And the memory of the executable instruction for storing the processor.Wherein, the processor is configured to via described in execution Executable instruction is come the step of executing the circulation processing method of electronic prescription described in any one above-mentioned embodiment.
Person of ordinary skill in the field it is understood that various aspects of the invention can be implemented as system, method or Program product.Therefore, various aspects of the invention can be embodied in the following forms, it may be assumed that complete hardware embodiment, complete The embodiment combined in terms of full Software Implementation (including firmware, microcode etc.) or hardware and software, can unite here Referred to as circuit, " module " or " system ".
The electronic equipment 600 of this embodiment according to the present invention is described referring to Fig. 8.The electronics that Fig. 8 is shown Equipment 600 is only an example, should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in figure 8, electronic equipment 600 is showed in the form of universal computing device.The component of electronic equipment 600 can wrap It includes but is not limited to: at least one processing unit 610, at least one storage unit 620, (including the storage of the different system components of connection Unit 620 and processing unit 610) bus 630, display unit 640 etc..
Wherein, the storage unit is stored with program code, and said program code can be held by the processing unit 610 Row, so that the processing unit 610 executes described in this specification above-mentioned electronic prescription circulation processing method part according to this The step of inventing various illustrative embodiments.For example, the processing unit 610 can execute step as shown in Figure 1.
The storage unit 620 may include the readable medium of volatile memory cell form, such as random access memory Unit (RAM) 6201 and/or cache memory unit 6202 can further include read-only memory unit (ROM) 6203.
The storage unit 620 can also include program/practical work with one group of (at least one) program module 6205 Tool 6204, such program module 6205 includes but is not limited to: operating system, one or more application program, other programs It may include the realization of network environment in module and program data, each of these examples or certain combination.
Bus 630 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage Cell controller, peripheral bus, graphics acceleration port, processing unit use any bus structures in a variety of bus structures Local bus.
Electronic equipment 600 can also be with one or more external equipments 700 (such as keyboard, sensing equipment, bluetooth equipment Deng) communication, the equipment that also tenant can be enabled interact with the electronic equipment 600 with one or more communicates, and/or with make Any equipment (such as the router, modulation /demodulation that the electronic equipment 600 can be communicated with one or more of the other calculating equipment Device etc.) communication.This communication can be carried out by input/output (I/O) interface 650.Also, electronic equipment 600 can be with By network adapter 660 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, Such as internet) communication.Network adapter 660 can be communicated by bus 630 with other modules of electronic equipment 600.It should Understand, although not shown in the drawings, other hardware and/or software module can be used in conjunction with electronic equipment 600, including but unlimited In: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and number According to backup storage system etc..
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that example described herein is implemented Mode can also be realized by software realization in such a way that software is in conjunction with necessary hardware.Therefore, according to the present invention The technical solution of embodiment can be embodied in the form of software products, which can store non-volatile at one Property storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) in or network on, including some instructions are so that a calculating Equipment (can be personal computer, server or network equipment etc.) executes the above-mentioned electronics of embodiment according to the present invention Prescription circulation processing method.
Compared with prior art, the present invention establishes transaction relationship table and key-value pair table when storing data to block chain to remember It records the state currently traded and once trades before each assets can be directed toward, while safeguarding last sale table to realize object key Quick moment inquiry and inquiry of tracing to the source.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to of the invention its Its embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or Person's adaptive change follows general principle of the invention and including the undocumented common knowledge in the art of the present invention Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by appended Claim is pointed out.

Claims (10)

1. a kind of block chain data storage method characterized by comprising
Transaction data is stored into a transaction data structure, the transaction data includes at least an at least key-value pair, the key The key of value pair is used to indicate the asset identification for participating in this time transaction, the value of the key-value pair be used to indicate corresponding keys in transaction Status information afterwards;
A transaction relationship table is generated in the transaction data structure according to the key in the key-value pair, the transaction relationship table is used It is related to position of the previous transaction data structure of the key of the key-value pair in block chain, multiple transaction data structure shapes in instruction At a data block, multiple data blocks form the block chain;
To it is newest enter chain transaction data structure in include key-value pair, according to the key and current transaction data in the key-value pair Location updating one last sale table of the structure in block chain, the last sale table are associated recently for storage key and the key Position of the transaction data structure in block chain.
2. block chain data storage method as described in claim 1, which is characterized in that an at least key-value pair is with key-value pair The form of table is stored in the transaction data structure, and the key-value pair table includes at least:
Value list starting location offset amount;
Bond number amount;
Key list, each key include the offset of the value of key length, key content and the corresponding key;
Value list.
3. block chain data storage method as claimed in claim 2, which is characterized in that the transaction relationship table corresponds to key-value pair Quantity include at least one relation record, every relation record includes at least:
The index of corresponding key-value pair, for reading key content from the key-value pair table;
It is related to transaction ID and offset of the previous transaction data structure of the key in block chain.
4. block chain data storage method as described in claim 1, which is characterized in that the transaction data structure further include:
The transaction data structure length;
The transaction ID of the transaction;
The timestamp of the transaction;
The HASH value of a transaction data before the transaction.
5. block chain data storage method as described in claim 1, which is characterized in that the block chain includes:
Data block catalogue and index, each to have entered the offset that the data block of chain records data block position in block chain, And from the keys being related to all in transaction data structure included in the data block to transaction data structure in block chain Position offset.
6. block chain data storage method as described in claim 1, which is characterized in that the key according in the key-value pair And current transaction data structure is after the one last sale table of location updating in block chain further include:
The status information of object key at a time is inquired according to the last sale table in the block chain.
7. block chain data storage method as described in claim 1, which is characterized in that the key according in the key-value pair And current transaction data structure is after the one last sale table of location updating in block chain further include:
The variation feelings of status information of the object key in certain time period are inquired according to the last sale table in the block chain Condition.
8. a kind of block chain data memory device characterized by comprising
Storage module, for storing transaction data into a transaction data structure, the transaction data includes at least at least one Key-value pair, the key of the key-value pair are used to indicate the asset identification for participating in this time transaction, and the value of the key-value pair is used to indicate pair The status information after the trade of Ying Jian;
Relationship module, for generating a transaction relationship table, institute in the transaction data structure according to the key in the key-value pair It states transaction relationship table and is used to indicate position of the previous transaction data structure for the key for being related to the key-value pair in block chain, it is multiple Transaction data structure forms a data block, and multiple data blocks form the block chain;
Update module, for it is newest it is described enter chain transaction data structure in include key-value pair, according to the key-value pair In one last sale table of location updating in block chain of key and current transaction data structure, the last sale table is for storing up Deposited the position of transaction data structure that time upper the last time is related to modifying to the value of key in block chain.
9. a kind of electronic equipment, which is characterized in that the electronic equipment includes:
Processor;
Storage medium is stored thereon with computer program, and such as right is executed when the computer program is run by the processor It is required that 1 to 7 described in any item steps.
10. a kind of storage medium, which is characterized in that be stored with computer program, the computer program on the storage medium Step as described in any one of claim 1 to 7 is executed when being run by the processor.
CN201810760792.0A 2018-07-11 2018-07-11 Block chain data storage method, device, electronic equipment, storage medium Pending CN109063016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810760792.0A CN109063016A (en) 2018-07-11 2018-07-11 Block chain data storage method, device, electronic equipment, storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810760792.0A CN109063016A (en) 2018-07-11 2018-07-11 Block chain data storage method, device, electronic equipment, storage medium

Publications (1)

Publication Number Publication Date
CN109063016A true CN109063016A (en) 2018-12-21

Family

ID=64816133

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810760792.0A Pending CN109063016A (en) 2018-07-11 2018-07-11 Block chain data storage method, device, electronic equipment, storage medium

Country Status (1)

Country Link
CN (1) CN109063016A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109559231A (en) * 2018-12-29 2019-04-02 华东师范大学 A kind of retrospect querying method towards block chain
CN109684333A (en) * 2018-12-24 2019-04-26 杭州复杂美科技有限公司 A kind of storage of data and method of cutting out, equipment and storage medium
CN109903161A (en) * 2019-02-28 2019-06-18 百度在线网络技术(北京)有限公司 Object processing method, device, equipment and medium based on block chain
CN110008738A (en) * 2019-02-21 2019-07-12 网易(杭州)网络有限公司 For the caching method of block chain contract data, device, medium and calculate equipment
CN110309173A (en) * 2019-06-14 2019-10-08 深圳前海达闼云端智能科技有限公司 Contract data recording method and device, block chain node and storage medium
CN110471923A (en) * 2019-08-12 2019-11-19 深圳前海微众银行股份有限公司 A kind of processing method and processing device of block chain transaction record
CN110874365A (en) * 2019-11-20 2020-03-10 深圳市网心科技有限公司 Information query method and related equipment thereof
WO2019141289A3 (en) * 2019-05-14 2020-03-12 Alibaba Group Holding Limited Methods and devices for data traversal
CN111310137A (en) * 2020-03-23 2020-06-19 杭州溪塔科技有限公司 Block chain associated data evidence storing method and device and electronic equipment
CN111602166A (en) * 2019-08-30 2020-08-28 阿里巴巴集团控股有限公司 Method and apparatus for providing traversable key-value data stores on blockchains
TWI738208B (en) * 2019-06-28 2021-09-01 開曼群島商創新先進技術有限公司 Method and device for sending certifiable information across chains
US11251966B2 (en) 2019-06-28 2022-02-15 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
US11336465B2 (en) 2019-06-28 2022-05-17 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
US11356282B2 (en) 2019-06-28 2022-06-07 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107169144A (en) * 2017-06-17 2017-09-15 南京中蓝数智信息技术有限公司 Block chain distribution account book storage method and server
CN107391649A (en) * 2017-07-14 2017-11-24 浙商银行股份有限公司 A kind of system and method for lifting block chain query efficiency
CN107562775A (en) * 2017-07-14 2018-01-09 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN108270571A (en) * 2017-12-08 2018-07-10 西安电子科技大学 Internet of Things identity authorization system and its method based on block chain

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107169144A (en) * 2017-06-17 2017-09-15 南京中蓝数智信息技术有限公司 Block chain distribution account book storage method and server
CN107391649A (en) * 2017-07-14 2017-11-24 浙商银行股份有限公司 A kind of system and method for lifting block chain query efficiency
CN107562775A (en) * 2017-07-14 2018-01-09 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN108270571A (en) * 2017-12-08 2018-07-10 西安电子科技大学 Internet of Things identity authorization system and its method based on block chain

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109684333B (en) * 2018-12-24 2021-02-09 杭州复杂美科技有限公司 Data storage and cutting method, equipment and storage medium
CN109684333A (en) * 2018-12-24 2019-04-26 杭州复杂美科技有限公司 A kind of storage of data and method of cutting out, equipment and storage medium
CN109559231A (en) * 2018-12-29 2019-04-02 华东师范大学 A kind of retrospect querying method towards block chain
CN110008738A (en) * 2019-02-21 2019-07-12 网易(杭州)网络有限公司 For the caching method of block chain contract data, device, medium and calculate equipment
CN110008738B (en) * 2019-02-21 2021-06-25 网易(杭州)网络有限公司 Caching method, device, medium and computing equipment for block chain contract data
CN109903161A (en) * 2019-02-28 2019-06-18 百度在线网络技术(北京)有限公司 Object processing method, device, equipment and medium based on block chain
CN111033489A (en) * 2019-05-14 2020-04-17 阿里巴巴集团控股有限公司 Method and apparatus for data traversal
WO2019141289A3 (en) * 2019-05-14 2020-03-12 Alibaba Group Holding Limited Methods and devices for data traversal
CN111033489B (en) * 2019-05-14 2023-11-17 创新先进技术有限公司 Method and apparatus for data traversal
US11263200B2 (en) 2019-05-14 2022-03-01 Advanced New Technologies Co., Ltd. Methods and devices for data traversal
CN110309173A (en) * 2019-06-14 2019-10-08 深圳前海达闼云端智能科技有限公司 Contract data recording method and device, block chain node and storage medium
CN110309173B (en) * 2019-06-14 2021-08-13 达闼机器人有限公司 Contract data recording method and device, block chain node and storage medium
US11251966B2 (en) 2019-06-28 2022-02-15 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
US11343103B2 (en) 2019-06-28 2022-05-24 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
US11336465B2 (en) 2019-06-28 2022-05-17 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
US11356282B2 (en) 2019-06-28 2022-06-07 Advanced New Technologies Co., Ltd. Sending cross-chain authenticatable messages
TWI738208B (en) * 2019-06-28 2021-09-01 開曼群島商創新先進技術有限公司 Method and device for sending certifiable information across chains
WO2021027531A1 (en) * 2019-08-12 2021-02-18 深圳前海微众银行股份有限公司 Block chain transaction record processing method and device
CN110471923A (en) * 2019-08-12 2019-11-19 深圳前海微众银行股份有限公司 A kind of processing method and processing device of block chain transaction record
CN110471923B (en) * 2019-08-12 2024-01-16 深圳前海微众银行股份有限公司 Processing method and device for blockchain transaction records
TWI742586B (en) * 2019-08-30 2021-10-11 開曼群島商創新先進技術有限公司 Methods and devices for providing traversable key-value data storage on blockchain
CN111602166A (en) * 2019-08-30 2020-08-28 阿里巴巴集团控股有限公司 Method and apparatus for providing traversable key-value data stores on blockchains
CN111602166B (en) * 2019-08-30 2023-08-22 创新先进技术有限公司 Method and apparatus for providing traversable key-value data storage on a blockchain
CN110874365A (en) * 2019-11-20 2020-03-10 深圳市网心科技有限公司 Information query method and related equipment thereof
CN110874365B (en) * 2019-11-20 2023-11-17 深圳市迅雷网络技术有限公司 Information query method and related equipment thereof
CN111310137A (en) * 2020-03-23 2020-06-19 杭州溪塔科技有限公司 Block chain associated data evidence storing method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN109063016A (en) Block chain data storage method, device, electronic equipment, storage medium
Liu et al. A blockchain-based framework of cross-border e-commerce supply chain
Antonopoulos Mastering Bitcoin: Programming the open blockchain
JP2019537318A (en) Method and system for identity and certificate protection and verification via blockchain
CN108520293A (en) A kind of product false proof source tracing method, device, server and storage medium
US20210304201A1 (en) Transaction verification method and apparatus, storage medium, and electronic device
CN109034849B (en) Agricultural product information traceability verification method and system based on block chain
CN109711837A (en) Processing method of insuring, device and electronic equipment based on block chain technology
CN112241506B (en) User behavior backtracking method, device, equipment and system
WO2020052578A1 (en) Method for managing and providing recruitment information
CN109992993A (en) Assets information processing method, device, equipment and storage medium based on block chain
CN112101938B (en) Digital seal using method and device based on block chain and electronic equipment
CN107248052A (en) A kind of commodity stocks information determines method, apparatus and system
CN110019540A (en) Implementation method, methods of exhibiting and the device of enterprise's map, equipment
CN109872015A (en) Method and device for behavioral data assessment
Epiphaniou et al. Smart distributed ledger technologies in Industry 4.0: Challenges and opportunities in supply chain management
CN108446976A (en) A kind of common reserve fund transfer method, computer readable storage medium and terminal device
CN109003093A (en) The method, apparatus and system traced to the source for commodity
CN110717809A (en) Vehicle transaction method and device based on big data, electronic equipment and computer readable medium
Shen et al. The geopolitics of infrastructuralized platforms: The case of Alibaba
CN110263003A (en) Item file deposits card method and terminal device
CN108537047A (en) The method and device of information is generated based on block chain
CN109034199A (en) Data processing method and device, storage medium and electronic equipment
Sathiya et al. Reshaping healthcare supply chain using chain-of-things technology and key lessons experienced from COVID-19 pandemic
CN109284452A (en) The online methods of exhibiting of electronic protocol, device, electronic equipment, 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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20181221

WD01 Invention patent application deemed withdrawn after publication