A kind of trusted timestamp adding method, device and storage medium

文档序号:1744539 发布日期:2019-11-26 浏览:12次 中文

阅读说明:本技术 一种可信时间戳添加方法、装置和存储介质 (A kind of trusted timestamp adding method, device and storage medium ) 是由 阮泽鑫 钟嘉栋 黄桂鸿 于 2019-08-21 设计创作,主要内容包括:本申请实施例提供一种可信时间戳添加方法、装置和存储介质,涉及区块链技术领域。其中,方法包括:获取区块链上当前最新区块的区块数据;获取可信时间,并根据所述可信时间为所述区块数据添加可信时间戳,得到具有可信时间戳的区块数据;根据所述具有可信时间戳的区块数据构建时间戳交易请求;向所述区块链中的节点发送所述时间戳交易请求,以使得所述节点根据所述时间戳交易请求将所述具有可信时间戳的区块数据添加至所述区块链中。本申请实施例通过异步地为区块链的当前最新区块的区块数据添加可信时间戳,提高了区块链的性能,方便对区块链进行管理。(The embodiment of the present application provides a kind of trusted timestamp adding method, device and storage medium, is related to block chain technical field.Wherein, method includes: the block data for obtaining current newest block on block chain;Trusted time is obtained, and is that the block data adds trusted timestamp according to the trusted time, obtains the block data with trusted timestamp;Timestamp transaction request is constructed according to the block data with trusted timestamp;Node into the block chain sends the timestamp transaction request, so that the block data with trusted timestamp is added in the block chain by the node according to the timestamp transaction request.The embodiment of the present application adds trusted timestamp by the block data asynchronously for the current newest block of block chain, improves the performance of block chain, convenient to be managed to block chain.)

1. a kind of trusted timestamp adding method characterized by comprising

Obtain the block data of current newest block on block chain;

Trusted time is obtained, and is that the block data adds trusted timestamp according to the trusted time, obtains having credible The block data of timestamp;

Timestamp transaction request is constructed according to the block data with trusted timestamp;

Node into the block chain sends the timestamp transaction request, so that the node is handed over according to the timestamp Easily the block data with trusted timestamp is added in the block chain by request.

2. trusted timestamp adding method as described in claim 1, which is characterized in that described that there is trusted time according to The block data of stamp constructs timestamp transaction request, comprising:

Default trading template is obtained, includes transaction content field in the default trading template;

Data filling is carried out to the transaction content field according to the block data with trusted timestamp;

A timestamp transaction is constructed according to filled default trading template;

It is traded according to the timestamp and generates timestamp transaction request.

3. trusted timestamp adding method as described in claim 1, which is characterized in that on the acquisition block chain currently most Before the block data of new block, further includes:

It obtains the first generation time of the newest block of last record in block chain and the second of current newest block generates Time;

When it is described second generation the time and it is described first generation the time difference reach prefixed time interval, then record it is described second give birth to At the time, and the step of executing the block data of current newest block on the acquisition block chain.

4. trusted timestamp adding method as claimed in claim 3, which is characterized in that carried in the timestamp transaction request Timestamp transaction, the timestamp transaction is constructed according to the block data with trusted timestamp, in the record After the second generation time, further includes:

Block generated within a preset time interval is obtained, as target block;

Whether detect in the target block includes transaction in addition to timestamp transaction;

If in the target block including the transaction in addition to timestamp transaction, on the execution acquisition block chain currently most The step of block data of new block.

5. trusted timestamp adding method as described in claim 1, which is characterized in that on the acquisition block chain currently most Before the block data of new block, further includes:

Obtain the block height and current block height of last record in block chain;

When to reach preset height poor for the difference of the current block height and the block height of the last record, then described in record Current block height, and the step of executing the block data of current newest block on the acquisition block chain.

6. trusted timestamp adding method as described in claim 1, which is characterized in that

Obtain the block data of current newest block on block chain, comprising: obtain from intermediate server current newest on block chain The block data of block;

The block data according to trusted timestamp constructs timestamp transaction request, comprising:

Timestamp transaction request is constructed according to the block data with trusted timestamp by intermediate server.

7. a kind of trusted timestamp adding method, which is characterized in that be applied to first node, the first node is in block chain Arbitrary node, comprising:

Receiving time stabs transaction request, and the timestamp transaction request carries the block data with trusted timestamp;

When the first node is to produce the destination node of block, block is generated, includes when having credible in the block Between the block data that stabs;

Second node into block chain broadcasts the checking request of the block, wherein the second node is to remove in block chain Node other than first node;

Receive the verification result that the second node is returned based on the checking request;

Based on the verification result that the second node returns, the block is added in the block chain.

8. trusted timestamp adding method as claimed in claim 7, which is characterized in that further include:

When the first node is not to produce the destination node of block, transmission is generated according to the timestamp transaction request and is referred to It enables;

Transmission instruction is sent to destination node, the transmission instruction is used to indicate: the destination node generates block, and The block is added in the block chain based on common recognition mechanism.

9. a kind of trusted timestamp adding set characterized by comprising

Block data acquiring unit, for obtaining the block data of current newest block on block chain;

Timestamp adding unit is that block data addition is credible for obtaining trusted time, and according to the trusted time Timestamp obtains the block data with trusted timestamp;

Construction unit is requested, for constructing timestamp transaction request according to the block data with trusted timestamp;

Request transmitting unit sends the timestamp transaction request for the node into the block chain, so that the section The block data with trusted timestamp is added in the block chain by point according to the timestamp transaction request.

10. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer journey Sequence when the computer program is executed by processor, realizes trusted timestamp addition side as claimed in any one of claims 1 to 6 Method.

Technical field

This application involves block chain technical fields, and in particular to a kind of trusted timestamp adding method, device and storage are situated between Matter.

Background technique

Block chain is the database for the decentralization that block is grouped together into a manner of chain.Specifically, one section The information (including depositing card data) generated in time, which is packaged, generates a block, adds trusted timestamp for the block, then with it is upper One block is engaged togather, in this way, joining end to end, forms block chain.Wherein, in the block head of each block, in addition to It creates outside generation block, all includes the cryptographic Hash of a upper block, include at least one transaction in the block body of each block, hand over Easily in include information generated such as include deposit card data.Since block chain is added to trusted timestamp when generating block, So that the time that the information being stored in block chain generates is believable, it is so block chain imparting trusted time.

Summary of the invention

The embodiment of the present application provides a kind of trusted timestamp adding method, device and storage medium, and block chain can be improved Performance.

The embodiment of the present application provides a kind of trusted timestamp adding method, comprising:

Obtain the block data of current newest block on block chain;

Trusted time is obtained, and is that the block data adds trusted timestamp according to the trusted time, is had The block data of trusted timestamp;

Timestamp transaction request is constructed according to the block data with trusted timestamp;

Node into the block chain sends the timestamp transaction request, so that the node is according to the time The block data with trusted timestamp is added in the block chain by stamp transaction request.

The embodiment of the present application also provides a kind of trusted timestamp adding methods, are applied to first node, described First node is the arbitrary node in block chain, comprising:

Receiving time stabs transaction request, and the timestamp transaction request carries the block data with trusted timestamp;

When the first node is to produce the destination node of block, block is generated, includes that have can in the block Believe the block data of timestamp;

Second node into block chain broadcasts the checking request of the block, wherein the second node is block chain In node in addition to first node;

Receive the verification result that the second node is returned based on the checking request;

Based on the verification result that the second node returns, the block is added into the block chain.

The embodiment of the present application also provides a kind of trusted timestamp adding sets, comprising:

Block data acquiring unit, for obtaining the block data of current newest block on block chain;

Timestamp adding unit is block data addition for obtaining trusted time, and according to the trusted time Trusted timestamp obtains the block data with trusted timestamp;

Construction unit is requested, for constructing timestamp transaction request according to the block data with trusted timestamp;

Request transmitting unit sends the timestamp transaction request for the node into the block chain, so that institute It states node and the block data with trusted timestamp is added in the block chain according to the timestamp transaction request.

Further, the request construction unit, comprising:

Template acquiring unit includes transaction content field in the default trading template for obtaining default trading template;

Fills unit, for being counted according to the block data with trusted timestamp to the transaction content field According to filling;

Timestamp transaction construction unit, for constructing a timestamp transaction according to filled default trading template;

Generation unit is requested, generates timestamp transaction request for trading according to the timestamp.

Further, the trusted timestamp adding set, further includes:

Time acquisition unit, for obtain in block chain the first of newest block of last record generate the time and The second of current newest block generates the time;

Time recording unit, if the difference for the second generation time and the first generation time reaches preset time Interval then records described second and generates the time, and triggers block data acquiring unit, with current newest on block chain for obtaining The block data of block.

Further, the timestamp transaction request includes timestamp transaction, and the timestamp transaction is according to the tool There are the block data building of trusted timestamp, the trusted timestamp adding set, further includes:

Target block acquiring unit, for obtaining block generated within a preset time interval, as target block;

Whether block detection unit includes friendship in addition to timestamp transaction for detecting in the target block Easily;If include in the target block except the timestamp transaction in addition to transaction, trigger block data acquiring unit, with In the block data for obtaining current newest block on block chain.

Further, the trusted timestamp adding set, further includes:

Height acquiring unit, for obtaining the block height and current block height of last record in block chain;

Altitude record unit, for reaching when the difference of the current block height and the block height of the last record Preset height is poor, then records the current block height, and trigger block data acquiring unit, to be taken in for obtaining block chain The block data of preceding newest block.

The embodiment of the present application also provides a kind of trusted timestamp adding sets, are applied to first node, the first segment Point is the arbitrary node in block chain, comprising:

Request reception unit stabs transaction request for receiving time, and the timestamp transaction request carries when having credible Between the block data that stabs;

Block generation unit, it is described for generating block when the first node is to produce the destination node of block It include the block data with trusted timestamp in block;

Radio unit broadcasts the checking request of the block for the second node into block chain, wherein described second Node is the node in block chain in addition to first node;

Verification result receiving unit, the verification result returned for receiving the second node based on the checking request;

The block is added to described by block adding unit, the verification result for being returned based on the second node In block chain.

Further, the trusted timestamp adding set, further includes:

Instruction generation unit, for when the first node be not produce block destination node when, according to it is described when Between stamp transaction request generate send instruction;

Instruction sending unit, for transmission instruction to be sent to destination node, the transmission instruction is used to indicate: institute It states destination node and generates block, and the block is added in the block chain based on common recognition mechanism.

The embodiment of the present application also provides a kind of computer readable storage medium, the computer-readable recording medium storage There is computer program, when the computer program is executed by processor, realizes any of the above-described kind of trusted timestamp adding method.

The block data that the embodiment of the present application passes through current newest block on acquisition block chain;Obtain trusted time, and root It is that block data adds trusted timestamp according to trusted time, the block data with trusted timestamp is obtained, according to credible The block data of timestamp constructs timestamp transaction request, and timestamp transaction request is sent to the node in block chain so that The node is obtained the block data with trusted timestamp is added in block chain according to timestamp transaction request.Such as This, asynchronously adds trusted timestamp for the current newest block of block chain, and trusted timestamp is added into block chain, comes Trusted time is assigned for block chain, block chain itself is not needed and obtains trusted timestamp, i.e., the scheme in the application is to block Chain is transformed without intrusion without the common recognition node to block chain.The embodiment of the present application is by being asynchronously the current of block chain Newest block adds trusted timestamp, improves the performance of block chain, convenient to be managed to block chain, without in block chain Common recognition node goes to obtain trusted timestamp when generating block, improves the flexibility of block chain;In addition, in the embodiment of the present application The scheme of addition trusted timestamp can assign trusted time for any block chain, applicability is wide.

Detailed description of the invention

In order to more clearly explain the technical solutions in the embodiments of the present application, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, the drawings in the following description are only some examples of the present application, for For those skilled in the art, without creative efforts, it can also be obtained according to these attached drawings other attached Figure.

Fig. 1 a is the system schematic provided by the embodiments of the present application that trusted timestamp is added for block chain;

Fig. 1 b is trusted timestamp adding method flow diagram provided by the embodiments of the present application;

Fig. 1 c is block structure schematic diagram provided by the embodiments of the present application;

Fig. 2 a is trusted timestamp adding method flow diagram provided by the embodiments of the present application;

Fig. 2 b is the schematic diagram of addition trusted timestamp provided by the embodiments of the present application;

Fig. 3 is another flow diagram of trusted timestamp adding method provided by the embodiments of the present application;

Fig. 4 is the schematic block diagram of trusted timestamp adding set provided by the embodiments of the present application;

Fig. 5 is another schematic block diagram of trusted timestamp adding set provided by the embodiments of the present application;

Fig. 6 is another schematic block diagram of trusted timestamp adding set provided by the embodiments of the present application;

Fig. 7 is the structural schematic diagram of computer equipment provided by the embodiments of the present application.

Specific embodiment

Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, those skilled in the art's every other implementation obtained without creative efforts Example, shall fall in the protection scope of this application.

Before to the embodiment of the present invention carrying out that explanation is explained in detail, first to the present embodiments relate to some names arrived Word is explained.

Block chain: block chain technology is derived from bit coin technology, is the Floor layer Technology of bit coin, is point of decentralization Cloth account book database.Block chain itself is a string using the associated data block (i.e. block) generated of cryptographic algorithm, each The information that multiple block chain network transaction effectively confirms is contained in a data block.It is based on this, so can not be by distorting Data on block are practised fraud, it can be ensured that the data on any block are open and clear, it is ensured that the peace of data Quan Xing.

Block chain can be divided into publicly-owned chain, privately owned chain, alliance's chain.Wherein, alliance's chain then between publicly-owned chain and privately owned chain it Between, cooperated to safeguard a block chain together by several tissues, the use of the block chain must be the management having permission, relevant information It can be protected, it is typical such as financial institution.In summary, block chain is the distributed data base system participated in by node, alternatively, The also referred to as one public account book of distribution based on P2P (point-to-point) network, due to joined trusted time to block chain Stamp, therefore, the characteristics of block chain is can not to change, can not forge.

