CN111597264B - A blockchain bookkeeping method and device - Google Patents
A blockchain bookkeeping method and device Download PDFInfo
- Publication number
- CN111597264B CN111597264B CN202010412219.8A CN202010412219A CN111597264B CN 111597264 B CN111597264 B CN 111597264B CN 202010412219 A CN202010412219 A CN 202010412219A CN 111597264 B CN111597264 B CN 111597264B
- Authority
- CN
- China
- Prior art keywords
- blockchain
- node
- accounting
- token
- new
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0807—Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Signal Processing (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
技术领域technical field
本发明涉及区块链技术领域,具体涉及一种区块链记账方法及装置。The invention relates to the technical field of block chains, in particular to a block chain bookkeeping method and device.
背景技术Background technique
在区块链技术中,记账节点生成区块要耗费整个区块链网络大量的算力去寻找满足哈希值的随机数,而这种计算本身毫无现实意义,会影响区块链记账效率。In the blockchain technology, it takes a lot of computing power of the entire blockchain network to find a random number that satisfies the hash value when the accounting node generates a block, and this calculation itself has no practical significance and will affect the blockchain record account efficiency.
发明内容Contents of the invention
为此,本发明提供一种区块链记账方法及装置,以解决现有技术中由于生成区块要耗费整个区块链网络大量的算力去寻找满足哈希值的随机数而导致的区块链记账效率低的问题。For this reason, the present invention provides a block chain bookkeeping method and device to solve the problem in the prior art that it takes a lot of computing power of the entire block chain network to find a random number that satisfies the hash value in the prior art. The problem of low efficiency of blockchain bookkeeping.
为了实现上述目的,本发明第一方面提供一种区块链记账方法,该方法包括:In order to achieve the above object, the first aspect of the present invention provides a blockchain bookkeeping method, the method comprising:
当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值;When a new bookkeeping node joins the blockchain to which the bookkeeping node belongs, determine the hash value corresponding to the blockchain identification of each bookkeeping node;
根据所述各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,所述排序列表包括所述区块链中各记账节点区块链标识对应的哈希值的序列;Update the locally stored sorting list according to the hash value corresponding to the block chain identification of each bookkeeping node, and the sorting list includes a sequence of hash values corresponding to the block chain identification of each bookkeeping node in the block chain ;
根据所述排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。The token is passed to the corresponding bookkeeping node according to the sorted list, so that the bookkeeping node currently holding the token generates a new block.
优选的,该方法还包括:Preferably, the method also includes:
当有新记账节点加入所述区块链时,确定所述新记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差值;When a new bookkeeping node joins the block chain, determine the hash value corresponding to the block chain identification of the new bookkeeping node and the hash corresponding to the block chain identification of the bookkeeping node currently holding the token the difference between the values;
根据所述差值确定所述新记账节点参与令牌传递前的等待时间。The waiting time before the new bookkeeping node participates in token transfer is determined according to the difference.
优选的,所述等待时间为标准时间的倍数,所述标准时间为所述令牌从一个记账节点传递至另一个记账节点的时间。Preferably, the waiting time is a multiple of a standard time, and the standard time is the time for the token to be transferred from one billing node to another billing node.
优选的,该方法还包括:Preferably, the method also includes:
当本记账节点当前持有令牌时,若检测到本记账节点生成的新区块涉及到的智能合约中出现整数溢出,则停止执行资金类交易的转账操作,并在所述区块链中广播第一广播消息,所述第一广播消息携带所述智能合约双方的标识、所述智能合约的编号和整数溢出报警标识。When the bookkeeping node currently holds the token, if it detects that an integer overflow occurs in the smart contract involved in the new block generated by the bookkeeping node, it will stop executing the transfer operation of the capital transaction, and in the block chain Broadcasting a first broadcast message in the middle, the first broadcast message carries the identifiers of both parties to the smart contract, the number of the smart contract, and an integer overflow alarm identifier.
优选的,该方法还包括:Preferably, the method also includes:
当本记账节点当前未持有令牌时,若检测到区块链中其他记账节点发布的新区块涉及到的智能合约中出现整数溢出,且未接收到所述其他记账节点广播的第一广播消息,则在所述区块链中广播第二广播消息,所述第二广播消息携带所述其他记账节点发布的新区块作废的消息、所述智能合约双方的标识、所述智能合约的编号和整数溢出报警标识。When the bookkeeping node does not currently hold tokens, if it detects that there is an integer overflow in the smart contract involved in the new block issued by other bookkeeping nodes in the blockchain, and does not receive the information broadcast by the other bookkeeping nodes The first broadcast message, then broadcast the second broadcast message in the block chain, the second broadcast message carries the message that the new block issued by the other bookkeeping node is invalidated, the identification of both parties of the smart contract, the The number of the smart contract and the integer overflow alarm flag.
本发明第二方面提供了一种记账节点,该记账节点包括第一处理模块、更新模块和传递模块;The second aspect of the present invention provides an accounting node, the accounting node includes a first processing module, an update module and a transfer module;
所述第一处理模块用于,当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值;The first processing module is used to determine the hash value corresponding to the block chain identifier of each bookkeeping node when a new bookkeeping node joins the blockchain to which the bookkeeping node belongs;
所述更新模块用于,根据所述各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,所述排序列表包括所述区块链中各记账节点区块链标识对应的哈希值的序列;The update module is used to update the locally stored sorted list according to the hash values corresponding to the blockchain identifiers of the accounting nodes, the sorted list includes the blockchain identifiers of the accounting nodes in the blockchain A sequence of corresponding hash values;
所述传递模块用于,根据所述排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。The transfer module is configured to transfer the token to the corresponding bookkeeping node according to the sorted list, so that the bookkeeping node currently holding the token generates a new block.
优选的,所述第一处理模块还用于,当有新记账节点加入所述区块链时,确定所述新记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差值,并根据所述差值确定所述新记账节点参与令牌传递前的等待时间。Preferably, the first processing module is further configured to, when a new bookkeeping node joins the blockchain, determine that the hash value corresponding to the blockchain identification of the new bookkeeping node is the same as the currently held token The difference between the corresponding hash values of the block chain identification of the bookkeeping node, and determine the waiting time before the new bookkeeping node participates in token transfer according to the difference.
优选的,所述等待时间为标准时间的倍数,所述标准时间为所述令牌从一个记账节点传递至另一个记账节点的时间。Preferably, the waiting time is a multiple of a standard time, and the standard time is the time for the token to be transferred from one billing node to another billing node.
优选的,该记账节点还包括第二处理模块;Preferably, the billing node further includes a second processing module;
所述第二处理模块用于,当本记账节点当前持有令牌时,若检测到本记账节点生成的新区块涉及到的智能合约中出现整数溢出,则停止执行资金类交易的转账操作,并在所述区块链中广播第一广播消息,所述第一广播消息携带所述智能合约双方的标识、所述智能合约的编号和整数溢出报警标识。The second processing module is used for, when the bookkeeping node currently holds the token, if it is detected that an integer overflow occurs in the smart contract involved in the new block generated by the bookkeeping node, then stop executing the transfer of the capital transaction operation, and broadcast a first broadcast message in the blockchain, where the first broadcast message carries the identifications of both parties to the smart contract, the number of the smart contract, and an integer overflow alarm identification.
优选的,所述第二处理模块还用于,当本记账节点当前未持有令牌时,若检测到区块链中其他记账节点发布的新区块涉及到的智能合约中出现整数溢出,且未接收到所述其他记账节点广播的第一广播消息,则在所述区块链中广播第二广播消息,所述第二广播消息携带所述其他记账节点发布的新区块作废的消息、所述智能合约双方的标识、所述智能合约的编号和整数溢出报警标识。Preferably, the second processing module is also used for, when the bookkeeping node does not currently hold a token, if it is detected that an integer overflow occurs in the smart contract involved in the new block issued by other bookkeeping nodes in the blockchain , and the first broadcast message broadcast by the other bookkeeping nodes is not received, then the second broadcast message is broadcast in the blockchain, and the second broadcast message carries the new block issued by the other bookkeeping nodes to be invalid message, the identification of both parties of the smart contract, the number of the smart contract and the integer overflow alarm identification.
本发明实施例提供的区块链记账方法,当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值,并根据各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,排序列表包括区块链中各记账节点区块链标识对应的哈希值的序列,根据排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。本发明实施例提供的区块链方法可以使得区块链中的记账节点们无需通过算力竞争去寻找一个满足哈希值的随机数来争夺新区块的记账权,提高了区块链记账效率。In the block chain bookkeeping method provided by the embodiment of the present invention, when a new bookkeeping node joins the block chain to which the bookkeeping node belongs, the hash value corresponding to the block chain identification of each bookkeeping node is determined, and according to each The hash value corresponding to the blockchain ID of the bookkeeping node updates the sorting list stored locally. The sorting list includes the sequence of hash values corresponding to the blockchain ID of each bookkeeping node in the blockchain, and the token is passed according to the sorting list To the corresponding bookkeeping node, so that the bookkeeping node currently holding the token generates a new block. The block chain method provided by the embodiment of the present invention can make the bookkeeping nodes in the block chain not need to compete for a random number that satisfies the hash value through computing power competition to compete for the bookkeeping right of the new block, which improves the block chain Bookkeeping efficiency.
附图说明Description of drawings
附图是用来提供对本发明的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本发明,但并不构成对本发明的限制。The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the description, together with the following specific embodiments, are used to explain the present invention, but do not constitute a limitation to the present invention.
图1为本发明实施例提供的区块链记账方法的流程示意图一;Fig. 1 is a schematic flow diagram one of the block chain bookkeeping method provided by the embodiment of the present invention;
图2为本发明实施例提供的区块链记账方法的流程示意图二;Fig. 2 is the second schematic flow diagram of the blockchain bookkeeping method provided by the embodiment of the present invention;
图3为本发明实施例提供的记账节点的结构示意图一;FIG. 3 is a structural schematic diagram 1 of an accounting node provided by an embodiment of the present invention;
图4为本发明实施例提供的记账节点的结构示意图二。FIG. 4 is a second schematic structural diagram of an accounting node provided by an embodiment of the present invention.
具体实施方式Detailed ways
以下结合附图对本发明的具体实施方式进行详细说明。应当理解的是,此处所描述的具体实施方式仅用于说明和解释本发明,并不用于限制本发明。Specific embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described here are only used to illustrate and explain the present invention, and are not intended to limit the present invention.
区块链是一种去中心化的数据库,它包含一张被称为区块的列表,有着持续增长并且排列整齐的记录。每个区块都包含一个时间戳和一个与前一区块的链接:设计区块链使得数据不可篡改,一旦记录下来,在一个区块中的数据将不可逆。区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。所谓共识机制是区块链系统中实现不同节点之间建立信任、获取权益的数学算法。A blockchain is a decentralized database consisting of a continuously growing list of records called blocks. Each block contains a timestamp and a link to the previous block: the blockchain is designed so that the data cannot be tampered with, and once recorded, the data in a block is irreversible. Blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. The so-called consensus mechanism is a mathematical algorithm to establish trust and obtain rights and interests between different nodes in the blockchain system.
随着移动互联网的不断发展,中国实体经济与互联网的关系愈加密切;为此,国家更是站在决策者的角度,将移动互联网定位为“创新发展新领域、公共服务新平台、信息分享新渠道”。PC(PersonalComputer,个人计算机)端互联网已经处于了日渐饱和的境况,而移动互联网却正在蓬勃发展,传统的互联网巨头们也开始将目光聚集到移动互联网。现在是一个科技驱动金融发展的时代,科技的驱动因素已经从最早的互联网信息发展到近年的大数据、云计算、移动互联网。但是,技术的创新是永无止境的,区块链作为科技驱动力量已经呈现蓬勃的发展趋势。作为以去中心化理念、分布式共享记账技术为核心的区块链,未来将嵌入金融领域的诸多环节,例如增信、确权、股权登记、金融贸易、数字资产等。区块链目前尚处于发展的初级阶段,无论是大机构还是小公司,对于区块链仍然走在探索的道路上。作为一种分布式共享记账的技术,金融科技领域最新、最前沿的技术区块链在更大意义上是让参与各方之间能够在技术层面建立信任关系。目前这一技术无论是在金融领域的股权登记、确权、清结算,还是在物流领域、产品验真的溯源领域均拥有大量的想象空间。布比区块链指出,目前布比更多技术集中于商用级的区块链技术支持服务,具体包含三个领域,第一,数字资产领域,除常见的积分、入住卡外还包含其他数据化的资产;第二是贸易金融领域;第三则是股权领域,提高股权交易便捷性。With the continuous development of the mobile Internet, the relationship between China's real economy and the Internet has become closer; for this reason, the country has positioned the mobile Internet as "a new field of innovation and development, a new platform for public services, and a new platform for information sharing" from the perspective of policymakers. channel". The PC (Personal Computer, personal computer) Internet has been in a situation of increasing saturation, while the mobile Internet is booming, and the traditional Internet giants have also begun to focus on the mobile Internet. Now is an era of technology-driven financial development. The driving factors of technology have developed from the earliest Internet information to big data, cloud computing, and mobile Internet in recent years. However, technological innovation is endless, and blockchain, as a technological driving force, has shown a vigorous development trend. As a blockchain with the concept of decentralization and distributed shared accounting technology as the core, it will be embedded in many links in the financial field in the future, such as credit enhancement, confirmation of rights, equity registration, financial trade, digital assets, etc. The blockchain is still in the initial stage of development. Whether it is a large organization or a small company, the blockchain is still on the road of exploration. As a distributed shared bookkeeping technology, the latest and most cutting-edge technology blockchain in the field of financial technology, in a larger sense, enables the parties involved to establish a trust relationship at the technical level. At present, this technology has a lot of room for imagination, whether it is in the equity registration, confirmation of rights, clearing and settlement in the financial field, or in the field of logistics and product verification and traceability. Bubi Blockchain pointed out that at present, more technologies of Bubi are focused on commercial-level blockchain technology support services, which specifically include three areas. First, the field of digital assets includes other data besides common points and check-in cards. The second is the field of trade finance; the third is the field of equity, which improves the convenience of equity transactions.
请参阅图1,图1为本发明实施例提供的区块链记账方法的流程示意图。Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a blockchain bookkeeping method provided by an embodiment of the present invention.
如图1所示,该方法可以包括以下步骤:As shown in Figure 1, the method may include the following steps:
步骤11,当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值。Step 11, when a new bookkeeping node joins the blockchain to which the bookkeeping node belongs, determine the hash value corresponding to the blockchain identifier of each bookkeeping node.
在本步骤中,当有新记账节点加入由记账节点们组成的私有区块链中时,各记账节点均需要确定各记账节点的区块链标识对应的哈希值。In this step, when a new bookkeeping node is added to the private blockchain composed of bookkeeping nodes, each bookkeeping node needs to determine the hash value corresponding to the blockchain identifier of each bookkeeping node.
步骤12,根据各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,排序列表包括区块链中各记账节点区块链标识对应的哈希值的序列。Step 12: Update the locally stored sorted list according to the hash values corresponding to the blockchain identifiers of each accounting node, and the sorted list includes a sequence of hash values corresponding to the blockchain identifiers of each accounting node in the blockchain.
在本步骤中,当有新记账节点加入由记账节点们组成的私有区块链中时,各记账节点均需要以各记账节点的区块链标识对应的哈希值为依据更新自己内部保存的排序列表,排序列表中可以按照哈希值从大到小的顺序将各记账节点进行排序。In this step, when a new bookkeeping node joins the private blockchain composed of bookkeeping nodes, each bookkeeping node needs to be updated based on the hash value corresponding to the blockchain identifier of each bookkeeping node In the sorted list saved internally, each bookkeeping node can be sorted according to the order of hash value from large to small.
步骤13,根据排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。Step 13, pass the token to the corresponding bookkeeping node according to the sorted list, so that the bookkeeping node currently holding the token generates a new block.
在本步骤中,可以采取令牌传递的方式来决定各记账节点生成新区块的顺序。各记账节点可以根据排序列表来确定当自己生成新区块之后需要将令牌传递给哪个记账节点,而当前持有令牌的记账节点拥有生成新区块的资格。In this step, token transfer can be adopted to determine the order in which each accounting node generates a new block. Each bookkeeping node can determine which bookkeeping node needs to pass the token to when it generates a new block according to the sorted list, and the bookkeeping node currently holding the token has the qualification to generate a new block.
通过上述步骤11-13可以看出,本发明实施例提供的区块链记账方法,当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值,并根据各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,排序列表包括区块链中各记账节点区块链标识对应的哈希值的序列,根据排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。本发明实施例提供的区块链方法可以使得区块链中的记账节点们无需通过算力竞争去寻找一个满足哈希值的随机数来争夺新区块的记账权,提高了区块链记账效率。It can be seen from the above steps 11-13 that in the block chain bookkeeping method provided by the embodiment of the present invention, when a new bookkeeping node joins the block chain to which the bookkeeping node belongs, the block chain of each bookkeeping node is determined. Identify the corresponding hash value, and update the locally stored sorted list according to the hash value corresponding to the blockchain ID of each bookkeeping node. The sorted list includes the hash value corresponding to the blockchain ID of each bookkeeping node in the blockchain According to the sorted list, the token is passed to the corresponding bookkeeping node, so that the bookkeeping node currently holding the token can generate a new block. The block chain method provided by the embodiment of the present invention can make the bookkeeping nodes in the block chain not need to compete for a random number that satisfies the hash value through computing power competition to compete for the bookkeeping right of the new block, which improves the block chain Bookkeeping efficiency.
如图2所示,在一些实施例中,所述区块链记账方法还可以包括以下步骤:As shown in Figure 2, in some embodiments, the blockchain bookkeeping method may also include the following steps:
步骤21,当有新记账节点加入区块链时,确定新记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差值。Step 21, when a new bookkeeping node joins the blockchain, determine the hash value corresponding to the blockchain ID of the new bookkeeping node and the hash value corresponding to the blockchain ID of the bookkeeping node currently holding the token the difference between.
在本步骤中,当有新记账节点加入由记账节点们组成的私有区块链中时,各记账节点均可以确定该新加入的记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差的绝对值。In this step, when a new bookkeeping node joins the private blockchain composed of bookkeeping nodes, each bookkeeping node can determine the hash value corresponding to the blockchain identifier of the newly added bookkeeping node The absolute value of the difference between the hash values corresponding to the blockchain id of the ledger node currently holding the token.
步骤22,根据差值确定新记账节点参与令牌传递前的等待时间。Step 22, determine the waiting time before the new bookkeeping node participates in token transfer according to the difference.
在本步骤中,各记账节点均可以根据新加入的记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差的绝对值,来确定该新加入的记账节点何时参与到令牌传递。In this step, each bookkeeping node can be based on the difference between the hash value corresponding to the blockchain ID of the newly added bookkeeping node and the hash value corresponding to the blockchain ID of the bookkeeping node currently holding the token. The absolute value of the difference to determine when the newly added bookkeeping node participates in the token transfer.
通过上述步骤21-22可以看出,本发明实施例提供的区块链记账方法,当有新记账节点加入区块链时,确定新记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差值,根据差值确定新记账节点参与令牌传递前的等待时间。本发明实施例提供的区块链方法可以使得新加入区块链中的记账节点也可以有序参与令牌传递进而等待拥有新区块的记账权。As can be seen from the above steps 21-22, the block chain bookkeeping method provided by the embodiment of the present invention, when a new bookkeeping node joins the block chain, determine the hash value corresponding to the block chain identification of the new bookkeeping node The difference between the hash values corresponding to the block chain identification of the bookkeeping node currently holding the token, and determine the waiting time before the new bookkeeping node participates in the token transfer according to the difference. The block chain method provided by the embodiment of the present invention can enable the bookkeeping nodes newly added to the block chain to participate in the token transfer in an orderly manner and wait for the bookkeeping right of the new block.
在一些实施例中,等待时间为标准时间的倍数,标准时间为令牌从一个记账节点传递至另一个记账节点的时间。In some embodiments, the waiting time is a multiple of a standard time, which is the time it takes for a token to pass from one accounting node to another accounting node.
在本实施例中,当有新记账节点加入由记账节点们组成的私有区块链中时,各记账节点可以根据该新加入的记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差的绝对值,来确定该新加入的记账节点参与到令牌传递前的等待时间是标准时间的几倍,其中,标准时间可以为令牌从一个记账节点传递至另一个记账节点的时间。In this embodiment, when a new bookkeeping node is added to the private blockchain composed of bookkeeping nodes, each bookkeeping node can identify the corresponding hash value according to the blockchain identification of the newly added bookkeeping node The absolute value of the difference between the hash values corresponding to the blockchain identification of the accounting node currently holding the token is used to determine that the waiting time before the newly added accounting node participates in the token transfer is the standard time Several times, where the standard time can be the time for the token to pass from one ledger node to another ledger node.
在一些实施例中,所述区块链记账方法可以包括以下步骤:当本记账节点当前持有令牌时,若检测到本记账节点生成的新区块涉及到的智能合约中出现整数溢出,则停止执行资金类交易的转账操作,并在区块链中广播第一广播消息,第一广播消息携带智能合约双方的标识、智能合约的编号和整数溢出报警标识。In some embodiments, the blockchain bookkeeping method may include the following steps: when the bookkeeping node currently holds the token, if it is detected that an integer appears in the smart contract involved in the new block generated by the bookkeeping node overflow, the transfer operation of capital transactions will be stopped, and the first broadcast message will be broadcast in the blockchain. The first broadcast message will carry the identification of both parties to the smart contract, the number of the smart contract, and the integer overflow alarm identification.
由记账节点们组成的私有区块链中,各记账节点均可以在内部设置一个整数溢出检测模块,该模块主要用于检查在本区块链中产生的新区块中里涉及到的智能合约中的是否存在整数溢出。因为智能合约中的整数变量会有相应的最大值和最小值,一旦变量所存储的值超过了最大值就会发生整数上溢错误,导致变量最后存储的值为0,反之则是整数下溢错误,变量最后存储的值为变量最大值。当然,溢出的情况并不限于整数上溢或者整数下溢,还可能会在计算、转换等过程中发生溢出。智能合约中的余额,通常由无符号整数表示,通常有256比特数字。当无符号整数下溢或上溢时,它们的值立马就改变了。In the private blockchain composed of bookkeeping nodes, each bookkeeping node can set an integer overflow detection module inside, which is mainly used to check the smart contracts involved in the new blocks generated in the blockchain Whether there is an integer overflow in . Because the integer variables in the smart contract have corresponding maximum and minimum values, once the value stored in the variable exceeds the maximum value, an integer overflow error will occur, resulting in the last stored value of the variable being 0, otherwise it is an integer underflow Error, the last value stored in the variable is the maximum value of the variable. Of course, the situation of overflow is not limited to integer overflow or integer underflow, overflow may also occur in the process of calculation, conversion, etc. Balances in smart contracts, usually represented by unsigned integers, usually 256-bit numbers. When unsigned integers underflow or overflow, their values change immediately.
当令牌轮到自己生成新区块的时候,记账节点中的检测模块检测每次自己生成的新区块里面涉及到的智能合约是否存在整数下溢或上溢,即智能合约涉及到的交易更新的状态是否在字节阈值范围内。如果超过了阈值范围,则记账节点对该智能合约所涉及到的资金类交易立即停止执行转账,再进行整数溢出报警操作,具体的,该记账节点使用自己的私钥对本次新区块所涉及到的智能合约双方的标识、智能合约编号和整数溢出报警标识进行签名,然后将包括了这些信息的第一广播消息广播到区块链网络中。When it is the turn of the token to generate a new block, the detection module in the bookkeeping node detects whether there is an integer underflow or overflow in the smart contract involved in each new block generated by itself, that is, the transaction update involved in the smart contract Whether the status of is within the byte threshold. If it exceeds the threshold range, the bookkeeping node will immediately stop the transfer of capital transactions involved in the smart contract, and then perform an integer overflow alarm operation. Specifically, the bookkeeping node uses its own private key to update the new block The identifications of the two parties involved in the smart contract, the smart contract number and the integer overflow alarm identification are signed, and then the first broadcast message including these information is broadcast to the block chain network.
在一些实施例中,区块链记账方法可以包括以下步骤:当本记账节点当前未持有令牌时,若检测到区块链中其他记账节点发布的新区块涉及到的智能合约中出现整数溢出,且未接收到其他记账节点广播的第一广播消息,则在区块链中广播第二广播消息,第二广播消息携带其他记账节点发布的新区块作废的消息、智能合约双方的标识、智能合约的编号和整数溢出报警标识。In some embodiments, the blockchain bookkeeping method may include the following steps: when the bookkeeping node does not currently hold a token, if it is detected that the smart contract involved in the new block issued by other bookkeeping nodes in the blockchain Integer overflow occurs in , and the first broadcast message broadcast by other bookkeeping nodes is not received, the second broadcast message is broadcast in the blockchain, and the second broadcast message carries the invalidation message of the new block issued by other bookkeeping nodes. The identification of both parties to the contract, the number of the smart contract and the integer overflow alarm identification.
当令牌没有轮到自己生成新区块的时候,各记账节点的检测模块检测每次自己新收到的广播消息中其他记账节点发布的新区块里面是否涉及到智能合约中是否存在整数下溢或上溢,如果发现了该其他记账节点发布的新区块中涉及到的智能合约的交易更新的状态超过了阈值范围,而该其他记账节点没有发送报警操作的广播消息,那么本记账节点不承认该新区块的合法性,并且使用自己的私钥对本次新区块作废的消息、本次新区块所涉及到的智能合约双方的标识、智能合约编号和整数溢出报警标识进行签名,然后将包括了这些信息的第二广播消息广播到区块链网络中。When the token is not its turn to generate a new block, the detection module of each bookkeeping node detects whether the new block released by other bookkeeping nodes in the newly received broadcast message involves whether there is an integer sub-block in the smart contract. overflow or overflow, if it is found that the transaction update status of the smart contract involved in the new block issued by the other bookkeeping node exceeds the threshold range, and the other bookkeeping node does not send a broadcast message for alarm operation, then the bookkeeping node The ledger node does not recognize the legitimacy of the new block, and uses its own private key to sign the invalidation message of this new block, the identification of both parties to the smart contract involved in this new block, the smart contract number and the integer overflow alarm identification , and then broadcast the second broadcast message including these information to the block chain network.
本发明实施例通过在各记账节点内部设置整数溢出检测模块,当检测出其他记账节点生成的新区块涉及到的智能合约中出现整数溢出且并未发出第一报警消息时,发出第二报警信息以否认该新区块的合法性,能够保证其他记账节点生成的区块中不会由于整数溢出而带来资产损失,提升了用户体验和区块链交易的安全性,促进了区块链技术的发展。In the embodiment of the present invention, by setting an integer overflow detection module inside each accounting node, when it is detected that an integer overflow occurs in the smart contract involved in a new block generated by other accounting nodes and the first alarm message is not issued, a second alarm message is issued. Alarm information to deny the legitimacy of the new block can ensure that the blocks generated by other bookkeeping nodes will not cause asset loss due to integer overflow, which improves the user experience and the security of blockchain transactions, and promotes the block The development of chain technology.
基于相同的发明构思,本发明实施例还提供了一种记账节点,应用于区块链记账。Based on the same inventive concept, an embodiment of the present invention also provides an accounting node, which is applied to blockchain accounting.
请参阅图3,图3为本发明实施例提供的一种记账节点的模块示意图。Please refer to FIG. 3 . FIG. 3 is a schematic diagram of modules of an accounting node provided by an embodiment of the present invention.
如图3所示,该点评装置可以包括第一处理模块100、更新模块200和传递模块300。As shown in FIG. 3 , the evaluation device may include a
第一处理模块100用于,当有新记账节点加入本记账节点所属的区块链时,确定各记账节点的区块链标识对应的哈希值。The
更新模块200用于,根据各记账节点的区块链标识对应的哈希值更新本地存储的排序列表,排序列表包括区块链中各记账节点区块链标识对应的哈希值的序列。The
传递模块300用于,根据排序列表将令牌传递给对应的记账节点,以使当前持有令牌的记账节点生成新区块。The
在一些实施例中,第一处理模块100还用于:当有新记账节点加入区块链时,确定新记账节点的区块链标识对应的哈希值与当前持有令牌的记账节点的区块链标识对应的哈希值之间的差值,并根据差值确定新记账节点参与令牌传递前的等待时间。In some embodiments, the
在一些实施例中,等待时间可以为标准时间的倍数,标准时间可以为令牌从一个记账节点传递至另一个记账节点的时间。In some embodiments, the waiting time may be a multiple of a standard time, which may be the time it takes for a token to pass from one accounting node to another accounting node.
在一些实施例中,如图4所示,记账节点还可以包括第二处理模块400。In some embodiments, as shown in FIG. 4 , the billing node may further include a
第二处理模块400用于,当本记账节点当前持有令牌时,若检测到本记账节点生成的新区块涉及到的智能合约中出现整数溢出,则停止执行资金类交易的转账操作,并在区块链中广播第一广播消息,第一广播消息携带智能合约双方的标识、智能合约的编号和整数溢出报警标识。The
在一些实施例中,第二处理模块400还用于,当本记账节点当前未持有令牌时,若检测到区块链中其他记账节点发布的新区块涉及到的智能合约中出现整数溢出,且未接收到其他记账节点广播的第一广播消息,则在区块链中广播第二广播消息,第二广播消息携带其他记账节点发布的新区块作废的消息、智能合约双方的标识、智能合约的编号和整数溢出报警标识。In some embodiments, the
可以理解的是,以上实施方式仅仅是为了说明本发明的原理而采用的示例性实施方式,然而本发明并不局限于此。对于本领域内的普通技术人员而言,在不脱离本发明的精神和实质的情况下,可以做出各种变型和改进,这些变型和改进也视为本发明的保护范围。It can be understood that, the above embodiments are only exemplary embodiments adopted for illustrating the principle of the present invention, but the present invention is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also regarded as the protection scope of the present invention.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010412219.8A CN111597264B (en) | 2020-05-15 | 2020-05-15 | A blockchain bookkeeping method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010412219.8A CN111597264B (en) | 2020-05-15 | 2020-05-15 | A blockchain bookkeeping method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111597264A CN111597264A (en) | 2020-08-28 |
| CN111597264B true CN111597264B (en) | 2023-06-23 |
Family
ID=72190911
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010412219.8A Active CN111597264B (en) | 2020-05-15 | 2020-05-15 | A blockchain bookkeeping method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111597264B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112162770B (en) * | 2020-10-20 | 2023-11-10 | 深圳技术大学 | Firmware version upgrading method and device for realizing integrity verification based on block chain |
| CN112927078B (en) * | 2021-03-03 | 2025-04-18 | 中交(厦门)电子商务有限公司 | Blockchain financial big data analysis and processing system and method and transaction platform system |
| CN114666043B (en) * | 2022-03-04 | 2024-09-10 | 江苏梦想物联有限公司 | Method for generating billing person by using difference probability consensus algorithm of block chain |
Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107566124A (en) * | 2017-08-24 | 2018-01-09 | 深圳市易成自动驾驶技术有限公司 | Common recognition method for building up, block catenary system and storage medium based on lottery mechanism |
| CN108259235A (en) * | 2018-01-04 | 2018-07-06 | 杭州复杂美科技有限公司 | A kind of block chain accounting nodes selection method |
| CN108596621A (en) * | 2018-04-28 | 2018-09-28 | 深圳市优学链科技有限公司 | Block chain accounting nodes generation method, device, computer equipment and storage medium |
| CN109039648A (en) * | 2018-08-03 | 2018-12-18 | 克洛斯比尔有限公司 | A kind of creation method, equipment and the readable storage medium storing program for executing of block chain |
| CN109102287A (en) * | 2018-08-13 | 2018-12-28 | 中国联合网络通信集团有限公司 | Block chain bookkeeping methods, device, equipment and storage medium |
| CN109146484A (en) * | 2018-08-31 | 2019-01-04 | 深圳付贝科技有限公司 | Common recognition verification method, digging mine machine and block catenary system based on block chain |
| CN109525648A (en) * | 2018-10-26 | 2019-03-26 | 全链通有限公司 | Block chain common recognition mechanism, equipment and computer readable storage medium |
| CN110471953A (en) * | 2018-12-07 | 2019-11-19 | 深圳市智税链科技有限公司 | Method, agent node and the medium of accounting nodes are determined in block chain network |
| WO2020042586A1 (en) * | 2018-08-27 | 2020-03-05 | 深圳前海益链网络科技有限公司 | Method and apparatus for generating address of smart contract, computer device, and readable storage medium |
| CN110868386A (en) * | 2019-05-17 | 2020-03-06 | 北京安妮全版权科技发展有限公司 | Block chain consensus method |
| CN111147229A (en) * | 2019-12-30 | 2020-05-12 | 山东爱城市网信息技术有限公司 | Consensus method and device with block hash to be generated as seed and medium |
-
2020
- 2020-05-15 CN CN202010412219.8A patent/CN111597264B/en active Active
Patent Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107566124A (en) * | 2017-08-24 | 2018-01-09 | 深圳市易成自动驾驶技术有限公司 | Common recognition method for building up, block catenary system and storage medium based on lottery mechanism |
| CN108259235A (en) * | 2018-01-04 | 2018-07-06 | 杭州复杂美科技有限公司 | A kind of block chain accounting nodes selection method |
| CN108596621A (en) * | 2018-04-28 | 2018-09-28 | 深圳市优学链科技有限公司 | Block chain accounting nodes generation method, device, computer equipment and storage medium |
| CN109039648A (en) * | 2018-08-03 | 2018-12-18 | 克洛斯比尔有限公司 | A kind of creation method, equipment and the readable storage medium storing program for executing of block chain |
| CN109102287A (en) * | 2018-08-13 | 2018-12-28 | 中国联合网络通信集团有限公司 | Block chain bookkeeping methods, device, equipment and storage medium |
| WO2020042586A1 (en) * | 2018-08-27 | 2020-03-05 | 深圳前海益链网络科技有限公司 | Method and apparatus for generating address of smart contract, computer device, and readable storage medium |
| CN109146484A (en) * | 2018-08-31 | 2019-01-04 | 深圳付贝科技有限公司 | Common recognition verification method, digging mine machine and block catenary system based on block chain |
| CN109525648A (en) * | 2018-10-26 | 2019-03-26 | 全链通有限公司 | Block chain common recognition mechanism, equipment and computer readable storage medium |
| CN110471953A (en) * | 2018-12-07 | 2019-11-19 | 深圳市智税链科技有限公司 | Method, agent node and the medium of accounting nodes are determined in block chain network |
| CN110868386A (en) * | 2019-05-17 | 2020-03-06 | 北京安妮全版权科技发展有限公司 | Block chain consensus method |
| CN111147229A (en) * | 2019-12-30 | 2020-05-12 | 山东爱城市网信息技术有限公司 | Consensus method and device with block hash to be generated as seed and medium |
Non-Patent Citations (2)
| Title |
|---|
| "Decentration Transaction Method Based on Blockchain Technology";Qi Liu等;《2018 International Conference on Intelligent Transportation, Big Data & Smart City (ICITBS)》;20180409;全文 * |
| "区块链共识机制之POW算法";程瑤等;《数字通信世界》;20190301;全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111597264A (en) | 2020-08-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11544794B2 (en) | Claim settlement method and apparatus employing blockchain technology | |
| CN109685486B (en) | Block chain technology-based aggregation chain architecture | |
| US20180365688A1 (en) | Transaction execution and validation in a blockchain | |
| CN111199481B (en) | Distributed trading network based on asynchronous directed acyclic graph | |
| CN111597264B (en) | A blockchain bookkeeping method and device | |
| CN111144859B (en) | Virtual resource transfer method and device, computer equipment and storage medium | |
| US20200134719A1 (en) | Distributed ledger implementation for entity formation and monitoring system | |
| CN108335206A (en) | Assets management method and device, electronic equipment | |
| CN108335207A (en) | Assets management method and device, electronic equipment | |
| CN110020936A (en) | Asset management method and device based on block chain and electronic equipment | |
| CN111260421B (en) | A blockchain-based electronic invoice control method and device | |
| CN109886695A (en) | Information sharing method and device and electronic equipment between different blocks chain | |
| CN110610424A (en) | Account system, service terminal, transaction management method and system, device and medium | |
| CN112491900A (en) | Abnormal node identification method, device, equipment and medium | |
| CN111047310A (en) | Method and device for realizing distribution and transfer of digital assets and online financing | |
| CN111597269A (en) | Block chain-based contract implementation method, device and equipment | |
| CN114328666A (en) | Alliance chain cross-chain distributed treatment method and device and server | |
| CN115471368A (en) | Intellectual property trading method and system based on block chain and intelligent contract | |
| Chen et al. | A Comprehensive Survey of Blockchain Scalability: Shaping Inner-Chain and Inter-Chain Perspectives | |
| WO2022068665A1 (en) | Method for data communication and electronic device | |
| JP2025531835A (en) | Blockchain-based token protocol | |
| Liu et al. | Big data security and international settlement system of electronic economy based on blockchain | |
| CN111260364A (en) | Extensible quick payment method and system based on block chain | |
| CN115150092B (en) | Method and device for creating service sub-chain, electronic equipment and computer storage medium | |
| AU2021100212A4 (en) | CWCP- Multi-Branched Blockchain Rules: Creating A Multi-Branched Blockchain with Configurable Protocol Rules |
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 |