The blocking method, apparatus of transaction record, electronic equipment and storage medium
Technical field
The present invention relates to finance data protection technique field more particularly to a kind of blocking method, apparatus of transaction record, electricity
Sub- equipment and medium.
Background technique
In face of the e-payment become increasingly prosperous, the verification and storage of a large amount of transaction data become new problem.Block chain is
A kind of a kind of linked data structure for being sequentially in time combined into data block in such a way that sequence is connected, and with cryptography
The distributed account book that can not be distorted He can not forge that mode guarantees;Mature includes bit coin, ether with scene at present
Coin, transnational bank's reconciliation system etc..Traditional block chain technology needs to be related to proof of work mechanism, and this mechanism can not expire
In sufficient financial system the characteristics of high-timeliness and demand.
Summary of the invention
For overcome the deficiencies in the prior art, one of the objects of the present invention is to provide a kind of blocking sides of transaction record
Method forms a transaction record by dimension of preset range to the transaction of user based on the block create-rule in block chain
Group in next transaction record group (transaction record for saving next preset range), while saving a transaction record
The timestamp of group while being reinforced the block before on chain so as to form chain structure storage, guarantees going through from the near to the distant
History transaction can not distort.
The second object of the present invention is to provide a kind of blocking device of transaction record, raw based on the block in block chain
At rule, one transaction record group is formed by dimension of preset range to the transaction of user, (is saved in next transaction record group
The transaction of next month) in, while the timestamp of a transaction record group is saved, so as to form chain structure storage, simultaneously
Block before on chain is reinforced, guarantees can not distorting for historical trading from the near to the distant.
The third object of the present invention is to provide a kind of electronic equipment for realizing the blocking method of above-mentioned transaction record.
The fourth object of the present invention is to provide a kind of computer-readable depositing for storing the blocking method of above-mentioned transaction record
Storage media.
An object of the present invention adopts the following technical scheme that realization:
A kind of blocking method of transaction record comprising following steps:
Transaction record is grouped with time sequencing according to preset range, every group of transaction record is denoted as transaction record group;
Posterior transaction record group is combined in preceding timestamp, object time stamp, institute are generated by hash algorithm
Stating in preceding timestamp is the adjacent corresponding timestamp of preceding transaction record group of posterior transaction record group, the object time
Stamp is to be described in the corresponding timestamp of rear transaction record group.
Further, timestamp corresponding for first group of transaction record group passes through for first group of transaction record group
Hash algorithm generates.
Further, by posterior transaction record group and before preceding timestamp is combined, further includes:
It is encrypted using public key by asymmetric arithmetic to described in preceding timestamp;
It is verified by the private key matched with the public key, if verification passes through, by posterior transaction record
Group is combined in preceding timestamp.
Further, the preset range is the transaction record of default number of branches or the transaction record of predetermined period.
Further, the predetermined period is 1 month.
Further, after by hash algorithm generation object time stamp, further includes: to the transaction in default cutoff range
Record is compressed, to recycle hard drive space.
Further, the default cutoff range is default number of branches threshold value or preset time threshold;
Boil down to is carried out by Merkle tree algorithm to default number of branches threshold value to the transaction record in default cutoff range
Or the transaction record of preset time threshold is compressed.
The second object of the present invention adopts the following technical scheme that realization:
A kind of blocking device of transaction record, comprising:
Grouping module, for transaction record to be ranked up sequentially in time, by the transaction record after sequence according to pre-
If range is grouped, every group of transaction record is denoted as transaction record group;
Generation module is generated for being combined posterior transaction record group in preceding timestamp by hash algorithm
Object time stamp, the preceding transaction record group corresponding time adjacent for posterior transaction record group in preceding timestamp
Stamp, the object time stamp is to be described in the corresponding timestamp of rear transaction record group.
The third object of the present invention adopts the following technical scheme that realization:
A kind of electronic equipment, comprising: one or more processors;Storage device, for storing one or more programs, when
One or more of programs are executed by one or more of processors, so that one or more of processors realize this hair
The blocking method of the transaction record of the bright first purpose.
The fourth object of the present invention adopts the following technical scheme that realization:
A kind of computer readable storage medium, is stored thereon with computer program, realization when which is executed by processor
The blocking method of the transaction record of one of the object of the invention.
Compared with prior art, the beneficial effects of the present invention are:
1, the present invention is based on the block create-rules in block chain, form one by dimension of preset range to the transaction of user
A transaction record group, in the treatment process (transaction record for saving next month) of next transaction record group, by upper one
Input parameter when treatment process of the timestamp of transaction record group as next transaction record group, so as to form chain structure
Storage, while reinforcing the block before on chain, guarantee can not the distorting of historical trading from the near to the distant (once distort,
Its timestamp is just changed, and can be done verification verification and is used), it is verified in user, company's account, law works has been appraised and decided huge
Reliability.
2, the safety of storage protection user and business data are encrypted, it may be verified that Encryption Algorithm ensure that data can core
Reality, block link algorithm ensure that the continuous reinforcement characteristic of data encryption, while guarantee block using certain compression algorithm
Link size is controllable;Relatively current verification and storage scheme has very big breakthrough and superiority.
Detailed description of the invention
Fig. 1 is the flow chart of the blocking method of transaction record of the embodiment of the present invention one;
Fig. 2 is the structural schematic diagram of the blocking device of transaction record of the embodiment of the present invention two;
Fig. 3 is the structural schematic diagram of the electronic equipment of the embodiment of the present invention three.
Specific embodiment
In the following, being described further in conjunction with attached drawing and specific embodiment to the present invention, it should be noted that not
Under the premise of conflicting, new implementation can be formed between various embodiments described below or between each technical characteristic in any combination
Example.
Embodiment one
The embodiment of the present invention one discloses a kind of blocking method of transaction record, and this method can be by hardware or/and software
It executes, please refers to shown in Fig. 1 comprising following steps:
110, transaction record is grouped with time sequencing according to preset range, every group of transaction record is denoted as transaction record
Group.
Transaction record is generated and is sorted according to time sequencing, therefore, is grouped sequentially in time, the rule of grouping
Predetermined period be can be with preset range for example as unit of the moon, be also possible to default transaction record item number, such as with 10
For unit, naturally it is also possible to be that each transaction record is used as a transaction record group.Application block chain is to transaction record group
When carrying out chain structure storage, each transaction record group is a block.Here transaction record can be all transaction
Record, is also possible to be labeled with important transaction record, can be the corresponding transaction record of a client, be also possible to own
Client or partial region (such as being divided with region) corresponding transaction record.
120, posterior transaction record group is combined in preceding timestamp, the object time is generated by hash algorithm
Stamp, the preceding transaction record group corresponding timestamp adjacent for posterior transaction record group in preceding timestamp, the mesh
Marking timestamp is described in the corresponding timestamp of rear transaction record group.
Chain structure storage is carried out to transaction record group in order to be formed, meanwhile, block preceding on chain is reinforced, is protected
Can not distorting for the historical trading of card from the near to the distant, in preferred embodiments of the present invention, passes through hash for preceding transaction record group
The timestamp (referred to as in preceding timestamp) that algorithm generates as the parameter in rear transaction record group, with posterior transaction record group into
It is generated by hash algorithm in the corresponding timestamp of rear transaction record group after row combination, i.e. the object time stabs, in preceding transaction record
Group is adjacent to rear transaction record group and sequentially in time, is located at before rear transaction record group in preceding transaction record group.With this
So that posterior transaction record group in being treated journey, is reinforced preceding All Activity record group, thus
Prevent distorting for transaction record.
For first group of transaction record group, there is no preceding transaction record group, therefore, corresponding timestamp is
The timestamp that the transaction record of first group of transaction record group itself is generated by hash algorithm, then using its timestamp as second
Group transaction record group input parameter, and so on, preceding timestamp and rear transaction record group combination can be it is more
Kind, such as will be before or after preceding timestamp is placed in the transaction record of rear transaction record group etc..
Timestamp includes two parts content, first is that transaction record group and timestamp are plucked by the data that hash algorithm generates
Want, i.e. hash code, the byte number of the hash code in each timestamp is identical, generally 256 bytes, second is that hash code generate or
The specific time being broadcasted or time sequencing, referred to as time series, certainly, time series can be used as a part of hash code,
That is time series and hash code totally 256 bytes.
It further include the encryption to timestamp in preferred embodiments of the present invention to guarantee the safety of data.That is: will
Posterior transaction record group (the transaction record content for referring to posterior transaction record group) is gone back with before preceding timestamp is combined
Include:
It is encrypted using public key by asymmetric arithmetic to described in preceding timestamp;By being matched with the public key
Private key verified, if verification pass through, posterior transaction record group is combined in preceding timestamp, is then passed through
Hash algorithm is generated in rear timestamp.
It is, of course, also possible to be: being encrypted using private key by asymmetric arithmetic to described in preceding timestamp;By with institute
The public key that private key is matched is stated to be verified, if verification pass through, by posterior transaction record group with preceding timestamp into
Row combination, is then generated by hash algorithm in rear timestamp.
For having carried out blocking processing and strengthened each block, compression can be carried out and realize returning for hard drive space
It receives, reduces the system resource of occupancy.Specifically:
Transaction record in default cutoff range is compressed by Merkle tree (Merkel tree) algorithm.It is default
Cutoff range can be default number of branches threshold value, such as preceding 1000 transaction records, be also possible to preset time threshold, such as preceding 12
A month transaction record.It is, of course, preferable to default cutoff range and preset range are corresponding, for example, preset range is default number of branches,
So default cutoff range uses default number of branches threshold value, and default number of branches threshold value is the integral multiple of default number of branches, and preset range is pre-
If the period, then default cutoff range uses preset time threshold, preset time threshold is the integral multiple of default number of branches.
This method encrypts the transaction record of user in financial system, and is calculated using preset range as dimension by hash
Method generates timestamp;Use for reference block chain technology in block chain thought, using in the hash timestamp of preceding block as in the rear block time
Stab generate important element, in subsequent block constantly to chain before block carry out reinforcing encryption, it is therefore prevented that transaction record is usurped
Change.
Embodiment two
Embodiment two discloses a kind of blocking device of transaction record of corresponding above-described embodiment, shown referring to figure 2.,
Include:
Grouping module 210, for transaction record to be ranked up sequentially in time, by the transaction record after sequence according to
Preset range is grouped, and every group of transaction record is denoted as transaction record group;
Generation module 220, it is raw by hash algorithm for posterior transaction record group to be combined in preceding timestamp
It is stabbed at the object time, the preceding transaction record group corresponding time adjacent for posterior transaction record group in preceding timestamp
Stamp, the object time stamp is to be described in the corresponding timestamp of rear transaction record group.
Embodiment three
Fig. 3 is the structural schematic diagram for a kind of electronic equipment that the embodiment of the present invention three provides, as shown in figure 3, the electronics is set
Standby includes processor 310, memory 320, input unit 330 and output device 340;The number of processor 310 in computer equipment
It measures and can be one or more, in Fig. 3 by taking a processor 310 as an example;Processor 310, memory 320 in electronic equipment,
Input unit 330 can be connected with output device 340 by bus or other modes, in Fig. 3 for being connected by bus.
Memory 320 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computer
Sequence and module, if the corresponding program instruction/module of the blocking method of transaction record in the embodiment of the present invention is (for example, transaction
Record block disguises the grouping module 210 in setting and generation module 220).Processor 310 is stored in memory 320 by operation
In software program, instruction and module realize thereby executing the various function application and data processing of electronic equipment
The blocking method of the transaction record stated.
Memory 320 can mainly include storing program area and storage data area, wherein storing program area can store operation system
Application program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.This
Outside, memory 320 may include high-speed random access memory, can also include nonvolatile memory, for example, at least one
Disk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 320 can be into one
Step includes the memory remotely located relative to processor 310, these remote memories can be set by network connection to electronics
It is standby.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Input unit 330 can be used for receiving the subscriber identity information of input.Output device 340 may include the display such as display screen
Equipment.
Example IV
The embodiment of the present invention four also provides a kind of storage medium comprising computer executable instructions, and the computer can be held
Row instruction is used to execute a kind of blocking method of transaction record when being executed by computer processor, this method comprises:
Transaction record is ranked up sequentially in time, the transaction record after sequence is divided according to preset range
Group, every group of transaction record are denoted as transaction record group;
Posterior transaction record group is combined in preceding timestamp, object time stamp, institute are generated by hash algorithm
Stating in preceding timestamp is the adjacent corresponding timestamp of preceding transaction record group of posterior transaction record group, the object time
Stamp is to be described in the corresponding timestamp of rear transaction record group.
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present invention
The method operation that executable instruction is not limited to the described above, can also be performed transaction record provided by any embodiment of the invention
Relevant operation in blocking method.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present invention
It can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is more
Good embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior art
Part can be embodied in the form of software products, which can store in computer readable storage medium
In, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computer
Access Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions use so that an electronic equipment
(can be mobile phone, personal computer, server or the network equipment etc.) executes method described in each embodiment of the present invention.
It is worth noting that, in the embodiment of the above-mentioned blocking device of transaction record, included each unit and module
It is only divided according to the functional logic, but is not limited to the above division, as long as corresponding functions can be realized;
In addition, the specific name of each functional unit is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
The above embodiment is only the preferred embodiment of the present invention, and the scope of protection of the present invention is not limited thereto,
The variation and replacement for any unsubstantiality that those skilled in the art is done on the basis of the present invention belong to institute of the present invention
Claimed range.