WO2022033488A1 - 区块处理方法、设备和存储介质 - Google Patents

区块处理方法、设备和存储介质 Download PDF

Info

Publication number
WO2022033488A1
WO2022033488A1 PCT/CN2021/111860 CN2021111860W WO2022033488A1 WO 2022033488 A1 WO2022033488 A1 WO 2022033488A1 CN 2021111860 W CN2021111860 W CN 2021111860W WO 2022033488 A1 WO2022033488 A1 WO 2022033488A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
miner
blocks
height
address
Prior art date
Application number
PCT/CN2021/111860
Other languages
English (en)
French (fr)
Inventor
何正军
王志文
吴思进
Original Assignee
杭州复杂美科技有限公司
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 杭州复杂美科技有限公司 filed Critical 杭州复杂美科技有限公司
Publication of WO2022033488A1 publication Critical patent/WO2022033488A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0635Risk analysis of enterprise or organisation activities

Definitions

  • the present application relates to the field of Internet technologies, and in particular, to a block processing method, device and storage medium.
  • a blockchain fork means that in the blockchain network, at least two legal blocks are generated at the same block height. For example, at the height H a , blocks block1 and block2 exist in the blockchain network at the same time.
  • the solution to the current blockchain fork is to determine which fork has a higher block height. For example, after a period of time, at the time of judgment, there are 5 blocks generated subsequently based on block1, and based on block 1. There are 2 subsequent blocks generated by block2, then the block height based on the fork of block1 is higher, block1 and its subsequent blocks are determined as correct blocks, and block2 and its subsequent blocks are discarded.
  • the nodes deployed by the group can make it easier for the blocks dug by the nodes in the group to be determined as correct blocks, resulting in
  • the blockchain network has the risk of centralization. For example, at height H b , the nodes in the group mine block3, the nodes outside the group mine block4, and all the nodes in the group choose to continue mining based on block3, which will increase the probability that block3 is finally determined as the correct block.
  • the fork cannot be quickly suppressed when the fork is just generated, and it must wait for each fork to grow for a certain period of time before eliminating the fork.
  • the present invention provides a block processing method suitable for blockchain nodes, including:
  • the area mined by the first miner's address corresponding to the first block is determined Whether the number of blocks is less than the number of blocks mined by the second miner address corresponding to the second block:
  • the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform various functions according to the present invention.
  • the block processing method provided by the embodiment is not limited to the embodiment.
  • the present invention further provides a storage medium storing a computer program, and the computer program enables a computer to execute the block processing method provided according to each embodiment of the present invention.
  • the block processing method, device and storage medium provided by various embodiments of the present invention directly determine the block mined by a miner with a smaller number of blocks when a fork occurs by counting the number of blocks generated by each miner's address in the near future as
  • the correct block on the one hand, ensures that the small team cannot increase the block generation probability of the nodes in the team when a fork occurs, thus curbing the centralization risk brought by small and medium-sized teams in the blockchain network, and on the other hand realizes no need to wait.
  • FIG. 1 is a flowchart of a block processing method according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of step S11 in a preferred embodiment of the method shown in FIG. 1 .
  • FIG. 3 is a flowchart of step S11 in another preferred embodiment of the method shown in FIG. 1 .
  • FIG. 4 is a schematic structural diagram of a device according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a block processing method according to an embodiment of the present invention.
  • the present invention provides a block processing method suitable for blockchain nodes, including:
  • step S15 discard the first block
  • step S17 determine the first block as a block with the first local height, and broadcast the first block.
  • the following is a small group consisting of 100 nodes in a blockchain network with more than 3,000 nodes.
  • the block height is 3,250,000
  • node A outside the small group digs out block 3250001-A
  • the small group The above method is exemplarily explained by taking the node B in the group excavating the block block 3250001-B as an example.
  • each blockchain node counts the number of blocks mined by each miner address in the last month according to the miner address of the mining transaction of each block generated in the last month, for example, the miner address addr A mined 16 blocks, addr B mined 23 blocks, addr C mined 5 blocks, etc.
  • the specific statistical methods may adopt the methods shown in FIG. 2 or FIG. 3 (the following will be described in detail with reference to FIG. 2 and FIG. 3 respectively), or other statistical methods that can be understood by those skilled in the art.
  • step S13 take node C that receives block 3250001-A first and then block 3250001-B as an example:
  • node C When receiving block 3250001-A , node C judges that block 3250001-A has passed the check and there is no block with height of 3250001 locally, so it stores and broadcasts block 3250001-A ;
  • node C judges that block 3250001-B has passed the check and that block 3250001-A with height 3250001 already exists locally, indicating that a fork has occurred at this time, and node C judges block 3250001-B Whether the number of blocks 23 dug by the corresponding miner address addr B is less than the number 16 of blocks dug by the miner address addr A corresponding to block 3250001-A :
  • node C executes step S15 and directly discards block 3250001-B .
  • node D When receiving block 3250001-B , node D judges that block 3250001-B has passed the inspection and does not yet have a block with a height of 3250001 locally, so it stores and broadcasts block 3250001-B ;
  • node D judges that block 3250001-A has passed the check and that block 3250001-B with a height of 3250001 already exists locally, indicating that a fork has occurred at this time, and node D judges block 3250001-A Whether the number of blocks 16 mined by the corresponding miner address addr A is less than the number of blocks 23 mined by the miner address addr B corresponding to block 3250001-B :
  • step S17 determines block 3250001-A as a block with a local block height of 3250001, and broadcasts block 3250001-A .
  • node E in the small group in the existing scheme, no matter if block 3250001-A or block 3250001-B is received first, node E can directly select the block based on the block dug by node B also in the small group Block block 3250001-B continues to mine to increase the probability that block 3250001-B is finally determined to be the correct block.
  • node E can only directly select miners with a small number of recent blocks. Addresses mined blocks without being able to "favor" other nodes in the small group.
  • the above embodiment counts the number of blocks produced by each miner’s address in the near future, and directly determines the block mined by the miner with a small number of blocks as the correct block when a fork occurs, which on the one hand guarantees that the small team will not occur in the event of a fork.
  • the probability of block generation of the nodes in the team cannot be increased, thus curbing the centralization risk brought by small and medium-sized teams in the blockchain network.
  • FIG. 2 is a flowchart of step S11 in a preferred embodiment of the method shown in FIG. 1 .
  • step S11 includes:
  • a fixed block height range is used for statistics in each period of time.
  • the block height range for the previous month is [2500000, 3000000]
  • the block height for the next month is calculated.
  • the range is [3000001, 3500000], and so on.
  • step S1111 when the block height exceeds the current first block height range, for example, the current first block height range is [2500000, 3000000], and when the block height reaches 3000001, the first block needs to be re-determined height range.
  • the re-determined first block height range is [3000001, 3500000].
  • the specified first duration is 1 month
  • the block generation interval of the current blockchain is 5 seconds
  • the re-determined first block height range is [3000001, 3518400].
  • each block chain node counts the number of blocks mined by each miner address in the near future according to the miner address of the mining transaction of each block within the first block height range. For example, if the current first block height range is [3000001, 3518400], and the current block height is 3001000, then the miner addresses of the mining transactions in the 1000 blocks from 3000001-3001000 will be counted according to the miner addresses mined by each miner address. number of blocks.
  • the current block height is 3001000.
  • the block chain node receives a block with a block height of 3001001 and passes the check, it will update the block mined by the address of the miner corresponding to the block. number of blocks.
  • the blockchain rolls back it is also necessary to update the number of blocks mined by the miner address corresponding to each rollback block.
  • FIG. 3 is a flowchart of step S11 in another preferred embodiment of the method shown in FIG. 1 .
  • step S11 includes:
  • S1121 Determine the number of first blocks in the first duration according to the first duration and the block generation interval duration;
  • S1123 Count and maintain the number of blocks mined by each of the miner addresses according to the miner addresses of the mining transactions of the latest first block number and blocks.
  • the difference between the method shown in FIG. 3 and the method shown in FIG. 2 is that in the method shown in FIG. 2 , the statistical range is fixed within a certain period of time, while in the method shown in FIG. 3 , the statistical range is Dynamic, always determined to be a fixed number of newest blocks.
  • the current block height is 3518400, and the current statistics of the number of blocks produced by each miner address are based on the height range of [3000001, 3518400].
  • the number of blocks produced by the miner's address corresponding to the block with a block height of 3000001 is decremented by 1, and the number of blocks produced by the miner's address corresponding to the block with a block height of 3518401 is increased by 1.
  • the blockchain rolls back corresponding maintenance is also required.
  • FIG. 4 is a schematic structural diagram of a device according to an embodiment of the present invention.
  • the present application also provides a device 400 , comprising one or more central processing units (CPUs) 401 , which can operate according to a program stored in a read only memory (ROM) 402 or Various appropriate actions and processes are executed from the program loaded into the random access memory (RAM) 403 from the storage section 408 .
  • ROM read only memory
  • RAM random access memory
  • various programs and data necessary for the operation of the device 400 are also stored.
  • the CPU 401 , the ROM 402 , and the RAM 403 are connected to each other through a bus 404 .
  • An input/output (I/O) interface 405 is also connected to bus 404 .
  • the following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc. ; and a communication section 409 including a network interface card such as a LAN card, a modem, and the like. The communication section 409 performs communication processing via a network such as the Internet.
  • a drive 410 is also connected to the I/O interface 405 as needed.
  • a removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.
  • the method described in any of the above embodiments may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing any of the methods described above.
  • the computer program may be downloaded and installed from the network via the communication portion 409 and/or installed from the removable medium 411 .
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a computer-readable storage medium included in the apparatus of the foregoing embodiment; A computer-readable storage medium in a device.
  • the computer-readable storage medium stores one or more programs that are used by one or more processors to perform the methods described in the present application.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by dedicated hardware-based systems that perform the specified functions or operations , or can be implemented by a combination of dedicated hardware and computer instructions.
  • the units or modules involved in the embodiments of the present application may be implemented in a software manner, and may also be implemented in a hardware manner.
  • the described units or modules may also be provided in the processor, for example, each unit may be a software program provided in a computer or a mobile smart device, or may be a separately configured hardware device. Wherein, the names of these units or modules do not constitute limitations on the units or modules themselves under certain circumstances.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Human Resources & Organizations (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Game Theory and Decision Science (AREA)
  • Educational Administration (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明提供一种区块处理方法、设备和存储介质,该方法包括:根据各区块的挖矿交易的矿工地址统计近期内各矿工地址分别挖出的区块数量;在收到第一高度的第一区块、第一区块通过检查且本地已存有第一高度的第二区块时,判断第一区块所对应的第一矿工地址所挖出的区块数量是否小于第二区块所对应的第二矿工地址所挖出的区块数量:否,则丢弃第一区块;是,则将第一区块确定为本地第一高度的区块,并广播第一区块。本发明一方面保障了小团队在发生分叉时无法增大团队内节点的出块概率,从而遏制了区块链网络中小团队带来的中心化风险,另一方面实现了无需等待分叉增长、直接遏制分叉。

Description

区块处理方法、设备和存储介质 技术领域
本申请涉及互联网技术领域,具体涉及一种区块处理方法、设备和存储介质。
背景技术
区块链分叉是指在区块链网络中,同一区块高度上产生了至少两个合法的区块,例如,在高度H a,区块链网络中同时存在区块block1和block2。
当前区块链分叉的解决方式为,判断哪一个分叉的区块高度更高,例如,在经过一段时间后,在判断的时间点,基于block1后续产生的区块有5个,而基于block2后续产生的区块有2个,则基于block1的分叉的区块高度更高,将block1及其后续区块确定为正确的区块,丢弃block2及其后续区块。
上述解决方案的缺陷在于:
一方面,在上述解决方案中,当区块链网络中存在利益相关的小团体时,该团体部署的各节点可以使团体内节点挖到的区块更容易被确定为正确的区块,导致区块链网络存在中心化风险。例如,在高度H b,团体内的节点挖到block3,团体外的节点挖到block4,团体内的节点全都选择基于block3继续挖矿,会增大block3最终被确定为正确区块的概率。
另一方面,在上述解决方案中,在刚产生分叉时无法迅速遏制分叉,而必须等待各分叉分别增长一段时间再消除分叉。
发明内容
鉴于现有技术中的上述缺陷或不足,期望提供一种遏制区块链网络中小团队带来的中心化风险,并且无需等待分叉增长、直接遏制分 叉的区块处理方法、设备和存储介质。
第一方面,本发明提供一种适用于区块链节点的区块处理方法,包括:
根据各区块的挖矿交易的矿工地址统计近期内各矿工地址分别挖出的区块数量;
在收到第一高度的第一区块、第一区块通过检查且本地已存有第一高度的第二区块时,判断第一区块所对应的第一矿工地址所挖出的区块数量是否小于第二区块所对应的第二矿工地址所挖出的区块数量:
否,则丢弃第一区块;
是,则将第一区块确定为本地第一高度的区块,并广播第一区块。
第二方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该一个或多个处理器执行根据本发明各实施例提供的区块处理方法。
第三方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的区块处理方法。
本发明诸多实施例提供的区块处理方法、设备和存储介质通过统计近期内各矿工地址的出块数量,在发生分叉时直接将出块数量较少的矿工所挖出的区块确定为正确的区块,一方面保障了小团队在发生分叉时无法增大团队内节点的出块概率,从而遏制了区块链网络中小团队带来的中心化风险,另一方面实现了无需等待分叉增长、直接遏制分叉。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1为本发明一实施例提供的一种区块处理方法的流程图。
图2为图1所示方法的一种优选实施例中步骤S11的流程图。
图3为图1所示方法的另一种优选实施例中步骤S11的流程图。
图4为本发明一实施例提供的一种设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
图1为本发明一实施例提供的一种区块处理方法的流程图。
如图1所示,在本实施例中,本发明提供一种适用于区块链节点的区块处理方法,包括:
S11:根据各区块的挖矿交易的矿工地址统计近期内各矿工地址分别挖出的区块数量;
S13:在收到第一高度的第一区块、第一区块通过检查且本地已存有第一高度的第二区块时,判断第一区块所对应的第一矿工地址所挖出的区块数量是否小于第二区块所对应的第二矿工地址所挖出的区块数量:
否,则执行步骤S15:丢弃第一区块;
是,则执行步骤S17:将第一区块确定为本地第一高度的区块,并广播第一区块。
具体地,以下以节点数量超过3000的区块链网络中存在100个节点组成的小团体,在区块高度为3250000时,该小团体外的节点A挖出区块block 3250001-A、该小团体内的节点B挖出区块block 3250001-B为例,对上述方法进行示例性的阐述。
在步骤S11中,每个区块链节点根据最近1个月产生的各区块的挖矿交易的矿工地址统计出最近1个月内各矿工地址分别挖出了多少个区块,例如,矿工地址addr A挖出了16个区块,addr B挖出了23个区块,addr C挖出了5个区块,……,等等。具体的统计方式可采用图 2或图3所示的各方法(以下将分别结合图2、图3进行详细阐述),或,其它本领域技术人员可以理解的不同统计方法。
在步骤S13中,以先收到block 3250001-A、再收到block 3250001-B的节点C为例:
在收到block 3250001-A时,节点C判断出block 3250001-A通过检查、本地尚未存有高度为3250001的区块,因此存储并广播block 3250001-A
在收到block 3250001-B时,节点C判断出block 3250001-B通过检查、本地已存有高度为3250001的区块block 3250001-A,说明此时发生了分叉,节点C判断block 3250001-B所对应的矿工地址addr B所挖出的区块数量23是否小于block 3250001-A所对应的矿工地址addr A所挖出的区块数量16:
否,则节点C执行步骤S15,直接丢弃block 3250001-B
再以先收到block 3250001-B、再收到block 3250001-A的节点D为例:
在收到block 3250001-B时,节点D判断出block 3250001-B通过检查、本地尚未存有高度为3250001的区块,因此存储并广播block 3250001-B
在收到block 3250001-A时,节点D判断出block 3250001-A通过检查、本地已存有高度为3250001的区块block 3250001-B,说明此时发生了分叉,节点D判断block 3250001-A所对应的矿工地址addr A所挖出的区块数量16是否小于block 3250001-B所对应的矿工地址addr B所挖出的区块数量23:
是,则节点D执行步骤S17,将block 3250001-A确定为本地区块高度3250001的区块,并广播block 3250001-A
对于小团体中的节点E而言,在现有方案中,无论先收到block 3250001-A还是block 3250001-B,节点E都可以直接选择基于同样在小团体中的节点B所挖出的区块block 3250001-B继续挖矿,以增大block 3250001-B最终被确定为正确区块的概率,但在上述图1所示的方法中,节点E只能直接选择最近出块数量少的矿工地址所挖出的区块,而无法“偏袒”小团体中的其它节点。
上述实施例通过统计近期内各矿工地址的出块数量,在发生分叉时直接将出块数量较少的矿工所挖出的区块确定为正确的区块,一方 面保障了小团队在发生分叉时无法增大团队内节点的出块概率,从而遏制了区块链网络中小团队带来的中心化风险,另一方面实现了无需等待分叉增长、直接遏制分叉。
图2为图1所示方法的一种优选实施例中步骤S11的流程图。如图2所示,在一优选实施例中,步骤S11包括:
S1111:在当前区块高度超出第一区块高度范围时,重新确定最近的第一区块高度范围;
S1113:根据第一区块高度范围内的各区块的挖矿交易的矿工地址统计近期内各矿工地址分别挖出的区块数量;
S1115:将第一区块高度范围内的第三区块确定为本地第二高度的区块时,更新第三区块对应的矿工地址所挖出的区块数量。
具体地,在本实施例中,每一段时间内采用一个固定的区块高度范围进行统计,例如,前一个月统计的区块高度范围为【2500000,3000000】,后一个月统计的区块高度范围为【3000001,3500000】,等等。
在步骤S1111中,当区块高度超出当前的第一区块高度范围时,例如当前的第一区块高度范围为【2500000,3000000】,区块高度达到3000001时,需要重新确定第一区块高度范围。
在一些实施例中,可以根据指定的区块数量来确定,例如,指定区块数量为500000个区块,则重新确定的第一区块高度范围为【3000001,3500000】。
在另一些实施例中,可以根据指定的时长确定,例如,指定的第一时长为1个月,当前区块链的出块间隔时长为5秒,则1个月内的出块数量为30*24*60*60/5=518400个,则重新确定的第一区块高度范围为【3000001,3518400】。
在步骤S1113中,每个区块链节点根据第一区块高度范围内的各区块的挖矿交易的矿工地址统计近期内各矿工地址分别挖出的区块数量。例如,当前第一区块高度范围为【3000001,3518400】,当前的区块高度为3001000,则分别根据3000001-3001000这1000个区块的挖矿交易的矿工地址统计各矿工地址分别挖出的区块数量。
在步骤S1115中,例如,当前的区块高度为3001000,当区块链节点收到区块高度为3001001的区块并通过检查,则更新挖出该区块对应的矿工地址所挖出的区块数量。同理,当区块链发生回滚时,也需要更新各回滚区块所对应的矿工地址所挖出的区块数量。
图3为图1所示方法的另一种优选实施例中步骤S11的流程图。如图3所示,在另一优选实施例中,步骤S11包括:
S1121:根据第一时长和出块间隔时长确定第一时长内的第一区块数量;
S1123:根据最新的第一区块数量个区块的挖矿交易的矿工地址统计并维护各所述矿工地址分别挖出的区块数量。
具体地,图3所示方法与图2所示方法的区别在于,在图2所示的方法中,统计范围在一定时长内是固定的,而在图3所示的方法中,统计范围是动态的,始终确定为固定数量个最新区块。
例如,对于某节点,当前区块高度为3518400,当前统计的各矿工地址的出块数量是基于【3000001,3518400】的高度范围所统计的,当新增区块高度为3518401的区块时,则对统计数据中区块高度为3000001的区块所对应的矿工地址的出块数量减1,并对区块高度为3518401的区块所对应的矿工地址的出块数量加1。同理,当区块链发生回滚时,也需要进行相应的维护。
图4为本发明一实施例提供的一种设备的结构示意图。
如图4所示,作为另一方面,本申请还提供了一种设备400,包括一个或多个中央处理单元(CPU)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储部分408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM403中,还存储有设备400操作所需的各种程序和数据。CPU401、ROM402以及RAM403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。
以下部件连接至I/O接口405:包括键盘、鼠标等的输入部分406;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分407;包括硬盘等的存储部分408;以及包括诸如LAN卡、 调制解调器等的网络接口卡的通信部分409。通信部分409经由诸如因特网的网络执行通信处理。驱动器410也根据需要连接至I/O接口405。可拆卸介质411,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器410上,以便于从其上读出的计算机程序根据需要被安装入存储部分408。
特别地,根据本公开的实施例,上述任一实施例描述的方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,计算机程序包含用于执行上述任一方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分409从网络上被下载和安装,和/或从可拆卸介质411被安装。
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请提供的方法。
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各单元可以是设置在计算机或移动智能设备 中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (6)

  1. 一种区块处理方法,其特征在于,所述方法适用于区块链节点,所述方法包括:
    根据各区块的挖矿交易的矿工地址统计近期内各所述矿工地址分别挖出的区块数量;
    在收到第一高度的第一区块、所述第一区块通过检查且本地已存有所述第一高度的第二区块时,判断所述第一区块所对应的第一矿工地址所挖出的区块数量是否小于所述第二区块所对应的第二矿工地址所挖出的区块数量:
    否,则丢弃所述第一区块;
    是,则将所述第一区块确定为本地所述第一高度的区块,并广播所述第一区块。
  2. 根据权利要求1所述的方法,其特征在于,所述根据各区块的挖矿交易的矿工地址统计近期内各所述矿工地址分别挖出的区块数量包括:
    在当前区块高度超出第一区块高度范围时,重新确定最近的第一区块高度范围;
    根据所述第一区块高度范围内的各区块的挖矿交易的矿工地址统计近期内各所述矿工地址分别挖出的区块数量;
    将所述第一区块高度范围内的第三区块确定为本地第二高度的区块时,更新所述第三区块对应的矿工地址所挖出的区块数量。
  3. 根据权利要求2所述的方法,其特征在于,所述重新确定最近的第一区块高度范围包括:
    根据第一时长和出块间隔时长确定所述第一时长内的第一区块数量;
    根据更新前的第一区块高度范围和所述第一区块数量确定更新后的第一区块高度范围。
  4. 根据权利要求1所述的方法,其特征在于,所述根据各区块的挖矿交易的矿工地址统计近期内各所述矿工地址分别挖出的区块数量包括:
    根据第一时长和出块间隔时长确定所述第一时长内的第一区块数量;
    根据最新的第一区块数量个区块的挖矿交易的矿工地址统计并维护各所述矿工地址分别挖出的区块数量。
  5. 一种设备,其特征在于,所述设备包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-4中任一项所述的方法。
  6. 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-4中任一项所述的方法。
PCT/CN2021/111860 2020-08-10 2021-08-10 区块处理方法、设备和存储介质 WO2022033488A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010796555.7A CN111858777A (zh) 2020-08-10 2020-08-10 区块处理方法、设备和存储介质
CN202010796555.7 2020-08-10

Publications (1)

Publication Number Publication Date
WO2022033488A1 true WO2022033488A1 (zh) 2022-02-17

Family

ID=72972772

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/111860 WO2022033488A1 (zh) 2020-08-10 2021-08-10 区块处理方法、设备和存储介质

Country Status (2)

Country Link
CN (1) CN111858777A (zh)
WO (1) WO2022033488A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858777A (zh) * 2020-08-10 2020-10-30 杭州复杂美科技有限公司 区块处理方法、设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647963A (zh) * 2018-05-02 2018-10-12 百度在线网络技术(北京)有限公司 区块链主链的确定方法、装置、服务器和存储介质
CN108960837A (zh) * 2018-06-05 2018-12-07 上海和数软件有限公司 区块链共识验证方法、装置及计算机可读存储介质
US20190102777A1 (en) * 2016-10-26 2019-04-04 International Business Machines Corporation Blockchain: automatic fork protection
CN111382456A (zh) * 2020-06-01 2020-07-07 腾讯科技(深圳)有限公司 提案消息处理方法、装置、设备以及存储介质
CN111858777A (zh) * 2020-08-10 2020-10-30 杭州复杂美科技有限公司 区块处理方法、设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190102777A1 (en) * 2016-10-26 2019-04-04 International Business Machines Corporation Blockchain: automatic fork protection
CN108647963A (zh) * 2018-05-02 2018-10-12 百度在线网络技术(北京)有限公司 区块链主链的确定方法、装置、服务器和存储介质
CN108960837A (zh) * 2018-06-05 2018-12-07 上海和数软件有限公司 区块链共识验证方法、装置及计算机可读存储介质
CN111382456A (zh) * 2020-06-01 2020-07-07 腾讯科技(深圳)有限公司 提案消息处理方法、装置、设备以及存储介质
CN111858777A (zh) * 2020-08-10 2020-10-30 杭州复杂美科技有限公司 区块处理方法、设备和存储介质

Also Published As

Publication number Publication date
CN111858777A (zh) 2020-10-30

Similar Documents

Publication Publication Date Title
WO2020156225A1 (zh) 基于区块链系统的业务处理方法、装置、介质及电子设备
US10484326B2 (en) Distributed message queue stream verification
CN108984662B (zh) 一种区块链数据同步方法
US11611634B2 (en) Method and device for timeout monitoring
CN110442579B (zh) 一种状态树数据存储方法、同步方法及设备和存储介质
US8572265B2 (en) Opportunistic network updates
WO2022033488A1 (zh) 区块处理方法、设备和存储介质
CN107146012B (zh) 风险事件处理方法及系统
US7376682B2 (en) Time model
CN111275438B (zh) 区块链网络的共识方法、装置、设备和存储介质
CN110445843B (zh) 平行链区块推送方法、设备和存储介质
CN110581887A (zh) 数据处理方法、装置、区块链节点及存储介质
US9027026B2 (en) Managing transactions within an application server
CN110535933B (zh) 平行链共识方法、设备和存储介质
CN110083666B (zh) 服务器装置、信息收集系统、信息收集方法以及记录介质
CN110516006B (zh) 平行链区块生成方法、设备和存储介质
CN114153609A (zh) 资源控制方法及装置、电子设备、计算机可读存储介质
CN109684611B (zh) 一种字典转码方法、装置、存储介质及终端
US9948587B2 (en) Data deduplication at the network interfaces
CN115658347A (zh) 数据消费方法、装置、电子设备、存储介质及程序产品
WO2023273576A1 (zh) 异常请求处理方法、装置、电子设备和存储介质
CN115525666A (zh) 一种实时数据更新方法、装置、电子设备及存储介质
CN110535922B (zh) 状态数据存储方法和平行链区块生成方法
US8775371B2 (en) Synchronizing an auxiliary data system with a primary data system
US7904612B2 (en) Ticket mechanism for sharing computer resources

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21855540

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21855540

Country of ref document: EP

Kind code of ref document: A1