The node of block chain: the equipment for participating in building block chain.One node can be the separate unit for participating in building block chain Computer equipment is also possible to computer equipment cluster such as server cluster etc..The node is stored with Correlation block data, than Such as, which may include the data such as transaction.It wherein, include common recognition node in the node, common recognition node refers to can With generate block the node ability of block (have generate), can be based on common recognition mechanism to the thing occurred within the regular hour The node that business is known together, such as knows together to newly-generated block, to reach common understanding.It should be noted simultaneously that block chain Block can be generated in only one common recognition node of synchronization in network.

Relationship interconnected between the multiple nodes and multiple nodes of block chain constitutes block chain network.Therefore, Node in block chain network is identical with the node meaning of block chain.

The embodiment of the present application provides a kind of trusted timestamp adding method, device, computer equipment and storage medium.

The embodiment of the present application provides a kind of trusted timestamp add-on system, including any offer of the embodiment of the present application can Believe timestamp adding set.The trusted timestamp adding set can integrate in the network equipments such as server.When such as this is credible Between stab add-on system in include server and block chain network.Wherein, pass through network connection between server and block chain network. It include the network entities such as router, gateway in network.In each block chain network, include block chain multiple nodes ( Can be described as network node or node device), peer to peer connection between each node preserves the full dose of block chain in each node Data.

Some node in the block chain network is configured in the server, obtains the node configured, and server passes through The interface and the acquired section that block chain network provides establish connection.In this way, so that server and block chain network are established Connection.

Wherein, the server of the trusted timestamp add-on system is realized: obtaining the block of current newest block on block chain Data;Trusted time is obtained, and is that block data adds trusted timestamp according to trusted time, obtains that there is trusted timestamp Block data;Timestamp transaction request is constructed according to the block data with trusted timestamp;Node into block chain is sent Timestamp transaction request, so that the block data with trusted timestamp is added to area according to timestamp transaction request by node In block chain.Wherein, which is any one node in block chain.

Any one node in the block chain network is realized: receiving time stabs transaction request, the timestamp transaction request Carry the block data with trusted timestamp;When the node is to produce destination node (the target common recognition node) of block, Block is generated, and block is added in block chain based on common recognition mechanism;When the node is not the destination node for producing block When, it is generated according to timestamp transaction request and sends instruction;Instruction will be sent and be sent to destination node, which instructs for referring to Show: the destination node generates block, and the block is added in block chain based on common recognition mechanism.

Block data with trusted timestamp may include trusted timestamp and block data, and can also only include can Believe timestamp.

It should be noted that the server of the trusted timestamp add-on system can be a server, it is also possible to more A server, such as server cluster.

For example, with reference to Fig. 1 a, trusted timestamp add-on system, including intermediate server, time stamp server and block chain Network.Server i.e. in the trusted timestamp add-on system includes two: intermediate server and time stamp server.Centre clothes Business device and time stamp server are connected with each other, and are such as passed through interface and are connected.It wherein, include multiple common recognition nodes in block chain network, It is reciprocity between multiple common recognition nodes, such as including n common recognition node.The full dose of the block chain is saved in each common recognition node Data.In one embodiment, which further includes national time service center.

Some common recognition node in the block chain network is configured in intermediate server, obtains the common recognition section configured Point, the interface and the acquired common recognition node that intermediate server is provided by block chain network establish connection.

It should be noted that the common recognition node configured in intermediate server can be it is any one in block chain network A common recognition node is also possible to some specified common recognition node, such as some the common recognition node specified according to preset rules, example Such as, a common recognition node nearest from intermediate server network distance is specified, the network distance is configured in intermediate server most The close common recognition node.

After intermediate server and block chain network establish connection, intermediate server obtains the current newest block of block chain Block data;The block data is sent to time stamp server.After time stamp server receives the block data, for the area Block number is according to addition trusted timestamp.Specifically, time stamp server goes to obtain trusted time to national time service center, and will be obtained Trusted time and block data for taking etc. are signed together, to obtain the block data with trusted timestamp, and by the tool There is the block data of trusted timestamp to be back to intermediate server.Intermediate server receiving time stabs having for server return can Believe the block data of timestamp, and timestamp transaction request constructed according to the block data with trusted timestamp, and by when Between stamp transaction request be sent to a common recognition node in block chain network, which is preconfigured common recognition node, The common recognition node can be any one of block chain network common recognition node.

The content that the common recognition node of block chain network is realized is consistent with the node in above block chain network, herein not It repeats again.

Fig. 1 b is trusted timestamp adding method flow diagram provided by the embodiments of the present application, and this method is applied to service In device, the detailed process of the trusted timestamp adding method be can be such that

101, obtain the block data of current newest block on block chain.

Wherein, each block in block chain includes block head and block body, as illustrated in figure 1 c.It include at least in block body One transaction includes under normal circumstances multiple transaction in block body, includes to deposit card data etc. in transaction.As described in Fig. 1 c, packet Include 8 transaction.Cryptographic Hash, version, timestamp in block head including a upper block is (local when the block generates for saving Time), difficulty, random number, Merkel is with information such as, block height.It should be noted that also only being included in Fig. 1 c A portion information further includes that have in other information, such as block head further include number of transaction in block head.It needs It is noted that obtaining the block data of current newest block on block chain, which can be the area of current newest block The data of build and block body are also possible to the data of the block head of current newest block, can also be current newest block Block cryptographic Hash etc., other combinations for the data that can also be enumerated at this.It should be noted that the block counts of current newest block According to can uniquely indicate a block.Wherein, block cryptographic Hash is referred to institute after the information progress Hash operation in block head Obtained cryptographic Hash, the cryptographic Hash can uniquely indicate a block.What current newest block referred to being newly generated on block chain One block.After one block generates, so that it may calculate the cryptographic Hash of the block.

Specifically, for example, server sends acquisition request to some node of block chain, which obtains for requesting The block data for taking the current newest block of block chain, such as block cryptographic Hash;It, will after the node of block chain receives acquisition request The block data of calculated current newest block returns to server.Alternatively, some conditions can be set also to trigger service Device sends acquisition request, for example, trigger the server sends acquisition request after setting reaches some period.

In one embodiment, if server includes multiple servers, such as intermediate server and time stamp server, wherein Intermediate server and time stamp server pass through interconnection.Step 101, comprising: obtain block chain from intermediate server and be taken in The block data of preceding newest block.It is to be appreciated that intermediate server obtains the block data of current newest block on block chain, Time stamp server obtains the block data of current newest block on block chain from intermediate server.

102, trusted time is obtained, and be that the block data adds trusted timestamp according to the trusted time, obtained Block data with trusted timestamp.

