It is a kind of to improve the method and device that block produces speed
Technical field
It is more particularly to a kind of to improve the method and device that block produces speed the present invention relates to financial technology field.
Background technology
In recent years, block chain technology, as the Floor layer Technology of bit coin, is a kind of hardly possible distribution being modified
Database and account book recording technique, can go to center due to the technology and transaction event elder generation is recorded on the basis of guaranteeing data security
The characteristics of afterwards and with that can not distort so that block chain technology is undergoing the stage of fast development.
Using block chain as the encryption digital cash system constructed by Floor layer Technology, due to its distributed feature, data note
Record security very high.But, each node has a complete account book, needs to review each notes record when confirming transaction,
Therefore promote over time, when transaction data super large, performance issue just occurs, such as the first time using needing download to go through
All Activity record ability normal work in history, or merchandise to verify that possessing the enough amount of money really then needs to review every time
History each transaction calculates remaining sum.And single block finite capacity, the data stored with block increase, for merchandising
When efficiency relative to traditional center type server or transaction operator processing it is low, volume business list can not be still met at present
The demand handled in time.
The content of the invention
Above mentioned problem is directed to, the present invention provides a kind of block that improves and produces speed method and device, realizes and improve block
The purpose of the trading efficiency of chain network.
To achieve these goals, improve block there is provided one kind according to the first aspect of the invention and produce speed method,
This method includes:
When block data storage, by Transaction Information storage into database, and by cryptographic Hash storage into block;
Set up the cryptographic Hash and the index relative of the Transaction Information in the database;
When verify Transaction Information be really existence when, according to the index relative, download the transaction letter to be verified
Breath is verified.
It is preferred that, when be stored with block Transaction Information when, this method also includes:
The Transaction Information is extracted from the block, and the Transaction Information is stored into database.
It is preferred that, the index relative of the Transaction Information set up in the cryptographic Hash and the database, including:
The numbering of the block of the storage cryptographic Hash is set;
Get database Transaction Information corresponding with the cryptographic Hash, and by the numbering of the Transaction Information be set to
The cryptographic Hash block is stored to be identically numbered;
Set up the index relative of the cryptographic Hash with being stored in the block number identical Transaction Information and the block.
It is preferred that, it is described when verifying the necessary being of Transaction Information, according to the index relative, download described to be tested
The Transaction Information of card verified, including:
When verifying the necessary being of Transaction Information, the Transaction Information for needing to verify is downloaded in the database;
According to the index relative, cryptographic Hash corresponding with the Transaction Information to be verified is obtained;
By being verified to the cryptographic Hash, the checking to the Transaction Information to be verified is realized.
It is preferred that, the database is local data base or strange land database.
The device that block produces speed is improved there is provided a kind of according to the second aspect of the invention, the device includes:
Memory module, for when block data storage, Transaction Information storage to be stored into database, and by cryptographic Hash
Into block;
Module is set up, for setting up the cryptographic Hash and the index relative of the Transaction Information in the database;
Authentication module, for when verify Transaction Information be really existence when, according to the index relative, download described in treat
The Transaction Information of checking is verified.
It is preferred that, when be stored with block Transaction Information when, the device also includes:
Extraction module, is stored to number for extracting the Transaction Information from the block, and by the Transaction Information
According in storehouse.
It is preferred that, the module of setting up includes:
First setting unit, the numbering of the block for setting the storage cryptographic Hash;
Second setting unit, for getting database Transaction Information corresponding with the cryptographic Hash, and by the transaction
The numbering of information is set to be identically numbered with storing the cryptographic Hash block;
Unit is set up, for setting up the cryptographic Hash with being stored in the block number identical Transaction Information and the block
Index relative.
It is preferred that, the authentication module includes:
Download unit, for when verifying the necessary being of Transaction Information, download to need checking in the database
Transaction Information;
Acquiring unit, for according to the index relative, obtaining cryptographic Hash corresponding with the Transaction Information to be verified;
Authentication unit, for by being verified to the cryptographic Hash, realizing testing to the Transaction Information to be verified
Card.
Compared to prior art, the present invention stores Transaction Information into database when block deposits data, in block
In only store cryptographic Hash, reduce the capacity of block data storage, confirm the true of checking Transaction Information during Transaction Information
Existence, can index particular transactions information, it is thus only necessary to download friendship to be verified according to index relative by cryptographic Hash
Easy information, is verified by cryptographic Hash, has so saved download time, so as to reduce confirmation event, improves block production
Raw speed, the trading efficiency of further block chain network can just be greatly improved.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the accompanying drawing used required in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
The embodiment of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis
The accompanying drawing of offer obtains other accompanying drawings.
Fig. 1 is the schematic flow sheet for the method that a kind of raising block that the embodiment of the present invention one is provided produces speed;
Fig. 2 is the structural representation for the device that a kind of raising block that the embodiment of the present invention two is provided produces speed.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made
Embodiment, belongs to the scope of protection of the invention.
Term " first " and " second " in description and claims of this specification and above-mentioned accompanying drawing etc. are to be used for area
Not different objects, rather than for describing specific order.In addition term " comprising " and " having " and their any deformations,
It is intended to cover non-exclusive include.For example contain the process of series of steps or unit, method, system, product or set
It is standby not to be set in the step of having listed or unit, but the step of may include not list or unit.
Embodiment one
It is the schematic flow sheet that a kind of raising block that the embodiment of the present invention one is provided produces the method for speed referring to Fig. 1,
This method comprises the following steps:
S11, when block data storage, by Transaction Information storage into database, and by cryptographic Hash storage into block;
It is understood that Transaction Information and cryptographic Hash are stored in block in existing block chain technology, this
Sample adds the capacity of block, and Transaction Information is stored in database in embodiments of the present invention, and pass is only stored in block
Key data is cryptographic Hash, so reduces the capacity of block data storage.Meanwhile, the database that Transaction Information is stored can be
Local data base can also be strange land database.
It is preferred that, if having stored Transaction Information in existing block in block chain, the transaction can also be believed
Breath is extracted from corresponding block, and the Transaction Information extracted is stored into database.
S12, the Transaction Information set up in the cryptographic Hash and the database index relative;
Specifically, the specific method step for setting up index relative use in an embodiment of the present invention is as follows:
The numbering of the block of the storage cryptographic Hash is set;
Get database Transaction Information corresponding with the cryptographic Hash, and by the numbering of the Transaction Information be set to
The cryptographic Hash block is stored to be identically numbered;
Set up the index relative of the cryptographic Hash with being stored in the block number identical Transaction Information and the block.
It is corresponding, it would however also be possible to employ other in the prior art to set up the methods indexed, set up Hash as long as can realize
Value and the index relative of the Transaction Information in the database, the present invention do not do clear and definite limit to specific method for building up
System.
S13, when verify Transaction Information be really existence when, according to the index relative, download the friendship to be verified
Easy information is verified.
Specifically, verification process includes:
When verifying the necessary being of Transaction Information, the Transaction Information for needing to verify is downloaded in the database;
According to the index relative, cryptographic Hash corresponding with the Transaction Information to be verified is obtained;
By being verified to the cryptographic Hash, the checking to the Transaction Information to be verified is realized.
By technical scheme disclosed in the embodiment of the present invention one, Transaction Information is stored into database, and in block only
Cryptographic Hash is stored, specific Transaction Information can be indexed by cryptographic Hash, and then set up the cryptographic Hash and the database
In Transaction Information index relative, due to having only existed cryptographic Hash in block, reduce the capacity of block data storage, confirm
During Transaction Information, that is, verify Transaction Information necessary being, it is thus only necessary to download specific Transaction Information need it is to be verified
Transaction Information, verified by cryptographic Hash, saved download time, so as to reduce acknowledging time, improve block production
Speed is given birth to, and then the trading efficiency of block chain network can be increased substantially, this has also for the payment of block chain network is promoted
Huge facilitation.
Embodiment two
Corresponding with the disclosed method for improving block generation speed of the embodiment of the present invention one, embodiments of the invention two are also
The device that block produces speed is improved there is provided a kind of, is that one kind that the embodiment of the present invention two is provided improves block production referring to Fig. 2
The structural representation of the device of raw speed, the device includes:
Memory module 1, for when block data storage, Transaction Information storage to be deposited into database, and by cryptographic Hash
Store up in block;
Module 2 is set up, for setting up the cryptographic Hash and the index relative of the Transaction Information in the database;
Authentication module 3, for when verify Transaction Information be really existence when, according to the index relative, download described
Transaction Information to be verified is verified.
It is corresponding, when be stored with block Transaction Information when, the device also includes:
Extraction module, is stored to number for extracting the Transaction Information from the block, and by the Transaction Information
According in storehouse.
Specifically, the module 2 of setting up includes:
First setting unit 21, the numbering of the block for setting the storage cryptographic Hash;
Second setting unit 22, is handed over for getting database Transaction Information corresponding with the cryptographic Hash, and by described
The numbering of easy information is set to be identically numbered with storing the cryptographic Hash block;
Unit 23 is set up, for setting up the Hash with being stored in the block number identical Transaction Information and the block
The index relative of value.
Specifically, the authentication module 3 includes:
Download unit 31, is tested for when verifying the necessary being of Transaction Information, downloading needs in the database
The Transaction Information of card;
Acquiring unit 32, for according to the index relative, obtaining Hash corresponding with the Transaction Information to be verified
Value;
Authentication unit 33, for by being verified to the cryptographic Hash, realizing to the Transaction Information to be verified
Checking.
In embodiments of the invention two, Transaction Information is stored into database by memory module, cryptographic Hash is deposited
Storage within a block, so reduces the capacity of block data storage, due to that can index specific transaction letter by cryptographic Hash
Breath, the i.e. index relative of the Transaction Information in cryptographic Hash and the database are established in setting up module, pass through authentication module
When verifying the necessary being of Transaction Information, it is thus only necessary to download Transaction Information to be verified, verified by cryptographic Hash,
Download time has been saved, so as to reduce acknowledging time, block has been improved and produces speed, and then the trading efficiency of block chain network
It can increase substantially, this has huge facilitation also for the payment of block chain network is promoted.
The embodiment of each in this specification is described by the way of progressive, and what each embodiment was stressed is and other
Between the difference of embodiment, each embodiment identical similar portion mutually referring to.For device disclosed in embodiment
For, because it is corresponded to the method disclosed in Example, so description is fairly simple, related part is said referring to method part
It is bright.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or using the present invention.
A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention
The embodiments shown herein is not intended to be limited to, and is to fit to and principles disclosed herein and features of novelty phase one
The most wide scope caused.