WO2020244514A1 - 一种区块链群组的拆分方法及装置 - Google Patents

一种区块链群组的拆分方法及装置 Download PDF

Info

Publication number
WO2020244514A1
WO2020244514A1 PCT/CN2020/093997 CN2020093997W WO2020244514A1 WO 2020244514 A1 WO2020244514 A1 WO 2020244514A1 CN 2020093997 W CN2020093997 W CN 2020093997W WO 2020244514 A1 WO2020244514 A1 WO 2020244514A1
Authority
WO
WIPO (PCT)
Prior art keywords
group
smart contract
block
node
smart
Prior art date
Application number
PCT/CN2020/093997
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 WO2020244514A1 publication Critical patent/WO2020244514A1/zh

Links

Images

Classifications

    • 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
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • 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/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiment of the present invention relates to the field of financial technology (Fintech), and in particular to a method and device for splitting a blockchain group.
  • Blockchain (BlockChain) is a chain composed of a series of blocks. Each block records the data of this block and the hash value of the previous block. In this way, all blocks successively form a chain.
  • the cryptographic technology and decentralized ideas on which the blockchain is based make the historical information on the chain unable to be tampered with.
  • the blockchain system includes multiple groups, and each group performs independent data storage and consensus processes.
  • a group is composed of multiple blockchain nodes, and each blockchain node is a group of physical networks composed of computers, blockchain application software, and databases. The normal operation of the group depends on the hardware resources of the nodes in the group.
  • the problem is solved by increasing the hardware resources of each node, such as increasing the node disk memory, increasing the network bandwidth, and increasing the node processor The computing speed, etc., but this solution requires the modification of the hardware of each node, and the cost is high.
  • the embodiment of the present invention provides a method and device for splitting a block chain group to solve the problem that the hardware resources of the nodes in the group cannot satisfy the normal operation of the group and reduce the cost of hardware transformation.
  • the method for splitting a block chain group provided by an embodiment of the present invention is applicable to a block chain system with at least one group, and each group has an independent consensus mechanism and records transaction data through its own smart contract.
  • the method includes:
  • the splitting principle is used to instruct to split the first group into at least a second group and a third group, the first group being the block Any group in the chain system; each node of the second group and each node of the third group are not exactly the same and are all nodes of the first group;
  • the second group and the third group are activated, and the second group and the third group are both groups in the blockchain system.
  • the first group is split into at least the second group and the third group, and the ledger is split, and the book data volume of the second and third groups is smaller than that of the first group Ledger data volume, to solve the problem that the disk capacity of group nodes limits the book data capacity;
  • the number of consensus nodes in the second and third groups is less than the number of consensus nodes in the first group, then the second and third groups
  • the network bandwidth required by the mid-node broadcast is less than the network bandwidth required by the node broadcast in the first group, which solves the problem of the network bandwidth in the group limiting the network scale of the group; in the second and third groups
  • the computing capacity of the nodes is less than the computing capacity of the nodes in the first group, which solves the problem that the computing power of the group node limits the computing power of the group, guarantees the normal operation of the group, and does not need to modify the hardware of the group node to reduce the transformation cost.
  • the method further includes:
  • the resource situation of each node that does not meet the requirements of the first group operation includes:
  • the first group is determined to be split, and the splitting principle can be determined according to different resource conditions .
  • the splitting principle can be determined according to different resource conditions .
  • each smart contract of the first group is a smart contract created by the first group according to the time period of the received transaction data, and the received transaction data is recorded in the smart contract corresponding to the time period;
  • determining the smart contract belonging to the second group and the smart contract belonging to the third group from the smart contracts of the first group includes:
  • a smart contract whose time period is greater than the split time point is determined from each smart contract of the first group as the smart contract of the third group.
  • the first group stores transaction data in the smart contract corresponding to the time period.
  • the first group can be effectively split according to the smart contract corresponding to each time period.
  • Split at the time point the smart contracts of the smart contracts of the first group that are determined to belong to the time period not greater than the split time point are regarded as the smart contracts of the second group, and the time period of the smart contracts of the first group is determined.
  • the smart contract smaller than the split time point is used as the smart contract of the third group, which can solve the problem that the book data in the first group is too large, the disk capacity of the group node limits the book data, and the group in the first group
  • the network bandwidth limits the problem of the network size of the group.
  • the time-based The principle of splitting is to split the first group to effectively solve the above problems.
  • each smart contract of the first group is that the first group generates a corresponding smart contract based on the received transaction data, and records the received transaction data in the corresponding In the smart contract;
  • the determination of the splitting principle of the first group includes:
  • the splitting principle is determined according to the business type corresponding to each smart contract of the first group; the splitting principle is used to indicate that the smart contracts of each group after splitting correspond to the same business type.
  • the first group generates a corresponding smart contract based on the received transaction data, and records the transaction data in the corresponding smart contract.
  • the smart contract can be The business type of the contract, the split principle is determined, and the first group is effectively split according to the business type, which can solve the problem of the disk capacity of the group node limiting the amount of book data storage, and the network bandwidth in the first group The problem of limiting the network scale of the group, and the problem of the computing power of the group node in the first group limiting the computing power of the group.
  • the first group can be split according to the principle of business splitting, thereby effectively solving the above problems.
  • the method further includes:
  • the first block information is used to characterize the second group Historical operations of the smart contract in each block of the first group;
  • the packaging the smart contract of the second group as the genesis block of the second group, and packaging the smart contracts of the third group as the genesis block of the third group includes :
  • the first block information used to characterize the historical operation of the smart contract of the second group in each block of the first group is obtained, and the smart contract used to characterize the third group is in the first group.
  • the second block information of the historical operation in each block of the group, the smart contract of the second group and the first block information are packaged into at least one first new block, the smart contract of the third group, the second block
  • the information is packaged into at least one second new block, that is, the historical operation information of the smart contract in each group after the split is packaged into each group, so as to ensure the credibility of the first group split into each sub-group degree.
  • the embodiment of the present invention also provides a block chain group splitting device, which is suitable for a block chain system with at least one group, and each group has an independent consensus mechanism and passes its own smart contract. Record transaction data;
  • the device includes:
  • the first processing unit is configured to determine a splitting principle of the first group; the splitting principle is used to instruct to split the first group into at least a second group and a third group, and the first group A group is any group in the blockchain system; each node of the second group and each node of the third group are not exactly the same and are all nodes of the first group;
  • the second processing unit is configured to determine the smart contract belonging to the second group and the smart contract belonging to the third group from the smart contracts of the first group according to the splitting principle; Package the smart contract of the second group as the genesis block of the second group, and package the smart contracts of the third group as the genesis block of the third group; start the The second group and the third group, the second group and the third group are all groups in the blockchain system.
  • the device further includes: an acquiring unit;
  • the first processing unit is also used for:
  • control the acquiring unit Before the determination of the split principle of the first group, control the acquiring unit to acquire the resource status of each node in the first group; determine whether the resource status of each node meets the operation of the first group If the requirement of is not met, it is determined to split the first group and stop the operation of the first group.
  • the first processing unit is specifically configured to:
  • each smart contract of the first group is a smart contract created by the first group according to the time period of the received transaction data, and the received transaction data is recorded in the smart contract corresponding to the time period;
  • the second processing unit is specifically configured to:
  • a smart contract whose time period is greater than the split time point is determined from each smart contract of the first group as the smart contract of the third group.
  • each smart contract of the first group is that the first group generates a corresponding smart contract based on the received transaction data, and records the received transaction data in the corresponding In the smart contract;
  • the first processing unit is specifically configured to:
  • the splitting principle is determined according to the business type corresponding to each smart contract of the first group; the splitting principle is used to indicate that the smart contracts of each group after splitting correspond to the same business type.
  • the second processing unit is further configured to:
  • the acquisition unit is controlled to traverse the first group.
  • Each block of the group obtains the first block information of the smart contract of the second group in each block; the first block information is used to indicate that the smart contract of the second group is in the Describe the historical operations in each block of the first group;
  • the second processing unit is specifically configured to:
  • an embodiment of the present invention also provides a computing device, including:
  • Memory used to store program instructions
  • the processor is configured to call the program instructions stored in the memory, and execute the above-mentioned block chain group splitting method according to the obtained program.
  • an embodiment of the present invention also provides a computer-readable non-volatile storage medium, including computer-readable instructions.
  • the computer reads and executes the computer-readable instructions, the computer executes the above-mentioned blockchain group. How to split the group.
  • the embodiments of the present invention also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the above-mentioned method for splitting the blockchain group.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a method for splitting a blockchain group provided by an embodiment of the present invention
  • FIG. 3 is a schematic diagram of splitting groups by time according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of splitting groups according to service types according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a device for splitting a blockchain group provided by an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a computing device provided by this application.
  • FIG. 1 exemplarily shows that an embodiment of the present invention provides a blockchain system.
  • the blockchain system includes at least one group.
  • Each group has an independent consensus mechanism and records transaction data through its own smart contract.
  • Each group can not only include multiple nodes, a node can also belong to multiple different groups, that is, multiple groups can share one node.
  • Each node is a combination of a physical network, computer, blockchain application software, and database.
  • the nodes are connected to each other through TCP/IP (Transmission Control Protocol/Internet Protocol, Transmission Control Protocol/Internet Protocol).
  • the key indicators of the group may include: the network scale of the group, the book data capacity of the group, and the computing power of the group.
  • the key indicators of the group determine the hardware resources required by the group during normal operation.
  • a group can contain multiple blockchain nodes.
  • the blockchain nodes in the group are divided into consensus nodes and observation nodes. The sum of the two types of nodes is the number of blockchain nodes in the group. The number of consensus nodes and the interconnection of each consensus node determine the network scale of the group.
  • the embodiment of the present invention provides a method for calculating the network scale of a group. It is assumed that there are N consensus nodes and M observation nodes in the group. Among them, R connections can be established between N consensus nodes (R>N-1) .
  • the network scale of the group (Scale) can be as shown in formula (1).
  • S is the network scale of the group; N, M, and R are all positive integers.
  • Independent ledger data is stored in the group.
  • Each blockchain node belonging to the group will store a complete ledger data.
  • the disk space occupied by this ledger is the group's ledger data capacity.
  • the embodiment of the present invention provides a method for calculating the book data capacity of a group. Assuming that the number of users in the book is n and each user stores m pieces of account information, the book data capacity (Storage) of the group can be as the formula ( 2) Shown.
  • s is the book data capacity of the group; n and m are both positive integers.
  • the business logic is mainly implemented by smart contracts.
  • the computing power of the group is related to the type of smart contract and the number of transactions.
  • the embodiment of the present invention provides a calculation method for the computing power of a group. Assuming that the smart contracts in the group are pre-compiled smart contracts, the number of pre-compiled smart contracts is a 1 , and the code amount of pre-compiled smart contracts is b 1 , then The computing power (Thruput) of the group can be as shown in formula (3).
  • T 1 is the computing power of the group; a 1 and b 1 are both positive integers.
  • the embodiment of the present invention provides a calculation method for the computing power of another population group. It is assumed that the smart contract in the group is an EVM (Environment Virtual Machine, Ethereum Virtual Machine) smart contract, the number of EVM smart contracts is a 2 , and the EVM smart contract The code amount of is b 2 , then the computing power of the group can be as shown in formula (4).
  • EVM Environment Virtual Machine, Ethereum Virtual Machine
  • T 2 is the computing power of the group; a 2 and b 2 are both positive integers.
  • the network bandwidth required for each node's broadcast is the minimum network bandwidth required by the group.
  • the minimum network bandwidth (Bandwidth) required by the group can be as shown in formula (5).
  • B is the minimum network bandwidth required by the group.
  • the minimum network bandwidth required by the group can be calculated to be 4.8 Mbits.
  • the minimum disk capacity (Capacity) required by the group can be as shown in formula (6).
  • C is the minimum disk capacity required by the group.
  • the minimum disk capacity required by the group is 93G.
  • the computing power of the group is T
  • the number of cores of the processor of the group node is c
  • the main frequency is f
  • the minimum node computing power required (c ⁇ f ) Can be as shown in formula (7).
  • the above exemplarily provides key indicators in the group, such as the group’s network size, the group’s book data capacity, and the calculation method of the group’s computing power, and correspondingly provides the normal operation of the group.
  • the required minimum network bandwidth, minimum disk capacity, and minimum node computing power are calculated.
  • other parameters or calculation methods can also be used to obtain key indicators and hardware resource requirements in the group.
  • the resource situation of each node in the current group can be obtained, and the resource situation of each node can be used to determine whether the demand for group operation is met. If it is not satisfied, it is determined that the group needs to be split and the operation of the group is stopped.
  • the group can be defined as the first group, which is any group in the blockchain system.
  • the resource situation of each node does not meet the requirements of the first group operation mainly as follows:
  • the normal operation of the group can be realized by splitting the group. Specifically, when it is determined that the network bandwidth of each node is less than the network bandwidth required by the nodes in the first group to broadcast, the first group with a large number of consensus nodes can be split into multiple sub-groups with a small number of consensus nodes.
  • the present invention exemplarily shows a process of a method for splitting a blockchain group, and the process can be executed by a splitting device of a blockchain group.
  • the process specifically includes:
  • Step 201 Determine the splitting principle of the first group.
  • Step 202 Determine, from the smart contracts of the first group, a smart contract belonging to the second group and a smart contract belonging to the third group according to the splitting principle.
  • Step 203 Package the smart contract of the second group as the genesis block of the second group, and package the smart contracts of the third group as the genesis block of the third group.
  • Step 204 Activate the second group and the third group, and both the second group and the third group are groups in the blockchain system.
  • the first group is any group in the blockchain system, the splitting principle of the first group is determined, and the first group is split into the second group and the third group according to the splitting principle. Groups, where the nodes in the second group and the third group after splitting are not completely the same, and all belong to the first group.
  • nodes 1, node 2, and ...Node 100 there are nodes 1, node 2, and ...Node 100, according to the principle of splitting, node 1, node 2, ..., node 50, node 51, ..., node 60 can be determined as the nodes in the second group, and nodes 50, 51, ..., node 60, node 61, ..., node 100 are determined to be nodes in the third group, in this example, node 50, node 51, ..., node 60 are both the second group and the third group The nodes in are all nodes in the first group.
  • different types of smart contracts can be created for different types of the first group, which can be created according to time periods or according to business types.
  • the first group can create a smart contract for that time period according to the time period of the received transaction data; of course, the first group You can also create smart contracts for different periods in advance. For example, there are 30 smart contracts set in advance, corresponding to 30 days. This type of smart contract is used to record the transaction data of the first group after the first group receives the transaction data. In the smart contract corresponding to the time period.
  • the first group is an account reconciliation system. After the first group receives a piece of account data, the account data records a business serial number field, and the business serial number field contains the time and date when the account data occurred. According to the time and date of the account data, it can be determined to store the account data in the smart contract corresponding to the time period. For example, if the account data A with the account date of May 25, 2019 is received, if the current account data does not exist in the first group The smart contract corresponding to the date is created, the smart contract can be named after the creation time, and the account data A is stored in the smart contract. If another account date of May 25, 2019 is received Data B, then the account data B can be directly stored in the smart contract.
  • the first group After receiving the transaction data, the first group can generate the corresponding smart contract according to the received transaction data, and record the received transaction data in the corresponding smart contract. Specifically, it can be based on the transaction data belongs to Create a smart contract corresponding to the business type.
  • the first group is the evidence storage system, which is used to store evidence. Each time the first group receives a piece of evidence, it will be created according to the business type of the evidence A smart contract corresponding to the business type.
  • the first group will create a smart contract corresponding to the economic case to store the economic case Evidence; if the evidence received by the first group is evidence of a criminal case, the first group will create a smart contract corresponding to the criminal case to store the evidence of the criminal case.
  • the split principle can be determined according to different types of smart contracts created.
  • the splitting principle is determined to be split by time; when the smart contract in the first group is created according to the business type, the splitting principle is determined to be based on the business type Split.
  • the first group is split into at least the second group and the third group according to the splitting principle.
  • the group is split into the second group and the third group as an example for description.
  • the present invention provides an achievable way, which is suitable for smart contracts created according to time periods and a determined split principle of splitting according to time.
  • Split the first group into the second group and the third group. Specifically, you can first determine the split time point corresponding to the split principle, and determine the period of time from each smart contract of the first group.
  • the smart contract larger than the split time point is regarded as the smart contract of the second group, and the smart contract whose time period is greater than the split time point is determined from the smart contracts of the first group as the smart contract of the third group.
  • the first group is split into the second group and the third group according to the split time point, and the split time point is first determined.
  • the split time point can be set by the staff based on experience. It may also be determined by the first group based on the current data storage situation in each node through a preset rule.
  • the smart contract corresponding to the split time point is determined as the split smart contract.
  • the creation time of the split smart contract can be less than or equal to the split time point.
  • the split smart contract and the smart contract before the split smart contract are determined as the second
  • the smart contract of the group determines the smart contract after splitting the smart contract as the smart contract of the third group. As shown in Figure 3, the smart contract is created every day in the first group, and the corresponding time point for the split smart contract is determined to be January 1, 2018.
  • the smart contract created on January 1, 2018 will be used as the split smart contract.
  • It can also be a smart contract named "January 1, 2018" created before January 1, 2018, and the smart contract before the split smart contract is determined as the second group of smart contracts
  • the contract determines the smart contract after splitting the smart contract as the third group of smart contracts.
  • the bank reconciliation system in the banking field as an example. If the disk capacity of the nodes in the first group cannot meet the data capacity of the books in the first group, you need to change a book with a larger data capacity. Group, split into multiple groups with less book data capacity. For example, the current first group includes 100 nodes, and each node stores 10,000 data of the bank reconciliation system, which is the disk of the guarantee node If the capacity meets the data capacity of the ledger, two nodes can be determined from the first group to form a second group.
  • the second group is used to store 8000 pieces of data in the smart contract whose period is not greater than the split time point , And then group the remaining 98 nodes into a third group, which is used to store 2000 pieces of data in the smart contract whose period is less than the split time point.
  • obtaining the split time point is equivalent to determining the specific time point that needs to be split.
  • a binary search can be performed on the entire block chain of the first group to find the nearest For the smart contract that is less than the split time point, the found smart contract will be used as the split smart contract, and the binary search process is as 301 to step 304.
  • Step 301 Obtain a search interval.
  • the search interval determined for the first time is all blocks in the block chain of the first group. From all blocks, determine the block with the middle value of the block height, and determine the block with the middle value of the block height as the current block , Find all transactions that create smart contracts from the current block.
  • Step 302 if a qualified smart contract is found in the current block, the process ends and the smart contract is returned; if no qualified smart contract is found, step 303 or step 304 is executed.
  • Step 303 If the split time point is greater than the date of the smart contract with the largest creation date in the current block, reset the search interval, set the start position of the search interval to the current block, and set the end position of the search interval to The end block of the blockchain of the first group.
  • Step 304 If the split time point is less than the date of the smart contract with the smallest creation date in the current block, reset the search interval, and set the starting position of the search interval as the starting block of the first group of blockchains , The end position of the search interval is the current block.
  • the first group is divided into two subgroups, namely the second group and the third group.
  • the first group can also be divided into multiple subgroups.
  • K split time points can be set to split the first group into K+1 sub-groups, where K is greater than 1.
  • the present invention is also applicable to group the data in the smart contract at the split time point and the period before the split time point into the second group, and the data in the smart contract at the time period after the split time point to form the third group, that is Any way of splitting according to time period is within the protection scope of the present invention.
  • the present invention provides another achievable way, which is suitable for smart contracts created according to business types and the determined splitting principle for splitting according to business types.
  • Split the first group into the second group and the third group. Specifically, you can first determine the business type corresponding to each smart contract in the first group. For example, there are 30 smart contracts in the first group. Among them, 10 correspond to the first business type and 20 correspond to the second business type. It can be further determined that there are two types of smart contracts in the first group. The two types of business types are the first business type and the second business type.
  • the split principle which is used to indicate that the smart contracts of each group after splitting correspond to the same business type, that is, the first group split Is the second group and the third group, specifically, the data belonging to the first service type in the first group is stored in the second group, and the data belonging to the second service type in the first group is stored in the first group.
  • the business types corresponding to each smart contract stored in the first group include economic case type and criminal case type, and the first group can be split into economic case types according to the two types of business types.
  • the first group is split into the second group and the third group according to the two business types corresponding to the smart contract in the first group.
  • the smart contract in the first group can be For multiple business types, split the first group into sub-groups corresponding to each business type. In other words, in each sub-group after splitting the first group, the business corresponding to the smart contract The types are the same.
  • the split principle is determined according to the relationship between the smart contracts of the first group, and the split principle is used to indicate After the split, the smart contracts of each group do not have an association relationship.
  • the first and second types of smart contracts are both legal smart contracts
  • the third, The fourth type of smart contracts belong to economic smart contracts
  • the fifth type of smart contracts belong to other types of smart contracts.
  • the first group can be divided into three subgroups, and the first and second types of smart contracts can be stored separately.
  • the third and fourth types of smart contracts, the fifth type of smart contracts, the smart contracts in each group after the split have an association relationship, but the smart contracts between the groups do not have an association relationship.
  • the determined smart contracts belonging to the second group can be packaged into the second group
  • the group’s genesis block packs the determined smart contract belonging to the third group into the third group’s genesis block.
  • the smart contracts in the first group are respectively packaged into the genesis block of the corresponding subgroup, but this process is only to store each smart contract in the first group, but it is lost
  • the historical operations of each smart contract in each block of the first group that is to say, in order to ensure the credibility of splitting the first group into sub-groups in the above embodiment, each smart contract needs to be
  • the historical block information in the first group and each smart contract are stored in the subgroups.
  • the smart contracts used to characterize the second group are obtained respectively.
  • the first block information of historical operations in each block of the first group, and the second block information used to characterize historical operations of the smart contract of the third group in each block of the first group specifically, Traverse each block of the first group, obtain the first block information of the smart contract of the second group in each block, traverse each block of the first group, and obtain the smart contract of the third group in each block The second block of information.
  • the historical operations of each smart contract and each smart contract in each block of the first group can be packaged together into the corresponding subgroup in.
  • the creation block of the third group package the third group's smart contract and the second block information of the third group's smart contract into at least one second new block, and determine the third group from the at least one second new block Set of genesis blocks.
  • the split group can be restarted as a group in the blockchain system.
  • a certain sub-group is only used to store the ledger data in the first group, and no new data needs to be written, and the work of the nodes in the sub-group can be stopped, that is, the sub-group does not need to be started .
  • This split method reduces the book data capacity of the first group under the premise of ensuring the integrity of the book data.
  • routing information can be determined according to the nodes of each sub-group after splitting, and the routing information is used Instructs to route the transaction request to the corresponding split subgroup after receiving the transaction request. For example, if the first group is split into the second group and the third group, if a query request is received, the query request is used to query certain transaction data, and the transaction data to be queried is determined according to the routing information If it is stored in the second group, the query request can be routed to the nodes in the second group.
  • the transaction data contained in the on-chain request If it is a criminal case, it can be determined according to the routing information that the transaction data to be uploaded should be stored in the third group corresponding to the criminal case type, and the request for uploading can be routed to the third group corresponding to the criminal case type Node.
  • the operation of the first group can be suspended, and the key information of the first group can be recorded, such as the block height in the current block chain of the first group, consensus node list, network connectivity, and the first group
  • the business classification of smart contracts, the number of smart contracts, whether there is a relationship between smart contracts, the total data capacity of the first group, etc. According to the organization of the smart contract, design a split strategy to split the first group.
  • the resource situation of each node in the first group does not meet the requirements of the operation of the first group, not only can the problem be solved by splitting the first group, but also the export and / of all blockchain nodes can be improved. Or the network bandwidth of the entrance, increase the number of network connections of the nodes in the group, increase the disk capacity of the nodes in the group, reduce the number of accounts for each user, upgrade the processor of each node in the group, modify the smart contract logic, etc., In this way, the resource situation of each node in the first group meets the operation requirements of the first group, and the normal operation of the first group is ensured.
  • splitting the first group into at least the second group and the third group can not only solve the problem that the book data in the first group is too large, and the disk capacity of the group node limits the book data capacity. It can also solve the problem of the network bandwidth limiting the network scale of the group in the first group.
  • the explanation is that when there are 80 consensus nodes in the first group, any consensus node needs to broadcast transaction information or new blocks to others 79 consensus nodes, and after splitting, for example, if two groups are split, and one group has 40 consensus nodes, any consensus node in a group will broadcast transaction information or new blocks to the other 39 The consensus node reduces the network bandwidth required for broadcasting in the blockchain.
  • this solution can also solve the problem that the computing power of the group node limits the computing power of the group.
  • the first group needs to calculate the transaction data of the economic case type and the criminal case type. If the first group is based on the data type After the split, the two subgroups after splitting calculate the transaction data of the economic case type and the transaction data of the criminal case type respectively, which reduces the group's requirements for the computing power of each node.
  • FIG. 5 exemplarily shows the structure of a block chain group splitting device provided by an embodiment of the present invention, which can execute the process of the block chain group splitting method.
  • the device is suitable for a blockchain system with at least one group, each group has an independent consensus mechanism and records transaction data through its own smart contract; the device includes:
  • the first processing unit 501 is configured to determine a splitting principle of the first group; the splitting principle is used to instruct to split the first group into at least a second group and a third group, and the first group A group is any group in the blockchain system; each node of the second group and each node of the third group are not exactly the same and are all nodes of the first group;
  • the second processing unit 502 is configured to determine the smart contract belonging to the second group and the smart contract belonging to the third group from the smart contracts of the first group according to the split principle ; Package the smart contract of the second group as the genesis block of the second group, and package the smart contracts of the third group as the genesis block of the third group;
  • the second group and the third group, the second group and the third group are all groups in the blockchain system.
  • the device further includes: an obtaining unit 503;
  • the first processing unit 501 is further configured to:
  • control the obtaining unit 503 Before the determination of the split principle of the first group, control the obtaining unit 503 to obtain the resource status of each node in the first group; determine whether the resource status of each node meets the first group If the operation requirement is not met, it is determined to split the first group and stop the operation of the first group.
  • the first processing unit 501 is specifically configured to:
  • each smart contract of the first group is a smart contract created by the first group according to the time period of the received transaction data, and the received transaction data is recorded in the smart contract corresponding to the time period;
  • the second processing unit 502 is specifically configured to:
  • a smart contract whose time period is greater than the split time point is determined from each smart contract of the first group as the smart contract of the third group.
  • each smart contract of the first group is that the first group generates a corresponding smart contract based on the received transaction data, and records the received transaction data in the corresponding In the smart contract;
  • the first processing unit 501 is specifically configured to:
  • the splitting principle is determined; the splitting principle is used to indicate that the smart contracts of each split group correspond to the same business type.
  • the second processing unit 502 is further configured to:
  • the acquiring unit 503 is controlled to traverse the first group. For each block of a group, the first block information of the smart contract of the second group in each block is obtained; the first block information is used to indicate that the smart contract of the second group is in Historical operations in each block of the first group;
  • the second processing unit 502 is specifically configured to:
  • the present application further provides a computing device 600 including at least one processor 620 for implementing any method in FIG. 2 provided in the embodiment of the present application.
  • the computing device 600 may also include at least one memory 630 for storing program instructions and/or data.
  • the memory 630 and the processor 620 are coupled.
  • the coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units, or modules, and may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules.
  • the processor 620 may cooperate with the memory 630 to operate.
  • the processor 620 may execute program instructions stored in the memory 630. At least one of the at least one memory may be included in the processor.
  • the steps of the above method can be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
  • the processor in the embodiment of the present application may be an integrated circuit chip with signal processing capability.
  • the steps of the foregoing method embodiments can be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
  • the above-mentioned processor may be a general-purpose processor, a digital signal processing circuit (digital signal processor, DSP), a dedicated integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA) or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP digital signal processing circuit
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • Programming logic devices discrete gates or transistor logic devices, discrete hardware components.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the memory in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electronic Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • serial link DRAM SLDRAM
  • direct rambus RAM direct rambus RAM
  • the computing device 600 may further include a communication interface 610 for communicating with other devices through a transmission medium, so that the device used in the computing device 600 can communicate with other devices.
  • the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface.
  • the transceiver when the communication interface is a transceiver, the transceiver may include an independent receiver and an independent transmitter; it may also be a transceiver with integrated transceiver functions, or an interface circuit.
  • the computing device 600 may also include a communication line 640.
  • the communication interface 610, the processor 620, and the memory 630 may be connected to each other through a communication line 640;
  • the communication line 640 may be a peripheral component interconnection standard (peripheral component interconnect, PCI for short) bus or an extended industry standard architecture (extended industry standard architecture) , Referred to as EISA) bus and so on.
  • the communication line 640 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in FIG. 6, but it does not mean that there is only one bus or one type of bus.
  • embodiments of the present invention also provide a computer-readable non-volatile storage medium, including computer-readable instructions.
  • the computer reads and executes the computer-readable instructions, the computer executes the aforementioned blocks. How to split the chain group.
  • embodiments of the present application provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the above-mentioned method for splitting the blockchain group.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种区块链群组的拆分方法及装置,适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据,其中,方法包括:确定第一群组的拆分原则,根据拆分原则,从第一群组的各智能合约中确定出属于第二群组的智能合约和属于第三群组的智能合约,将第二群组的智能合约打包为第二群组的创世块,并将第三群组的智能合约打包为第三群组的创世块,启动第二群组和第三群组。由此解决了群组中节点的硬件资源不能满足群组的正常运行的问题,且降低了硬件改造的成本。

