CN109410055B - A blockchain consensus method based on computing power parasitism - Google Patents
A blockchain consensus method based on computing power parasitism Download PDFInfo
- Publication number
- CN109410055B CN109410055B CN201811165472.7A CN201811165472A CN109410055B CN 109410055 B CN109410055 B CN 109410055B CN 201811165472 A CN201811165472 A CN 201811165472A CN 109410055 B CN109410055 B CN 109410055B
- Authority
- CN
- China
- Prior art keywords
- hash value
- block
- chain
- transaction
- business
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 230000024241 parasitism Effects 0.000 title claims abstract description 10
- 238000012986 modification Methods 0.000 claims description 12
- 230000004048 modification Effects 0.000 claims description 12
- 230000003071 parasitic effect Effects 0.000 claims description 12
- 238000012508 change request Methods 0.000 claims description 7
- 230000007123 defense Effects 0.000 abstract description 3
- 238000012790 confirmation Methods 0.000 description 20
- 238000005065 mining Methods 0.000 description 11
- 239000003999 initiator Substances 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 238000012544 monitoring process Methods 0.000 description 4
- 238000005192 partition Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种基于算力寄生的区块链共识方法,涉及区块链领域,包括:首先,接收第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与当前业务数据相匹配的第一当前业务哈希值;然后,检测未被第一相关链所确认的第二交易是否被确认;然后,获取新增的被第一相关链确认的第二交易的第二历史业务哈希值及第二交易所在的第二区块号;最后,将第一当前业务哈希值、第二历史业务哈希值以及第二区块号记录于本区块链网络上。在本发明中,本区块链网络依托于相关区块链的算力,只需要相关区块链的防御算力攻击能力较高,则本区块链的防御算力攻击能力也得到提升,提高本区块链的防御算力攻击的能力。
The invention discloses a blockchain consensus method based on computing power parasitism, which relates to the field of blockchain and includes: first, receiving at least one group of current business data in a first time period, and transferring the current business data to a hash The hash value of the first current business that matches the current business data is obtained by solving the arithmetic operation; then, it is detected whether the second transaction that is not confirmed by the first related chain is confirmed; then, the newly added confirmed by the first related chain is obtained. The second historical business hash value of the second transaction and the second block number where the second transaction is located; finally, record the first current business hash value, the second historical business hash value and the second block number on this blockchain network. In the present invention, the blockchain network relies on the computing power of the relevant blockchain, and only the defense computing power attack capability of the relevant blockchain is required to be high, and the defense computing power attack capability of the blockchain is also improved. Improve the ability of this blockchain to defend against computing power attacks.
Description
技术领域technical field
本发明涉及区块链领域,特别涉及一种基于算力寄生的区块链共识方法。The invention relates to the field of blockchain, in particular to a blockchain consensus method based on computing power parasitics.
背景技术Background technique
非算力的区块链网络,仅仅对包含上一区块的哈希值的本区块头进行哈希求解获得本区块的哈希值,并将该哈希值作为下一区块头的组成部分,并形成链式账本结构,每个区块仅执行一次哈希值求解,若整体区块数为100万个,则攻破该非算力区块链网络算力1GH/s的矿机只需一秒即可攻破。The non-computing blockchain network only hashes the block header containing the hash value of the previous block to obtain the hash value of this block, and uses the hash value as the composition of the next block header. part, and form a chain ledger structure, each block only executes the hash value solution once, if the overall number of blocks is 1 million, then the mining machine with a computing power of 1GH/s to break the non-computing blockchain network will only be It takes a second to break through.
据BTC.com数据显示,今年八月底的比特币全网算力为50.13EH/s,全网难度约为6.73T,未确认交易数为1500,即每秒可执行哈希算法数为5×1016次。即便拥有区块链网络的1‰的算力,也能够轻易攻破非算力的区块链网络。According to BTC.com data, at the end of August this year, the computing power of the entire Bitcoin network was 50.13EH/s, the difficulty of the entire network was about 6.73T, and the number of unconfirmed transactions was 1,500, that is, the number of hash algorithms executed per second was 5× 10 16 times. Even if you have 1‰ of the computing power of the blockchain network, you can easily break through the non-computing blockchain network.
而随着区块链技术的发展,越来越多的区块链项目出现,并且每个区块链项目都具有负责挖矿的矿工和矿机。然后,主要的较大的区块链网络(如比特币、以太坊)等已经产生,其已经聚集了较多的算力资源。与对于大型区块链网络的算力相比而言,一方面,小型的新兴区块链项目的算力对其毫无防御能力,在收到大型区块链网络的攻击时,小型区块链网络瞬间瓦解;另一方面,若越来越多的小型区块链网络发展为大型区块链网络,则会进一步损耗社会算力资源,造成电力资源、水力资源的浪费。With the development of blockchain technology, more and more blockchain projects appear, and each blockchain project has miners and mining machines responsible for mining. Then, major larger blockchain networks (such as Bitcoin, Ethereum), etc. have been created, which have gathered more computing resources. Compared with the computing power of large-scale blockchain networks, on the one hand, the computing power of small emerging blockchain projects has no defense against them. When attacked by large-scale blockchain networks, small blocks The chain network collapses instantly; on the other hand, if more and more small blockchain networks develop into large-scale blockchain networks, it will further consume social computing resources, resulting in waste of power resources and water resources.
发明内容SUMMARY OF THE INVENTION
有鉴于现有技术的一部分缺陷,本发明所要解决的技术问题是在现有技术中,构建一个稳定的区块链网络需要耗费较大的算力资源,并且存在被大算力区块链网络的攻击可能,存在算力攻击风险。本发明旨在提供一种基于算力寄生的区块链共识方法,基于该方法形成的区块链网络无需较高的算力基础设施即可减少被算力攻击攻破的可能,提高本区块链网络数据的防止被算力攻击篡改的能力。In view of some defects of the prior art, the technical problem to be solved by the present invention is that in the prior art, building a stable blockchain network requires a large amount of computing resources, and there is a large computing power blockchain network. The attack is possible, and there is a risk of a computing power attack. The present invention aims to provide a blockchain consensus method based on computing power parasitics. The blockchain network formed based on the method can reduce the possibility of being broken by computing power attacks without requiring higher computing power infrastructure, and improve the The ability of chain network data to prevent tampering by computing power attacks.
为实现上述目的,在本发明的第一方面提供一种基于算力寄生的区块链共识方法,所述方法包括:In order to achieve the above purpose, a first aspect of the present invention provides a blockchain consensus method based on computing power parasitics, the method includes:
接收本区块链网络的第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与所述当前业务数据相匹配的第一当前业务哈希值;其中,所述第一当前业务哈希值用于生成与所述第一当前业务哈希值相匹配的第一交易;所述第一交易用于在第一相关链上发布,并以便记录于所述第一相关链的主链区块上;Receive at least one group of current business data within the first time period of the blockchain network, and obtain a first current business hash value matching the current business data by hashing the current business data; Wherein, the first current business hash value is used to generate a first transaction that matches the first current business hash value; the first transaction is used to be published on the first relevant chain and recorded in the on the main chain block of the first relevant chain;
根据与历史业务数据相匹配的各个历史业务哈希值,检测所述第一相关链在所述第一时间周期内与各个所述历史业务哈希值相匹配且未被所述第一相关链所确认的第二交易是否被确认;其中,所述历史业务哈希值由所述历史业务哈希值相对应的所述历史业务数据经哈希运算求解获得;According to each historical service hash value matching the historical service data, it is detected that the first correlation chain matches each of the historical service hash values within the first time period and is not matched by the first correlation chain Whether the confirmed second transaction is confirmed; wherein, the historical service hash value is obtained by solving the historical service data corresponding to the historical service hash value through a hash operation;
获取新增的被所述第一相关链所确认的所述第二交易的所述历史业务哈希值,并将所述历史业务哈希值作为第二历史业务哈希值;获取所述第二交易在所述第一相关链上所在区块所相对应的第二区块号;Obtain the newly added historical service hash value of the second transaction confirmed by the first related chain, and use the historical service hash value as the second historical service hash value; obtain the first 2. The second block number corresponding to the block where the transaction is located on the first relevant chain;
将所述第一当前业务哈希值、所述第二历史业务哈希值以及第二区块号记录于与所述第一时间周期相对应的本区块链网络的当前区块上。The first current service hash value, the second historical service hash value and the second block number are recorded on the current block of the blockchain network corresponding to the first time period.
在一具体实施方式中,所述将所述第一当前业务哈希值、所述第二历史业务哈希值以及第二区块号记录于与所述第一时间周期相对应的本区块链网络的当前区块上,包括:In a specific embodiment, the first current service hash value, the second historical service hash value and the second block number are recorded in the current block corresponding to the first time period. On the current block of the chain network, including:
将所述第一当前业务哈希值标记为未共识,将所述第二历史业务哈希值标记为已共识,并记录于与所述第一时间周期相对应的本区块链网络的当前区块上。Mark the first current business hash value as unconsensus, mark the second historical business hash value as consensus, and record it in the current blockchain network corresponding to the first time period. on the block.
在一具体实施方式中,所述本区块链网络的本链区块包括区块头、第一哈希存储区、第二哈希存储区;所述第一哈希存储区用于存储所述当前区块在所述第一时间周期内新打包的所述当前业务数据的所述第一当前业务哈希值,所述第二哈希存储区用于存储在所述第一时间周期内新增的被所述第一相关链所确认的所述第二交易的所述第二历史业务哈希值以及所述第二交易所相对应的所述第二区块号。In a specific embodiment, the local chain block of the local blockchain network includes a block header, a first hash storage area, and a second hash storage area; the first hash storage area is used to store the The first current service hash value of the current service data newly packaged by the current block within the first time period, and the second hash storage area is used for storing the new service data within the first time period The second historical business hash value of the second transaction confirmed by the first related chain and the second block number corresponding to the second transaction are added.
在一具体实施方式中,所述接收本区块链网络的第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与所述当前业务数据相匹配的第一当前业务哈希值,还包括:In a specific embodiment, the receiving at least one set of current business data in the first time period of the blockchain network is performed, and the current business data is obtained through hash operation to match the current business data. The first current business hash value of , also includes:
获取在第一时间周期内接收到的本区块链网络的各个业务单元;所述至少一组当前业务数据由所述业务单元组成;Acquire each business unit of the blockchain network received within the first time period; the at least one group of current business data is composed of the business units;
求解各个业务单元的单元哈希值;Solve the unit hash value of each business unit;
根据各个所述单元哈希值及默克尔树算法,生成默克尔树顶部哈希值,并将所述默克尔树顶部哈希值作为所述第一当前业务哈希值。According to each of the unit hash values and the Merkle tree algorithm, a Merkle tree top hash value is generated, and the Merkle tree top hash value is used as the first current service hash value.
在一具体实施方式中,所述根据与历史业务数据相匹配的各个历史业务哈希值,检测所述第一相关链在所述第一时间周期内与各个所述历史业务哈希值相匹配且未被所述第一相关链所确认的第二交易是否被确认,还包括:In a specific embodiment, according to each historical service hash value matched with historical service data, it is detected that the first correlation chain matches each of the historical service hash values within the first time period. and whether the second transaction that is not confirmed by the first relevant chain is confirmed, further including:
与所述第一相关链上的至少三个不同网络的主链节点进行通讯,定时检测至少三个不同网络的所述主链节点的所述第二交易是否被确认;其中,所述主链节点数为奇数个;Communicate with the main chain nodes of at least three different networks on the first related chain, and regularly detect whether the second transaction of the main chain nodes of at least three different networks is confirmed; wherein, the main chain The number of nodes is an odd number;
在所有的所述主链节点中,若所述第二交易被半数以上的所述主链节点所确认,则认为所述第二交易被确认。Among all the main chain nodes, if the second transaction is confirmed by more than half of the main chain nodes, the second transaction is considered to be confirmed.
在一具体实施方式中,还包括:In a specific embodiment, it also includes:
在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;After the second transaction is confirmed, collect the third block number of the block corresponding to the second historical business hash value of the second transaction;
响应于所述第三区块号与所述第二区块号不相同,执行第一修改操作;所述第一修改操作包括:删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。In response to the third block number being different from the second block number, a first modifying operation is performed; the first modifying operation includes: deleting a block originally on the first local chain on the local blockchain network For the second historical business hash value and the second block number recorded by the second exchange, the second local chain on the local blockchain network corresponding to the third block number The block records the second historical service hash value and the third block number.
在一具体实施方式中,所述方法还包括:In a specific embodiment, the method further includes:
在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;After the second transaction is confirmed, collect the third block number of the block corresponding to the second historical business hash value of the second transaction;
响应于所述第三区块号与所述第二区块号不相同,向本区块链网络的本链节点发送链数据变更请求;其中,所述本链节点接收所述链数据变更请求后,根据所述第二历史业务哈希值,向与所述本链节点相对应的所述第一相关链的主链节点请求所述第二交易的所述第三区块号,并响应于所述第三区块号与所述第二区块号不相同,删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。In response to the third block number being different from the second block number, send a chain data change request to the own chain node of the blockchain network; wherein the own chain node receives the chain data change request Then, according to the second historical service hash value, request the third block number of the second transaction from the main chain node of the first related chain corresponding to the local chain node, and respond Since the third block number is not the same as the second block number, delete the second historical business that was originally recorded on the first local chain block for the second exchange on this blockchain network Hash value and the second block number, record the second historical business hash value and the The third block number.
在一具体实施方式中,本区块链网络的前一区块哈希值作为后一区块哈希值求解的输入参数;在执行所述第一修改操作后,所述方法还包括:In a specific embodiment, the hash value of the previous block of the blockchain network is used as an input parameter for solving the hash value of the next block; after performing the first modification operation, the method further includes:
比较所述第一本链区块和所述第二本链区块的区块序号的大小;comparing the size of the block serial numbers of the first local chain block and the second local chain block;
自所述第一本链区块和所述第二本链区块的区块序号较小者起,重新逐个求解本区块链网络的各个区块的哈希值,使得本区块链网络的各个区块组成链式连接。Starting from the smaller of the block serial number of the first local chain block and the second local chain block, the hash value of each block of this blockchain network is re-solved one by one, so that this blockchain network The various blocks of the chain form a chain connection.
在一具体实施方式中,所述本区块链网络的若干个节点在连接本区块链网络的同时,也连接所述第一相关链的网络。In a specific embodiment, several nodes of the local blockchain network are also connected to the network of the first related chain while connecting to the local blockchain network.
在一具体实施方式中,所述方法还包括:In a specific embodiment, the method further includes:
将与未共识的业务数据相匹配的业务哈希值存放于第一哈希列表中;Store the business hash value matching the unconsensus business data in the first hash list;
和/或将已共识的业务数据相匹配的业务哈希值存放于第二哈希列表中。And/or the business hash value matching the consensus business data is stored in the second hash list.
本发明的有益效果是:本发明的有益效果是:本区块链网络是依附于另一相关区块链网络,将本区块的业务数据的哈希值以交易的形式记录于相关区块链上,并在该交易被确认之后,本区块链网络的节点接收到该交易被确认的信息后,将该业务的交易信息写入本区块链,使得该业务数据得到确认,实现共识;本区块链网络依托于相关区块链的算力,只需要相关区块链的防御算力攻击能力较高,则本区块链的防御算力攻击能力也得到提升,提高本区块链的防御算力攻击的能力。此外,本发明提供的区块链技术无需自身网络建设算力基础,节约社会成本。The beneficial effects of the present invention are: the beneficial effects of the present invention are: this block chain network is attached to another related block chain network, and the hash value of the business data of this block is recorded in the relevant block in the form of a transaction On the chain, and after the transaction is confirmed, the node of the blockchain network receives the confirmation information of the transaction, and writes the transaction information of the business into the blockchain, so that the business data is confirmed and a consensus is achieved. ; This blockchain network relies on the computing power of the relevant blockchains. As long as the relevant blockchains have higher defensive computing power attack capabilities, the blockchain’s defensive computing power attack capabilities will also be improved. The chain's ability to defend against computing power attacks. In addition, the blockchain technology provided by the present invention does not require its own network to build a computing power foundation, thereby saving social costs.
附图说明Description of drawings
图1是本发明一具体实施方式中的一种基于算力寄生的区块链共识方法的流程示意图;1 is a schematic flowchart of a blockchain consensus method based on computing power parasitism in a specific embodiment of the present invention;
图2是本发明一具体实施方式中的一种基于算力寄生的区块链共识方法的数据传输示意图;FIG. 2 is a schematic diagram of data transmission of a blockchain consensus method based on computing power parasitics in a specific embodiment of the present invention;
图3是本发明一具体实施方式中的一种基于算力寄生的区块链共识方法的基于默克尔树生成业务哈希值的示意图;3 is a schematic diagram of generating a business hash value based on a Merkle tree based on a blockchain consensus method based on computing power parasitics in a specific embodiment of the present invention;
图4是本发明一具体实施方式中的第一相关链网络与本区块链网络的关联结构图;Fig. 4 is the association structure diagram of the first relevant chain network and the current blockchain network in a specific embodiment of the present invention;
图5是本发明一具体实施方式中的一种基于算力寄生的区块链共识方法的区块数据变更时的数据传输示意图。FIG. 5 is a schematic diagram of data transmission when block data is changed in a blockchain consensus method based on computing power parasitics in an embodiment of the present invention.
图6是本发明一具体实施方式中的一种基于算力寄生的区块链共识装置的结构框图。FIG. 6 is a structural block diagram of a blockchain consensus device based on parasitic computing power in an embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步说明:Below in conjunction with accompanying drawing and embodiment, the present invention will be further described:
如图1-6所示,在本发明第一实施例中,提供一种基于算力寄生的区块链共识方法,所述方法包括:As shown in Figures 1-6, in the first embodiment of the present invention, a blockchain consensus method based on parasitic computing power is provided, and the method includes:
步骤S1、接收本区块链网络的第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与所述当前业务数据相匹配的第一当前业务哈希值;其中,所述第一当前业务哈希值用于生成与所述第一当前业务哈希值相匹配的第一交易;所述第一交易用于在第一相关链上发布,并以便记录于所述第一相关链的主链区块上;Step S1: Receive at least one group of current business data in the first time period of the blockchain network, and solve the current business data through hash operation to obtain the first current business data that matches the current business data. value; wherein, the first current business hash value is used to generate a first transaction matching the first current business hash value; the first transaction is used to publish on the first relevant chain, and so as to be recorded on the main chain block of the first relevant chain;
值得一提的是,第一当前业务哈希值的生成可以是对一组或多组业务数据整体进行哈希运算;第一当前业务哈希值的生成也可以是采用默克尔树的形式对每个业务数据进行哈希运算后,再两两生成上级哈希值,并直至求解出默克尔树顶部哈希值,该默克尔树顶部哈希值即为所述第一当前业务哈希值;It is worth mentioning that the generation of the first current business hash value may be a hash operation on one or more groups of business data as a whole; the generation of the first current business hash value may also be in the form of a Merkle tree. After hash operation is performed on each business data, the upper-level hash value is generated in pairs, until the top hash value of the Merkle tree is solved, and the top hash value of the Merkle tree is the first current business. hash value;
在本实施例中,并不限定本区块链网络的第一时间周期的长短,可选的,第一时间周期就是本区块链网络的区块生成周期;可选的,第一时间周期与本区块链网络的区块生成周期无关。In this embodiment, the length of the first time period of the current blockchain network is not limited. Optionally, the first time period is the block generation period of the current blockchain network; optionally, the first time period It has nothing to do with the block generation cycle of this blockchain network.
在本实施例中是将第一时间周期内的若干或所有业务数据作为整体打包为哈希值,并在第一相关链(如比特币网络、以太坊)上以交易的形式发布;其中,第一时间周期与第一相关链的区块生成周期并无关系,在本实施例中,只需将第一交易发布于第一相关链,而交易的确认时间与第一相关链本身设置有关,本区块链网络只需要等待该交易的确认即可。例如,在比特币网络中,发起一笔比特币交易,在等待一定时长后,该交易能够被比特币网络的矿工进行记账和确认,并写入区块链中。In this embodiment, some or all of the business data in the first time period are packaged as a whole into hash values, and published in the form of transactions on the first related chain (such as Bitcoin network, Ethereum); wherein, The first time period has nothing to do with the block generation period of the first related chain. In this embodiment, it is only necessary to publish the first transaction on the first related chain, and the confirmation time of the transaction is related to the settings of the first related chain itself. , the blockchain network only needs to wait for the confirmation of the transaction. For example, in the Bitcoin network, a Bitcoin transaction is initiated, and after waiting for a certain period of time, the transaction can be recorded and confirmed by the miners of the Bitcoin network, and written into the blockchain.
步骤S2、根据与历史业务数据相匹配的各个历史业务哈希值,检测所述第一相关链在所述第一时间周期内与各个所述历史业务哈希值相匹配且未被所述第一相关链所确认的第二交易是否被确认;其中,所述历史业务哈希值由所述历史业务哈希值相对应的所述历史业务数据经哈希运算求解获得;Step S2, according to each historical service hash value matching the historical service data, detect that the first correlation chain matches each of the historical service hash values within the first time period and is not detected by the first correlation chain. Whether the second transaction confirmed by a related chain is confirmed; wherein, the historical business hash value is obtained by solving the historical business data corresponding to the historical business hash value through a hash operation;
对于本区块链网络的区块而言,在将业务数据以交易的形式发布于第一相关链的同时,也对之前发布于第一相关链的交易进行检测,并在业务数据相对应的交易被确认之后,写入本区块链网络的区块中;For the blocks of this blockchain network, when the business data is published in the first relevant chain in the form of transactions, the transactions previously published in the first relevant chain are also detected, and in the corresponding business data After the transaction is confirmed, it is written into the block of this blockchain network;
值得一提的是,首次写入第一相关链的主链区块上,即可认为该交易是被确认的;可选的,累计多次写入第一相关链的主链区块上,即可认为是该交易是被确认的。It is worth mentioning that the transaction is considered to be confirmed when it is written to the main chain block of the first related chain for the first time; That is, the transaction is considered to be confirmed.
步骤S3、获取新增的被所述第一相关链所确认的所述第二交易的所述历史业务哈希值,并将所述历史业务哈希值作为第二历史业务哈希值;获取所述第二交易在所述第一相关链上所在区块所相对应的第二区块号;Step S3: Obtain the newly added historical service hash value of the second transaction confirmed by the first associated chain, and use the historical service hash value as the second historical service hash value; obtain the second block number corresponding to the block where the second transaction is located on the first relevant chain;
步骤S4、将所述第一当前业务哈希值、所述第二历史业务哈希值以及第二区块号记录于与所述第一时间周期相对应的本区块链网络的当前区块上。Step S4, recording the first current service hash value, the second historical service hash value and the second block number in the current block of the blockchain network corresponding to the first time period superior.
可选的,在本实施例中,所述将所述第一当前业务哈希值、所述第二历史业务哈希值以及第二区块号记录于与所述第一时间周期相对应的本区块链网络的当前区块上,包括:Optionally, in this embodiment, the first current service hash value, the second historical service hash value, and the second block number are recorded in a time period corresponding to the first time period. On the current block of this blockchain network, including:
将所述第一当前业务哈希值标记为未共识,将所述第二历史业务哈希值标记为已共识,并记录于与所述第一时间周期相对应的本区块链网络的当前区块上。Mark the first current business hash value as unconsensus, mark the second historical business hash value as consensus, and record it in the current blockchain network corresponding to the first time period. on the block.
可选的,在本实施例中,所述本区块链网络的本链区块包括区块头、第一哈希存储区、第二哈希存储区;所述第一哈希存储区用于存储所述当前区块在所述第一时间周期内新打包的所述当前业务数据的所述第一当前业务哈希值,所述第二哈希存储区用于存储在所述第一时间周期内新增的被所述第一相关链所确认的所述第二交易的所述第二历史业务哈希值以及所述第二交易所相对应的所述第二区块号。Optionally, in this embodiment, the local chain block of the local blockchain network includes a block header, a first hash storage area, and a second hash storage area; the first hash storage area is used for storing the first current service hash value of the current service data newly packaged by the current block in the first time period, and the second hash storage area is used to store the first time The second historical business hash value of the second transaction confirmed by the first related chain and the second block number corresponding to the second transaction newly added in the cycle.
值得一提的是,可选的,在第一哈希存储区及第二哈希存储区设定标识符,以便确定分区;可选的,通过固定第一哈希存储区及第二哈希存储区的大小或者字节数,以便确定各个相对的分区。It is worth mentioning that, optionally, identifiers are set in the first hash storage area and the second hash storage area to determine the partition; optionally, by fixing the first hash storage area and the second hash storage area The size or number of bytes of the storage area to determine the relative partitions.
可选的,在本实施例中,所述接收本区块链网络的第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与所述当前业务数据相匹配的第一当前业务哈希值,还包括:Optionally, in this embodiment, the receiving at least one group of current business data in the first time period of the blockchain network is performed, and the current business data is obtained by hashing the current business data. The first current business hash value that matches the data, also includes:
获取在第一时间周期内接收到的本区块链网络的各个业务单元;所述至少一组当前业务数据由所述业务单元组成;Acquire each business unit of the blockchain network received within the first time period; the at least one group of current business data is composed of the business units;
求解各个业务单元的单元哈希值;Solve the unit hash value of each business unit;
根据各个所述单元哈希值及默克尔树算法,生成默克尔树顶部哈希值,并将所述默克尔树顶部哈希值作为所述第一当前业务哈希值。According to each of the unit hash values and the Merkle tree algorithm, a Merkle tree top hash value is generated, and the Merkle tree top hash value is used as the first current service hash value.
常见的默克尔树算法是对单元哈希值进行两两生成上级哈希值,并直至求解出默克尔树顶部哈希值。The common Merkle tree algorithm is to generate the upper-level hash value by pairing the unit hash values, and until the top hash value of the Merkle tree is solved.
可选的,在本实施例中,所述根据与历史业务数据相匹配的各个历史业务哈希值,检测所述第一相关链在所述第一时间周期内与各个所述历史业务哈希值相匹配且未被所述第一相关链所确认的第二交易是否被确认,还包括:Optionally, in this embodiment, according to each historical service hash value matching the historical service data, it is detected that the first correlation chain is associated with each of the historical service hashes within the first time period. whether a second transaction whose value matches and is not confirmed by the first associated chain is confirmed, further comprising:
与所述第一相关链上的至少三个不同网络的主链节点进行通讯,定时检测至少三个不同网络的所述主链节点的所述第二交易是否被确认;其中,所述主链节点数为奇数个;Communicate with the main chain nodes of at least three different networks on the first related chain, and regularly detect whether the second transaction of the main chain nodes of at least three different networks is confirmed; wherein, the main chain The number of nodes is an odd number;
在所有的所述主链节点中,若所述第二交易被半数以上的所述主链节点所确认,则认为所述第二交易被确认。Among all the main chain nodes, if the second transaction is confirmed by more than half of the main chain nodes, the second transaction is considered to be confirmed.
实际上,本区块链网络仅与第一相关链上的一个主链节点进行通讯,即可获得交易是否被确认的信息;而通过与多个主链节点,降低分叉率。在实际应用场景中,可以在不同的矿场设置第一相关链的主链节点。由于同一个矿场一般集体挖矿,并且通络延时少,矿场内数据相对一致,故而可以选择不同矿场的不同主链节点以便获得第一交易的交易记录信息。In fact, this blockchain network only communicates with one main chain node on the first related chain to obtain information on whether the transaction is confirmed; and by communicating with multiple main chain nodes, the fork rate is reduced. In practical application scenarios, the main chain nodes of the first related chain can be set in different mining farms. Since the same mining farm generally mines collectively, and the network delay is small, the data in the mining farm is relatively consistent, so different main chain nodes of different mining farms can be selected to obtain the transaction record information of the first transaction.
可选的,在本实施例中,所述方法,还包括:Optionally, in this embodiment, the method further includes:
在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;After the second transaction is confirmed, collect the third block number of the block corresponding to the second historical business hash value of the second transaction;
响应于所述第三区块号与所述第二区块号不相同,执行第一修改操作;所述第一修改操作包括:删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。In response to the third block number being different from the second block number, a first modifying operation is performed; the first modifying operation includes: deleting a block originally on the first local chain on the local blockchain network For the second historical business hash value and the second block number recorded by the second exchange, the second local chain on the local blockchain network corresponding to the third block number The block records the second historical service hash value and the third block number.
值得一提的是,在基于算力共识的区块链技术中,如比特币区块,是依靠矿工们不断进行数学运算而产生的,每一个区块都必须引用其上一个区块,因此最长的链也是最难以推翻和篡改的,所以节点永远认为最长链才是有效的区块链,只有在最长链上挖矿的矿工才能够获得奖励,这就是我们常说的比特币最长链原则。当二个或多个节点几乎同时记账,则出现分叉,此时,暂时保留两个份记账方式,并最终由较长链的区块链作为最终的记账账本。It is worth mentioning that in the blockchain technology based on the consensus of computing power, such as the Bitcoin block, it is generated by the continuous mathematical operation of miners, and each block must refer to its previous block, so The longest chain is also the most difficult to overthrow and tamper with, so nodes always think that the longest chain is an effective blockchain, and only miners who mine on the longest chain can get rewards, which is what we often call Bitcoin The longest chain principle. When two or more nodes book accounts at almost the same time, a fork occurs. At this time, two bookkeeping methods are temporarily reserved, and the blockchain of the longer chain is finally used as the final bookkeeping book.
在可选案例中,当第一相关链出现分叉且本区块链网络的节点根据第一交易是否被确认而记账时,会遵循分叉之一,而后若因第一相关链选择另一分叉造成本区块链网络的第一交易的交易记录信息发生变动,此时,可以对其修改,并相应的修改之后的区块链。In an optional case, when a fork occurs in the first related chain and the nodes of this blockchain network record according to whether the first transaction is confirmed, one of the forks will be followed, and then if the first related chain chooses another A fork causes the transaction record information of the first transaction of the blockchain network to change. At this time, it can be modified, and the blockchain after modification can be correspondingly modified.
可选的,在本实施例中,所述方法还包括:Optionally, in this embodiment, the method further includes:
在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;After the second transaction is confirmed, collect the third block number of the block corresponding to the second historical business hash value of the second transaction;
响应于所述第三区块号与所述第二区块号不相同,向本区块链网络的本链节点发送链数据变更请求;其中,所述本链节点接收所述链数据变更请求后,根据所述第二历史业务哈希值,向与所述本链节点相对应的所述第一相关链的主链节点请求所述第二交易的所述第三区块号,并响应于所述第三区块号与所述第二区块号不相同,删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。In response to the third block number being different from the second block number, send a chain data change request to the own chain node of the blockchain network; wherein the own chain node receives the chain data change request Then, according to the second historical service hash value, request the third block number of the second transaction from the main chain node of the first related chain corresponding to the local chain node, and respond Since the third block number is not the same as the second block number, delete the second historical business that was originally recorded on the first local chain block for the second exchange on this blockchain network Hash value and the second block number, record the second historical business hash value and the The third block number.
在典型的区块链实例中,本网络区块链的前一区块哈希值作为后一区块哈希值求解的输入参数,以便求解后一区块哈希值。In a typical blockchain example, the hash value of the previous block of the blockchain of this network is used as the input parameter for solving the hash value of the next block, so as to solve the hash value of the next block.
可选的,在本实施例中,本区块链网络的前一区块哈希值作为后一区块哈希值求解的输入参数;在执行所述第一修改操作后,所述方法还包括:Optionally, in this embodiment, the hash value of the previous block of the blockchain network is used as an input parameter for solving the hash value of the next block; after the first modification operation is performed, the method further include:
比较所述第一本链区块和所述第二本链区块的区块序号的大小;comparing the size of the block serial numbers of the first local chain block and the second local chain block;
自所述第一本链区块和所述第二本链区块的区块序号较小者起,重新逐个求解本区块链网络的各个区块的哈希值,使得本区块链网络的各个区块组成链式连接。Starting from the smaller of the block serial number of the first local chain block and the second local chain block, the hash value of each block of this blockchain network is re-solved one by one, so that this blockchain network The various blocks of the chain form a chain connection.
由于算力竞争及网络延时等因素,第一相关链会存在分叉并保留若干个区块生成周期,并选取最长链作为最终账本;本区块链网络也会因第一相关链而形成分叉,但是随着主链的运行,本区块链网络更新区块数据,本区块链网络的分叉问题也能够随着主链解决分叉问题而自行得到解决。Due to factors such as computing power competition and network delay, the first related chain will fork and retain several block generation cycles, and the longest chain will be selected as the final ledger; this blockchain network will also be affected by the first related chain. A fork is formed, but with the operation of the main chain, the block chain network updates the block data, and the fork problem of the block chain network can also be solved by itself as the main chain solves the fork problem.
值得一提的是,当本区块链的区块之间采用链式连接,即将前一区块的哈希值存储与后一区块之中时,则应第一交易记录信息发生变动,则需要重新求解区块哈希值,并同时修改之后的哈希值,值得一提的是,例如比特币网络需要6次确认以保证区块链数据的不被篡改,故而,仅需要修改第一相关链6个区块周期内的本区块链网络的区块之间的链式连接,其算力要求并不高。It is worth mentioning that when the blocks of this blockchain are connected in a chain, that is, when the hash value of the previous block is stored in the next block, the first transaction record information should be changed. It is necessary to re-solve the block hash value and modify the hash value at the same time. It is worth mentioning that, for example, the Bitcoin network requires 6 confirmations to ensure that the blockchain data is not tampered with. Therefore, it is only necessary to modify the first block. The chain connection between the blocks of this blockchain network within 6 block cycles of a related chain does not require high computing power.
可选的,在本实施例中,本区块链网络的区块头包括但不限于区块序号、第一当前业务哈希值、第二历史业务哈希值、时间戳、所述当前区块的上一区块的哈希值。Optionally, in this embodiment, the block header of this blockchain network includes but is not limited to the block serial number, the first current service hash value, the second historical service hash value, the timestamp, the current block The hash value of the previous block.
可选的,本区块链网络的若干个节点会对第一相关链进行数据监控,以便获知第一交易、第二交易的是否被确认;可选的,本区块链网络的若干个节点在连接本区块链网络的同时,也连接第一相关链网络;Optionally, several nodes of this blockchain network will monitor the data of the first related chain, so as to know whether the first transaction and the second transaction are confirmed; optionally, several nodes of this blockchain network While connecting to this blockchain network, it also connects to the first related chain network;
可选的,在本实施例中,所述本区块链网络的若干个节点在连接本区块链网络的同时,也连接所述第一相关链的网络。Optionally, in this embodiment, several nodes of the local blockchain network are also connected to the network of the first related chain while connecting to the local blockchain network.
可选的,在本实施例中,所述方法还包括:Optionally, in this embodiment, the method further includes:
将与未共识的业务数据相匹配的业务哈希值存放于第一哈希列表中;Store the business hash value matching the unconsensus business data in the first hash list;
和/或将已共识的业务数据相匹配的业务哈希值存放于第二哈希列表中。And/or the business hash value matching the consensus business data is stored in the second hash list.
通过设置第一哈希管理模块和/或第二哈希管理模块,便于管理相关业务数据在第一相关链上的共识的发起、确认、追踪。By setting the first hash management module and/or the second hash management module, it is convenient to manage the initiation, confirmation and tracking of the consensus of the relevant business data on the first relevant chain.
此外,由于第一交易的第一发起者接收第一交易的确认信息相对而言,较为及时。可选的,接收所述第一交易的第一发起者关于所述第一交易被确认的第一确认信息;所述第一发起者与本区块网络连接,所述第一发起者与第一相关链网络连接;In addition, since the first initiator of the first transaction receives the confirmation information of the first transaction, it is relatively timely. Optionally, receive first confirmation information about the confirmation of the first transaction from the first initiator of the first transaction; the first initiator is connected to the network of this block, and the first initiator is connected to the first transaction. A related chain network connection;
本实例提供的是一种区块链共识技术,当相关业务数据的哈希值被确认于第一相关链上,则认为相关业务数据能够不容易被篡改,而被共识。同时,在第一交易被确认后,可以将相关交易信息,如业务数据的第一当前业务哈希值被确认于区块链的哪一区块中。This example provides a blockchain consensus technology. When the hash value of the relevant business data is confirmed on the first relevant chain, it is considered that the relevant business data can not be easily tampered with, and thus can be agreed upon. At the same time, after the first transaction is confirmed, the relevant transaction information, such as the first current business hash value of the business data, can be confirmed in which block of the blockchain.
在实际应用中,根据本区块链业务数据的数量、交易手续费以及第一相关链网络的吞吐能力,对一次打包的业务数据的数量设定;值得一提的是,当设置较高的单次业务数据打包数量时,可以减低在第一相关区块链上发布第一交易或第二交易的手续费,并且降低第一相关区块链的负载,而另一方面单次业务数据打包数量较少时,可以有效提高交易的确认速度。In practical applications, the amount of business data packaged at one time is set according to the amount of business data in this blockchain, the transaction fee and the throughput capacity of the first related chain network; it is worth mentioning that when a higher value is set When the number of business data is packaged in a single time, the handling fee for publishing the first transaction or the second transaction on the first related blockchain can be reduced, and the load of the first related blockchain can be reduced. When the number is small, it can effectively improve the confirmation speed of the transaction.
值得一提的是,如图2所示,在第一相关链网络200的区块XGL1000完成之后,在一个时间周期内,收集本区块链网络100的客户端发起的业务数据,并生成业务哈希值1,并在第一相关链网络200上生成交易1;并进一步在第一相关链网络200上发起交易2、交易3;并且,交易1和交易2在第一相关链网络200的区块XGL1001上得到确认,最后,将交易1(所匹配的业务哈希值)、交易2(所匹配的业务哈希值)以及相关链上的区块XGL1000的区块序号记录在本区块链网络100的区块BQKL1001-1上,即,完成了业务哈希值1、业务哈希值2的共识。值得一提的是,对于本区块链网络的区块BQKL1001-1而言,一方面业务哈希值4所对应的交易4是该区块的第一交易,而交易1、交易2经主链区块XGL1001所确认,交易1、交易2是区块BQKL1001-1的第二交易,此时,上述第一交易、第二交易被记录在本区块链网络的区块BQKL1001-1上。It is worth mentioning that, as shown in FIG. 2, after the completion of the block XGL1000 of the first
如图3中,业务数据1-7两两配对生成上一级业务哈希值,并最终形成第一当前业务哈希值。As shown in FIG. 3 , the service data 1-7 are paired to generate an upper-level service hash value, and finally a first current service hash value is formed.
如图4中,本区块链网络100和第一相关链网络200存在两个共同节点。As shown in FIG. 4 , the
如图5中,图中的第一相关链存在分叉,本区块链网络第一次记录业务数据时采用上半图的记账结果,后由于第一相关链分叉并重新共识,而变更为下半图的记账结果。首先,第一相关链的区块XGL1001发生变动,并且,原第一交易3的确认由区块XGL1001内发生而变成区块XGL1002内发生。故而,造成本区块网络区块BQKL1001-1的输入发生变化,使得首先需要将原输入的交易3的第二历史业务哈希值剔除,然后,并且要重新求解区块BQKL1001-1的区块哈希值以便重新作为区块BQKL1001-2的输入,并做相应的修改。值得一提的是,其它后续的区块未修改是因为原本的区块并未记录这些信息,后续的记录为新增数据。As shown in Figure 5, there is a fork in the first related chain in the figure. When the blockchain network records business data for the first time, the accounting results in the upper half of the diagram are used. Later, because the first related chain forks and re-consensus, and Changed to the accounting result in the lower half of the figure. First, the block XGL1001 of the first related chain changes, and the confirmation of the original first transaction 3 is changed from the block XGL1001 to the block XGL1002. Therefore, the input of the network block BQKL1001-1 in this block is changed, so that the second historical business hash value of the original input transaction 3 needs to be eliminated first, and then, the block of the block BQKL1001-1 needs to be solved again. The hash value can be re-used as the input of block BQKL1001-2 and modified accordingly. It is worth mentioning that other subsequent blocks are not modified because the original block does not record this information, and the subsequent records are new data.
如图6所示,在本发明的第二实施例中,提供一种基于算力寄生的区块链共识装置,所述装置包括:As shown in FIG. 6 , in the second embodiment of the present invention, a blockchain consensus device based on computing power parasitics is provided, and the device includes:
第一哈希获取模块101,用于接收本区块链网络的第一时间周期内的至少一组当前业务数据,并将所述当前业务数据经哈希运算求解获得与所述当前业务数据相匹配的第一当前业务哈希值;其中,所述第一当前业务哈希值用于生成与所述第一当前业务哈希值相匹配的第一交易;所述第一交易用于在第一相关链上发布,并以便记录于所述第一相关链的主链区块上;The first
值得一提的是,第一当前业务哈希值的生成可以是对一组或多组业务数据整体进行哈希运算;第一当前业务哈希值的生成也可以是采用默克尔树的形式对每个业务数据进行哈希运算后,再两两生成上级哈希值,并直至求解出默克尔树顶部哈希值,该默克尔树顶部哈希值即为所述第一当前业务哈希值;It is worth mentioning that the generation of the first current business hash value may be a hash operation on one or more groups of business data as a whole; the generation of the first current business hash value may also be in the form of a Merkle tree. After hash operation is performed on each business data, the upper-level hash value is generated in pairs, until the top hash value of the Merkle tree is solved, and the top hash value of the Merkle tree is the first current business. hash value;
在本实施例中,并不限定本区块链网络的第一时间周期的长短,可选的,第一时间周期就是本区块链网络的区块生成周期;可选的,第一时间周期与本区块链网络的区块生成周期无关。In this embodiment, the length of the first time period of the blockchain network is not limited. Optionally, the first time period is the block generation period of the blockchain network; optionally, the first time period It has nothing to do with the block generation cycle of this blockchain network.
在本实施例中是将第一时间周期内的若干或所有业务数据作为整体打包为哈希值,并在第一相关链(如比特币网络、以太坊)上以交易的形式发布;其中,第一时间周期与第一相关链的区块生成周期并无关系,在本实施例中,只需将第一交易发布于第一相关链,而交易的确认时间与第一相关链本身设置有关,本区块链网络只需要等待该交易的确认即可。例如,在比特币网络中,发起一笔比特币交易,在等待一定时长后,该交易能够被比特币网络的矿工进行记账和确认,并写入区块链中。In this embodiment, some or all of the business data in the first time period are packaged as a whole into hash values, and published in the form of transactions on the first related chain (such as Bitcoin network, Ethereum); wherein, The first time period has nothing to do with the block generation period of the first related chain. In this embodiment, it is only necessary to publish the first transaction on the first related chain, and the confirmation time of the transaction is related to the settings of the first related chain itself. , the blockchain network only needs to wait for the confirmation of the transaction. For example, in the Bitcoin network, a Bitcoin transaction is initiated, and after waiting for a certain period of time, the transaction can be recorded and confirmed by the miners of the Bitcoin network, and written into the blockchain.
交易监控模块102,用于根据与历史业务数据相匹配的各个历史业务哈希值,检测所述第一相关链在所述第一时间周期内与各个所述历史业务哈希值相匹配且未被所述第一相关链所确认的第二交易是否被确认;其中,所述历史业务哈希值由所述历史业务哈希值相对应的所述历史业务数据经哈希运算求解获得;The
对于本区块链网络的区块而言,在将业务数据以交易的形式发布于第一相关链的同时,也对之前发布于第一相关链的交易进行检测,并在业务数据相对应的交易被确认之后,写入本区块链网络的区块中;For the blocks of this blockchain network, when the business data is published in the first relevant chain in the form of transactions, the transactions previously published in the first relevant chain are also detected, and in the corresponding business data After the transaction is confirmed, it is written into the block of this blockchain network;
值得一提的是,首次写入第一相关链的主链区块上,即可认为该交易是被确认的;可选的,累计多次写入第一相关链的主链区块上,即可认为是该交易是被确认的。It is worth mentioning that the transaction is considered to be confirmed when it is written to the main chain block of the first related chain for the first time; That is, the transaction is considered to be confirmed.
第二哈希获取模块103,用于获取新增的被所述第一相关链所确认的所述第二交易的所述历史业务哈希值,并将所述历史业务哈希值作为第二历史业务哈希值;获取所述第二交易在所述第一相关链上所在区块所相对应的第二区块号;The second
数据记录模块104,用于将所述第一当前业务哈希值、所述第二历史业务哈希值以及第二区块号记录于与所述第一时间周期相对应的本区块链网络的当前区块上。The
可选的,在本实施例中,所述数据记录模块104,包括:Optionally, in this embodiment, the
第一标记单元,用于将所述第一当前业务哈希值标记为未共识;a first marking unit, configured to mark the first current service hash value as unconsensus;
第二标记单元,用于将所述第二历史业务哈希值标记为已共识;a second marking unit, configured to mark the second historical service hash value as consensus;
数据记录单元,用于将所述第一当前业务哈希值、所述第二历史业务哈希值记录于与所述第一时间周期相对应的本区块链网络的当前区块上。A data recording unit, configured to record the first current service hash value and the second historical service hash value on the current block of the blockchain network corresponding to the first time period.
可选的,在本实施例中,所述本区块链网络的本链区块包括区块头、第一哈希存储区、第二哈希存储区;所述第一哈希存储区用于存储所述当前区块在所述第一时间周期内新打包的所述当前业务数据的所述第一当前业务哈希值,所述第二哈希存储区用于存储在所述第一时间周期内新增的被所述第一相关链所确认的所述第二交易的所述第二历史业务哈希值以及所述第二交易所相对应的所述第二区块号。Optionally, in this embodiment, the local chain block of the local blockchain network includes a block header, a first hash storage area, and a second hash storage area; the first hash storage area is used for storing the first current service hash value of the current service data newly packaged by the current block in the first time period, and the second hash storage area is used to store the first time The second historical business hash value of the second transaction confirmed by the first related chain and the second block number corresponding to the second transaction newly added in the cycle.
值得一提的是,可选的,在第一哈希存储区及第二哈希存储区设定标识符,以便确定分区;可选的,通过固定第一哈希存储区及第二哈希存储区的大小或者字节数,以便确定各个相对的分区。It is worth mentioning that, optionally, identifiers are set in the first hash storage area and the second hash storage area to determine the partition; optionally, by fixing the first hash storage area and the second hash storage area The size or number of bytes of the storage area to determine the relative partitions.
可选的,在本实施例中,所述第一哈希获取模块101,还包括:Optionally, in this embodiment, the first
业务获取单元,用于获取在第一时间周期内接收到的本区块链网络的各个业务单元;所述至少一组当前业务数据由所述业务单元组成;a service acquisition unit, configured to acquire each service unit of the blockchain network received within the first time period; the at least one group of current service data is composed of the service units;
业务哈希求解单元,用于求解各个业务单元的单元哈希值;The business hash solving unit is used to solve the unit hash value of each business unit;
第一哈希求解单元,用于根据各个所述单元哈希值及默克尔树算法,生成默克尔树顶部哈希值,并将所述默克尔树顶部哈希值作为所述第一当前业务哈希值。The first hash solving unit is used to generate the top hash value of the Merkle tree according to each of the unit hash values and the Merkle tree algorithm, and use the top hash value of the Merkle tree as the first hash value. A current business hash value.
常见的默克尔树算法是对单元哈希值进行两两生成上级哈希值,并直至求解出默克尔树顶部哈希值。The common Merkle tree algorithm is to generate the upper-level hash value by pairing the unit hash values, and until the top hash value of the Merkle tree is solved.
可选的,在本实施例中,所述交易监控模块102,还包括:Optionally, in this embodiment, the
多节点检测单元,用于与所述第一相关链上的至少三个不同网络的主链节点进行通讯,定时检测至少三个不同网络的所述主链节点的所述第二交易是否被确认;其中,所述主链节点数为奇数个;A multi-node detection unit, configured to communicate with the main chain nodes of at least three different networks on the first correlation chain, and regularly detect whether the second transaction of the main chain nodes of at least three different networks is confirmed ; Wherein, the number of the main chain nodes is an odd number;
多节点交易确认单元,用于在所有的所述主链节点中,若所述第二交易被半数以上的所述主链节点所确认,则认为所述第二交易被确认。The multi-node transaction confirmation unit is used for, among all the main chain nodes, if the second transaction is confirmed by more than half of the main chain nodes, the second transaction is considered to be confirmed.
实际上,本区块链网络仅与第一相关链上的一个主链节点进行通讯,即可获得交易是否被确认的信息;而通过与多个主链节点,降低分叉率。在实际应用场景中,可以在不同的矿场设置第一相关链的主链节点。由于同一个矿场一般集体挖矿,并且通络延时少,矿场内数据相对一致,故而可以选择不同矿场的不同主链节点以便获得第一交易的交易记录信息。In fact, this blockchain network only communicates with one main chain node on the first related chain to obtain information on whether the transaction is confirmed; and by communicating with multiple main chain nodes, the fork rate is reduced. In practical application scenarios, the main chain nodes of the first related chain can be set in different mining farms. Since the same mining farm generally mines collectively, and the network delay is small, the data in the mining farm is relatively consistent, so different main chain nodes of different mining farms can be selected to obtain the transaction record information of the first transaction.
可选的,在本实施例中,所述装置,还包括:Optionally, in this embodiment, the device further includes:
交易持续监控模块105,用于在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;The transaction
第一交易修改模块106,用于响应于所述第三区块号与所述第二区块号不相同,执行第一修改操作;所述第一修改操作包括:删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。The first
值得一提的是,在基于算力共识的区块链技术中,如比特币区块,是依靠矿工们不断进行数学运算而产生的,每一个区块都必须引用其上一个区块,因此最长的链也是最难以推翻和篡改的,所以节点永远认为最长链才是有效的区块链,只有在最长链上挖矿的矿工才能够获得奖励,这就是我们常说的比特币最长链原则。当二个或多个节点几乎同时记账,则出现分叉,此时,暂时保留两个份记账方式,并最终由较长链的区块链作为最终的记账账本。It is worth mentioning that in the blockchain technology based on the consensus of computing power, such as the Bitcoin block, it is generated by the continuous mathematical operation of miners, and each block must refer to its previous block, so The longest chain is also the most difficult to overthrow and tamper with, so nodes always think that the longest chain is an effective blockchain, and only miners who mine on the longest chain can get rewards, which is what we often call Bitcoin The longest chain principle. When two or more nodes book accounts at almost the same time, a fork occurs. At this time, two bookkeeping methods are temporarily reserved, and the blockchain of the longer chain is finally used as the final bookkeeping book.
在可选案例中,当第一相关链出现分叉且本区块链网络的节点根据第一交易是否被确认而记账时,会遵循分叉之一,而后若因第一相关链选择另一分叉造成本区块链网络的第一交易的交易记录信息发生变动,此时,可以对其修改,并相应的修改之后的区块链。In an optional case, when a fork occurs in the first related chain and the nodes of this blockchain network record according to whether the first transaction is confirmed, one of the forks will be followed, and then if the first related chain chooses another A fork causes the transaction record information of the first transaction of the blockchain network to change. At this time, it can be modified, and the blockchain after modification can be correspondingly modified.
可选的,在本实施例中,所述装置还包括:Optionally, in this embodiment, the device further includes:
交易持续监控模块105,用于在所述第二交易被确认后,采集与所述第二历史业务哈希值相对应的所述第二交易所在区块的第三区块号;The transaction
第二交易修改模块107,用于响应于所述第三区块号与所述第二区块号不相同,向本区块链网络的本链节点发送链数据变更请求;其中,所述本链节点接收所述链数据变更请求后,根据所述第二历史业务哈希值,向与所述本链节点相对应的所述第一相关链的主链节点请求所述第二交易的所述第三区块号,并响应于所述第三区块号与所述第二区块号不相同,删除本区块链网络上原先在第一本链区块上针对所述第二交易所记录的所述第二历史业务哈希值及所述第二区块号,在与所述第三区块号相对应的本区块链网络上的第二本链区块记录所述第二历史业务哈希值及所述第三区块号。The second
在典型的区块链实例中,本网络区块链的前一区块哈希值作为后一区块哈希值求解的输入参数,以便求解后一区块哈希值。In a typical blockchain example, the hash value of the previous block of the blockchain of this network is used as the input parameter for solving the hash value of the next block, so as to solve the hash value of the next block.
可选的,在本实施例中,本区块链网络的前一区块哈希值作为后一区块哈希值求解的输入参数;所述第一交易修改模块106还包括区块重建单元;Optionally, in this embodiment, the hash value of the previous block of the blockchain network is used as an input parameter for solving the hash value of the next block; the first
所述区块重建单元,用于比较所述第一本链区块和所述第二本链区块的区块序号的大小;The block reconstruction unit is used to compare the size of the block serial numbers of the first home chain block and the second home chain block;
所述区块重建单元,还用于自所述第一本链区块和所述第二本链区块的区块序号较小者起,重新逐个求解本区块链网络的各个区块的哈希值,使得本区块链网络的各个区块组成链式连接。The block reconstruction unit is also used to re-solve the block sequence numbers of each block of this blockchain network one by one starting from the smaller of the block serial numbers of the first local chain block and the second local chain block. The hash value makes each block of the blockchain network form a chain connection.
由于算力竞争及网络延时等因素,第一相关链会存在分叉并保留若干个区块生成周期,并选取最长链作为最终账本;本区块链网络也会因第一相关链而形成分叉,但是随着主链的运行,本区块链网络更新区块数据,本区块链网络的分叉问题也能够随着主链解决分叉问题而自行得到解决。Due to factors such as computing power competition and network delay, the first related chain will fork and retain several block generation cycles, and the longest chain will be selected as the final ledger; this blockchain network will also be affected by the first related chain. A fork is formed, but with the operation of the main chain, the block chain network updates the block data, and the fork problem of the block chain network can also be solved by itself as the main chain solves the fork problem.
值得一提的是,当本区块链的区块之间采用链式连接,即将前一区块的哈希值存储与后一区块之中时,则应第一交易记录信息发生变动,则需要重新求解区块哈希值,并同时修改之后的哈希值,值得一提的是,例如比特币网络需要6次确认以保证区块链数据的不被篡改,故而,仅需要修改第一相关链6个区块周期内的本区块链网络的区块之间的链式连接,其算力要求并不高。It is worth mentioning that when the blocks of this blockchain are connected in a chain, that is, when the hash value of the previous block is stored in the next block, the first transaction record information should be changed. It is necessary to re-solve the block hash value and modify the hash value at the same time. It is worth mentioning that, for example, the Bitcoin network requires 6 confirmations to ensure that the blockchain data is not tampered with. Therefore, it is only necessary to modify the first block. The chain connection between the blocks of this blockchain network within 6 block cycles of a related chain does not require high computing power.
可选的,在本实施例中,本区块链网络的区块头包括但不限于区块序号、第一当前业务哈希值、第二历史业务哈希值、时间戳、所述当前区块的上一区块的哈希值。Optionally, in this embodiment, the block header of this blockchain network includes but is not limited to the block serial number, the first current service hash value, the second historical service hash value, the timestamp, the current block The hash value of the previous block.
可选的,本区块链网络的若干个节点会对第一相关链进行数据监控,以便获知第一交易、第二交易的是否被确认;可选的,本区块链网络的若干个节点在连接本区块链网络的同时,也连接第一相关链网络;Optionally, several nodes of this blockchain network will monitor the data of the first related chain, so as to know whether the first transaction and the second transaction are confirmed; optionally, several nodes of this blockchain network While connecting to this blockchain network, it also connects to the first related chain network;
可选的,在本实施例中,所述本区块链网络的若干个节点在连接本区块链网络的同时,也连接所述第一相关链的网络。Optionally, in this embodiment, several nodes of the local blockchain network are also connected to the network of the first related chain while connecting to the local blockchain network.
可选的,在本实施例中,所述装置还包括:Optionally, in this embodiment, the device further includes:
第一哈希管理模块108,用于将与未共识的业务数据相匹配的业务哈希值存放于第一哈希列表中;The first
和/或第二哈希管理模块109,用于将已共识的业务数据相匹配的业务哈希值存放于第二哈希列表中。and/or the second
通过设置第一哈希管理模块108和/或第二哈希管理模块109,便于管理相关业务数据在第一相关链上的共识的发起、确认、追踪。By setting the first
此外,由于第一交易的第一发起者接收第一交易的确认信息相对而言,较为及时。可选的,接收所述第一交易的第一发起者关于所述第一交易被确认的第一确认信息;所述第一发起者与本区块网络连接,所述第一发起者与第一相关链网络连接;In addition, since the first initiator of the first transaction receives the confirmation information of the first transaction, it is relatively timely. Optionally, receive first confirmation information about the confirmation of the first transaction from the first initiator of the first transaction; the first initiator is connected to the network of this block, and the first initiator is connected to the first transaction. A related chain network connection;
本实例提供的是一种区块链共识技术,当相关业务数据的哈希值被确认于第一相关链上,则认为相关业务数据能够不容易被篡改,而被共识。同时,在第一交易被确认后,可以将相关交易信息,如业务数据的第一当前业务哈希值被确认于区块链的哪一区块中。This example provides a blockchain consensus technology. When the hash value of the relevant business data is confirmed on the first relevant chain, it is considered that the relevant business data can not be easily tampered with, and thus can be agreed upon. At the same time, after the first transaction is confirmed, the relevant transaction information, such as the first current business hash value of the business data, can be confirmed in which block of the blockchain.
在实际应用中,根据本区块链业务数据的数量、交易手续费以及第一相关链网络的吞吐能力,对一次打包的业务数据的数量设定;值得一提的是,当设置较高的单次业务数据打包数量时,可以减低在第一相关区块链上发布第一交易或第二交易的手续费,并且降低第一相关区块链的负载,而另一方面单次业务数据打包数量较少时,可以有效提高交易的确认速度。In practical applications, the amount of business data packaged at one time is set according to the amount of business data in this blockchain, the transaction fee and the throughput capacity of the first related chain network; it is worth mentioning that when a higher value is set When the number of business data is packaged in a single time, the handling fee for publishing the first transaction or the second transaction on the first related blockchain can be reduced, and the load of the first related blockchain can be reduced. When the number is small, it can effectively improve the confirmation speed of the transaction.
值得一提的是,如图2所示,在第一相关链网络200的区块XGL1000完成之后,在一个时间周期内,收集本区块链网络100的客户端发起的业务数据,并生成业务哈希值1,并在第一相关链网络200上生成交易1;并进一步在第一相关链网络200上发起交易2、交易3;并且,交易1和交易2在第一相关链网络200的区块XGL1001上得到确认,最后,将交易1(所匹配的业务哈希值)、交易2(所匹配的业务哈希值)以及相关链上的区块XGL1000的区块序号记录在本区块链网络100的区块BQKL1001-1上,即,完成了业务哈希值1、业务哈希值2的共识。值得一提的是,对于本区块链网络的区块BQKL1001-1而言,一方面业务哈希值4所对应的交易4是该区块的第一交易,而交易1、交易2经主链区块XGL1001所确认,交易1、交易2是区块BQKL1001-1的第二交易,此时,上述第一交易、第二交易被记录在本区块链网络的区块BQKL1001-1上。It is worth mentioning that, as shown in FIG. 2, after the completion of the block XGL1000 of the first
如图3中,业务数据1-7两两配对生成上一级业务哈希值,并最终形成第一当前业务哈希值。As shown in FIG. 3 , the service data 1-7 are paired to generate an upper-level service hash value, and finally a first current service hash value is formed.
如图4中,本区块链网络100和第一相关链网络200存在两个共同节点。As shown in FIG. 4 , the
如图5中,图中的第一相关链存在分叉,本区块链网络第一次记录业务数据时采用上半图的记账结果,后由于第一相关链分叉并重新共识,而变更为下半图的记账结果。首先,第一相关链的区块XGL1001发生变动,并且,原第一交易3的确认由区块XGL1001内发生而变成区块XGL1002内发生。故而,造成本区块网络区块BQKL1001-1的输入发生变化,使得首先需要将原输入的交易3的第二历史业务哈希值剔除,然后,并且要重新求解区块BQKL1001-1的区块哈希值以便重新作为区块BQKL1001-2的输入,并做相应的修改。值得一提的是,其它后续的区块未修改是因为原本的区块并未记录这些信息,后续的记录为新增数据。As shown in Figure 5, there is a fork in the first related chain in the figure. When the blockchain network records business data for the first time, the accounting results in the upper half of the diagram are used. Later, because the first related chain forks and re-consensus, and Changed to the accounting results in the lower half of the figure. First, the block XGL1001 of the first related chain changes, and the confirmation of the original first transaction 3 is changed from the block XGL1001 to the block XGL1002. Therefore, the input of the network block BQKL1001-1 in this block is changed, so that the second historical business hash value of the original input transaction 3 needs to be eliminated first, and then, the block of the block BQKL1001-1 needs to be solved again. The hash value can be re-used as the input of block BQKL1001-2 and modified accordingly. It is worth mentioning that other subsequent blocks are not modified because the original block does not record this information, and the subsequent records are new data.
以上详细描述了本发明的较佳具体实施例。应当理解,本领域的普通技术人员无需创造性劳动就可以根据本发明的构思作出诸多修改和变化。因此,凡本技术领域中技术人员依本发明的构思在现有技术的基础上通过逻辑分析、推理或者有限的实验可以得到的技术方案,皆应在由权利要求书所确定的保护范围内。The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make many modifications and changes according to the concept of the present invention without creative efforts. Therefore, all technical solutions that can be obtained by those skilled in the art through logical analysis, reasoning or limited experiments on the basis of the prior art according to the concept of the present invention shall fall within the protection scope determined by the claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811165472.7A CN109410055B (en) | 2018-10-08 | 2018-10-08 | A blockchain consensus method based on computing power parasitism |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811165472.7A CN109410055B (en) | 2018-10-08 | 2018-10-08 | A blockchain consensus method based on computing power parasitism |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109410055A CN109410055A (en) | 2019-03-01 |
CN109410055B true CN109410055B (en) | 2020-08-07 |
Family
ID=65466773
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811165472.7A Active CN109410055B (en) | 2018-10-08 | 2018-10-08 | A blockchain consensus method based on computing power parasitism |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109410055B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111598567B (en) * | 2020-05-07 | 2023-11-10 | 深圳创客区块链技术有限公司 | Method, device and storage medium for preventing blockchain powerful attack |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012162748A2 (en) * | 2011-06-03 | 2012-12-06 | Rate Validation Services Pty Ltd | Method and system for generating a set of rates |
CN105488675A (en) * | 2015-11-25 | 2016-04-13 | 布比(北京)网络技术有限公司 | Distributed shared general ledger construction method of block chain |
CN106650495A (en) * | 2016-12-16 | 2017-05-10 | 杭州嘉楠耘智信息科技有限公司 | File verification method and device |
KR20180041055A (en) * | 2017-09-06 | 2018-04-23 | 주식회사 코인플러그 | Method for providing certificate service based on smart contract and server using the same |
CN108235799A (en) * | 2017-12-27 | 2018-06-29 | 深圳达闼科技控股有限公司 | Block generation method, device, storage medium and block chain network |
CN207895450U (en) * | 2018-03-30 | 2018-09-21 | 李欣宇 | Knowledge Q-A system based on the double-chain block chain of same root |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150170112A1 (en) * | 2013-10-04 | 2015-06-18 | Erly Dalvo DeCastro | Systems and methods for providing multi-currency platforms comprising means for exchanging and interconverting tangible and virtual currencies in various transactions, banking operations, and wealth management scenarios |
-
2018
- 2018-10-08 CN CN201811165472.7A patent/CN109410055B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012162748A2 (en) * | 2011-06-03 | 2012-12-06 | Rate Validation Services Pty Ltd | Method and system for generating a set of rates |
CN105488675A (en) * | 2015-11-25 | 2016-04-13 | 布比(北京)网络技术有限公司 | Distributed shared general ledger construction method of block chain |
CN106650495A (en) * | 2016-12-16 | 2017-05-10 | 杭州嘉楠耘智信息科技有限公司 | File verification method and device |
KR20180041055A (en) * | 2017-09-06 | 2018-04-23 | 주식회사 코인플러그 | Method for providing certificate service based on smart contract and server using the same |
CN108235799A (en) * | 2017-12-27 | 2018-06-29 | 深圳达闼科技控股有限公司 | Block generation method, device, storage medium and block chain network |
CN207895450U (en) * | 2018-03-30 | 2018-09-21 | 李欣宇 | Knowledge Q-A system based on the double-chain block chain of same root |
Non-Patent Citations (2)
Title |
---|
An Overview of Blockchain Technology :Architecture, Consensus, and Future Trends;Zibin Zheng 等;《2017 IEEE 6th International Congress on Big Data》;20171231;第557-564页 * |
区块链共识机制研究与分析;刘童桐;《信息通信技术与政策》;20180731(第7期);第26-33页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109410055A (en) | 2019-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109361661B (en) | A consensus device of a blockchain that relies on the computing power of the relevant chain | |
CN111241114B (en) | A smart service transaction blockchain reputation management method and system combining transaction and consensus | |
CN110866825B (en) | Public link-based block chain information storage method and system | |
CN112313916B (en) | A method and system for mimetic storage of tamper-proof logs integrated with blockchain technology | |
CN109214817B (en) | Block chain consensus device based on computational power parasitism | |
US20200143366A1 (en) | Methods for decentralized digital asset transfer and smart contract state transition | |
CN110650128B (en) | A system and method for detecting Ethereum digital currency theft attack | |
CN109389502B (en) | consensus method of block chains depending on related chain computing power | |
CN106528775A (en) | Private block chain operation support system that supports logical multi-chain, and working method thereof | |
CN109189751A (en) | Method of data synchronization and terminal device based on block chain | |
WO2020019943A1 (en) | Method and device for transmitting data, and method and apparatus for receiving data | |
CN109255057B (en) | Block generation method, device, equipment and storage medium | |
CN101753597B (en) | Keeping alive method between peer node and client under peer node-client architecture | |
WO2020142906A1 (en) | Structured directed acyclic graph-based transaction allocation method and apparatus | |
CN111698094A (en) | Consensus method based on block chain system and block chain system | |
CN109543459A (en) | A kind of data deposit card method and apparatus | |
CN110597922A (en) | Data processing method, device, terminal and storage medium | |
CN109410055B (en) | A blockchain consensus method based on computing power parasitism | |
Liu et al. | BCmaster: A compatible framework for comprehensively analyzing and monitoring blockchain systems in IoT | |
CN113238996A (en) | Block chain data archiving method based on DHT, electronic equipment and storage medium | |
CN101577626B (en) | Method for monitoring initiative specific information dissemination based on eMule | |
CN109872196A (en) | A kind of user behavior value control system and method based on block chain | |
CN111241069B (en) | Block chain-based data flattening method and system | |
CN110119947A (en) | Shared proof of work calculates the method and apparatus that power generates symbiosis block chain | |
CN110517041A (en) | Block chain management method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20210319 Address after: Room 1a201 and 1g201, No.12, Gaoxin 2nd Road, Zhangba Street office, Gaoxin District, Xi'an City, Shaanxi Province, 710065 Patentee after: XI'AN ZHIGUI INTERNET TECHNOLOGY Co.,Ltd. Address before: 351139 Hualin Industrial Park, Xiagao village, Huating Town, Chengxiang District, Putian City, Fujian Province Patentee before: PUTIAN ZHUHUO INFORMATION TECHNOLOGY Co.,Ltd. |
|
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: Room 201, Building 10B, Zilang Technology City, No. 60 Chongzhou Avenue, Nantong Development Zone, Jiangsu Province Patentee after: Jiangsu Zhigui Digital Technology Co.,Ltd. Country or region after: China Address before: Houses 1A201 and 1G201, No. 12 Gaoxin 2nd Road, Zhangba Street Office, High tech Zone, Xi'an City, Shaanxi Province Patentee before: XI'AN ZHIGUI INTERNET TECHNOLOGY Co.,Ltd. Country or region before: China |