After server obtains the block data of current newest block, Xiang Guojia time service center obtains trusted time, server It is that block data adds trusted timestamp according to trusted time after receiving the trusted time that national time service center returns.Service Acquired block data, trusted time etc. are signed with the private key saved in server, are finally obtained with credible by device The block data of timestamp.It is to be appreciated that server has the function of time stamp server.And time stamp server meets " RFC3161 standard " examines detection by the Ministry of Public Security, close office, state, securely and reliably;The private key of time stamp server is present in the time It can not export, can not be obtained by anyone in stamp server password card;Therefore time stamp server can provide the believable time It proves.

Due to acquisition be current newest block block data, which can uniquely indicate current block, Therefore, after adding trusted timestamp for the block data, the current newest block of as acquired block chain and acquired Block chain current newest block before block add trusted timestamp, it is current in acquired block chain to prove The All Activity in block before the current newest block of newest block and acquired block chain, in the trusted timestamp It is had existed before corresponding trusted time.

103, timestamp transaction request is constructed according to the block data with trusted timestamp.

A timestamp transaction request is generated according to the block data with trusted timestamp, in the timestamp transaction request Including the block data with trusted timestamp.

In one embodiment, step 103, comprising: timestamp is constructed according to the block data with trusted timestamp Transaction trades according to timestamp and generates timestamp transaction request.Wherein, timestamp trade, refer to transaction in include have can Believe the block data of timestamp.Substantially, timestamp transaction is also a transaction, only includes having trusted time in the transaction The block data of stamp.

Specifically, according to the block data building timestamp transaction with trusted timestamp the step of, comprising:

(1) default trading template is obtained, includes transaction content in the default trading template.

Wherein, default trading template can be the trading template being configured in advance by operation maintenance personnel, be also possible to other Equipment is supplied to the trading template of server after pre-establishing, alternatively, the trading template that can also be voluntarily generated by server, Etc..The default trading template can temporarily be generated by server or temporarily be obtained when constructing transaction;It is also possible in advance Setting or pre-generated or acquisition in advance, save in the server, when constructing transaction, obtain the default transaction of the preservation Template.

Default trading template presets transaction it can be appreciated that default transaction format or the data structure etc. of default transaction Field in template is it can be appreciated that parameter, each parameter include the information such as parameter name, parameter type, parameter value.It needs It reminds, the certain fields preset in trading template can also include next stage field.For example, certain fields are defining data When structure, it is just defined as the field that the field includes multiple next stage, further includes the field for having lower next stage in next stage field Deng.If certain fields are stored in a manner of array, multiple data in array correspond to the next stage field of the field.

Field in default trading template includes transaction version number, additional data (type json), input array, output Array, locking time (default value 0), base58 | hex returns to the fields such as format.Wherein, for example, base58 | hex returns to lattice Formula field, type string are defaulted as the base58 | and hex returns to format fields and does not fill out, if in the case where not filling out, it should Base58 | hex returns to format words segment value=base58, this field is not involved in signature.

It wherein, include one or more input in the input array field of each transaction, for example, being handed over for timestamp Easily, inputting in array field has an input.It include input serial number, reference source output information, unlock foot in each input The fields such as this.For example, input sequence number field, type uint32, are worth for some positive integer since 0, such as 0, the input Serial number only guarantees uniqueness, without guaranteeing continuity.For example, using source output information field, type json, the application Source output information refers to the information of reference transaction, i.e., the output information of a upper transaction.It further include next in the field Two fields of grade: hash and index, wherein hash refers to the hash value of reference transaction, and index refers to reference transaction Index.It should be noted that timestamp transaction is because without reference transaction, hash and index are fixed value, to make spy Different processing;And non-time-stamped trade, i.e., timestamp transaction except transaction, such as deposit card transaction etc. need to quote actual information.Than Such as, Script Field is unlocked, type can be string or base58, and the value of the field is to obtain after calculating using base58 function The value arrived, the value obtained after being calculated such as base58 (script type+script version+signature).

It wherein, include one or more output in the output array field of each transaction, for example, being handed over for timestamp Easily, exporting in array field has an output.In each output include output serial number, to account address, Asset ID, dollar amount, The fields such as transaction content, locking script.For example, output sequence number field, type uint32 are worth for some since 0 just Integer, such as 0, which need to only guarantee uniqueness, without guaranteeing continuity.For example, arriving account address field, type is String or base58 is worth for 1KzBWDAcf66fyZ1qGb2r6YZp3CfuRgfdDr.For example, dollar amount field, class Type is uint64, and being worth is 100.For example, transaction content field, type is string or base58, and timestamp transaction is come It says, the value of transaction content field is the information such as block data with trusted timestamp and data type after serializing.

(2) data are carried out to the transaction content field in default trading template according to the block data with trusted timestamp Filling.

Transaction content field is a field information for including in the output exported in array.In transaction content word Arbitrary data can be filled in section, wherein filling can be understood as field assignment.In timestamp transaction, transaction content The data of field filling include: the type for filling data and the particular content etc. for filling data.Such as the type of filling data For trusted timestamp, the particular content for filling data is the block data with trusted timestamp.The type of data will be filled It is serialized with the particular content of filling data, with the value serialized.If the number of the trusted timestamp after serializing It is indicated according to the value of type with 5, the value of the data type of trusted timestamp can also use other numbers or letter or symbol To indicate the having value of the block data of trusted timestamp for djREFASDGJs483K.So transaction content field carries out data After filling and serializing, are as follows: 5djREFASDGJs483K.It is noted that the value of the data type of the timestamp at this with And the value of the block data with trusted timestamp is not to be really worth, and is intended merely to illustrate, not structure The limitation of the value of the data type of the value and trusted timestamp of block data with trusted timestamp in pairs.

(3) a timestamp transaction is constructed according to filled default trading template.

It has been the field assignment of transaction content in filled default trading template.

It should be noted that reference source output information, refer to the information of reference transaction, i.e., the output of a upper transaction Information.Since timestamp transaction is there is no upper one transaction, i.e. the output a traded letter is not quoted in timestamp transaction Breath, therefore, there is no practical reference source output information for timestamp transaction, will so quote the hash in source output information and Index is both configured to fixed value.Wherein, hash=" 000000000000.....000 " (64 zero), index=" -1 ".Separately Outside, the value to fields such as account address, dollar amounts in the output array of timestamp transaction is also both configured to fixed value.

A transaction is constructed according to filled default trading template, includes the following three types situation:

One, in the default trading template of acquisition, in addition to the field of transaction content, some other field, such as reference source The fields such as account address, dollar amount are arrived in hash and index value, output array in output information, are all had been carried out It is arranged (i.e. data filling), for example is set as fixed value or interim calculated value.It is to be appreciated that in the default friendship of acquisition In easy template other than transaction content field, other fields have had corresponding value.So again to transaction content into After the filling of row data, all fields in filled default trading template have all had corresponding value, in this way, all fields It all carries out the filled default trading template of data and constitutes a transaction.The transaction that will be constructed is traded as timestamp.