Description

一种区块链群组的拆分方法及装置
相关申请的交叉引用
本申请要求在2019年06月06日提交中国专利局、申请号为201910488990.0、申请名称为“一种区块链群组的拆分方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及金融科技(Fintech)领域,尤其涉及一种区块链群组的拆分方法及装置。
背景技术
区块链(BlockChain)是由一系列区块组成的一条链,每个区块记录本块的数据及上一块的哈希值,所有区块通过这种方式前后相继组成一条链。区块链所基于的密码学技术和去中心化思想使链上的历史信息无法被篡改。
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技转变,区块链技术也不例外,但由于金融、支付行业的安全性、实时性要求,也对区块链技术提出的更高的要求。
区块链系统包括多个群组,各群组进行独立的数据存储和共识流程。群组是由多个区块链节点组成的,每个区块链节点即一组物理网络,由计算机、区块链应用软件、数据库组成。群组的正常运行依赖于群组中节点的硬件资源。
当群组中节点的硬件资源不能满足群组的运行需求时,现有技术中,通过提高各节点的硬件资源来解决问题,如增大节点磁盘内存、增大网络带宽、提高节点处理器的运算速率等,但该种解决方式需要对各节点的硬件进行改造,成本高。
发明内容
本发明实施例提供一种区块链群组的拆分方法及装置,用以解决群组中节点的硬件资源不能满足群组的正常运行的问题,且降低硬件改造的成本。
本发明实施例提供的一种区块链群组的拆分方法,适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据。
所述方法包括:
确定第一群组的拆分原则;所述拆分原则用于指示将所述第一群组拆分为至少第二群组和第三群组,所述第一群组为所述区块链系统中的任一群组;所述第二群组的各节点和所述第三群组的各节点不完全相同且均是所述第一群组的节点;
根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约;
将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块;
启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
上述技术方案中,将第一群组拆分为至少第二群组和第三群组,将账本进行拆分,则第二群组、第三群组的账本数据量小于第一群组的账本数据量,解决群组节点的磁盘容量限制账本数据容量的问题;第二群组、第三群组的共识节点数量小于第一群组共识节点数量,则第二群组、第三群组中节点广播所需的网络带宽均小于第一群组中节点广播所需的网络带宽,也就解决群组中网络带宽限制群组的网络规模的问题;第二群组、第三群组中节点运算量均小于第一群组中节点运算量,解决群组节点的运算能力限制群组的运算能力的问题,保证群组的正常运行,且无需对群组节点的硬件进行改造,降低改造成本。
可选的,在所述确定第一群组的拆分原则之前,还包括:
获取所述第一群组中各节点的资源情况;判断所述各节点的资源情况是否满足所述第一群组运行的需求,若不满足,则确定对所述第一群组进行拆分并停止所述第一群组的运行。
可选的,所述各节点的资源情况不满足所述第一群组运行的需求,包括:
确定所述各节点的网络带宽小于所述第一群组内节点广播所需的网络带宽;或
确定所述各节点的存储空间小于所述第一群组内账本所需的空间;或
确定所述各节点运算能力小于所述第一群组内各节点运行所述智能合约所需的运算能力。
上述技术方案中,在确定第一群组中各节点的资源情况不满足第一群组运行的需求时,确定对第一群组进行拆分,且可以根据不同的资源情况,确定拆分原则,以解决资源情况不满足第一群组运行需求的问题,保证群组的正常运行,且无需对群组节点的硬件进行改造,降低改造成本。
可选的,所述第一群组的各智能合约是所述第一群组根据接收的交易数据的所属时段创建的智能合约并将接收到的交易数据记录在所属时段对应的智能合约中;
所述根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约,包括:
确定所述拆分原则对应的拆分时间点;
从所述第一群组的各智能合约中确定出所属时段不大于所述拆分时间点的智能合约作为所述第二群组的智能合约;
从所述第一群组的各智能合约中确定出所属时段大于所述拆分时间点的智能合约作为所述第三群组的智能合约。
上述技术方案中,第一群组将交易数据存储至所属时段对应的智能合约中,在进行第一群组拆分时,可以根据各时段对应的智能合约,有效将第一群组按照拆分时间点进行拆分,将第一群组的各智能合约中确定所属时段不大于拆分时间点的智能合约作为第二群组的智能合约,将第一群组的各智能合约中确定所属时段小于拆分时间点的智能合约作为第三群组的智能合约,可以解决第一群组中账本数据过大,群组节点的磁盘容量限制账本数据的问题,以及第一群组中群组内网络带宽限制群组的网络规模的问题。也就是说,当确定各节点的网络带宽小于第一群组内节点广播所需的网络带宽时,或确定各节点的存储空间小于第一群组内账本所需的空间时,可以采用按照时间进行拆分的原则,对第一群组进行拆分,从而有效解决上述问题。
可选的,所述第一群组的各智能合约是所述第一群组根据接收到的交易数据生成相对应的智能合约,并将所述接收到的交易数据记录在所述相对应的智能合约中;
所述确定第一群组的拆分原则,包括:
根据所述第一群组的各智能合约所对应的业务类型,确定所述拆分原则;所述拆分原则用于指示拆分后的各群组的智能合约对应相同业务类型。
上述技术方案中,第一群组根据接收到的交易数据生成相对应的智能合约,并将交易数据记录在相对应的智能合约中,在对第一群组进行拆分时,可以根据各智能合约的业务类型,确定拆分原则,有效将第一群组按照业务类型进行拆分,可以解决群组节点的磁盘容量限制账本数据存储量的问题,以及第一群组中群组内网络带宽限制群组的网络规模的问题,以及第一群组中群组节点的运算能力限制群组的运算能力的问题。也就是说,当确定各节点的网络带宽小于第一群组内节点广播所需的网络带宽时,或确定各节点的存储空间小于第一群组内账本所需的空间时,或确定各节点运算能力小于第一群组内各节点运行智能合约所需的运算能力时,可以采用按照业务进行拆分的原则,对第一群组进行拆分,从而有效解决上述问题。
可选的,在所述从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约之后,还包括:
遍历所述第一群组的各区块,获取所述第二群组的智能合约在所述各区块中的第一区块信息;所述第一区块信息用于表征所述第二群组的智能合约在所述第一群组的各区块中的历史操作;
遍历所述第一群组的各区块,获取所述第三群组的智能合约在所述各区块中的第二区块信息;所述第二区块信息用于表征所述第三群组的智能合约在所述第一群组的各区块中的历史操作;
所述将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块,包括:
将所述第二群组的智能合约及所述第二群组的智能合约的第一区块信息打包为至少一个第一新区块;并从所述至少一个第一新区块中确定出所述第二群组的创世块;
将所述第三群组的智能合约及所述第三群组的智能合约的第二区块信息打包为至少一个第二新区块;并从所述至少一个第二新区块中确定出所述第三群组的创世块。
上述技术方案中,分别获取用于表征第二群组的智能合约在第一群组的各区块中的历史操作的第一区块信息、用于表征第三群组的智能合约在第一群组的各区块中的历史操作的第二区块信息,将第二群组的智能合约、第一区块信息打包为至少一个第一新区块,第三群组的智能合约、第二区块信息打包为至少一个第二新区块,即将拆分后的各群组内的智能合约的历史操作信息一起打包至各群组中,从而保障第一群组拆分为各子群组的可信度。
相应的,本发明实施例还提供了一种区块链群组的拆分装置,适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据;
所述装置包括:
第一处理单元,用于确定第一群组的拆分原则;所述拆分原则用于指示将所述第一群组拆分为至少第二群组和第三群组,所述第一群组为所述区块链系统中的任一群组;所述第二群组的各节点和所述第三群组的各节点不完全相同且均是所述第一群组的节点;
第二处理单元,用于根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约;将所述第二群组的智能合约打 包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块;启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
可选的,所述装置还包括:获取单元;
所述第一处理单元还用于:
在所述确定第一群组的拆分原则之前,控制所述获取单元获取所述第一群组中各节点的资源情况;判断所述各节点的资源情况是否满足所述第一群组运行的需求,若不满足,则确定对所述第一群组进行拆分并停止所述第一群组的运行。
可选的,所述第一处理单元具体用于:
确定所述各节点的网络带宽小于所述第一群组内节点广播所需的网络带宽;或
确定所述各节点的存储空间小于所述第一群组内账本所需的空间;或
确定所述各节点运算能力小于所述第一群组内各节点运行所述智能合约所需的运算能力。
可选的,所述第一群组的各智能合约是所述第一群组根据接收的交易数据的所属时段创建的智能合约并将接收到的交易数据记录在所属时段对应的智能合约中;
所述第二处理单元具体用于:
确定所述拆分原则对应的拆分时间点;
从所述第一群组的各智能合约中确定出所属时段不大于所述拆分时间点的智能合约作为所述第二群组的智能合约;
从所述第一群组的各智能合约中确定出所属时段大于所述拆分时间点的智能合约作为所述第三群组的智能合约。
可选的,所述第一群组的各智能合约是所述第一群组根据接收到的交易数据生成相对应的智能合约,并将所述接收到的交易数据记录在所述相对应的智能合约中;
所述第一处理单元具体用于:
根据所述第一群组的各智能合约所对应的业务类型,确定所述拆分原则;所述拆分原则用于指示拆分后的各群组的智能合约对应相同业务类型。
可选的,所述第二处理单元还用于:
在所述从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约之后,控制所述获取单元遍历所述第一群组的各区块,获取所述第二群组的智能合约在所述各区块中的第一区块信息;所述第一区块信息用于表征所述第二群组的智能合约在所述第一群组的各区块中的历史操作;
控制所述获取单元遍历所述第一群组的各区块,获取所述第三群组的智能合约在所述各区块中的第二区块信息;所述第二区块信息用于表征所述第三群组的智能合约在所述第一群组的各区块中的历史操作;
所述第二处理单元具体用于:
将所述第二群组的智能合约及所述第二群组的智能合约的第一区块信息打包为至少一个第一新区块;并从所述至少一个第一新区块中确定出所述第二群组的创世块;
将所述第三群组的智能合约及所述第三群组的智能合约的第二区块信息打包为至少一个第二新区块;并从所述至少一个第二新区块中确定出所述第三群组的创世块。
相应的,本发明实施例还提供了一种计算设备,包括:
存储器,用于存储程序指令;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行上述区块链群组的拆分方法。
相应的,本发明实施例还提供了一种计算机可读非易失性存储介质,包括计算机可读指令,当计算机读取并执行所述计算机可读指令时,使得计算机执行上述区块链群组的拆分方法。
相应的,本发明实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述区块链群组的拆分方法。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种系统架构的示意图;
图2为本发明实施例提供的一种区块链群组的拆分方法的流程示意图;
图3为本发明实施例提供的一种按时间拆分群组的示意图;
图4为本发明实施例提供的一种按业务类型拆分群组的示意图;
图5为本发明实施例提供的一种区块链群组的拆分装置的结构示意图;
图6为本申请提供的一种计算设备的结构示意图。
具体实施方式
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
图1示例性的示出了本发明实施例提供一种区块链系统,该区块链系统包括至少一个群组,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据。每个群组不仅可以包括多个节点,一个节点也可以属于多个不同的群组,即多个群组可以共用一个节点。每个节点是一组物理网络、计算机、区块链应用软件以及数据库的组合,节点与节点之间通过TCP/IP(Transmission Control Protocol/Internet Protocol,传输控制协议/因特网互联协议)互相连接。
群组的关键指标可以包括:群组的网络规模、群组的账本数据容量、群组的运算能力。群组的各关键指标决定了群组在正常运行时所需的硬件资源。
先对群组的关键指标进行解释如下:
一、群组的网络规模
群组可以包含多个区块链节点,群组内的区块链节点分为共识节点和观察节点,两种节点数量的加和为群组内区块链节点的数量。共识节点的数量、各共识节点的互联关系,决定了群组的网络规模。
本发明实施例提供一种群组的网络规模的计算方式,假设群组内包含N个共识节点、 M个观察节点,其中,N个共识节点间可以建立R个连接(R>N-1)。群组的网络规模(Scale)可以如公式(1)所示。
S=N 2×R×(1/(R-N))+M…………(1)
其中,S为群组的网络规模;N、M、R均为正整数。
二、群组的账本数据容量
群组内保存独立的账本数据,每个属于该群组的区块链节点都会保存一份完整的账本数据,这个账本占用的磁盘空间大小为群组的账本数据容量。
本发明实施例提供一种群组的账本数据容量的计算方式,假设账本内的用户数为n,每个用户存储了m个账目信息,则群组的账本数据容量(Storage)可以如公式(2)所示。
s=n 1.5×m…………(2)
其中,s为群组的账本数据容量;n、m均为正整数。
三、群组的运算能力
不同的群组会处理不同业务逻辑,业务逻辑主要由智能合约实现,群组的运算能力与智能合约的类别、交易数量有关。
本发明实施例提供一种群组的运算能力的计算方式,假设群组内智能合约为预编译智能合约,预编译智能合约的数量为a 1,预编译智能合约的代码量为b 1,则群组的运算能力(Thruput)可以如公式(3)所示。
T 1=a 1×b 1…………(3)
其中,T 1为群组的运算能力;a 1、b 1均为正整数。
本发明实施例提供另一种群组的运算能力的计算方式,假设群组内智能合约为EVM(Environment Virtual Machine,以太坊虚拟机)智能合约,EVM智能合约的数量为a 2,EVM智能合约的代码量为b 2,则群组的运算能力可以如公式(4)所示。
Figure PCTCN2020093997-appb-000001
其中,T 2为群组的运算能力;a 2、b 2均为正整数。
结合上述群组的各关键指标,群组在运行时,若群组内各节点的硬件资源存在不足情况,则群组不能正常运行,或者说群组在运行过程中不能达到预期的运行效果。根据上述群组的各关键指标,下面提供可以满足群组正常运行的各节点的硬件资源指标。
一、群组所需的最小网络带宽
群组内节点需要进行交易广播或者区块广播,各节点在广播中需要网络带宽,各节点广播所需的网络带宽即群组所需的最小网络带宽。根据上述群组的网络规模的计算方法,设群组的网络规模为S,则该群组所需的最小网络带宽(Bandwidth)可以如公式(5)所示。
B=S×100Kbits…………(5)
其中,B为群组所需的最小网络带宽。
举例来说,若群组中有4个区块链的共识节点和0个区块链观察节点,根据公式(5),可计算出群组所需的最小网络带宽为4.8Mbits。
二、群组所需的最小磁盘容量
根据上述群组的账本数据容量的计算方法,设账本数据容量为s,则该群组所需的最小磁盘容量(Capacity)可以如公式(6)所示。
C=s×100Kbyte…………(6)
其中,C为群组所需的最小磁盘容量。
举例来说,若群组中有1000万用户,每个用户有100条账目信息,根据公式(6),得出该群组所需的最小磁盘容量为93G。
三、群组所需的最小节点运算能力
根据上述群组的运算能力的计算方法,设群组的运算能力为T,设群组节点的处理器的核心数为c、主频为f,则所需的最小节点运算能力(c×f)可以如公式(7)所示。
Figure PCTCN2020093997-appb-000002
需要说明的是,上述示例性的提供了群组内的关键指标,如群组的网络规模、群组的账本数据容量、群组的运算能力的计算方式,且对应的提供了群组正常运行所需的最小网络带宽、最小磁盘容量、最小节点运算能力的计算方式,但本发明中,还可以采用其他参数或计算方式获取群组内的关键指标和硬件资源需求。
基于上述群组运行所需的最小网络带宽、最小磁盘容量、最小节点运算能力,可以获取当前群组内各节点的资源情况,并根据各节点的资源情况判断是否满足群组运行的需求,若不满足,则确定需要对该群组进行拆分并停止该群组的运行。为了方便描述,可以将该群组定义为第一群组,该第一群组即区块链系统中的任一群组。
具体的,各节点的资源情况不满足第一群组运行的需求主要有:
确定各节点的网络带宽小于群组内节点广播所需的网络带宽;
或确定各节点的存储空间小于群组内账本所需的空间;
或确定各节点运算能力小于群组内各节点运行智能合约所需的运算能力。
进一步的,在确定各节点的资源情况不满足群组运行的需求时,需要采取相应解决措施,以实现群组的正常运行。针对上述三种情况,可以通过拆分群组的方式,以实现群组的正常运行。具体的,当确定各节点的网络带宽小于第一群组内节点广播所需的网络带宽时,可以将共识节点数较多的第一群组,拆分为多个共识节点数较少的子群组;当确各节点的存储空间小于第一群组内账本所需的空间时,将一个账本数据容量较大的第一群组,拆分为多个账本数据容量较少的子群组,可以降低账本数据容量;将一个运算能力需求较高的第一群组,拆分为多个运算能力需求低的子群组,可以降低运算能力需求。
基于上述描述,如图2所示,本发明示例性的示出了一种区块链群组的拆分方法的流程,该流程可以由区块链群组的拆分装置执行。
该流程具体包括:
步骤201,确定第一群组的拆分原则。
步骤202,根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约。
步骤203,将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块。
步骤204,启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
在步骤201中,第一群组为区块链系统中的任一群组,确定该第一群组的拆分原则,根据该拆分原则将第一群组拆分为第二群组和第三群组,其中,拆分后的第二群组和第三群组中的各节点是不完全相同的,且均属于第一群组,例如,第一群组中有节点1、节点2、……节点100,根据拆分原则,可以将节点1、节点2、……、节点50、节点51、……、节点60确定为第二群组中的节点,以及将节点50、节点51、……、节点60、节点61、……、节点100确定为第三群组中的节点,该例子中,节点50、节点51、……、节点60同时是第二群组和第三群组中的节点,且均是第一群组中的节点。
本发明实施例中,可以针对第一群组的不同类型创建不同类型的智能合约,可以是按照时段创建,还可以是按照业务类型创建。
一、按照时段创建智能合约
针对各时段创建与各时段对应的智能合约,可选的,第一群组可以在接收到交易数据后,根据接收到的交易数据的所属时段创建该时段的智能合约;当然,第一群组也可以预先创建不同时段的智能合约,如预先设置有30个智能合约,对应30天,该类智能合约用于在第一群组接收到交易数据后,将第一群组的交易数据记录在所属时段对应的智能合约中。
举例来说,第一群组是对账系统,第一群组在接收到一条账目数据后,该账目数据中记录有业务流水号字段,业务流水号字段中有发生该账目数据的时间日期,可以根据该账目数据的时间日期确定将该账目数据存储在所属时段对应的智能合约中,例如,接收到账目日期为2019年5月25日的账目数据A,若当前第一群组中不存在该日期对应的智能合约,则创建该智能合约,可以以创建时间命名该智能合约,进而将该账目数据A存储至智能合约中,若再接收到一条账目日期为2019年5月25日的账目数据B,则可以直接将该账目数据B存储至该智能合约中。
二、按照业务类型创建智能合约
第一群组可以在接收到交易数据后,根据接收到的交易数据生成相对应的智能合约,并将接收到的交易数据记录在相对应的智能合约中,具体的,可以是根据交易数据所属的业务类型,创建与所属业务类型相对应的智能合约,例如,第一群组是存证系统,用于存储证据,第一群组每接收到一条证据,就会根据证据所属的业务类型创建一个与该业务类型相对应的智能合约,例如,若第一群组接收到的证据是经济案件的证据,则第一群组会创建一个经济案件对应的智能合约,用于存储该经济案件的证据;若第一群组接收到的证据是刑事案件的证据,则第一群组会创建一个刑事案件对应的智能合约,用于存储该刑事案件的证据。
相应的,可以根据创建的不同类型的智能合约,确定拆分原则。当第一群组内的智能合约是按照时段创建时,确定拆分原则为按时间进行拆分;当第一群组内的智能合约是按照业务类型创建时,确定拆分原则为按业务类型进行拆分。
在确定第一群组的拆分原则之后,即在步骤201之后,根据拆分原则将第一群组至少拆分为第二群组和第三群组,为了方便描述,下面以将第一群组拆分为第二群组和第三群组为例进行说明。
本发明提供一种可实现的方式,该方式适用于按时段创建的智能合约,以及确定的按照时间进行拆分的拆分原则。将第一群组拆分为第二群组和第三群组,具体的,可以先确定拆分原则所对应的拆分时间点,从第一群组的各智能合约中确定出所属时段不大于该拆 分时间点的智能合约作为第二群组的智能合约,从第一群组的各智能合约中确定出所属时段大于该拆分时间点的智能合约作为第三群组的智能合约。
举例来说,根据拆分时间点将第一群组拆分为第二群组和第三群组,首先确定出拆分时间点,该拆分时间点可以是工作人员根据经验设定的,也可以是第一群组根据当前各节点中存储数据的情况通过预设规则确定出来的。将拆分时间点对应的智能合约确定为切分智能合约,切分智能合约的创建时间可以小于等于该拆分时间点,将切分智能合约、切分智能合约之前的智能合约确定为第二群组的智能合约,将切分智能合约之后的智能合约确定为第三群组的智能合约。如图3所示,第一群组中每天创建智能合约,确定切分智能合约对应时间点是2018年1月1日,即将2018年1月1日创建的智能合约作为切分智能合约,当然,还可以是在2018年1月1日之前创建的命名为“2018年1月1日”的智能合约,将切分智能合约、切分智能合约之前的智能合约确定为第二群组的智能合约,将切分智能合约之后的智能合约确定为第三群组的智能合约。
在具体实现中,可以以银行领域中的银行对账系统为例,若第一群组内节点的磁盘容量不能满足第一群组中账本的数据容量,则需要将一个账本数据容量较大的群组,拆分为多个账本数据容量较少的群组,如当前第一群组中包括100个节点,每个节点上存储有该银行对账系统的10000条数据,为保障节点的磁盘容量满足账本的数据容量,则可以从第一群组中确定出2个节点组成第二群组,该第二群组用于存储所属时段不大于拆分时间点的智能合约中的8000条数据,然后将剩余的98个节点组成第三群组,该第三群组用于存储所属时段小于拆分时间点的智能合约中的2000条数据。
本发明实施例中,获取拆分时间点即相当于确定出了需要拆分的具体时间点,根据该拆分时间点,可以在整个第一群组的区块链上进行二分查找,查找最近的小于该拆分时间点的智能合约,将查找到的该智能合约作为切分智能合约,二分查找的流程如301~步骤304。
步骤301,获取查找区间。首次确定的查找区间为第一群组的区块链中的所有区块,从所有区块中确定出块高为中间值的区块,将该块高为中间值的区块确定为当前块,从该当前块中查找所有创建智能合约的交易。
步骤302,如果在该当前块内找到了符合条件的智能合约,结束流程并返回该智能合约;如果未找到符合条件的智能合约,则执行步骤303或步骤304。
步骤303,如果拆分时间点大于该当前块中创建日期最大的智能合约的日期,则重新设置查找区间,将该查找区间的起始位置设置为该当前块,该查找区间的结束位置设置为第一群组的区块链的结束块。
步骤304,如果拆分时间点小于该当前块中创建日期最小的智能合约的日期,则重新设置查找区间,将该查找区间的起始位置设置为第一群组的区块链的起始块,该查找区间的结束位置为当前块。
重复执行步骤301~步骤304,直至找到符合要求的智能合约为止。
上述实施例中,为方便描述,将第一群组拆分为两个子群组,即第二群组和第三群组,当然,还可以将第一群组拆分为多个子群组,可以设置K个拆分时间点,将第一群组拆分为K+1个子群组,其中,K大于1。还可以设置1个拆分时间点,将第一群组拆分为第二群组和第三群组之后,再针对第二群组设置1个拆分时间点,将第二群组拆分为第四群组和第五群组,以及针对第三群组设置1个拆分时间点,将第三群组拆分为第六群组和第七 群组。
此外,虽然上述实施例中,提供的是将拆分时间点之前时段的智能合约中数据组成第二群组,拆分时间点、拆分时间点之后时段的智能合约中数据组成第三群组,但本发明同样适用于将拆分时间点、拆分时间点之前时段的智能合约中数据组成第二群组,拆分时间点之后时段的智能合约中数据组成第三群组,也就是说,任何根据时段进行拆分的方式均在本发明的保护范围内。
本发明提供另一种可实现的方式,该方式适用于按业务类型创建的智能合约,以及确定的按照业务类型进行拆分的拆分原则。将第一群组拆分为第二群组和第三群组,具体的,可以先确定第一群组的各智能合约所对应的业务类型,如第一群组中有30个智能合约,其中,10个对应第一业务类型,20个对应第二业务类型,则可以进一步确定出第一群组中有两类业务类型的智能合约,两类业务类型分别是第一业务类型、第二业务类型,然后根据确定出的两类业务类型,确定拆分原则,该拆分原则用于指示拆分后的各群组的智能合约对应相同业务类型,也就是说,第一群组拆分为第二群组和第三群组,具体为,将第一群组中属于第一业务类型的数据存储在第二群组中,第一群组中属于第二业务类型的数据存储在第三群组中。
如图4所示,第一群组中存储的各智能合约对应的业务类型有经济案件类型和刑事案件类型,则可以根据该两类业务类型将第一群组拆分为分别与经济案件类型的智能合约相对应的第二群组和与刑事案件类型的智能合约相对应的第三群组。
上述实施例是根据第一群组中智能合约对应的两个业务类型,将第一群组,拆分为第二群组和第三群组,同理,可以根据第一群组中智能合约对应的多个业务类型,将第一群组拆分为与各业务类型相对应的子群组,也可以说,将第一群组拆分后的各子群组中,智能合约所对应业务类型是相同的。
此外,在某些场景下,将第一群组根据业务类型进行拆分时,可以理解为,根据第一群组的各智能合约间的关联关系确定拆分原则,该拆分原则用于指示拆分后的各群组的智能合约不具有关联关系,例如,第一群组中存在五类智能合约,其中,第一类、第二类智能合约同属于法律类智能合约,第三类、第四类智能合约同属于经济类智能合约,第五类智能合约属于其它类智能合约,则可将第一群组拆分为三个子群组,分别存储第一类、第二类智能合约,第三类、第四类智能合约,第五类智能合约,拆分后的各群组中智能合约具有关联关系的,但各群组间的智能合约不具有关联关系。
在从第一群组的各智能合约中确定出属于第二群组的智能合约和属于第三群组的智能合约之后,可以将确定出的属于第二群组的智能合约打包为第二群组的创世块,将确定出的属于第三群组的智能合约打包为第三群组的创世块。
进一步说明,上述实施例中将第一群组中的智能合约分别打包到对应的子群组的创世块中,但此过程仅是将第一群组中的各智能合约进行存储,却丢失了各智能合约在第一群组的各区块中的历史操作,也就是说,为保障上述实施例中将第一群组拆分为各子群组的可信度,需要将各智能合约在第一群组中的历史区块信息和各智能合约一起存储至子群组中。本实现过程中,在从第一群组的各智能合约中确定出属于第二群组的智能合约和属于第三群组的智能合约之后,分别获取用于表征第二群组的智能合约在第一群组的各区块中的历史操作的第一区块信息、用于表征第三群组的智能合约在第一群组的各区块中的历史操作的第二区块信息,具体的,遍历第一群组的各区块,获取第二群组的智能合约在各区 块中的第一区块信息,遍历第一群组的各区块,获取第三群组的智能合约在各区块中的第二区块信息。在获取到各智能合约在第一群组的各区块中的历史操作后,即可以将各智能合约和各智能合约在第一群组的各区块中的历史操作一起打包到对应的子群组中。
可选的,将第二群组的智能合约及第二群组的智能合约的第一区块信息打包为至少一个第一新区块,并从至少一个第一新区块中确定出第二群组的创世块;将第三群组的智能合约及第三群组的智能合约的第二区块信息打包为至少一个第二新区块,并从至少一个第二新区块中确定出第三群组的创世块。
本实现过程中,将第一群组拆分为至少第二群组和第三群组后,拆分后的群组可以作为区块链系统中的群组被重新启动,在某些特定情况下,拆分后的某个子群组仅用于存储第一群组中的账本数据,无需再写入新的数据,则可以停止该子群组中节点的工作,即无需启动该子群组,该种拆分方式,在保障账本数据完整性的前提下,减少了第一群组的账本数据容量。
在将第一群组进行拆分后,本发明实施例还可以将各拆分后的信息进行汇总,具体的,可以根据拆分后各子群组的节点,确定路由信息,该路由信息用于指示在接收到交易请求后,将交易请求路由到对应的拆分后的子群组中。例如,若第一群组被拆分成了第二群组和第三群组,若接收到一个查询请求,该查询请求用于查询某交易数据,又根据路由信息确定该待查询的交易数据是存储在第二群组中,则可以将该查询请求路由至第二群组中的节点。又例如,若第一群组被拆分成了经济案件类型对应的第二群组和刑事案件类型对应的第三群组,若接收到一个上链请求,该上链请求中包含的交易数据是刑事案件,则可以根据路由信息确定该待上链的交易数据应该存储在刑事案件类型对应的第三群组中,则可以将该上链请求路由至刑事案件类型对应的第三群组中的节点。
为了更好地解释本发明,下面提供一种在具体场景下的实施例,首先,可以根据第一群组的运行情况,判断该第一群组中各节点的资源情况是否满足第一群组正常运行的要求,针对不同的运行指标,采用不同的评估方式。具体的,使用jnettop,查看当前第一群组内各节点所使用端口的出流量和入流量,评估第一群组的网络规模是否达到上限;使用df,查看第一群组内各节点的磁盘容量,评估第一群组的磁盘使用是否达到上限;使用top,查看第一群组内各节点的处理器使用率,评估第一群组的运算能力是否达到上限。若达到上限,则可以暂停第一群组的运行,记录第一群组的关键信息,如第一群组当前区块链中的区块高度、共识节点列表、网络联通情况、第一群组中智能合约的业务分类、智能合约的数量,智能合约之间是否有关联、第一群组的数据总容量等。根据智能合约的组织方式,设计拆分策略,对第一群组进行拆分。
在确定第一群组内各节点的资源情况不满足第一群组运行的需求时,不仅可以通过拆分第一群组的方式解决该问题,还可以提升所有区块链节点的出口和/或入口的网络带宽、增加群组内节点的网络连接数、提升群组内节点的磁盘容量、降低每个用户的账目数量、升级群组内各节点的处理器、修改智能合约逻辑等方式,以使得第一群组内各节点的资源情况满足第一群组运行的需求,保证第一群组的正常运行。
上述实施例中,将第一群组拆分为至少第二群组和第三群组,不仅可以解决第一群组中账本数据过大,群组节点的磁盘容量限制账本数据容量的问题,还可以解决第一群组中网络带宽限制群组的网络规模的问题,解释为,当第一群组中存在80个共识节点,则任一个共识节点都需要将交易信息或者新区块广播给其他79个共识节点,而在拆分后,例 如,拆分出两个群组,一个群组有40共识节点,则一个群组内的任一个共识节点将交易信息或者新区块广播给其他39个共识节点,降低了区块链中广播所需的网络带宽。进一步的,该方案还可以解决群组节点的运算能力限制群组的运算能力的问题,如第一群组需要运算经济案件类型和刑事案件类型的交易数据,若将第一群组按照数据类型进行拆分后,拆分后的两个子群组分别运算经济案件类型的交易数据和刑事案件类型的交易数据,则降低了群组对各节点运算能力的要求。
基于同一发明构思,图5示例性的示出了本发明实施例提供的一种区块链群组的拆分装置的结构,该装置可以执行区块链群组的拆分方法的流程。
该装置适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据;该装置包括:
第一处理单元501,用于确定第一群组的拆分原则;所述拆分原则用于指示将所述第一群组拆分为至少第二群组和第三群组,所述第一群组为所述区块链系统中的任一群组;所述第二群组的各节点和所述第三群组的各节点不完全相同且均是所述第一群组的节点;
第二处理单元502,用于根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约;将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块;启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
可选的,所述装置还包括:获取单元503;
所述第一处理单元501还用于:
在所述确定第一群组的拆分原则之前,控制所述获取单元503获取所述第一群组中各节点的资源情况;判断所述各节点的资源情况是否满足所述第一群组运行的需求,若不满足,则确定对所述第一群组进行拆分并停止所述第一群组的运行。
可选的,所述第一处理单元501具体用于:
确定所述各节点的网络带宽小于所述第一群组内节点广播所需的网络带宽;或
确定所述各节点的存储空间小于所述第一群组内账本所需的空间;或
确定所述各节点运算能力小于所述第一群组内各节点运行所述智能合约所需的运算能力。
可选的,所述第一群组的各智能合约是所述第一群组根据接收的交易数据的所属时段创建的智能合约并将接收到的交易数据记录在所属时段对应的智能合约中;
所述第二处理单元502具体用于:
确定所述拆分原则对应的拆分时间点;
从所述第一群组的各智能合约中确定出所属时段不大于所述拆分时间点的智能合约作为所述第二群组的智能合约;
从所述第一群组的各智能合约中确定出所属时段大于所述拆分时间点的智能合约作为所述第三群组的智能合约。
可选的,所述第一群组的各智能合约是所述第一群组根据接收到的交易数据生成相对应的智能合约,并将所述接收到的交易数据记录在所述相对应的智能合约中;
所述第一处理单元501具体用于:
根据所述第一群组的各智能合约所对应的业务类型,确定所述拆分原则;所述拆分原 则用于指示拆分后的各群组的智能合约对应相同业务类型。
可选的,所述第二处理单元502还用于:
在所述从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约之后,控制所述获取单元503遍历所述第一群组的各区块,获取所述第二群组的智能合约在所述各区块中的第一区块信息;所述第一区块信息用于表征所述第二群组的智能合约在所述第一群组的各区块中的历史操作;
控制所述获取单元503遍历所述第一群组的各区块,获取所述第三群组的智能合约在所述各区块中的第二区块信息;所述第二区块信息用于表征所述第三群组的智能合约在所述第一群组的各区块中的历史操作;
所述第二处理单元502具体用于:
将所述第二群组的智能合约及所述第二群组的智能合约的第一区块信息打包为至少一个第一新区块;并从所述至少一个第一新区块中确定出所述第二群组的创世块;
将所述第三群组的智能合约及所述第三群组的智能合约的第二区块信息打包为至少一个第二新区块;并从所述至少一个第二新区块中确定出所述第三群组的创世块。
基于与上述图2所示的方法相同的构思,本申请还提供一种计算设备600,包括至少一个处理器620,用于实现本申请实施例提供的图2中任一方法。
计算设备600还可以包括至少一个存储器630,用于存储程序指令和/或数据。存储器630和处理器620耦合。本申请实施例中的耦合是装置、单元或模块之间的间接耦合或通信连接,可以是电性,机械或其它的形式,用于装置、单元或模块之间的信息交互。处理器620可能和存储器630协同操作。处理器620可能执行存储器630中存储的程序指令。所述至少一个存储器中的至少一个可以包括于处理器中。
在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。
应注意,本申请实施例中的处理器可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理电路(digital signal processor,DSP)、专用集成芯片(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包 括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。
计算设备600还可以包括通信接口610,用于通过传输介质和其它设备进行通信,从而用于计算设备600中的装置可以和其它设备进行通信。在本申请实施例中,通信接口可以是收发器、电路、总线、模块或其它类型的通信接口。在本申请实施例中,通信接口为收发器时,收发器可以包括独立的接收器、独立的发射器;也可以集成收发功能的收发器、或者是接口电路。
计算设备600还可以包括通信线路640。其中,通信接口610、处理器620以及存储器630可以通过通信线路640相互连接;通信线路640可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。所述通信线路640可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
基于同一发明构思,本发明实施例还提供了一种计算机可读非易失性存储介质,包括计算机可读指令,当计算机读取并执行所述计算机可读指令时,使得计算机执行上述区块链群组的拆分方法。
基于同一发明构思,本申请实施例提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述区块链群组的拆分方法。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他 可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (15)

  1. 一种区块链群组的拆分方法,其特征在于,适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据;所述方法包括:
    确定第一群组的拆分原则;所述拆分原则用于指示将所述第一群组拆分为至少第二群组和第三群组,所述第一群组为所述区块链系统中的任一群组;所述第二群组的各节点和所述第三群组的各节点不完全相同且均是所述第一群组的节点;
    根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约;
    将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块;
    启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
  2. 如权利要求1所述的方法,其特征在于,在所述确定第一群组的拆分原则之前,还包括:
    获取所述第一群组中各节点的资源情况;判断所述各节点的资源情况是否满足所述第一群组运行的需求,若不满足,则确定对所述第一群组进行拆分并停止所述第一群组的运行。
  3. 如权利要求2所述的方法,其特征在于,所述各节点的资源情况不满足所述第一群组运行的需求,包括:
    确定所述各节点的网络带宽小于所述第一群组内节点广播所需的网络带宽;或
    确定所述各节点的存储空间小于所述第一群组内账本所需的空间;或
    确定所述各节点运算能力小于所述第一群组内各节点运行所述智能合约所需的运算能力。
  4. 如权利要求1所述的方法,其特征在于,所述第一群组的各智能合约是所述第一群组根据接收的交易数据的所属时段创建的智能合约并将接收到的交易数据记录在所属时段对应的智能合约中;
    所述根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约,包括:
    确定所述拆分原则对应的拆分时间点;
    从所述第一群组的各智能合约中确定出所属时段不大于所述拆分时间点的智能合约作为所述第二群组的智能合约;
    从所述第一群组的各智能合约中确定出所属时段大于所述拆分时间点的智能合约作为所述第三群组的智能合约。
  5. 如权利要求1所述的方法,其特征在于,所述第一群组的各智能合约是所述第一群组根据接收到的交易数据生成相对应的智能合约,并将所述接收到的交易数据记录在所述相对应的智能合约中;
    所述确定第一群组的拆分原则,包括:
    根据所述第一群组的各智能合约所对应的业务类型,确定所述拆分原则;所述拆分原则用于指示拆分后的各群组的智能合约对应相同业务类型。
  6. 如权利要求1至5任一项所述的方法,其特征在于,在所述从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约之后,还包括:
    遍历所述第一群组的各区块,获取所述第二群组的智能合约在所述各区块中的第一区块信息;所述第一区块信息用于表征所述第二群组的智能合约在所述第一群组的各区块中的历史操作;
    遍历所述第一群组的各区块,获取所述第三群组的智能合约在所述各区块中的第二区块信息;所述第二区块信息用于表征所述第三群组的智能合约在所述第一群组的各区块中的历史操作;
    所述将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块,包括:
    将所述第二群组的智能合约及所述第二群组的智能合约的第一区块信息打包为至少一个第一新区块;并从所述至少一个第一新区块中确定出所述第二群组的创世块;
    将所述第三群组的智能合约及所述第三群组的智能合约的第二区块信息打包为至少一个第二新区块;并从所述至少一个第二新区块中确定出所述第三群组的创世块。
  7. 一种区块链群组的拆分装置,其特征在于,适用于具有至少一个群组的区块链系统,每个群组具有独立的共识机制且通过各自的智能合约记录交易数据;所述装置包括:
    第一处理单元,用于确定第一群组的拆分原则;所述拆分原则用于指示将所述第一群组拆分为至少第二群组和第三群组,所述第一群组为所述区块链系统中的任一群组;所述第二群组的各节点和所述第三群组的各节点不完全相同且均是所述第一群组的节点;
    第二处理单元,用于根据所述拆分原则,从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约;将所述第二群组的智能合约打包为所述第二群组的创世块,并将所述第三群组的智能合约打包为所述第三群组的创世块;启动所述第二群组和所述第三群组,所述第二群组和所述第三群组均为所述区块链系统中的群组。
  8. 如权利要求7所述的装置,其特征在于,所述装置还包括:获取单元;
    所述第一处理单元还用于:
    在所述确定第一群组的拆分原则之前,控制所述获取单元获取所述第一群组中各节点的资源情况;判断所述各节点的资源情况是否满足所述第一群组运行的需求,若不满足,则确定对所述第一群组进行拆分并停止所述第一群组的运行。
  9. 如权利要求8所述的装置,其特征在于,所述第一处理单元具体用于:
    确定所述各节点的网络带宽小于所述第一群组内节点广播所需的网络带宽;或
    确定所述各节点的存储空间小于所述第一群组内账本所需的空间;或
    确定所述各节点运算能力小于所述第一群组内各节点运行所述智能合约所需的运算能力。
  10. 如权利要求7所述的装置,其特征在于,所述第一群组的各智能合约是所述第一群组根据接收的交易数据的所属时段创建的智能合约并将接收到的交易数据记录在所属时段对应的智能合约中;
    所述第二处理单元具体用于:
    确定所述拆分原则对应的拆分时间点;
    从所述第一群组的各智能合约中确定出所属时段不大于所述拆分时间点的智能合约作为所述第二群组的智能合约;
    从所述第一群组的各智能合约中确定出所属时段大于所述拆分时间点的智能合约作为所述第三群组的智能合约。
  11. 如权利要求7所述的装置,其特征在于,所述第一群组的各智能合约是所述第一群组根据接收到的交易数据生成相对应的智能合约,并将所述接收到的交易数据记录在所述相对应的智能合约中;
    所述第一处理单元具体用于:
    根据所述第一群组的各智能合约所对应的业务类型,确定所述拆分原则;所述拆分原则用于指示拆分后的各群组的智能合约对应相同业务类型。
  12. 如权利要求7至11任一项所述的装置,其特征在于,所述第二处理单元还用于:
    在所述从所述第一群组的各智能合约中确定出属于所述第二群组的智能合约和属于所述第三群组的智能合约之后,控制所述获取单元遍历所述第一群组的各区块,获取所述第二群组的智能合约在所述各区块中的第一区块信息;所述第一区块信息用于表征所述第二群组的智能合约在所述第一群组的各区块中的历史操作;
    控制所述获取单元遍历所述第一群组的各区块,获取所述第三群组的智能合约在所述各区块中的第二区块信息;所述第二区块信息用于表征所述第三群组的智能合约在所述第一群组的各区块中的历史操作;
    所述第二处理单元具体用于:
    将所述第二群组的智能合约及所述第二群组的智能合约的第一区块信息打包为至少一个第一新区块;并从所述至少一个第一新区块中确定出所述第二群组的创世块;
    将所述第三群组的智能合约及所述第三群组的智能合约的第二区块信息打包为至少一个第二新区块;并从所述至少一个第二新区块中确定出所述第三群组的创世块。
  13. 一种计算设备,其特征在于,包括:
    存储器,用于存储程序指令;
    处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行权利要求1至6任一项所述的方法。
  14. 一种计算机可读非易失性存储介质,其特征在于,包括计算机可读指令,当计算机读取并执行所述计算机可读指令时,使得计算机执行如权利要求1至6任一项所述的方法。
  15. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1至6任一所述方法。
PCT/CN2020/093997 2019-06-06 2020-06-02 一种区块链群组的拆分方法及装置 WO2020244514A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910488990.0A CN110225110B (zh) 2019-06-06 2019-06-06 一种区块链群组的拆分方法及装置
CN201910488990.0 2019-06-06

Publications (1)

Publication Number Publication Date
WO2020244514A1 true WO2020244514A1 (zh) 2020-12-10

Family

ID=67819525

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093997 WO2020244514A1 (zh) 2019-06-06 2020-06-02 一种区块链群组的拆分方法及装置

Country Status (2)

Country Link
CN (1) CN110225110B (zh)
WO (1) WO2020244514A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022161646A1 (en) * 2021-01-29 2022-08-04 NEC Laboratories Europe GmbH Method and system for scaling blockchains via secure chain division

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110225110B (zh) * 2019-06-06 2022-08-12 深圳前海微众银行股份有限公司 一种区块链群组的拆分方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108492550A (zh) * 2018-05-17 2018-09-04 济南浪潮高新科技投资发展有限公司 基于区块链的v2x高速车队自组织系统
US20180323974A1 (en) * 2017-05-03 2018-11-08 International Business Machines Corporation Optimal data storage configuration in a blockchain
CN109285005A (zh) * 2018-08-16 2019-01-29 北京京东尚科信息技术有限公司 区块链的拆分处理方法、装置、区块链节点及存储介质
CN110225110A (zh) * 2019-06-06 2019-09-10 深圳前海微众银行股份有限公司 一种区块链群组的拆分方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107528886B (zh) * 2017-07-25 2020-07-31 中国科学院计算技术研究所 区块链全网拆分方法与系统
CN108023729B (zh) * 2017-10-13 2020-06-23 中国银联股份有限公司 区块链网络及其交易方法
CN109818993B (zh) * 2017-11-20 2021-08-24 西南交通大学 一种高效的区块链共识与交换系统
CN108769264B (zh) * 2018-07-09 2021-06-04 中国联合网络通信集团有限公司 一种区块链分域方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180323974A1 (en) * 2017-05-03 2018-11-08 International Business Machines Corporation Optimal data storage configuration in a blockchain
CN108492550A (zh) * 2018-05-17 2018-09-04 济南浪潮高新科技投资发展有限公司 基于区块链的v2x高速车队自组织系统
CN109285005A (zh) * 2018-08-16 2019-01-29 北京京东尚科信息技术有限公司 区块链的拆分处理方法、装置、区块链节点及存储介质
CN110225110A (zh) * 2019-06-06 2019-09-10 深圳前海微众银行股份有限公司 一种区块链群组的拆分方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022161646A1 (en) * 2021-01-29 2022-08-04 NEC Laboratories Europe GmbH Method and system for scaling blockchains via secure chain division

Also Published As

Publication number Publication date
CN110225110A (zh) 2019-09-10
CN110225110B (zh) 2022-08-12

Similar Documents

Publication Publication Date Title
CN107368259B (zh) 一种向区块链系统中写入业务数据的方法和装置
WO2021204040A1 (zh) 联邦学习数据处理方法、装置、设备及存储介质
US10657526B2 (en) System and method to dynamically setup a private sub-blockchain based on agility of transaction processing
US11823178B2 (en) Optimization of high volume transaction performance on a blockchain
CN112153085B (zh) 一种数据处理方法、节点及区块链系统
WO2021027531A1 (zh) 一种区块链交易记录的处理方法及装置
CN107395665A (zh) 一种区块链业务受理及业务共识方法及装置
CN107360206A (zh) 一种区块链共识方法、设备及系统
US20210203477A1 (en) Method and device for blockchain full sharding based on a p2p storage network and a multi-layer architecture
WO2020244514A1 (zh) 一种区块链群组的拆分方法及装置
CN106503058B (zh) 一种数据加载方法、终端和计算集群
WO2020248982A1 (zh) 一种区块链中交易处理的方法及装置
CN110659905B (zh) 交易验证方法、装置、终端设备以及存储介质
WO2020037623A1 (zh) 可抗量子区块链账户系统的扩容方法、装置以及系统
US20230102617A1 (en) Repeat transaction verification method, apparatus, and device, and medium
CN115470156A (zh) 基于rdma的内存使用方法、系统、电子设备和存储介质
WO2020256831A1 (en) Smart contract information redirect to updated version of smart contract
CN106294423A (zh) 数据库分表的写入方法及装置
WO2021115002A1 (zh) 一种区块链交易记录的处理方法及装置
CN113037824B (zh) 一种面向云计算的高性能区块链的构建方法
CN110069533A (zh) 一种基于区块链的事件订阅方法及装置
CN113114678B (zh) 一种业务执行方法及装置
WO2021227789A1 (zh) 存储空间的分配方法、装置、终端及计算机可读存储介质
CN109697596A (zh) 一种构建电子政务的方法及装置
CN116467081A (zh) 数据处理方法、装置、设备及计算机可读存储介质

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: 20819565

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: 20819565

Country of ref document: EP

Kind code of ref document: A1