+

CN108616363A - A kind of book keeping operation power confirmation method, device and computer storage media - Google Patents

A kind of book keeping operation power confirmation method, device and computer storage media Download PDF

Info

Publication number
CN108616363A
CN108616363A CN201810450001.4A CN201810450001A CN108616363A CN 108616363 A CN108616363 A CN 108616363A CN 201810450001 A CN201810450001 A CN 201810450001A CN 108616363 A CN108616363 A CN 108616363A
Authority
CN
China
Prior art keywords
random
node
value
preset
mapping value
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.)
Granted
Application number
CN201810450001.4A
Other languages
Chinese (zh)
Other versions
CN108616363B (en
Inventor
胡宇光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201810450001.4A priority Critical patent/CN108616363B/en
Publication of CN108616363A publication Critical patent/CN108616363A/en
Application granted granted Critical
Publication of CN108616363B publication Critical patent/CN108616363B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION 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/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/56Financial cryptography, e.g. electronic payment or e-cash

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Economics (AREA)
  • Development 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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Storage Device Security (AREA)

Abstract

本发明例公开一种记账权确认方法、装置及计算机存储介质,能够有效节约资源,提高记账权分配的公平性。该方法包括:在产生新区块情况下,确定挑战值;发送控制信息至参与竞争记账权的第二节点,控制信息用于指示第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在闲置存储空间,第二节点从闲置存储空间中确定出与挑战值距离最小的随机映射值对应的随机关键字;在获得全网参与竞争记账权的M个第二节点反馈的竞争信息后,基于M个竞争信息,从M个第二节点中确定目标节点,确定目标节点获得新区块的记账权,每个竞争信息至少包括所属的第二节点的闲置存空间中与挑战值距离最小的随机映射值对应的随机关键字。

The example of the invention discloses a method, device and computer storage medium for confirming bookkeeping rights, which can effectively save resources and improve the fairness of bookkeeping right distribution. The method includes: in the case of generating a new block, determining the challenge value; sending control information to the second node participating in the competition for accounting rights, and the control information is used to instruct the second node to generate a random key corresponding to a random key based on a preset one-way function. After the mapping value is stored in the idle storage space with a corresponding relationship, the second node determines the random key corresponding to the random mapping value with the smallest distance from the challenge value from the idle storage space; After the competition information fed back by the second node, based on the M competition information, the target node is determined from the M second nodes, and the target node is determined to obtain the accounting right of the new block. Each competition information includes at least the idle time of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the storage space.

Description

一种记账权确认方法、装置及计算机存储介质Method, device and computer storage medium for confirming bookkeeping right

技术领域technical field

本发明涉及区块链技术领域,尤其涉及一种记账权确认方法、装置及计算机存储介质。The present invention relates to the technical field of block chains, in particular to a method, device and computer storage medium for confirming bookkeeping rights.

背景技术Background technique

区块链是当下的热点和引领未来的趋势,区块链技术,也被称之为分布式账本技术,是一种互联网数据库技术,因为其具有去中心化、公开透明,每个人均可参与数据库记录,信息不可伪造和篡改的特点,非常适合现代信息化管理领域。区块链中,去中心化是通过全网节点参与竞争获得新区块的记账权,现有技术中,通常采用区块链共识机制包括:POW(Proof of Work,工作证明)、POS(Proof of Stake,股权证明)、DPOS(Delegated Proofof Stake,委任权益证明)等方式去确认记账权的归属,POW所消耗的资源较多,POS与DPOS存在记账权分配不公问题,所以,现有技术中的记账权确认方式存在资源浪费或分配不公平的问题。Blockchain is the current hot spot and leading the future trend. Blockchain technology, also known as distributed ledger technology, is an Internet database technology. Because of its decentralization, openness and transparency, everyone can participate The characteristics of database records and information that cannot be forged and tampered are very suitable for the field of modern information management. In the blockchain, decentralization is to obtain the bookkeeping rights of new blocks by participating in the competition of the nodes of the whole network. In the existing technology, the consensus mechanism of the blockchain is usually adopted, including: POW (Proof of Work, proof of work), POS (Proof of Work) of Stake, DPOS (Delegated Proof of Stake, delegated Proof of Stake) and other methods to confirm the ownership of bookkeeping rights, POW consumes more resources, and POS and DPOS have the problem of unfair distribution of bookkeeping rights. Therefore, the existing There are problems of waste of resources or unfair distribution in the way of confirmation of bookkeeping rights in technology.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的记账权确认方法、装置及计算机存储介质。In view of the above problems, the present invention is proposed to provide an accounting right confirmation method, device and computer storage medium that overcome the above problems or at least partially solve the above problems.

第一方面,本申请提供一种记账权确认方法,应用于第一节点,包括:In the first aspect, this application provides a method for confirming bookkeeping rights, which is applied to the first node, including:

在产生新区块情况下,确定挑战值;In the case of generating a new block, determine the challenge value;

发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;Send control information to the second node participating in the competition for accounting rights, the control information is used to instruct the second node to generate a random mapping value corresponding to the random keyword based on a preset one-way function, and store it in the corresponding relationship in the The free storage space of the second node, so that after the free storage space of the second node is filled, the second node determines from the free storage space that the random mapping value with the smallest distance from the challenge value corresponds to random keywords for ;

在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。After obtaining the competition information fed back by the M second nodes participating in the competing bookkeeping rights in the entire network based on the challenge value, a total of M competition information is obtained, and based on the M competition information, from the M second nodes Determine the target node, determine that the target node obtains the bookkeeping right of the new block, wherein each of the M pieces of competition information includes at least the challenge value in the idle storage space of the second node to which it belongs The random key corresponding to the random mapping value with the smallest distance, M is an integer greater than 1.

可选的,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。Optionally, the length of the mapping value generated by the preset one-way function is a first preset length, the length of the defined random key is a second preset length, and the control information is used to indicate that the second node The quotient obtained by dividing the storage amount of the idle storage space by the sum of the first preset length and the second preset length is N, and then generating N random keywords, and using the preset one-way function to generate The N random mapping values corresponding to the N random keywords one by one, storing the N random keywords and the N random mapping values according to the corresponding relationship, and the N random keywords and the N Randomly mapped values can fill up free storage space of the second node.

可选的,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。Optionally, each of the N random keywords includes identification information of the node to which it belongs, a random value, and a preset character string.

可选的,所述确定挑战值,包括:Optionally, the determination of the challenge value includes:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

可选的,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:Optionally, each of the competition information includes only the random key corresponding to the random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs, and based on the M pieces of competition information, from Determining the target node among the M second nodes includes:

基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;Based on the preset one-way function, generate a random mapping value corresponding to a random keyword in each competition information, a total of M random mapping values;

从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。A first random mapping value with the smallest distance from the challenge value is determined from the M random mapping values, and a second node to which the first random keyword corresponding to the first random mapping value belongs is determined as the target node.

可选的,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:Optionally, each piece of competition information includes a random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs and a random key corresponding to the random mapping value, and the M The competition information, determining the target node from the M second nodes, includes:

从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。A second random mapping value with the smallest distance to the challenge value is determined from the M random mapping values corresponding to the M pieces of competition information one-to-one, and the second node to which the second random mapping value belongs is determined as the target node.

可选的,所述确定所述第二随机映射值所属的第二节点为目标节点,包括:Optionally, the determining that the second node to which the second random mapping value belongs is the target node includes:

基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;Verifying the second random mapping value based on a second random key corresponding to the second random mapping value;

如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。If the verification passes, it is determined that the second node to which the second random mapping value belongs is the target node.

可选的,所述基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证,包括:Optionally, the verifying the second random mapping value based on the second random key corresponding to the second random mapping value includes:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

可选的,所述确定所述目标节点获得所述新区块的记账权,包括:Optionally, the determining that the target node obtains the bookkeeping right of the new block includes:

基于预设共识算法,获取全网节点对所述目标节点的反馈意见;Based on the preset consensus algorithm, obtain feedback from the nodes of the entire network to the target node;

如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。If the obtained feedback satisfies the preset condition, it is determined that the target node obtains the bookkeeping right of the new block.

第二方面,本申请提供一种记账权确认装置,应用于第一节点,所述装置包括:In a second aspect, the present application provides an accounting right confirmation device, which is applied to the first node, and the device includes:

第一确定单元,用于在产生新区块情况下,确定挑战值;The first determination unit is used to determine the challenge value when a new block is generated;

发送单元,用于发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;A sending unit, configured to send control information to a second node participating in the competition for accounting rights, where the control information is used to instruct the second node to generate a random mapping value corresponding to a random keyword based on a preset one-way function, and then use the corresponding The relationship is saved in the idle storage space of the second node, so that after the idle storage space of the second node is filled, the second node determines from the idle storage space that the distance from the challenge value is the smallest The random key corresponding to the random mapping value of ;

第二确定单元,用于在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。The second determining unit is configured to obtain a total of M pieces of competition information based on the competition information fed back by the M second nodes participating in the competing bookkeeping rights of the entire network based on the challenge value, and based on the M pieces of competition information, from all Determine the target node among the M second nodes, and determine that the target node obtains the accounting right of the new block, wherein each of the M competition information includes at least the idle memory of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the space, M is an integer greater than 1.

可选的,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。Optionally, the length of the mapping value generated by the preset one-way function is a first preset length, the length of the defined random key is a second preset length, and the control information is used to indicate that the second node The quotient obtained by dividing the storage amount of the idle storage space by the sum of the first preset length and the second preset length is N, and then generating N random keywords, and using the preset one-way function to generate The N random mapping values corresponding to the N random keywords one by one, storing the N random keywords and the N random mapping values according to the corresponding relationship, and the N random keywords and the N Randomly mapped values can fill up free storage space of the second node.

可选的,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。Optionally, each of the N random keywords includes identification information of the node to which it belongs, a random value, and a preset character string.

可选的,所述确定挑战值,包括:Optionally, the determination of the challenge value includes:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

可选的,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述第二确定单元包括:Optionally, each piece of competition information only includes a random key corresponding to the random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs, and the second determining unit includes:

第一生成模块,用于基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;The first generation module is configured to generate a random mapping value corresponding to a random keyword in each competition information based on the preset one-way function, a total of M random mapping values;

第一确定模块,用于从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。The first determining module is configured to determine the first random mapping value with the smallest distance from the challenge value from the M random mapping values, and determine the first random mapping value to which the first random key corresponding to the first random mapping value belongs. The second node is the target node.

可选的,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述第二确定单元包括:Optionally, each piece of competition information includes a random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs and a random key corresponding to the random mapping value, and the second determination unit includes :

第二确定模块,用于从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。The second determining module is configured to determine the second random mapping value with the smallest distance from the challenge value from the M random mapping values corresponding to the M pieces of competition information one-to-one, and determine the location to which the second random mapping value belongs. The second node is the target node.

可选的,所述第二确定模块包括:Optionally, the second determination module includes:

验证子模块,用于基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;A verification submodule, configured to verify the second random mapping value based on the second random key corresponding to the second random mapping value;

确定子模块,用于如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。The determining submodule is configured to determine that the second node to which the second random mapping value belongs is the target node if the verification is passed.

可选的,所述验证子模块具体用于:Optionally, the verification submodule is specifically used for:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

可选的,所述第二确定单元包括:Optionally, the second determination unit includes:

获取模块,用于基于预设共识算法,获取全网节点对所述目标节点的反馈意见;An acquisition module, configured to acquire feedback from nodes on the entire network to the target node based on a preset consensus algorithm;

第三确定模块,用于如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。The third determining module is configured to determine that the target node obtains the bookkeeping right of the new block if the obtained feedback satisfies a preset condition.

第三方面,本申请提供一种记账权确认装置,应用于第一节点,所述装置包括处理器和存储器:所述存储器用于存储执行前述第一方面所述记账权确认方法的程序;所述处理器被配置为用于执行所述存储器中存储的程序。In a third aspect, the present application provides a billing right confirmation device, which is applied to a first node, and the device includes a processor and a memory: the memory is used to store a program for executing the billing right confirmation method described in the aforementioned first aspect ; the processor is configured to execute the program stored in the memory.

第四方面,本申请提供一种计算机存储介质,用于储存为上述记账权确认装置所用的计算机软件指令,其包含用于执行上述方面为记账权确认装置所设计的程序。In a fourth aspect, the present application provides a computer storage medium for storing computer software instructions used by the above-mentioned accounting right confirmation device, which includes a program designed for executing the above-mentioned aspect for the accounting right confirmation device.

本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:The above one or more technical solutions in the embodiments of the present application have at least one or more of the following technical effects:

在本发明实施例的技术方案中,通过提供一种记账权确认方法,应用于第一节点,在产生新区块情况下,确定挑战值,然后发送控制信息至参与竞争记账权的第二节点,控制信息用于指示第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在第二节点的闲置存储空间,以使得第二节点的闲置存储空间被填满后,第二节点从闲置存储空间中确定出与挑战值距离最小的随机映射值对应的随机关键字;在获得全网参与竞争记账权的M个第二节点基于挑战值反馈的竞争信息后,共计获得M个竞争信息,基于M个竞争信息,从M个第二节点中确定目标节点,确定目标节点获得新区块的记账权,其中,M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与挑战值距离最小的随机映射值对应的随机关键字。通过这样的方式,如果第二节点的闲置存储空间越大,那么存储的随机关键字以及与之对应的随机映射值越多,找到与挑战值距离最小的随机映射值的概率越大,越有可能成为记账节点。所以,相较于POW,由于全网所有节点不必全部与新区块进行哈希挑战,能有效节约资源,相较于POS和DPOS,闲置存储空间越大就越有可能获得记账权,而闲置存储空间会随时间变化,所以,记账权归属的节点随时间变化,对于记账权的分配更加公平。In the technical solution of the embodiment of the present invention, by providing a bookkeeping right confirmation method, it is applied to the first node, and in the case of generating a new block, the challenge value is determined, and then the control information is sent to the second node participating in the competition for the bookkeeping right. node, the control information is used to instruct the second node to generate the random mapping value corresponding to the random keyword based on the preset one-way function, and store it in the idle storage space of the second node with a corresponding relationship, so that the idle storage space of the second node is After filling up, the second node determines the random key corresponding to the random mapping value with the smallest distance from the challenge value from the idle storage space; the M second nodes that have obtained the right to participate in the competition bookkeeping of the whole network compete based on the challenge value feedback After information, a total of M competition information is obtained, based on the M competition information, the target node is determined from the M second nodes, and the target node is determined to obtain the accounting right of the new block, wherein each of the M competition information At least including the random key corresponding to the random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs. In this way, if the free storage space of the second node is larger, the more random keywords and corresponding random mapping values are stored, the greater the probability of finding the random mapping value with the smallest distance from the challenge value, and the more May become a bookkeeping node. Therefore, compared with POW, all nodes in the entire network do not have to perform hash challenges with new blocks, which can effectively save resources. Compared with POS and DPOS, the larger the idle storage space, the more likely it is to obtain the right to bookkeeping, and the idle The storage space will change with time, so the node to which the bookkeeping right belongs changes with time, which is more fair for the distribution of bookkeeping rights.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:

图1为本发明第一实施例中的一种记账权确认方法的流程图;Fig. 1 is a flow chart of a method for confirming bookkeeping rights in the first embodiment of the present invention;

图2为本发明第二实施例中的一种记账权确认装置的示意图;FIG. 2 is a schematic diagram of an accounting right confirmation device in a second embodiment of the present invention;

图3为本发明第三实施例中的一种记账权确认装置的示意图。Fig. 3 is a schematic diagram of an accounting right confirmation device in a third embodiment of the present invention.

具体实施方式Detailed ways

本实施例公开一种记账权确认方法、装置及计算机存储介质,能够减少在确定记账权时消耗的资源,提高记账权分配的公平性。该方法包括:在产生新区块情况下,确定挑战值;发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。This embodiment discloses a method, device, and computer storage medium for confirming bookkeeping rights, which can reduce resources consumed when determining bookkeeping rights and improve the fairness of bookkeeping right distribution. The method includes: in the case of generating a new block, determining a challenge value; sending control information to a second node participating in the competition for accounting rights, the control information is used to instruct the second node to generate a random key based on a preset one-way function After the random mapping value corresponding to the word, save it in the idle storage space of the second node with a corresponding relationship, so that after the idle storage space of the second node is filled, the second node starts from the idle storage space Determine the random key corresponding to the random mapping value with the smallest distance from the challenge value; after obtaining the competition information fed back by the M second nodes participating in the competition for bookkeeping rights in the entire network, a total of M Competition information, based on the M pieces of competition information, determine a target node from the M second nodes, and determine that the target node obtains the accounting right of the new block, wherein each of the M pieces of competition information The competition information at least includes a random key corresponding to the random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs, and M is an integer greater than 1.

下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以及实施例中的技术特征可以相互组合。The technical solutions of the present invention will be described in detail below through the drawings and specific examples. It should be understood that the embodiments of the present application and the specific features in the examples are detailed descriptions of the technical solutions of the present application, rather than limitations on the technical solutions of the present application. In the case of no conflict, the embodiments of the present application and the technical features in the embodiments may be combined with each other.

本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.

实施例Example

本发明第一实施例提供一种记账权确认方法,该方法的流程图如图1所示,该记账权确认方法应用于第一节点,该记账权确认方法包括如下步骤:The first embodiment of the present invention provides a method for confirming bookkeeping rights. The flow chart of the method is shown in Figure 1. The method for confirming bookkeeping rights is applied to the first node. The method for confirming bookkeeping rights includes the following steps:

S101:在产生新区块情况下,确定挑战值;S101: In the case of generating a new block, determine the challenge value;

S102:发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;S102: Send control information to the second node participating in the competition for accounting rights, the control information is used to instruct the second node to generate the random mapping value corresponding to the random key based on the preset one-way function, and store it in the corresponding relationship The free storage space of the second node, so that after the free storage space of the second node is filled, the second node determines a random mapping with the smallest distance from the challenge value from the free storage space The random key corresponding to the value;

S103:在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。S103: After obtaining the competition information fed back based on the challenge value by the M second nodes participating in the competing bookkeeping rights of the entire network, a total of M competition information is obtained, and based on the M competition information, from the M second nodes Determine the target node among the nodes, and determine that the target node obtains the bookkeeping right of the new block, wherein each of the M pieces of competition information includes at least the information in the idle storage space of the second node to which it belongs and the The random keyword corresponding to the random mapping value with the smallest challenge value distance, M is an integer greater than 1.

具体的,在本实施例中,记账权确认方法主要应用区块链中的节点,区块链中包括多个节点,节点具体可以为用户电脑,用户手机、路由设备、服务器等等,当然,还可以是其他类型设备,在此,本申请不做限制。本实施例中的第一节点为中心节点,该中心节点为区域链中受全网节点信任的节点,如:服务器。当然,也可以是区块链中的任意一个节点,在此,本申请不做限制。第二节点可以是参与竞争记账权的全网中的任意节点。Specifically, in this embodiment, the bookkeeping right confirmation method is mainly applied to the nodes in the block chain, which includes multiple nodes, and the nodes can specifically be user computers, user mobile phones, routing devices, servers, etc., of course , can also be other types of equipment, which is not limited in this application. The first node in this embodiment is a central node, and the central node is a node trusted by nodes in the entire network in the area chain, such as a server. Of course, it can also be any node in the blockchain, which is not limited in this application. The second node can be any node in the entire network participating in the competition for bookkeeping rights.

在区块链系统中产生一个新区块时,第一节点会将该新区块的相关信息广播至全网所有节点。第一节点还会通过步骤S101确定出一个挑战值,用于基于该挑战值确定该新区块的记账权的归属。具体的,可将该新区块的区块哈希值为所述挑战值;或基于历史区块的数据,采用所述预设单向函数产生挑战值。预设函数可以是哈希函数,当然,还可以是其他将数据转化为固定长度的单向函数,在此,本申请不做限制。When a new block is generated in the blockchain system, the first node will broadcast the relevant information of the new block to all nodes in the entire network. The first node also determines a challenge value through step S101, which is used to determine the ownership of the bookkeeping right of the new block based on the challenge value. Specifically, the block hash value of the new block can be the challenge value; or based on the data of the historical block, the challenge value can be generated by using the preset one-way function. The preset function may be a hash function, and of course, it may also be other one-way functions that convert data into a fixed length, which is not limited in this application.

以预设单向函数为哈希函数为例,可获得新区块的相关数据,采用哈希函数将其转化为区块哈希值,将该新区块的区块哈希值作为挑战值。当然,产生新区块时,新区块记录有上一个区块的区块哈希值,也可将上一个区块的区块哈希值作为挑战值。当然,还可以获得距当前时刻最接近的R个历史区块的相关数据信息,采用哈希函数将其转换为哈希值,将该哈希值作为挑战值。在具体实施过程中,确定挑战值的方式可根据实际需要进行设定,在此,本申请不做限制。Taking the preset one-way function as the hash function as an example, the relevant data of the new block can be obtained, converted into the block hash value by using the hash function, and the block hash value of the new block is used as the challenge value. Of course, when a new block is generated, the new block records the block hash value of the previous block, and the block hash value of the previous block can also be used as the challenge value. Of course, it is also possible to obtain the relevant data information of the R historical blocks closest to the current moment, use a hash function to convert it into a hash value, and use the hash value as the challenge value. In a specific implementation process, the manner of determining the challenge value may be set according to actual needs, which is not limited in this application.

当全网的节点获知产生新区块后,向第一节点申请竞争该新区块的记账权。当第一节点获知全网参与竞争记账权的有M个第二节点后,通过步骤S102向第二节点发送控制信息,用于指示参与竞争记账权的第二节点按指示的规则将自己闲置存储空间填满。When the nodes of the whole network know that a new block is generated, they apply to the first node to compete for the accounting right of the new block. When the first node learns that there are M second nodes participating in the competition for the bookkeeping right in the whole network, it sends control information to the second node through step S102, which is used to instruct the second node participating in the competition for the bookkeeping right to Free storage space fills up.

其中,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。Wherein, the length of the mapping value generated by the preset one-way function is the first preset length, the length of the defined random key is the second preset length, and the control information is used to instruct the second node to obtain an idle N random keywords are generated after dividing the storage capacity of the storage space by the sum of the first preset length and the second preset length to N, and using the preset one-way function to generate N random mapping values corresponding to the N random keywords one-to-one, save the N random keywords and the N random mapping values according to the corresponding relationship, and store the N random keywords and the N random mapping values The value can fill up the free storage space of the second node.

具体的,在本实施例中,第一节点规定第二节点需要采用预设单向函数生成随机关键字对应的随机映射值。如果第二节点的闲置存储空间的存储量为Q,第一节点设定随机关键字占P个字节,预设单向函数生成的映射值占K个字节,则N=Q/(P+K),确定需要生成N个占P个字节的随机关键字,可以指示第二节点采用预设单向函数生产与N个随机关键字一一对应的N个映射值,这样,N个随机关键字与N个映射值所占的存储空间刚好为Q,通过指示第二节点生成N个映射值,保存N个随机关键字与N个映射值后,第二节点的闲置存储空间刚好被填满。Specifically, in this embodiment, the first node specifies that the second node needs to use a preset one-way function to generate a random mapping value corresponding to a random keyword. If the storage capacity of the idle storage space of the second node is Q, the first node sets the random key to occupy P bytes, and the mapping value generated by the preset one-way function occupies K bytes, then N=Q/(P +K), it is determined that N random keywords occupying P bytes need to be generated, and the second node can be instructed to use the preset one-way function to produce N mapping values corresponding to N random keywords one-to-one. In this way, N The storage space occupied by random keywords and N mapping values is exactly Q. By instructing the second node to generate N mapping values and saving N random keywords and N mapping values, the idle storage space of the second node is exactly fill up.

在本实施例中,预设单向函数可以采用哈希函数,生成的映射值为二进制的为第一预设长度的哈希值。当然,还可以采用其他能产生固定长度字符串的单向函数,在此,本申请不做限制。以预设单向函数为哈希函数为例,第二节拥有1T的闲置存储空间。第一节点规定随机关键字占8字节,哈希函数生成的哈希值占32字节,则确定需要产生1T/(32+8)个随机关键字。In this embodiment, the preset one-way function may use a hash function, and the generated mapping value is a binary hash value with a first preset length. Certainly, other one-way functions capable of generating a fixed-length character string may also be used, and this application does not make a limitation here. Taking the preset one-way function as a hash function as an example, the second section has 1T of free storage space. The first node stipulates that the random key occupies 8 bytes, and the hash value generated by the hash function occupies 32 bytes, so it is determined that 1T/(32+8) random keys need to be generated.

进而,在第二节点产生随机关键字时,可以通过但不限于以下两种方式实现:Furthermore, when the second node generates random keywords, it can be realized in but not limited to the following two ways:

第一种方式:获得第二节点的标识信息;生成N个随机值,所述N个随机值互不相同;确定N个随机关键字中每个随机关键字包括所述标识信息、所述N个随机值中的一个随机值以及一个预设字符串,所述每个随机关键字包括的随机值不同。The first way: obtain the identification information of the second node; generate N random values, and the N random values are different from each other; determine that each random key in the N random keys includes the identification information, the N A random value among random values and a preset character string, and each random keyword includes a different random value.

具体的,在本实施例中,第二节点可以生成N个随机值,随机值可以是数字、字符或字符串,在具体实施过程中可根据实际需要进行设定,在此,本申请不做限制。第二节点接收的第一节点发送的控制信息中包括预设字符串,可以确定N个随机关键字中每个随机关键字包括自己的ID、N个随机值中的一个随机值以及一个预设字符串,每个随机关键字包括的随机值不同。在具体实施过程中,预设字符串为一个固定字符串,可根据实际需要进行设定,在此,本申请不做限制。举例来说,如果第二节点生成N个随机值为1、2、……、N,该节点的ID获知,预设字符串为A,则N个随机关键字可以为:ID+1+A、ID+2+A、……、ID+N+A。需要注意的是,N个随机关键字中每个关键字的长度为第二预设长度(如:8字节)。Specifically, in this embodiment, the second node can generate N random values, and the random values can be numbers, characters or character strings, which can be set according to actual needs during the specific implementation process. Here, this application does not limit. The control information sent by the first node received by the second node includes a preset character string, and it can be determined that each random keyword in the N random keywords includes its own ID, a random value in the N random values, and a preset character string. String, each random key includes a different random value. In a specific implementation process, the preset character string is a fixed character string, which can be set according to actual needs, which is not limited in this application. For example, if the second node generates N random values 1, 2, ..., N, the ID of the node is known, and the default character string is A, then the N random keywords can be: ID+1+A , ID+2+A, ..., ID+N+A. It should be noted that the length of each keyword in the N random keywords is a second preset length (for example: 8 bytes).

第二种方式:生成N个随机值,所述N个随机值互不相同;确定N个随机值为N个随机关键字。The second way: generate N random values, and the N random values are different from each other; determine the N random values as N random keywords.

具体的,在本实施例中,可以生成N个随机值,随机值可以是数字、字符或字符串,在具体实施过程中可根据实际需要进行设定,在此,本申请不做限制。第一节点可以直接将生成的N个随机值作为N个随机关键字。举例来说,如果第一节点生成N个随机值为1、2、……、N,则N个随机关键字可以为1、2、……、N。Specifically, in this embodiment, N random values can be generated, and the random values can be numbers, characters or character strings, which can be set according to actual needs during specific implementation, and this application does not make limitations here. The first node may directly use the generated N random values as N random keys. For example, if the first node generates N random values 1, 2, ..., N, then the N random keys may be 1, 2, ..., N.

由于存在上述两种生成N个随机关键字的方式,产生的N个随机关键字组成形式不同,所以,以下分为两种情况介绍。Since there are two methods for generating the N random keywords above, and the generated N random keywords have different composition forms, the following is divided into two situations.

第一种情况,N个随机关键字通过上述第一种方式确定,第二节点直接采用预设单向函数对N个随机关键字进行转换,以预设单向函数为哈希函数为例,沿用前述示例,N个随机关键字可以为:ID+1+A、ID+2+A、……、ID+N+A。则随机关键字ID+1+A通过哈希函数得到对应的哈希值为hashIn the first case, N random keywords are determined by the first method above, and the second node directly uses the preset one-way function to convert the N random keywords. Taking the preset one-way function as a hash function as an example, Following the foregoing example, the N random keywords may be: ID+1+A, ID+2+A, . . . , ID+N+A. Then the random keyword ID+1+A gets the corresponding hash value through the hash function.

(ID+1+A),随机关键字ID+2+A通过哈希函数得到对应的哈希值为hash(ID+1+A), the random keyword ID+2+A gets the corresponding hash value through the hash function

(ID+2+A),以此类推,随机关键字ID+N+A通过哈希函数得到对应的哈希值为hash(ID+N+A)。第二节点在转换得到每个随机关键字对应的哈希值时,会将该随机关键字和对应的哈希值保存起来,如:保存随机关键字ID+1+A与hash(ID+1+A)、随机关键字ID+2+A与hash(ID+2+A)、……、随机关键字ID+N+A与hash(ID+1+A)。(ID+2+A), and so on, the random keyword ID+N+A is obtained through the hash function and the corresponding hash value is hash(ID+N+A). When the second node converts the hash value corresponding to each random keyword, it will save the random keyword and the corresponding hash value, such as: save the random keyword ID+1+A and hash(ID+1 +A), random keyword ID+2+A and hash(ID+2+A), ..., random keyword ID+N+A and hash(ID+1+A).

第二种情况,N个随机关键字通过上述第二种方式确定,控制信息还包括预设字符串,第二节点基于所述随机关键字、预设字符串以及所述第二节点的标识信息确定N个组合随机关键字,并按所述预设单向函数生成与所述N个组合随机关键字中每个组合随机关键字一一对应的映射值,其中,每个所述组合随机关键字中包括所述标识信息、所述N个随机关键字中的一个随机关键字以及所述预设字符串,所述每个组合随机关键字包括的随机关键字不同。In the second case, N random keywords are determined by the second method above, and the control information also includes a preset character string, and the second node is based on the random keyword, the preset character string and the identification information of the second node Determine N combined random keys, and generate a one-to-one mapping value corresponding to each combined random key in the N combined random keys according to the preset one-way function, wherein each of the combined random keys The word includes the identification information, one random keyword among the N random keywords, and the preset character string, and the random keywords included in each combined random keyword are different.

具体的,在本实施例中,第二节点确定出N个随机关键字,如前述示例中的N个随机关键字可以为1、2、……、N。控制信息还可以包括预设字符串,预设字符串为一个固定字符串,可根据实际需要进行设定,在此,本申请不做限制。第二节点生成N个组合随机关键字,每个组合随机关键字包括该第二节点的ID,一个随机关键字和该预设字符串。进而,第二节点采用预设单向函数对N个组合随机关键字进行转换,得到N个组合随机关键字对应的映射值,并按对应关系保存N个随机关键字与N个组合随机关键字对应的映射值。Specifically, in this embodiment, the second node determines N random keywords, for example, the N random keywords in the preceding example may be 1, 2, . . . , N. The control information may also include a preset character string, which is a fixed character string and can be set according to actual needs, which is not limited in this application. The second node generates N combined random keys, and each combined random key includes the ID of the second node, a random key and the preset character string. Furthermore, the second node uses a preset one-way function to convert the N combined random keywords to obtain the mapping values corresponding to the N combined random keywords, and saves the N random keywords and the N combined random keywords according to the corresponding relationship The corresponding mapping value.

举例来说,以预设单向函数为哈希函数为例,沿用前述示例,如果第二节点生成N个随机关键字为1、2、……、N,预设字符串为A,则可得到N个组合随机关键字为ID+1+A、ID+2+A、……、ID+N+A,则组合随机关键字ID+1+A通过哈希函数得到对应的哈希值为hash(ID+1+A),组合随机关键字ID+2+A通过哈希函数得到对应的哈希值为hash(ID+2+A),以此类推,组合随机关键字ID+N+A通过哈希函数得到对应的哈希值为hash(ID+N+A)。第二节点在转换得到每个组合随机关键字对应的哈希值时,会将该组合随机关键字对应的随机关键字与得到的组合随机关键字对应的哈希值保存起来,如:保存随机关键字1与hash(ID+1+A)、随机关键字2与hash(ID+2+A)、……、随机关键字N与hash(ID+1+A)。For example, taking the default one-way function as a hash function as an example, following the previous example, if the second node generates N random keywords as 1, 2, ..., N, and the default string is A, then you can Get N combined random keywords as ID+1+A, ID+2+A, ..., ID+N+A, then the combined random keyword ID+1+A gets the corresponding hash value through the hash function hash(ID+1+A), combine random keyword ID+2+A to get the corresponding hash value through hash function hash(ID+2+A), and so on, combine random keyword ID+N+ A obtains the corresponding hash value as hash(ID+N+A) through the hash function. When the second node converts the hash value corresponding to each combined random key, it will save the random key corresponding to the combined random key and the hash value corresponding to the obtained combined random key, such as: save the random key Keyword 1 and hash (ID+1+A), random keyword 2 and hash (ID+2+A), ..., random keyword N and hash (ID+1+A).

在参与竞争记账权的各个第二节点按控制信息指示的方式填满自己的闲置存储空间后,控制信息还会指示各第二节点从自己的闲置存储空间中存储的随机映射值中确定出一个与挑战值距离最小的随机映射值,由于随机映射值与随机关键字按对应关系存储,还会获得该随机映射值对应的随机关键字。After each second node participating in the competition for bookkeeping rights fills up its own idle storage space according to the control information instruction, the control information will also instruct each second node to determine from the random mapping value stored in its own idle storage space A random mapping value with the smallest distance from the challenge value, since the random mapping value and the random key are stored in a corresponding relationship, the random key corresponding to the random mapping value will also be obtained.

举例来讲,第二节点(i)在按控制信息指示的方式填满自己的闲置存储空间后,从自己的闲置存储空间中存储的随机映射值中获得与挑战值H(T)距离最小的随机映射值H(i),该随机映射值H(i)对应的随机关键字为K(i)。For example, after the second node (i) fills up its free storage space in the manner indicated by the control information, it obtains the value with the smallest distance from the challenge value H(T) from the random mapping values stored in its free storage space A random mapping value H(i), the random key corresponding to the random mapping value H(i) is K(i).

每个第二节点均会反馈一个竞争信息至第一节点,该竞争信息中至少包括其所属的第二节点的闲置存空间中与挑战值距离最小的随机映射值对应的随机关键字。进而,通过步骤S103,接收到全网参与竞争记账权的M个第二节点反馈的竞争信息,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权。Each second node will feed back a competition information to the first node, and the competition information includes at least the random key corresponding to the random mapping value with the smallest distance to the challenge value in the free storage space of the second node to which it belongs. Furthermore, through step S103, competition information fed back by M second nodes participating in the competition for accounting rights in the entire network is received, and a total of M competition information is obtained. Based on the M competition information, from the M second nodes A target node is determined, and it is determined that the target node obtains the bookkeeping right of the new block.

由于第二节点反馈的竞争信息包括的内容不同,确定目标节点的方式不同,具体的,在本实施例中,分以下两种情况进行详细介绍:Since the contents of the competition information fed back by the second node are different, the methods of determining the target node are different. Specifically, in this embodiment, the following two situations are described in detail:

第一种情况:所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。The first case: each competition information only includes the random key corresponding to the random mapping value with the smallest distance from the challenge value in the free storage space of the second node, and based on the preset one-way function, generate The random mapping value corresponding to the random keyword in each competition information, a total of M random mapping values; determine the first random mapping value with the smallest distance from the challenge value from the M random mapping values, and determine the The second node to which the first random key corresponding to the first random mapping value belongs is the target node.

具体的,在本实施例中,第二节点反馈的竞争信息中仅包含了该节点闲置存空间中与挑战值距离最小的随机映射值对应的随机关键字,第一节点还会基于同样的规则,采用预设单向函数生成与每个随机关键字对应的随机映射值,由于存在M个第二节点,共计M个随机映射值。然后从这M个随机映射值中确定出与挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。Specifically, in this embodiment, the competition information fed back by the second node only includes the random key corresponding to the random mapping value with the smallest distance from the challenge value in the idle storage space of the node, and the first node will also , using a preset one-way function to generate a random mapping value corresponding to each random keyword. Since there are M second nodes, there are a total of M random mapping values. Then determine the first random mapping value with the smallest distance from the challenge value from the M random mapping values, and determine the second node to which the first random key corresponding to the first random mapping value belongs as the target node.

举例来讲,以预设单向函数为哈希函数为例,沿用前述示例,第一节点接收M个第二节点反馈的M个随机关键字,包括:K(1)、K(2)、……、K(i)、……、K(M)。K(i)为第i个第二节点反馈的随机关键字。For example, taking the default one-way function as a hash function as an example, following the previous example, the first node receives M random keywords fed back by M second nodes, including: K(1), K(2), ..., K(i), ..., K(M). K(i) is a random keyword fed back by the i-th second node.

如果第二节点采用前述第一种方式产生随机关键字,则第一节点通过哈希函数得到上述M个第二节点反馈的M个随机关键字的哈希值,包括:hash[K(1)]、hash[K(2)]、……、hash[K(i)]、……、hash[K(M)]。进而,第一节点确认M个随机映射值中的hash[K(j)](第j个第二节点的随机映射值)与挑战值H(T)距离最小,则将第j个第二节点作为目标节点。If the second node uses the aforementioned first method to generate random keywords, the first node obtains the hash values of the M random keywords fed back by the above-mentioned M second nodes through the hash function, including: hash[K(1) ], hash[K(2)], ..., hash[K(i)], ..., hash[K(M)]. Furthermore, the first node confirms that the distance between hash[K(j)] (the random mapping value of the jth second node) and the challenge value H(T) among the M random mapping values is the smallest, then the jth second node as the target node.

如果第二节点采用前述第二种方式产生随机关键字,预设字符串为A,则第一节点需要按同样的规则获得组合随机关键字,沿用前述示例,包括:ID(1)+K(1)+A、ID(2)+K(2)+A、……、ID(i)+K(i)+A、……、ID(M)+K(M)+A。ID(i)为第i个第二节点的标识。进而,通过哈希函数得到上述M个组合随机关键字的哈希值,包括:hash[ID(1)+K(1)+A]、hash[ID(2)+K(2)+A]、……、hash[ID(i)+K(i)+A]、……、hash[ID(M)+K(M)+A]。进而,第一节点确认M个随机映射值中的hash[ID(j)+K(j)+A](第j个第二节点的随机映射值)与挑战值H(T)距离最小,则将第j个第二节点作为目标节点。If the second node uses the aforementioned second method to generate a random keyword, and the default character string is A, then the first node needs to obtain a combined random keyword according to the same rules, following the previous example, including: ID(1)+K( 1)+A, ID(2)+K(2)+A, ..., ID(i)+K(i)+A, ..., ID(M)+K(M)+A. ID(i) is the identifier of the i-th second node. Furthermore, the hash values of the above M combinations of random keywords are obtained through a hash function, including: hash[ID(1)+K(1)+A], hash[ID(2)+K(2)+A] ,..., hash[ID(i)+K(i)+A],..., hash[ID(M)+K(M)+A]. Furthermore, the first node confirms that hash[ID(j)+K(j)+A] (the random mapping value of the jth second node) among the M random mapping values has the smallest distance from the challenge value H(T), then Take the jth second node as the target node.

如果第二节点的闲置存储空间越大,那么存储的随机关键字以及与之对应的随机映射值越多,找到与挑战值距离最小的随机映射值的概率越大,越有可能成为记账节点。If the free storage space of the second node is larger, the more random keywords and corresponding random mapping values are stored, the greater the probability of finding the random mapping value with the smallest distance from the challenge value, and the more likely it is to become a bookkeeping node .

第二种情况:所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。Case 2: Each competition information includes the random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs and the random key corresponding to the random mapping value. A second random mapping value with the smallest distance to the challenge value is determined from the M random mapping values corresponding to the information one-to-one, and the second node to which the second random mapping value belongs is determined as the target node.

具体的,在本实施例中,第二节点反馈的竞争信息中包含了该节点闲置存空间中与挑战值距离最小的随机映射值对应的随机映射值以及该随机映射值对应的随机关键字,共计获得M个随机映射值。第一节点直接从这M个随机映射值中确定出与挑战值距离最小的第二随机映射值,确定该第二随机映射值所属的第二节点为目标节点。Specifically, in this embodiment, the competition information fed back by the second node includes the random mapping value corresponding to the random mapping value with the smallest distance from the challenge value in the idle storage space of the node and the random key corresponding to the random mapping value, A total of M random mapping values are obtained. The first node directly determines a second random mapping value with the smallest distance from the challenge value from the M random mapping values, and determines that the second node to which the second random mapping value belongs is the target node.

举例来讲,以预设单向函数为哈希函数为例,沿用前述示例,第一节点接收M个第二节点反馈的M个随机关键字以及M个随机映射值,包括:K(1)和H(1)、K(2)和H(2)、……、K(i)和H(i)、……、K(M)和H(M)。K(i)为第i个第二节点反馈的随机关键字,H(i)为第i个第二节点反馈的与K(i)对应的随机映射值。进而,第一节点确认M个随机映射值中的H(j)(第j个第二节点的随机映射值)与挑战值H(T)距离最小,则将第j个第二节点作为目标节点。For example, taking the default one-way function as a hash function as an example, following the previous example, the first node receives M random keys and M random mapping values fed back by M second nodes, including: K(1) and H(1), K(2) and H(2), ..., K(i) and H(i), ..., K(M) and H(M). K(i) is a random key fed back by the i-th second node, and H(i) is a random mapping value corresponding to K(i) fed back by the i-th second node. Furthermore, the first node confirms that the distance between H(j) (the random mapping value of the jth second node) and the challenge value H(T) among the M random mapping values is the smallest, then the jth second node is used as the target node .

由于这样的方式可能存在第二节点作假的情况,如:恶意的第二节点在获知挑战值的情况下,可能会伪造一个随机映射值,该伪造的随机映射值与挑战值距离较小,这样,该第二节点争取到记账权的机率会更大。为了避免这种情况,第一节点还会对确定出的目标节点进行验证,验证可通过如下步骤实现:Due to this method, there may be cases where the second node cheats. For example, when the malicious second node knows the challenge value, it may forge a random mapping value. The distance between the forged random mapping value and the challenge value is small, so that , the probability that the second node will win the bookkeeping right will be greater. In order to avoid this situation, the first node will also verify the determined target node, and the verification can be achieved through the following steps:

基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。其中,所述基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证,包括:基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。Verifying the second random mapping value based on the second random key corresponding to the second random mapping value; if the verification is passed, determining that the second node to which the second random mapping value belongs is the target node. Wherein, the verifying the second random mapping value based on the second random key corresponding to the second random mapping value includes: generating a key corresponding to the second random key based on the preset one-way function The mapping value to be verified corresponding to the word; if the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

具体的,在本实施例中,由于每个第二节点直接反馈了随机映射值和对应的随机关键字,恶意的第二节点可以轻易伪造随机映射值,但随机映射值对应的随机关键字并不能轻易伪造,这是因为随机映射值是按第一节点指示的预设单向函数生成,伪造的随机映射值很难还原得到正确的随机关键字。所以,在确定与挑战值距离最小的第二随机映射值后,获得该第二随机映射值所属的第二节点反馈的与之对应的第二随机关键字,基于前述的预设单向函数,生成与该第二随机关键字对应的待验证映射值,如果该待验证映射值与第二随机映射值一致,确定表明第二随机映射值不是伪造的,确定验证通过。将第二随机映射值所属的第二节点为目标节点。Specifically, in this embodiment, since each second node directly feeds back the random mapping value and the corresponding random key, a malicious second node can easily forge the random mapping value, but the random key corresponding to the random mapping value does not It cannot be easily forged, because the random mapping value is generated according to the preset one-way function indicated by the first node, and it is difficult to restore the forged random mapping value to obtain the correct random key. Therefore, after determining the second random mapping value with the smallest distance from the challenge value, obtain the corresponding second random key fed back by the second node to which the second random mapping value belongs, based on the aforementioned preset one-way function, A mapping value to be verified corresponding to the second random keyword is generated, and if the mapping value to be verified is consistent with the second random mapping value, it is determined that the second random mapping value is not forged, and it is determined that the verification is passed. The second node to which the second random mapping value belongs is the target node.

举例来讲,以预设单向函数为哈希函数为例,沿用前述示例,第一节点确认M个随机映射值中的H(j)(第j个第二节点的随机映射值)与挑战值H(T)距离最小后,获得第j个第二节点反馈的随机关键字为K(j)。For example, taking the preset one-way function as a hash function as an example, following the previous example, the first node confirms that H(j) (the random mapping value of the jth second node) among the M random mapping values is the same as the challenge After the value H(T) has the smallest distance, the random key to obtain feedback from the jth second node is K(j).

如果第二节点采用前述第一种方式产生随机关键字,则第一节点通过哈希函数得到K(j)的哈希值为hash[K(j)],如果H(j)与hash[K(j)]一致,则表明H(j)不是伪造的,确定验证通过,将第j个第二节点作为目标节点。If the second node uses the aforementioned first method to generate a random keyword, then the first node obtains the hash value of K(j) through the hash function as hash[K(j)], if H(j) and hash[K (j)] consistent, it indicates that H(j) is not forged, it is determined that the verification is passed, and the jth second node is used as the target node.

如果第二节点采用前述第二种方式产生随机关键字,则第一节点首先按照同样的规则得到该随机关键字对应组合随机关键字为ID(j)+K(j)+A,其中,ID(j)为第j个第二节点的标识信息,预设字符串为A。则第一节点通过哈希函数得到组合随机关键字为ID(j)+K(j)+A的哈希值为hash[ID(j)+K(j)+A],如果H(j)与hash[ID(j)+K(j)+A]一致,则表明H(j)不是伪造的,确定验证通过,将第j个第二节点作为目标节点。If the second node generates a random key in the aforementioned second way, the first node first obtains the random key corresponding to the combination of random key ID(j)+K(j)+A according to the same rule, where ID (j) is the identification information of the jth second node, and the default character string is A. Then the first node obtains the hash value of the combined random key ID(j)+K(j)+A through the hash function as hash[ID(j)+K(j)+A], if H(j) If it is consistent with hash[ID(j)+K(j)+A], it indicates that H(j) is not forged, it is determined that the verification is passed, and the jth second node is taken as the target node.

进一步,通过步骤S103从M个第二节点确定出目标节点后,还会基于全网节点的意见确定是否将记账权分配给该目标节点。具体可通过如下步骤实现:Further, after the target node is determined from the M second nodes through step S103, it is also determined whether to assign the accounting right to the target node based on the opinions of the nodes in the entire network. Specifically, it can be achieved through the following steps:

基于预设共识算法,获取全网节点对所述目标节点的反馈意见;如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。Based on the preset consensus algorithm, the feedback opinions of the nodes of the whole network to the target node are obtained; if the obtained feedback meets the preset conditions, it is determined that the target node obtains the bookkeeping right of the new block.

具体的,在本实施例中,第一节点确定出的目标节点后,基于预设共识算法,获取全网节点对该目标节点的反馈意见。预设共识算法可以是PBFT(Practical ByzantineFault Tolerance,标准拜占庭容错)、SBFT(Simple Byzantine Fault Tolerance,简单拜占庭容错)等,当然,还可以是其他共识算法,在此,本申请不做限制。以PBFT为例,PBFT可以确保共识过程的安全性与稳定性,共识的时延短,共识效率高,可满足高频交易量的需求。进而通过PBFT算法,首先确定将目标节点作为领导节点,领导节点提供证明信息,如:计算力证明,将证明信息发送至全网其他节点,其他节点对目标节点的反馈意见(投票),如果第一节点接收到的反馈意见满足预设条件,如:投赞成该目标节点获得记账权的票数大于总票数的预设百分比,确定目标节点获得新区块的记账权。Specifically, in this embodiment, after the first node determines the target node, based on the preset consensus algorithm, the feedback opinions of the nodes in the entire network on the target node are obtained. The preset consensus algorithm can be PBFT (Practical Byzantine Fault Tolerance, standard Byzantine Fault Tolerance), SBFT (Simple Byzantine Fault Tolerance, Simple Byzantine Fault Tolerance), etc. Of course, it can also be other consensus algorithms, and this application does not limit it here. Taking PBFT as an example, PBFT can ensure the security and stability of the consensus process, the consensus delay is short, the consensus efficiency is high, and it can meet the needs of high-frequency trading volume. Then through the PBFT algorithm, first determine the target node as the leader node, and the leader node provides proof information, such as: computing power proof, sends the proof information to other nodes in the entire network, and other nodes give feedback (voting) to the target node. The feedback received by a node meets the preset conditions, such as: the number of votes for the target node to obtain the bookkeeping right is greater than the preset percentage of the total number of votes, and the target node is determined to obtain the bookkeeping right of the new block.

通过这样的方式,如果参与记账权竞争的第二节点的闲置存储空间越大,那么存储的随机关键字以及与之对应的随机映射值越多,找到与挑战值距离最小的随机映射值的概率越大,越有可能成为记账节点。所以,相较于POW,由于全网所有节点不必全部与新区块进行哈希挑战,能有效节约资源,相较于POS和DPOS,闲置存储空间越大就越有可能获得记账权,而闲置存储空间会随时间变化,所以,记账权归属的节点随时间变化,对于记账权的分配更加公平。In this way, if the free storage space of the second node participating in the bookkeeping right competition is larger, the more random keywords and corresponding random mapping values are stored, and the method of finding the random mapping value with the smallest distance from the challenge value is The greater the probability, the more likely it is to become a bookkeeping node. Therefore, compared with POW, all nodes in the entire network do not have to perform hash challenges with new blocks, which can effectively save resources. Compared with POS and DPOS, the larger the idle storage space, the more likely it is to obtain the right to bookkeeping, and the idle The storage space will change with time, so the node to which the bookkeeping right belongs changes with time, which is more fair for the distribution of bookkeeping rights.

请参照图2,本发明第二实施例还提供了一种记账权确认装置,应用于第一节点,所述装置包括:Please refer to FIG. 2, the second embodiment of the present invention also provides a billing right confirmation device, which is applied to the first node, and the device includes:

第一确定单元201,用于在产生新区块情况下,确定挑战值;The first determination unit 201 is configured to determine the challenge value when a new block is generated;

发送单元202,用于发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;The sending unit 202 is configured to send control information to the second node participating in the competition for the accounting right, the control information is used to instruct the second node to generate a random mapping value corresponding to the random keyword based on a preset one-way function, and to The corresponding relationship is stored in the idle storage space of the second node, so that after the idle storage space of the second node is filled, the second node determines the distance from the idle storage space to the challenge value The random key corresponding to the smallest random mapping value;

第二确定单元203,用于在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。The second determining unit 203 is configured to obtain a total of M competition information after obtaining the competition information fed back by the M second nodes participating in the competition bookkeeping right of the entire network based on the challenge value, and based on the M competition information, from Determining a target node among the M second nodes, determining that the target node obtains the accounting right of the new block, wherein each of the M competition information includes at least the idle status of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the storage space, M is an integer greater than 1.

作为一种可选的实施例,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。As an optional embodiment, the length of the mapping value generated by the preset one-way function is the first preset length, the length of the defined random key is the second preset length, and the control information is used to indicate The second node generates N random keywords after dividing the storage capacity of the idle storage space by the sum of the first preset length and the second preset length to N, and uses the preset Let the one-way function generate N random mapping values corresponding to the N random keywords one by one, save the N random keywords and the N random mapping values according to the corresponding relationship, and the N random keywords The free storage space of the second node can be filled with the N random mapping values.

作为一种可选的实施例,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。As an optional embodiment, each of the N random keywords includes identification information of the node it belongs to, a random value, and a preset character string.

作为一种可选的实施例,所述确定挑战值,包括:As an optional embodiment, the determination of the challenge value includes:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

作为一种可选的实施例,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述第二确定单元包括:As an optional embodiment, each piece of competition information only includes a random key corresponding to a random mapping value with the smallest distance from the challenge value in the free storage space of the second node to which it belongs, and the second determining unit include:

第一生成模块,用于基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;The first generation module is configured to generate a random mapping value corresponding to a random keyword in each competition information based on the preset one-way function, a total of M random mapping values;

第一确定模块,用于从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。The first determining module is configured to determine the first random mapping value with the smallest distance from the challenge value from the M random mapping values, and determine the first random mapping value to which the first random key corresponding to the first random mapping value belongs. The second node is the target node.

作为一种可选的实施例,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述第二确定单元包括:As an optional embodiment, each competition information includes a random mapping value with the smallest distance from the challenge value in the free memory space of the second node to which it belongs and a random key corresponding to the random mapping value, the The second determination unit includes:

第二确定模块,用于从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。The second determining module is configured to determine the second random mapping value with the smallest distance from the challenge value from the M random mapping values corresponding to the M pieces of competition information one-to-one, and determine the location to which the second random mapping value belongs. The second node is the target node.

作为一种可选的实施例,所述第二确定模块包括:As an optional embodiment, the second determination module includes:

验证子模块,用于基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;A verification submodule, configured to verify the second random mapping value based on the second random key corresponding to the second random mapping value;

确定子模块,用于如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。The determining submodule is configured to determine that the second node to which the second random mapping value belongs is the target node if the verification is passed.

作为一种可选的实施例,所述验证子模块具体用于:As an optional embodiment, the verification submodule is specifically used for:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

作为一种可选的实施例,所述第二确定单元包括:As an optional embodiment, the second determining unit includes:

获取模块,用于基于预设共识算法,获取全网节点对所述目标节点的反馈意见;An acquisition module, configured to acquire feedback from nodes on the entire network to the target node based on a preset consensus algorithm;

第三确定模块,用于如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。The third determining module is configured to determine that the target node obtains the bookkeeping right of the new block if the obtained feedback satisfies a preset condition.

本发明第三实施例还提供了一种记账权确认装置,请参照图3,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。The third embodiment of the present invention also provides a billing right confirmation device, please refer to Figure 3, for the convenience of description, only the parts related to the embodiment of the present invention are shown, for specific technical details not disclosed, please refer to the present invention Examples Methods Section.

图3示出的是与本发明实施例提供的记账权确认装置的部分结构的示意图。该记账权确认装置包括存储器301,所述存储器301用于存储执行前述第一实施例中的记账权确认方法的程序。该记账权确认装置还包括处理器302,与所述存储器301连接,所述处理器302被配置为用于执行所述存储器301中存储的程序。Fig. 3 is a schematic diagram showing a partial structure of the accounting right confirmation device provided by the embodiment of the present invention. The device for confirming the accounting right includes a memory 301, and the memory 301 is used for storing a program for executing the method for confirming the accounting right in the aforementioned first embodiment. The accounting right confirmation device further includes a processor 302 connected to the memory 301 , and the processor 302 is configured to execute a program stored in the memory 301 .

所述处理器302执行所述计算机程序时实现上述第一实施例中记账权确认方法中的步骤。或者,所述处理器执行所述计算机程序时实现上述第二实施例的记账权确认装置中各模块/单元的功能。When the processor 302 executes the computer program, the steps in the method for confirming the accounting right in the above-mentioned first embodiment are realized. Alternatively, when the processor executes the computer program, the functions of each module/unit in the device for confirming the accounting right in the second embodiment above are realized.

示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器中,并由所述处理器执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述计算机装置中的执行过程。例如,所述计算机程序可以被分割成第一确定单元、发送单元、第二确定单元的功能,各单元具体功能如下:Exemplarily, the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory and executed by the processor to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device. For example, the computer program can be divided into the functions of the first determination unit, the sending unit, and the second determination unit, and the specific functions of each unit are as follows:

第一确定单元,用于在产生新区块情况下,确定挑战值;The first determination unit is used to determine the challenge value when a new block is generated;

发送单元,用于发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;A sending unit, configured to send control information to a second node participating in the competition for accounting rights, where the control information is used to instruct the second node to generate a random mapping value corresponding to a random keyword based on a preset one-way function, and then use the corresponding The relationship is saved in the idle storage space of the second node, so that after the idle storage space of the second node is filled, the second node determines from the idle storage space that the distance from the challenge value is the smallest The random key corresponding to the random mapping value of ;

第二确定单元,用于在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。The second determining unit is configured to obtain a total of M pieces of competition information based on the competition information fed back by the M second nodes participating in the competing bookkeeping rights of the entire network based on the challenge value, and based on the M pieces of competition information, from all Determine the target node among the M second nodes, and determine that the target node obtains the accounting right of the new block, wherein each of the M competition information includes at least the idle memory of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the space, M is an integer greater than 1.

所述电子设备可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,所述示意图3仅仅是记账权确认装置的功能部件的示例图,并不构成对记账权确认装置的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述记账权确认装置还可以包括输入输出设备、网络接入设备、总线等。The electronic device may include, but is not limited to, a processor, a memory. Those skilled in the art can understand that the schematic diagram 3 is only an exemplary diagram of the functional components of the billing right confirmation device, and does not constitute a limitation to the billing right confirmation device, and may include more or less components than those shown in the figure, Or combine certain components, or different components, for example, the billing right confirmation device may also include input and output devices, network access devices, buses, and the like.

所称处理器302可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述计算机装置的控制中心,利用各种接口和线路连接整个计算机装置的各个部分。The so-called processor 302 may be a central processing unit (Central Processing Unit, CPU), and may also be other general-purpose processors, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., and the processor is the control center of the computer device, using various interfaces and lines to connect various parts of the entire computer device.

所述存储器301可用于存储所述计算机程序和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现所述计算机装置的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据记账权确认装置的使用所创建的数据(比如音频数据、视频数据等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(SecureDigital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 301 can be used to store the computer programs and/or modules, and the processor realizes the Various functions of computer equipment. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required by a function (such as a sound playback function, an image playback function, etc.) and the like; the storage data area may store Data (such as audio data, video data, etc.) etc. created in accordance with the use of the accounting right confirmation device. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, A flash memory card (Flash Card), at least one magnetic disk storage device, flash memory device, or other volatile solid state storage devices.

在本发明实施例中,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。In the embodiment of the present invention, the length of the mapping value generated by the preset one-way function is the first preset length, the length of the defined random key is the second preset length, and the control information is used to indicate the The second node generates N random keywords after dividing the storage capacity of the idle storage space by the sum of the first preset length and the second preset length to N, and uses the preset order Generate N random mapping values corresponding to the N random keywords one by one to the function, store the N random keywords and the N random mapping values according to the corresponding relationship, and store the N random keywords and the N random mapping values according to the corresponding relationship. The N random mapping values can fill up the idle storage space of the second node.

在本发明实施例中,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。In the embodiment of the present invention, each of the N random keys includes identification information of the node to which it belongs, a random value, and a preset character string.

在本发明实施例中,该处理器302还具有以下功能:In the embodiment of the present invention, the processor 302 also has the following functions:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

在本发明实施例中,该处理器302还具有以下功能:In the embodiment of the present invention, the processor 302 also has the following functions:

在本发明实施例中,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,该处理器302还具有以下功能:In the embodiment of the present invention, each competition information only includes the random key corresponding to the random mapping value with the smallest distance from the challenge value in the free memory space of the second node to which it belongs, and the processor 302 also has the following functions :

基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;Based on the preset one-way function, generate a random mapping value corresponding to a random keyword in each competition information, a total of M random mapping values;

从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。A first random mapping value with the smallest distance from the challenge value is determined from the M random mapping values, and a second node to which the first random keyword corresponding to the first random mapping value belongs is determined as the target node.

在本发明实施例中,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,该处理器302还具有以下功能:In the embodiment of the present invention, each competition information includes a random mapping value with the smallest distance from the challenge value in the free memory space of the second node to which it belongs and a random key corresponding to the random mapping value, and the processor 302 Also has the following functions:

从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。A second random mapping value with the smallest distance to the challenge value is determined from the M random mapping values corresponding to the M pieces of competition information one-to-one, and the second node to which the second random mapping value belongs is determined as the target node.

在本发明实施例中,该处理器302还具有以下功能:In the embodiment of the present invention, the processor 302 also has the following functions:

基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;Verifying the second random mapping value based on a second random key corresponding to the second random mapping value;

如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。If the verification passes, it is determined that the second node to which the second random mapping value belongs is the target node.

在本发明实施例中,该处理器302还具有以下功能:In the embodiment of the present invention, the processor 302 also has the following functions:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

在本发明实施例中,该处理器302还具有以下功能:In the embodiment of the present invention, the processor 302 also has the following functions:

基于预设共识算法,获取全网节点对所述目标节点的反馈意见;Based on the preset consensus algorithm, obtain feedback from the nodes of the entire network to the target node;

如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。If the obtained feedback satisfies the preset condition, it is determined that the target node obtains the bookkeeping right of the new block.

本发明第四实施例提供了一种计算机可读存储介质,其上存储有计算机程序,本发明第二实施例中的所述记账权确认装置集成的功能单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述第一实施例的记账权确认方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The fourth embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. If the integrated functional units of the accounting right confirmation device in the second embodiment of the present invention are implemented in the form of software functional units And when sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention realizes all or part of the process in the method for confirming the accounting right in the first embodiment above, and can also be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer. When the computer program is read from the storage medium, the computer program can realize the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), Random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, computer-readable media Excludes electrical carrier signals and telecommunication signals.

尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

本发明还公开A1、一种记账权确认方法,应用于区块链中的第一节点,包括:The present invention also discloses A1, a method for confirming bookkeeping rights, which is applied to the first node in the blockchain, including:

在产生新区块情况下,确定挑战值;In the case of generating a new block, determine the challenge value;

发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;Send control information to the second node participating in the competition for accounting rights, the control information is used to instruct the second node to generate a random mapping value corresponding to the random keyword based on a preset one-way function, and store it in the corresponding relationship in the The free storage space of the second node, so that after the free storage space of the second node is filled, the second node determines from the free storage space that the random mapping value with the smallest distance from the challenge value corresponds to random keywords for ;

在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。After obtaining the competition information fed back by the M second nodes participating in the competing bookkeeping rights in the entire network based on the challenge value, a total of M competition information is obtained, and based on the M competition information, from the M second nodes Determine the target node, determine that the target node obtains the bookkeeping right of the new block, wherein each of the M pieces of competition information includes at least the challenge value in the idle storage space of the second node to which it belongs The random key corresponding to the random mapping value with the smallest distance, M is an integer greater than 1.

A2、如A1所述的方法,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。A2. The method as described in A1, the length of the mapping value generated by the preset one-way function is the first preset length, the length of the defined random keyword is the second preset length, and the control information is used to indicate The second node generates N random keywords after dividing the storage capacity of the idle storage space by the sum of the first preset length and the second preset length to N, and uses the preset Let the one-way function generate N random mapping values corresponding to the N random keywords one by one, save the N random keywords and the N random mapping values according to the corresponding relationship, and the N random keywords The free storage space of the second node can be filled with the N random mapping values.

A3、如A2所述的方法,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。A3. The method described in A2, wherein each of the N random keywords includes identification information of the node to which it belongs, a random value, and a preset character string.

A4、如A1所述的方法,所述确定挑战值,包括:A4. The method as described in A1, the determination of the challenge value includes:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

A5、如A1所述的方法,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:A5. The method as described in A1, each of the competition information includes only the random key corresponding to the random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs, and the M competition information, determining the target node from the M second nodes, including:

基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;Based on the preset one-way function, generate a random mapping value corresponding to a random keyword in each competition information, a total of M random mapping values;

从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。A first random mapping value with the smallest distance from the challenge value is determined from the M random mapping values, and a second node to which the first random keyword corresponding to the first random mapping value belongs is determined as the target node.

A6、如A1所述的方法,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:A6. The method as described in A1, each of the competition information includes the random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs and the random key corresponding to the random mapping value, the Determining a target node from the M second nodes based on the M pieces of competition information includes:

从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。A second random mapping value with the smallest distance to the challenge value is determined from the M random mapping values corresponding to the M pieces of competition information one-to-one, and the second node to which the second random mapping value belongs is determined as the target node.

A7、如A6所述的方法,所述确定所述第二随机映射值所属的第二节点为目标节点,包括:A7. The method as described in A6, determining that the second node to which the second random mapping value belongs is the target node, including:

基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;Verifying the second random mapping value based on a second random key corresponding to the second random mapping value;

如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。If the verification passes, it is determined that the second node to which the second random mapping value belongs is the target node.

A8、如A7所述的方法,所述基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证,包括:A8. The method as described in A7, wherein the verification of the second random mapping value based on the second random keyword corresponding to the second random mapping value includes:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

A9、如A1所述的方法,所述确定所述目标节点获得所述新区块的记账权,包括:A9. The method as described in A1, the determining that the target node obtains the bookkeeping right of the new block includes:

基于预设共识算法,获取全网节点对所述目标节点的反馈意见;Based on the preset consensus algorithm, obtain feedback from the nodes of the entire network to the target node;

如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。If the obtained feedback satisfies the preset condition, it is determined that the target node obtains the bookkeeping right of the new block.

B10、一种记账权确认装置,应用于第一节点,所述装置包括:B10, a billing right confirmation device, applied to the first node, said device comprising:

第一确定单元,用于在产生新区块情况下,确定挑战值;The first determination unit is used to determine the challenge value when a new block is generated;

发送单元,用于发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;A sending unit, configured to send control information to a second node participating in the competition for accounting rights, where the control information is used to instruct the second node to generate a random mapping value corresponding to a random keyword based on a preset one-way function, and then use the corresponding The relationship is saved in the idle storage space of the second node, so that after the idle storage space of the second node is filled, the second node determines from the idle storage space that the distance from the challenge value is the smallest The random key corresponding to the random mapping value of ;

第二确定单元,用于在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。The second determining unit is configured to obtain a total of M pieces of competition information based on the competition information fed back by the M second nodes participating in the competing bookkeeping rights of the entire network based on the challenge value, and based on the M pieces of competition information, from all Determine the target node among the M second nodes, and determine that the target node obtains the accounting right of the new block, wherein each of the M competition information includes at least the idle memory of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the space, M is an integer greater than 1.

B11、如B10所述的装置,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。B11, the device as described in B10, the length of the mapping value generated by the preset one-way function is the first preset length, the length of the defined random key is the second preset length, and the control information is used to indicate The second node generates N random keywords after dividing the storage capacity of the idle storage space by the sum of the first preset length and the second preset length to N, and uses the preset Let the one-way function generate N random mapping values corresponding to the N random keywords one by one, save the N random keywords and the N random mapping values according to the corresponding relationship, and the N random keywords The free storage space of the second node can be filled with the N random mapping values.

B12、如B11所述的装置,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。B12. The device according to B11, wherein each of the N random keys includes identification information of the node to which it belongs, a random value, and a preset character string.

B13、如B10所述的装置,所述确定挑战值,包括:B13. The device as described in B10, the determination of the challenge value includes:

确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or

基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function.

B14、如B10所述的装置,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述第二确定单元包括:B14. The device as described in B10, each of the competition information includes only the random key corresponding to the random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs, and the second determination unit include:

第一生成模块,用于基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;The first generation module is configured to generate a random mapping value corresponding to a random keyword in each competition information based on the preset one-way function, a total of M random mapping values;

第一确定模块,用于从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。The first determining module is configured to determine the first random mapping value with the smallest distance from the challenge value from the M random mapping values, and determine the first random mapping value to which the first random key corresponding to the first random mapping value belongs. The second node is the target node.

B15、如B10所述的装置,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述第二确定单元包括:B15. The device as described in B10, each of the competition information includes a random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs and a random key corresponding to the random mapping value, the The second determination unit includes:

第二确定模块,用于从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。The second determining module is configured to determine the second random mapping value with the smallest distance from the challenge value from the M random mapping values corresponding to the M pieces of competition information one-to-one, and determine the location to which the second random mapping value belongs. The second node is the target node.

B16、如B15所述的装置,所述第二确定模块包括:B16, the device as described in B15, the second determination module includes:

验证子模块,用于基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;A verification submodule, configured to verify the second random mapping value based on the second random key corresponding to the second random mapping value;

确定子模块,用于如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。The determining submodule is configured to determine that the second node to which the second random mapping value belongs is the target node if the verification is passed.

B17、如B16所述的装置,所述验证子模块具体用于:B17. The device as described in B16, the verification submodule is specifically used for:

基于所述预设单向函数,生成与所述第二随机关键字对应的待验证映射值;generating a mapping value to be verified corresponding to the second random keyword based on the preset one-way function;

如果所述待验证映射值与所述第二随机映射值一致,确定验证通过。If the mapping value to be verified is consistent with the second random mapping value, it is determined that the verification is passed.

B18、如B10所述的装置,所述第二确定单元包括:B18. The device as described in B10, the second determination unit includes:

获取模块,用于基于预设共识算法,获取全网节点对所述目标节点的反馈意见;An acquisition module, configured to acquire feedback from nodes on the entire network to the target node based on a preset consensus algorithm;

第三确定模块,用于如果获得的反馈意见满足预设条件,确定所述目标节点获得所述新区块的记账权。The third determining module is configured to determine that the target node obtains the bookkeeping right of the new block if the obtained feedback satisfies a preset condition.

C19、一种记账权确认装置,应用于第一节点,包括:C19. A device for confirming bookkeeping rights, applied to the first node, including:

存储器,所述存储器用于存储执行A1至A9任一项所述方法的程序;A memory, the memory is used to store a program for executing any one of the methods described in A1 to A9;

处理器,与所述存储器连接,所述处理器被配置为用于执行所述存储器中存储的程序。A processor, connected to the memory, configured to execute programs stored in the memory.

D20、一种计算机存储介质,用于储存为上述记账权确认装置所用的计算机软件指令,其包含用于执行上述方面为记账权确认装置所设计的程序。D20. A computer storage medium for storing computer software instructions used by the above-mentioned billing right confirmation device, which includes the program designed for the billing right confirmation device for executing the above aspects.

Claims (10)

1.一种记账权确认方法,应用于区块链中的第一节点,其特征在于,包括:1. A method for confirming bookkeeping rights, applied to the first node in the block chain, characterized in that, comprising: 在产生新区块情况下,确定挑战值;In the case of generating a new block, determine the challenge value; 发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;Send control information to the second node participating in the competition for accounting rights, the control information is used to instruct the second node to generate a random mapping value corresponding to the random keyword based on a preset one-way function, and store it in the corresponding relationship in the The free storage space of the second node, so that after the free storage space of the second node is filled, the second node determines from the free storage space that the random mapping value with the smallest distance from the challenge value corresponds to random keywords for ; 在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。After obtaining the competition information fed back by the M second nodes participating in the competing bookkeeping rights in the entire network based on the challenge value, a total of M competition information is obtained, and based on the M competition information, from the M second nodes Determine the target node, determine that the target node obtains the bookkeeping right of the new block, wherein each of the M pieces of competition information includes at least the challenge value in the idle storage space of the second node to which it belongs The random key corresponding to the random mapping value with the smallest distance, M is an integer greater than 1. 2.如权利要求1所述的方法,其特征在于,所述预设单向函数生成的映射值的长度为第一预设长度,定义的随机关键字的长度为第二预设长度,所述控制信息用于指示所述第二节点获得闲置存储空间的存储量除以所述第一预设长度与所述第二预设长度之和得到的商值为N后生成N个随机关键字,并采用所述预设单向函数生成与所述N个随机关键字一一对应的N个随机映射值,按照对应关系保存所述N个随机关键字与所述N个随机映射值,所述N个随机关键字与所述N个随机映射值能填满所述第二节点的闲置存储空间。2. The method according to claim 1, wherein the length of the mapping value generated by the preset one-way function is a first preset length, and the length of the defined random key is a second preset length, so The control information is used to instruct the second node to generate N random keys after dividing the storage amount of the idle storage space obtained by the second node by the sum of the first preset length and the second preset length to be N. , and use the preset one-way function to generate N random mapping values corresponding to the N random keywords one-to-one, and save the N random keywords and the N random mapping values according to the corresponding relationship, so The N random keys and the N random mapping values can fill up the idle storage space of the second node. 3.如权利要求2所述的方法,其特征在于,所述N个随机关键字中每个随机关键字中包括所属节点的标识信息、随机值和预设字符串。3. The method according to claim 2, wherein each of the N random keywords includes identification information of the node to which it belongs, a random value and a preset character string. 4.如权利要求1所述的方法,其特征在于,所述确定挑战值,包括:4. The method according to claim 1, wherein said determining the challenge value comprises: 确定所述新区块的区块哈希值为所述挑战值;或determining the block hash value of the new block as the challenge value; or 基于历史区块的数据,采用所述预设单向函数产生挑战值。Based on the data of the historical blocks, the challenge value is generated by using the preset one-way function. 5.如权利要求1所述的方法,其特征在于,所述每个竞争信息中仅包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:5. The method according to claim 1, wherein each competition information only includes a random key corresponding to the random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs, The determining the target node from the M second nodes based on the M pieces of competition information includes: 基于所述预设单向函数,生成与每个竞争信息中的随机关键字对应的随机映射值,共计M个随机映射值;Based on the preset one-way function, generate a random mapping value corresponding to a random keyword in each competition information, a total of M random mapping values; 从所述M个随机映射值中确定出与所述挑战值距离最小的第一随机映射值,确定所述第一随机映射值对应的第一随机关键字所属的第二节点为目标节点。A first random mapping value with the smallest distance from the challenge value is determined from the M random mapping values, and a second node to which the first random keyword corresponding to the first random mapping value belongs is determined as the target node. 6.如权利要求1所述的方法,其特征在于,所述每个竞争信息中包括所属第二节点的闲置存空间中与所述挑战值距离最小的随机映射值以及该随机映射值对应的随机关键字,所述基于所述M个竞争信息,从所述M个第二节点中确定目标节点,包括:6. The method according to claim 1, wherein each competition information includes the random mapping value with the smallest distance from the challenge value in the idle storage space of the second node to which it belongs and the corresponding The random key, determining the target node from the M second nodes based on the M pieces of competition information includes: 从所述M个竞争信息一一对应的M个随机映射值中确定出与所述挑战值距离最小的第二随机映射值,确定所述第二随机映射值所属的第二节点为目标节点。A second random mapping value with the smallest distance to the challenge value is determined from the M random mapping values corresponding to the M pieces of competition information one-to-one, and the second node to which the second random mapping value belongs is determined as the target node. 7.如权利要求6所述的方法,其特征在于,所述确定所述第二随机映射值所属的第二节点为目标节点,包括:7. The method according to claim 6, wherein the determining that the second node to which the second random mapping value belongs is a target node comprises: 基于所述第二随机映射值对应的第二随机关键字,对所述第二随机映射值进行验证;Verifying the second random mapping value based on a second random key corresponding to the second random mapping value; 如果验证通过,确定所述第二随机映射值所属的第二节点为目标节点。If the verification passes, it is determined that the second node to which the second random mapping value belongs is the target node. 8.一种记账权确认装置,其特征在于,应用于第一节点,所述装置包括:8. A billing right confirmation device, characterized in that it is applied to the first node, and the device comprises: 第一确定单元,用于在产生新区块情况下,确定挑战值;The first determination unit is used to determine the challenge value when a new block is generated; 发送单元,用于发送控制信息至参与竞争记账权的第二节点,所述控制信息用于指示所述第二节点基于预设单向函数生成随机关键字对应的随机映射值后,以对应关系保存在所述第二节点的闲置存储空间,以使得所述第二节点的闲置存储空间被填满后,所述第二节点从所述闲置存储空间中确定出与所述挑战值距离最小的随机映射值对应的随机关键字;A sending unit, configured to send control information to a second node participating in the competition for accounting rights, where the control information is used to instruct the second node to generate a random mapping value corresponding to a random keyword based on a preset one-way function, and then use the corresponding The relationship is saved in the idle storage space of the second node, so that after the idle storage space of the second node is filled, the second node determines from the idle storage space that the distance from the challenge value is the smallest The random key corresponding to the random mapping value of ; 第二确定单元,用于在获得全网参与竞争记账权的M个第二节点基于所述挑战值反馈的竞争信息后,共计获得M个竞争信息,基于所述M个竞争信息,从所述M个第二节点中确定目标节点,确定所述目标节点获得所述新区块的记账权,其中,所述M个竞争信息中的每个竞争信息至少包括所属的第二节点的闲置存空间中与所述挑战值距离最小的随机映射值对应的随机关键字,M为大于1的整数。The second determining unit is configured to obtain a total of M pieces of competition information based on the competition information fed back by the M second nodes participating in the competing bookkeeping rights of the entire network based on the challenge value, and based on the M pieces of competition information, from all Determine the target node among the M second nodes, and determine that the target node obtains the accounting right of the new block, wherein each of the M competition information includes at least the idle memory of the second node to which it belongs. The random key corresponding to the random mapping value with the smallest distance from the challenge value in the space, M is an integer greater than 1. 9.一种记账权确认装置,应用于第一节点,其特征在于,包括:9. A device for confirming bookkeeping rights, applied to the first node, characterized in that it includes: 存储器,所述存储器用于存储执行权利要求1至7任一项所述方法的程序;a memory, the memory is used to store a program for executing the method according to any one of claims 1 to 7; 处理器,与所述存储器连接,所述处理器被配置为用于执行所述存储器中存储的程序。A processor, connected to the memory, configured to execute programs stored in the memory. 10.一种计算机存储介质,其特征在于,用于储存为上述记账权确认装置所用的计算机软件指令,其包含用于执行上述方面为记账权确认装置所设计的程序。10. A computer storage medium, characterized in that it is used for storing computer software instructions used by the above-mentioned accounting right confirmation device, which includes a program designed for the above-mentioned aspect to be used for the bookkeeping right confirmation device.
CN201810450001.4A 2018-05-11 2018-05-11 A kind of accounting right confirmation method, device and computer storage medium Active CN108616363B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810450001.4A CN108616363B (en) 2018-05-11 2018-05-11 A kind of accounting right confirmation method, device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810450001.4A CN108616363B (en) 2018-05-11 2018-05-11 A kind of accounting right confirmation method, device and computer storage medium

Publications (2)

Publication Number Publication Date
CN108616363A true CN108616363A (en) 2018-10-02
CN108616363B CN108616363B (en) 2021-08-06

Family

ID=63662867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810450001.4A Active CN108616363B (en) 2018-05-11 2018-05-11 A kind of accounting right confirmation method, device and computer storage medium

Country Status (1)

Country Link
CN (1) CN108616363B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106850536A (en) * 2016-11-30 2017-06-13 北京瑞卓喜投科技发展有限公司 Block chain common recognition method and system
CN106934611A (en) * 2017-03-21 2017-07-07 北京汇通金财信息科技有限公司 Data processing method and device
CN107347009A (en) * 2017-08-30 2017-11-14 北京知金链网络技术有限公司 Blockchain one-dimensional random number consensus recommendation method
CN107481145A (en) * 2017-08-30 2017-12-15 北京知金链网络技术有限公司 Block chain multidimensional random number common recognition election method
CN107566124A (en) * 2017-08-24 2018-01-09 深圳市易成自动驾驶技术有限公司 Common recognition method for building up, block catenary system and storage medium based on lottery mechanism
WO2018069566A1 (en) * 2016-10-14 2018-04-19 Nokia Technologies Oy Method, device and system for validating sensitive user data transactions within trusted circle
CN108009918A (en) * 2017-11-23 2018-05-08 深圳捷汇科技有限公司 The bookkeeping methods and electronic equipment of block chain common recognition algorithm transaction system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018069566A1 (en) * 2016-10-14 2018-04-19 Nokia Technologies Oy Method, device and system for validating sensitive user data transactions within trusted circle
CN106850536A (en) * 2016-11-30 2017-06-13 北京瑞卓喜投科技发展有限公司 Block chain common recognition method and system
CN106934611A (en) * 2017-03-21 2017-07-07 北京汇通金财信息科技有限公司 Data processing method and device
CN107566124A (en) * 2017-08-24 2018-01-09 深圳市易成自动驾驶技术有限公司 Common recognition method for building up, block catenary system and storage medium based on lottery mechanism
CN107347009A (en) * 2017-08-30 2017-11-14 北京知金链网络技术有限公司 Blockchain one-dimensional random number consensus recommendation method
CN107481145A (en) * 2017-08-30 2017-12-15 北京知金链网络技术有限公司 Block chain multidimensional random number common recognition election method
CN108009918A (en) * 2017-11-23 2018-05-08 深圳捷汇科技有限公司 The bookkeeping methods and electronic equipment of block chain common recognition algorithm transaction system

Also Published As

Publication number Publication date
CN108616363B (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN110288345B (en) Cross-chain communication method, device, main chain node and storage medium
CN108833398B (en) A method, device and equipment for updating a blockchain smart contract
CN111713088B (en) Method for processing data, apparatus for processing data and apparatus for processing data
CN108764870A (en) Blockchain-based transaction processing method, device, and electronic equipment
CN110505223A (en) Block chain multi-chain management method and device
CN108667632A (en) Blockchain-based credit record sharing method, device, and electronic equipment
WO2020042586A1 (en) Method and apparatus for generating address of smart contract, computer device, and readable storage medium
CN111612600B (en) Block chain auction method, equipment, storage medium and block chain system
CN109493054B (en) Multi-chain information management method, device, storage medium and block chain identity analyzer
CN111080287B (en) A business data processing method, related equipment and system
WO2020107223A1 (en) Multi-chain information management method and apparatus, storage medium, and blockchain identity parser
TW202008270A (en) Block release method and apparatus, and electronic device
WO2019153660A1 (en) Transaction processing method and apparatus, and computer device and storage medium
CN111324645B (en) Block chain data processing method and device
JP2022532764A (en) Systems and methods for deparallelized mining in proof of work blockchain networks
WO2023221350A1 (en) Blockchain-based code copyright registration system, method and platform
CN108616363A (en) A kind of book keeping operation power confirmation method, device and computer storage media
CN111177262A (en) Block chain consensus method, related device and system
CN116389040A (en) Reputation-based block chain consensus method, device and computer equipment
CN114666327B (en) Block packing method and device based on block chain transaction and electronic equipment
CN116471041A (en) Blockchain consensus method, system, equipment and medium based on consortium chain
CN108733788B (en) A method, device and computer storage medium for confirming idle storage space
CN115344836A (en) Digital personal registration method, device, electronic equipment and computer readable medium
CN113949508B (en) Process data processing method and device based on random number consensus mechanism
CN110933155B (en) Novel block chain network

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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载