Two, in the default trading template of acquisition, all fields all do not carry out data filling, it can be understood as, all words The value of section is all empty.After carrying out data filling to transaction content field, only handed in default trading template filled at this time Easy content field has carried out data filling.In this way, step " constructs a timestamp according to filled default trading template to hand over Easily ", further includes: data filling is carried out to other fields other than transaction content field, all fields are all subjected to data Filled default trading template is as a transaction.The transaction that will be constructed is traded as timestamp.

Three, in the default trading template of acquisition, some field has carried out data filling, it can be understood as, have one The value of part field is sky, and the value of some field is not empty.After carrying out data filling to transaction content field, there is also The value of the field of some does not carry out data filling.Then step " constructs a friendship according to filled default trading template Easily ", further includes: data filling is carried out to the field for not carrying out data filling, it is filled pre- that all fields are all carried out to data If trading template is as a transaction.The transaction that will be constructed is traded as timestamp.

It is to be appreciated that step 103, comprising: obtain default trading template, include in transaction in the default trading template Hold;Data filling is carried out to the transaction content field in default trading template according to the block data with trusted timestamp;Root A timestamp transaction is constructed according to filled default trading template;It is traded according to timestamp and generates timestamp transaction request.

It include that there is trusted timestamp in timestamp transaction in this way, including that timestamp is traded in timestamp transaction request Block data.

The embodiment further defines how to ask according to the block data building timestamp transaction with trusted timestamp It asks.It include a special field: transaction content field in the default trading template firstly, obtaining default trading template.The transaction Arbitrary content can be filled in content field, therefore, default trading template is filled according to the block data with trusted timestamp In transaction content field.Timestamp transaction is constructed further according to the default trading template for being filled with transaction content field, finally, root It trades according to timestamp and generates timestamp transaction request.Since the block data with trusted timestamp is filled into default transaction mould In the transaction content field of plate, therefore, the timestamp of building is traded for the node of block chain, there is no special feature, Only as being a general transaction, the node of block chain trades the timestamp to be handled as general transaction.

In one embodiment, if server includes multiple servers, such as intermediate server and time stamp server, step 103, comprising: timestamp transaction request is constructed according to the block data with trusted timestamp by intermediate server.It can To understand ground, the block data with trusted timestamp is sent to intermediate server, so that intermediate server constructs the time Stab transaction request.Specifically, above step (1), (2), (3) and the step that timestamp transaction request is generated according to timestamp transaction It suddenly is completed on intermediate server.

Node in 104, Xiang Suoshu block chains sends the timestamp transaction request, so that the node is according to The block data with trusted timestamp is added in the block chain by timestamp transaction request.

Timestamp transaction request can be sent to any one of block chain common recognition node by server, can also be sent To specified common recognition node.Wherein, the common recognition node that setup time stamp transaction request is sent in the server in advance is needed.Its In, after the common recognition node in block chain receives timestamp transaction request, will be carried in timestamp transaction request with credible The block data of timestamp is added in block chain.

Pass through the block data of current newest block on acquisition block chain in the embodiment of the present application;Trusted time is obtained, and It is that the block data adds trusted timestamp according to the trusted time, obtains the block data with trusted timestamp;Root Timestamp transaction request is constructed according to the block data with trusted timestamp;Described in node into the block chain is sent Timestamp transaction request, so that the node is according to the timestamp transaction request by the block with trusted timestamp Data are added in the block chain.In this way, being added by the block data that server is asynchronously the current newest block of block chain Add trusted timestamp, assign trusted time for block chain, does not need block chain itself and obtain trusted timestamp, is i.e. the application is real The scheme in example is applied to block chain without intrusion, without being transformed to block chain itself, trusted time can be assigned for block chain. The embodiment of the present application by asynchronously for block chain currently newest block block data add trusted timestamp, improve block The performance of chain is generating block without the node in block chain so that block chain itself is not necessarily to the problem of paying close attention to trusted timestamp When go to obtain trusted timestamp, it is convenient that block chain is managed, improve the performance and flexibility of block chain.On the other hand, After block data with trusted timestamp is added in block chain, the node acquisition being conveniently linked into block chain has can The block data for believing timestamp facilitates and carries out the shared of trusted timestamp.Moreover, the trusted timestamp in the embodiment of the present application adds The scheme added can add trusted timestamp for any block chain, and as any block chain assigns trusted time, fit It is wide with property.

Fig. 2 a is another flow diagram of trusted timestamp adding method provided by the embodiments of the present application, is applied to service The detailed process at device end, the trusted timestamp adding method includes:

201, obtain the newest block of last record in block chain first generates the time.

The first of the newest block of last time record generates the time, it can be understood as, the last time adds credible for block chain Acquired newest block when timestamp, the newest block generate the time.When the newest block generates, the newest block is recorded The generation time.The generation time for obtaining the newest block of last record generates the time as first.

If should be noted that is that block chain adds trusted timestamp for the first time, there is no the newest of last record The first of block generates the time, then executing step 202, obtains the generation time of current newest block, and records current newest The generation time of block generates the time as first, and executes " block data for obtaining current newest block on block chain " Step, to be directly that block chain adds trusted timestamp.

202, obtain current newest block second generates the time.The generation time for obtaining current newest block, as Second generates the time.Wherein, the first generation time and the second generation time are all the time of the server obtained.

203, judge whether the second generation time and the difference of the first generation time reach prefixed time interval.

Wherein, prefixed time interval is preset, such as with second grade for granularity, such as 5 seconds, may be set to be it His granularity.Judge whether the second generation time and the difference of the first generation time reach prefixed time interval.If reach default Between be spaced, then follow the steps 204;If not up to prefixed time interval, execute " when obtaining the second generation of current newest block Between " the step of.

204, it records described second and generates the time.

205, obtain the block data of newest block on block chain.

206, trusted time is obtained, and be that the block data adds trusted timestamp according to the trusted time, obtained Block data with trusted timestamp.

207, timestamp transaction request is constructed according to the block data with trusted timestamp.

Node in 208, Xiang Suoshu block chains sends the timestamp transaction request, so that the node is according to The block data with trusted timestamp is added in the block chain by timestamp transaction request.

Step 205-208 in the embodiment please refers to the description of step 101-104 in above-described embodiment, no longer superfluous herein It states.

The embodiment is further defined according to prefixed time interval come the block data for the current newest block of block chain Trusted timestamp is added, i.e., is that the block data addition of the current newest block of block chain is primary credible every prefixed time interval Timestamp, and timestamp transaction request is constructed according to the block data with trusted timestamp, according to the timestamp transaction request Block data with trusted timestamp is added in block chain.In this way, need not in real time be block chain currently newest block Block data adds trusted timestamp, reduces the interaction with server, saves the cost of addition trusted timestamp, while also subtracting Having lacked storage has the storage overhead and carrying cost of block data of trusted timestamp.

In one embodiment, if constructing timestamp transaction request, packet according to the block data with trusted timestamp It includes: according to the block data building timestamp transaction with trusted timestamp, being traded according to the timestamp and generate the time Transaction request is stabbed, or is traded it is also understood that carrying timestamp in timestamp transaction request, and timestamp transaction is root According to the block data building with trusted timestamp, then after recording the second generation time, block chain is obtained Before the block data of upper current newest block, the method also includes:

A obtains block generated within a preset time interval, as target block.

In block chain, if the number of transaction for not being added to block chain reaches preset quantity, or it is not added to block chain Transaction existing for the time reach the predetermined time, then can trigger generation new block.Therefore, within a preset time interval, it is possible to Generate multiple blocks, it is also possible to only generate a block.

When each block in block chain generates, the time of block generation, in Fig. 1 c, area can all be written in block head " timestamp " in build, preservation be generate block when time.Time when can be according to generation block, to obtain area Block chain block generated within a preset time interval, as target block.Block can also be obtained according to the height of block Chain block generated within a preset time interval, the height of block chain when such as obtaining last acquisition time, when reaching default Between when being spaced block chain height, since obtain block chain block generated within a preset time interval.

B, detect target block in whether include except timestamp transaction in addition to transaction.

Wherein, the transaction in addition to timestamp transaction, the transaction including being stored with card data.It is stored with card data Transaction is referred to as depositing card transaction.In this way, it is to be understood that the transaction in the embodiment of the present application is handed over including at least timestamp Easily and deposit card transaction.

Detect target block quantity, if target block have it is multiple, it is determined that in target block include except timestamp trade Except transaction, that is, determine target block in include deposit card transaction.It is to be appreciated that can only generate one within a preset time interval A timestamp transaction, if the timestamp is traded, the existing time reaches preset time, and does not generate within a preset time interval It is any to deposit card transaction, in this case, timestamp transaction is only included in the block of generation, do not include depositing card transaction.Then exist A target block is only generated in the prefixed time interval, only includes that the timestamp is traded in the target block.If target area Block has multiple, it is assumed that and one of target block only includes timestamp transaction, then other blocks centainly include depositing card transaction, It centainly include the transaction in addition to timestamp transaction in target block.

If target block has one, including following two situation: 1, it in a target block include timestamp trade, It also include depositing card transaction.It 2, only include that timestamp is traded in a target block.If target block has one, target can be obtained The number of transaction of block, by the number of transaction judge the target block whether include except timestamp transaction in addition to transaction.Such as If a target block only include timestamp transaction, then the number of transaction of the target block be it is fixed, by the friendship of the fixation Easy quantitative value is as preset quantity.Obtain target block number of transaction after, judge the target block traded quantity value whether For preset quantity, if preset quantity, it is determined that do not include the transaction in addition to timestamp transaction in target block, that is, determine mesh Mark in block only includes that timestamp is traded;If the number of transaction of the target block is not preset quantity, it is determined that in target block It include depositing card transaction including the transaction in addition to timestamp is traded, i.e., in target block.It should be noted that it can also be passed through Whether his mode includes transaction in addition to timestamp transaction to determine in target block.

If in target block including the transaction in addition to timestamp transaction, executes and " obtain current newest block in block chain Block data " the step of.It if including the transaction in addition to timestamp transaction, i.e., include depositing card in target block in target block Transaction deposits card transaction addition trusted time as in target block, this is then adding trusted timestamp again for block chain It is necessary to.If in target block not including the transaction in addition to timestamp transaction, executes and " obtain last record in block chain Newest block first generate the time " the step of.

If in target block not including the transaction in addition to timestamp transaction, executes and obtain last record in block chain The first of newest block generates the step of time.It is to be appreciated that if not including in addition to timestamp transaction in target block Transaction does not execute the block data step for obtaining current newest block on block chain then, suspends and add trusted time for block chain Stamp.To avoid only generating a block in prefixed time interval, and only include the case where that timestamp is traded, that is, is avoided in the block Trusted time is added again for the block only including timestamp transaction, or it is also understood that is avoided generated continuous multiple Block only includes the case where that timestamp is traded.

It as shown in Figure 2 b, is the schematic diagram of trusted timestamp provided by the embodiments of the present application addition.In the embodiment of the present application, Transaction includes two kinds: card transaction is traded and deposited to timestamp.In figure 2b, server includes multiple: intermediate server and timestamp Server, intermediate server obtain the block data of the current newest block of block chain, and such as block cryptographic Hash, intermediate server is by institute The block data of acquisition is sent to time stamp server, and time stamp server obtains the trusted time at national time service center, and will Block data, trusted time are signed together, to generate the block data with trusted timestamp.When intermediate server receives Between stamp server return the block data with trusted timestamp, and construct one include the trusted timestamp transaction, work For timestamp transaction, is traded according to timestamp and generate timestamp transaction request, which is sent to block chain In node in network.The timestamp for including in timestamp transaction request transaction is added to block chain by the node of block chain network In.Wherein, after the first generation time and the second generation time reaches prefixed time interval in block chain, then working as block chain The block data of preceding newest block adds trusted timestamp.Within a preset time interval, target block includes multiple, such as Fig. 2 b In six (second to the 7th in Fig. 2 b).Within a preset time interval, the block including timestamp transaction is generated, If the block that background is white further includes depositing other than including timestamp transaction (transaction that background is white) in the block Card transaction (transaction that background is Dark grey), i.e., in figure 2b, timestamp transaction deposit card transaction with other and generate an area together Block is added in block chain.It should be noted that in some embodiments, timestamp transaction can independently generate a block, And it is added in block chain.

The embodiment further defines, if within a preset time interval in target block generated, including remove the time Transaction except stamp transaction, then obtain the block data of newest block in block chain, is that the newest block addition of block chain is credible Timestamp;If not including the transaction in addition to timestamp transaction, then temporarily within a preset time interval in target block generated Stop adding trusted timestamp for the newest block of block chain.The area that the embodiment further eliminates only to include timestamp transaction Block adds trusted time, reduces the interaction with server, saves the cost of addition trusted timestamp, while decreasing storage The storage overhead and carrying cost of timestamp transaction and the block data with trusted timestamp.

The embodiment of the present application also provides a kind of trusted timestamp adding method, be applied to server end, the embodiment with The difference of embodiment in Fig. 1 b is: on obtaining block chain before the block data of current newest block, increase step: Timing time is obtained, and detects whether timing time reaches prefixed time interval, if reaching prefixed time interval, executes acquisition The step of on block chain the step of the block data of current newest block and later;If not up to prefixed time interval, after It is continuous that the step of whether detection timing time reaches prefixed time interval executed.Wherein, current newest block on block chain is obtained The step of block data and later the step of, it is consistent with the embodiment in Fig. 1 b, specifically please refer to the embodiment pair in Fig. 1 b The description answered.

Wherein, whether detection timing time reaches prefixed time interval, can be accomplished in several ways.For example, setting one A timer, obtaining timing time is the time for obtaining timer, which starts from scratch timing, when reaching preset time When interval, it is determined that timing time reaches prefixed time interval, which is set to zero again.For example, obtaining in the machine At the first time, start timing since first time, if detecting from having begun to pass through prefixed time interval at the first time, it is determined that examine It measures timing time and reaches prefixed time interval.It is to be appreciated that being interpreted as every if setting prefixed time interval is one minute The step of " block data for obtaining current newest block on block chain " was executed every one minute.

In the embodiment, on obtaining block chain before the block data of current newest block, above-mentioned retouch can also be performed The A and step B stated.Details are not described herein.

The embodiment determines whether to reach prefixed time interval according to timing time, if reaching prefixed time interval, The step of executing " block data for obtaining current newest block on block chain ".I.e. the embodiment is further defined according to timing Time determines whether to reach prefixed time interval, according to prefixed time interval come the block counts for the current newest block of block chain Timestamp transaction request is constructed according to addition trusted timestamp, and according to the block data with trusted timestamp, according to the time Block data with trusted timestamp is added in block chain by stamp transaction request.In this way, need not be current for block chain in real time The block data of newest block adds trusted timestamp, reduces the interaction with server, save addition trusted timestamp at This, reducing storage has the storage overhead and carrying cost of block data of trusted timestamp.

The embodiment of the present application also provides a kind of trusted timestamp adding method, be applied to server end, the embodiment with The difference of embodiment in Fig. 1 b is: on obtaining block chain before the block data of current newest block, increasing step a-d.It is described more fully below in place of the difference of the embodiment in the embodiment and Fig. 1 b.In addition, on acquisition block chain currently most The step of block data of new block and later the step of, it is consistent with the embodiment in Fig. 1 b, specifically please refer in Fig. 1 b The corresponding description of embodiment.

A obtains the block height of last record in block chain.

It is to be appreciated that being obtained when the block data of the upper primary newest block for block chain adds trusted timestamp The block height of block chain, and record.

B obtains current block height.

It is poor to judge whether the difference of the block height of current block height and last record reaches preset height by c.

Wherein, preset height difference is set in advance, and preset height difference is greater than 1 positive integer, as preset height difference is 2,5 etc..Preset height difference is the positive integer greater than 1, illustrates the time in the current block height for obtaining block chain, in acquisition In time interval when block height, the number of blocks greater than 1 has been generated, then in the block generated, it is certain to wrap Include the transaction in addition to timestamp transaction.If it is poor that the difference of current block height and last block height reaches preset height, hold Row step d;If it is poor that the difference of current block height and last block height is not up to preset height, step b is executed, is worked as with obtaining Preceding block height.

D records current block height.And execute the step of obtaining the block data of current newest block on block chain and Later the step of.

The embodiment, which is further defined, adds according to preset height difference come the block data of the newest block for block chain Trusted timestamp, i.e., it is poor (every default block counts) every preset height, it is the block data addition of the newest block of block chain Trusted timestamp to obtain the block data with trusted timestamp, and constructs timestamp transaction request, according to timestamp Block data with trusted timestamp is added in block chain by transaction request.In this way, need not in real time for block chain most The block data of new block adds trusted timestamp, reduces the interaction with server, saves the cost of addition trusted timestamp, Decreasing storage simultaneously has the storage overhead and carrying cost of block data of trusted timestamp.

Fig. 3 is another flow diagram of trusted timestamp adding method provided by the embodiments of the present application, this method application In first node, which is the arbitrary node in block chain.It should be noted that the node in the embodiment of the present application Refer to common recognition node.The detailed process of this method includes:

301, receiving time stabs transaction request, and the timestamp transaction request carries the block counts with trusted timestamp According to.

The first common recognition node in block chain network receives server sending time and stabs transaction request, and timestamp transaction is asked Middle carrying timestamp is asked to trade.It should be noted that the first common recognition node is the common recognition node configured in server.

302, detect whether the first node is destination node.

Wherein, destination node refers to target common recognition node, and target common recognition node is the node that can currently generate block.Area After the first common recognition node in block chain network receives the timestamp transaction request that server is sent, acquisition is stored in first common recognition Target common recognition nodal information in node, target common recognition nodal information include the information such as the IP of target common recognition node.Obtain this The IP of one common recognition node;Judge whether the IP of the first common recognition node is identical as the target common recognition IP of node;If they are the same, it is determined that The first common recognition node is target common recognition node;If not identical, it is determined that the first common recognition node is not target common recognition node.

It should be noted that target common recognition node can be pre-selected out in this block chain network, and target is known together node Information preservation others common recognition nodes in.Once selecting target common recognition node, if detecting, target common recognition node is raw At block do not pass through in this block chain network other common recognition node verifications after, need replacing target common recognition node.Specifically, A common recognition node is selected from others common recognition node according to algorithm, using the common recognition node as target common recognition node, and The information of target common recognition node is sent to other common recognition nodes, all saves target common recognition in other common recognition nodes to allow The information of node.

If the first common recognition node is target common recognition node, step 303 is executed;If the first common recognition node is not total for target Know node, executes step 307.

303, block is generated, includes the block data with trusted timestamp in the block.

If it is determined that the first common recognition node is target common recognition node, if detecting that target common recognition node meets generates block Condition (such as whether reaching the time for generating block), generation includes the block with the block data of trusted timestamp.

304, the second node into block chain broadcasts the checking request of the block, wherein the second node is area Node in block chain in addition to first node.

Wherein, second node refers to the second common recognition node, block described in the second common recognition node broadcasts into block chain Checking request, in this way, the second common recognition node has received the message of block.Second common recognition node receives the message of block Afterwards, which is verified.

305, receive the verification result that the second node is returned based on the checking request.

Verification result will do it broadcast by the second common recognition node, in this way, the second common recognition node can all receive testing for broadcast Demonstrate,prove result.Wherein, verification result includes being verified result and verifying not pass through result.

306, based on the verification result that the second node returns, the block is added in the block chain.

Wherein, the verification result returned based on the second node, the block is added in the block chain, is wrapped It includes: reaching being verified as a result, by the block of the first preset quantity if having in the verification result that the second common recognition node returns It is added in the block chain.Wherein, the first preset quantity is related to total common recognition number of nodes in block chain network, and (first is pre- If quantity+1)/number of nodes of always knowing together=default ratio.Wherein, presetting ratio is the value greater than 1/2, such as default ratio=2/ 3.First preset quantity+1 refers to the second common recognition node and target common recognition node of the first preset quantity.If reception reaches What the second common recognition node of the first preset quantity was sent be verified as a result, this means that the newly-generated block completes common recognition, The block is added in block chain.

307, it is generated according to the timestamp transaction request and sends instruction.

Even first common recognition node is not target common recognition node, is generated according to timestamp transaction request and sends instruction.

308, transmission instruction is sent to destination node, the transmission instruction is used to indicate: the destination node is raw The block is added in the block chain at block, and based on common recognition mechanism.

After target common recognition node receives transmission instruction (including timestamp transaction request), detect whether to meet generation block Condition (such as whether reaching the time for generating block) block is generated, and into block chain if meeting the condition for generating block The checking request of first common recognition node and the second common recognition node broadcasts block, wherein the second common recognition node at this is block Node in chain in addition to the first common recognition node and target common recognition node;First common recognition node, which is based on checking request, can obtain one Verification result, while receiving the verification result that the second common recognition node and target common recognition node are returned based on checking request;If detection Reach being verified as a result, being added the block into the block chain for the second preset quantity.Wherein, the second preset quantity It is related to total common recognition number of nodes in block chain network, (the second preset quantity)/number of nodes of always knowing together=default ratio.If detection Reach being verified as a result, this means that newly-generated block completion common recognition, newly-generated is somebody's turn to do for the second preset quantity Block is added in block chain.

The target common recognition node in block chain network is pre-selected out in the embodiment, after selecting target common recognition node, The target know together node generally no longer change (the block that target common recognition node generates is unverified just can reselection again Target common recognition node).Current block is generated by the target common recognition node of the fixation, without allowing all common recognition node contentions to work as Previous existence at the right of block, improves the efficiency for generating block, reduces the resource consumption that contention is currently generated block right.Separately On the one hand, the first common recognition node for receiving the timestamp transaction request of server transmission, is not necessarily to the timestamp transaction request Broadcast transmission to others know together nodes, and need to only be sent to target common recognition node, by target common recognition node generate block, reduce Bandwidth, saves Internet resources and each common recognition node stores the storage resource of the transaction.

The method according to described in above-described embodiment, the present embodiment will be further from the angle of trusted timestamp adding set It is described, which can be used as independent entity specifically to realize, also can integrate in server In realize.

As shown in figure 4, the trusted timestamp adding set includes for executing the addition of the trusted timestamp in above-mentioned Fig. 1 b Unit corresponding to method.The apparatus may include block data acquiring unit 401, timestamp adding unit 402, request buildings Unit 403 and request transmitting unit 404.

Block data acquiring unit 401, for obtaining the block data of current newest block on block chain.

Timestamp adding unit 402 is that the block data adds for obtaining trusted time, and according to the trusted time Add trusted timestamp, obtains the block data with trusted timestamp.

Construction unit 403 is requested, for asking according to the block data building timestamp transaction with trusted timestamp It asks.

Request transmitting unit 404 submits instruction for trading to generate according to the timestamp, and the submission is instructed and is sent out It send to second server, the submission instruction is used to indicate the second server and the block is added in timestamp transaction In chain.

In one embodiment, request construction unit 403 includes specifically including: transaction construction unit, request generation unit.Its In, construction unit of trading, for according to the block data building timestamp transaction with trusted timestamp.Generation unit is requested, Timestamp transaction request is generated for trading according to timestamp.Wherein, transaction construction unit, comprising: template acquiring unit, filling Unit, timestamp transaction construction unit.Wherein, template acquiring unit, for obtaining default trading template, the default transaction mould It include transaction content field in plate.Fills unit, for according to the trusted timestamp to the institute in the default trading template It states transaction content field and carries out data filling.Timestamp transaction construction unit, for according to filled default trading template structure Build a timestamp transaction.

Fig. 5 is another schematic block diagram of trusted timestamp adding set provided by the embodiments of the present application, which includes For executing unit corresponding to the trusted timestamp adding method of above-mentioned Fig. 2 a embodiment.The device includes time acquisition unit 501, time judging unit 502, time recording unit 503, block data acquiring unit 504, timestamp adding unit 505, ask Ask construction unit 506 and request transmitting unit 507.The difference of the Installation practice and Installation practice shown in Fig. 4 exists In: increase time acquisition unit 501, time judging unit 502, time recording unit 503.Block data in the embodiment Acquiring unit 504, timestamp adding unit 505, request construction unit 506 and request transmitting unit 507 and above-described embodiment In block data acquiring unit 401, timestamp adding unit 402, request construction unit 403 and request transmitting unit 404 It corresponds, specifically can be referring to the description in Fig. 4 embodiment, details are not described herein.It is described below Installation practice and Fig. 4 Shown in Installation practice difference in place of.

Time acquisition unit 501, first for obtaining the newest block of last record in block chain generates the time.When Between acquiring unit 501, be also used to current newest block second generate the time.

Whether time judging unit 502, the difference for the second generation time and the first generation time reach between preset time Every.

Time recording unit 503, if the difference for the second generation time and the first generation time reaches prefixed time interval, Record the second generation time.Then block data acquiring unit 504 is triggered;If second generate the time with first generate the time it Difference is not up to prefixed time interval, triggered time acquiring unit 501, when generating with second for obtaining current newest block Between.

In one embodiment, if carrying timestamp transaction in timestamp transaction request, and timestamp transaction is according to institute The block data building with trusted timestamp is stated, then the trusted timestamp adding set further includes that target block obtains list Member, block detection unit.Wherein,

Target block acquiring unit, for obtaining block generated within a preset time interval, as target block.

Whether block detection unit includes transaction in addition to timestamp transaction for detecting in target block.

If in target block not including the transaction in addition to timestamp transaction, triggered time acquiring unit 501, for obtaining First of the newest block of last record in block chain is taken to generate the time;If including in addition to timestamp transaction in target block Transaction, trigger block data acquiring unit 504.

In one embodiment, a kind of trusted timestamp adding set is additionally provided, which includes timing detection unit, area Block data capture unit, timestamp adding unit, request construction unit and request transmitting unit.Wherein, the Installation practice Difference with Installation practice shown in Fig. 4 is: timing detection unit is increased, wherein timing detection unit, for obtaining Timing time, and detect whether timing time reaches prefixed time interval.Wherein, the block data in the Installation practice obtains Area in unit, timestamp adding unit, request construction unit and request transmitting unit and Installation practice shown in Fig. 4 Block data capture unit 401, timestamp adding unit 402, request construction unit 403 and request transmitting unit 404 1 are a pair of It answers, specifically can be referring to the description in Fig. 4 embodiment, details are not described herein.

A kind of trusted timestamp adding set is additionally provided in embodiments herein, the device is integrated in the server. The device includes height acquiring unit, height judging unit, altitude record unit, block data acquiring unit, timestamp addition Unit, request construction unit and request transmitting unit.The difference of the Installation practice and Installation practice shown in Fig. 4 exists In: increase height acquiring unit, height judging unit, altitude record unit.Block data acquiring unit in the embodiment, Timestamp adding unit, request construction unit and request transmitting unit are obtained with the block data in above-mentioned embodiment illustrated in fig. 4 Unit 401, timestamp adding unit 402, request construction unit 403 and request transmitting unit 404 is taken to correspond, specifically Can be referring to the description in Fig. 4 embodiment, details are not described herein.It is described below Installation practice and device shown in Fig. 4 is real In place of the difference for applying example.

Height acquiring unit for obtaining in block chain the block height of last record, and is also used to obtain block The current block height of chain.

Height judging unit, for judging whether the difference of block height of current block height and last record reaches pre- If difference in height.

Altitude record unit, if the difference for current block height and the block height of last record reaches preset height Difference records current block height, and triggers block data acquiring unit;If the block of current block height and last record is high It is poor that the difference of degree is not up to preset height, height acquiring unit is triggered, with the current block height for obtaining block chain.

29页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数据传输方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!