CN114490020A - Block chain fragmentation method and system and electronic equipment - Google Patents

Block chain fragmentation method and system and electronic equipment Download PDF

Info

Publication number
CN114490020A
CN114490020A CN202111475185.8A CN202111475185A CN114490020A CN 114490020 A CN114490020 A CN 114490020A CN 202111475185 A CN202111475185 A CN 202111475185A CN 114490020 A CN114490020 A CN 114490020A
Authority
CN
China
Prior art keywords
fragmentation
period
block chain
fragment
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111475185.8A
Other languages
Chinese (zh)
Inventor
艾崧溥
王同贺
曹军威
邢春晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tsinghua University
Original Assignee
Tsinghua University
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 Tsinghua University filed Critical Tsinghua University
Priority to CN202111475185.8A priority Critical patent/CN114490020A/en
Publication of CN114490020A publication Critical patent/CN114490020A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a block chain fragmentation method, a system and electronic equipment, wherein the method comprises the following steps: counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on the transaction quantity; and broadcasting the determined result in the block chain so that the service node updates the fragment in which the service node is positioned based on the determined result in the next fragment period. The method and the device are used for solving the defects that the block chain is subjected to random fragmentation so that the whole resource consumption of a block chain network is large and the consensus efficiency is low in the prior art, and realizing dynamic adjustment of the block chain fragmentation according to the transaction amount among service nodes, so that the block chain fragmentation is more reasonable, and the whole resource consumption of the block chain network is reduced.

Description

Block chain fragmentation method and system and electronic equipment
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a method, a system, and an electronic device for blocking a blockchain.
Background
The blockchain is used as a decentralized, distributed and stored peer-to-peer trusted network, and is a core support technology of a digital cryptocurrency system represented by bitcoin. The blockchain technology has the properties of high transparency, decentralization, distrust, collective maintenance (unchangeable), anonymity and the like, and can realize point-to-point transaction, coordination and cooperation based on decentralization credit in a distributed system with nodes not needing mutual trust by means of data encryption, timestamps, distributed consensus, economic incentive and the like, thereby providing a solution for solving the problems of high cost, low efficiency, unsafe data storage and the like commonly existing in a centralization mechanism.
Fragmentation is a traditional concept capacity expansion technology based on the division of a database into a plurality of fragments, the database is divided into a plurality of fragments and the fragments are placed on different servers, and in a system of a bottom public chain, transactions on a network are divided into different fragments which are composed of different nodes on the network. Thus, only a small portion of the incoming transaction needs to be processed, and a large amount of validation work can be done by processing in parallel with other nodes on the network. Segmenting the network into pieces allows more transactions to be processed and verified at the same time, so as the network grows, it becomes possible to block chain process more and more transactions.
The current fragmentation method mainly aims to solve the security problem of a block chain, so that the method is basically based on a random method. However, although the random fragmentation solves the security problem of the blockchain, the fragmentation of the service node in the blockchain has complete randomness due to the problem of the random fragmentation, and the problem of unreasonable fragmentation occurs to a great extent, which easily causes waste of resources such as communication, operation and the like.
Disclosure of Invention
The invention provides a block chain fragmentation method, a block chain fragmentation system and electronic equipment, which are used for solving the defects that the block chain is subjected to larger overall resource consumption of a block chain network and low consensus efficiency in the prior art based on a random fragmentation mode, and realize dynamic adjustment of the block chain fragmentation according to the transaction amount among service nodes, so that the block chain fragmentation is more reasonable, and the overall resource consumption of the block chain network is reduced.
The invention also provides a block chain fragmentation method, which comprises the following steps:
counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period;
determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity;
broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
According to the method for fragmenting a blockchain, the counting of the transaction quantity between every two service nodes in each service node of the blockchain in the current fragmentation period includes:
collecting the transaction quantity between every two service nodes in each fragmentation consensus stage in the current fragmentation period;
and summarizing the transaction quantity between every two service nodes in each fragment consensus phase to obtain the transaction quantity between every two service nodes in each service node of the block chain in the current fragment period.
According to the method for partitioning a blockchain, the determining of each partition of the blockchain in the next partition period of the current partition period based on each transaction amount includes:
mapping each service node to each distributed point in a multidimensional space one by one, wherein the coordinates of the points mapped by the service nodes at least comprise the transaction quantity between the service node and each service node in other service nodes;
based on a preset selection rule, selecting a clustering result corresponding to one fragment quantity candidate value from clustering results corresponding to the fragment quantity candidate values;
determining, based on a result of the selected clustering, respective slices of the block chain in a next slice period of the current slice period.
According to the block chain fragmentation method of the present invention, the candidate values of the number of fragments in the next fragmentation cycle include: a first fragmentation number candidate value of the next fragmentation cycle obtained according to a preset candidate rule and a plurality of second fragmentation number candidate values constructed according to the first fragmentation number reference value;
the predetermined candidate rule includes:
when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, obtaining a first fragmentation number candidate value of the next fragmentation cycle according to the total amount of the service nodes of the block chain and the number of the service nodes pre-contained in each fragmentation of the next fragmentation cycle;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, taking the fragmentation number of the current fragmentation period as a first fragmentation number candidate value of the next fragmentation period.
According to the block chain fragmentation method of the present invention, the fragmentation requirement of the next fragmentation cycle changes with respect to the fragmentation of the current fragmentation cycle, including:
any parameter in a preset parameter set in the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle;
wherein the preset parameter set comprises at least one of the following parameters: the number of the service nodes pre-contained in each fragment, a preset step length for constructing the second fragment number candidate value, and an adjustment parameter for expanding the number of the second fragment number candidate value.
According to the block chain fragmentation method of the present invention, the plurality of second fragmentation number candidates constructed according to the first fragmentation number reference value includes:
when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, constructing a plurality of second fragmentation quantity candidate values which are distributed towards two sides in an equal difference mode by taking the first fragmentation quantity candidate value as a center according to the first fragmentation quantity candidate value of the next fragmentation cycle, the preset step length and the adjustment parameter;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, constructing a plurality of second fragmentation number candidate values which are distributed towards two sides by equal difference values with the fragmentation number of the current fragmentation period as the center according to the fragmentation number of the current fragmentation period and the adjustment parameter.
According to the block chain fragmentation method of the present invention, selecting a clustering result corresponding to each fragment number candidate value from the clustering results corresponding to each fragment number candidate value based on a preset selection rule includes:
for each clustering, respectively calculating the distance between each point mapped by the service node in the clustering result and the corresponding clustering center;
summing the distances to obtain a distance sum based on the result of each cluster;
and determining the clustering result with the minimum distance as each fragment of the block chain in the next fragment period of the current fragment period.
The invention also provides a block chain fragmentation system, which comprises a global consensus node in the block chain;
the global consensus node is used for counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
The system for partitioning a blockchain according to the present invention further comprises: a supervisory node in the blockchain;
the supervision node is used for initially fragmenting each service node of the block chain according to a preset fragmentation rule and assigning the added fragmentation in the next fragmentation period for a new service node applying for adding into the block chain in the current fragmentation period according to the preset supervision rule;
and the preset supervision rule is a preset fragmentation rule, or the new service node is added into the fragmentation to which the service node performing the first transaction with the new service node belongs in the next fragmentation period.
The invention further provides an electronic device, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above block chain fragmentation methods when executing the program.
The invention provides a method, a system and an electronic device for fragmenting a block chain, which are characterized in that the transaction quantity between every two service nodes in each service node of the block chain is counted in the current fragmentation period, then each fragment of the block chain in the next fragmentation period of the current fragmentation period is determined based on each transaction quantity, and finally the determined result is broadcasted in the block chain, so that the service nodes update the fragments where the service nodes are located in the next fragmentation period based on the determined result, the adjustment of the block chain fragments in the next fragmentation period according to the transaction quantity among the service nodes is realized in each fragmentation period, the transaction conditions between the fragments of the block chain and the service nodes are more matched, the fragments of the block chain are more reasonable, and the whole resource consumption of the block chain network is reduced, and improves consensus efficiency.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for partitioning a blockchain according to the present invention;
fig. 2 is a schematic structural diagram of a blockchain fragmentation system according to the present invention;
fig. 3 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, for convenience of understanding, before describing the method, the system and the electronic device for dividing a blockchain according to the present invention, the terms and names related to the present invention are described:
block chains: a decentralized, distributed storage, peer-to-peer trusted network is a core support technology of digital cryptocurrency system represented by bitcoin. The blockchain technology has the properties of high transparency, decentralization, distrust, collective maintenance (unchangeable), anonymity and the like, and can realize point-to-point transaction, coordination and cooperation based on decentralization credit in a distributed system with nodes not needing mutual trust by means of data encryption, timestamps, distributed consensus, economic incentive and the like, thereby providing a solution for solving the problems of high cost, low efficiency, unsafe data storage and the like commonly existing in a centralization mechanism.
Slicing: a traditional concept capacity expansion technology based on a database divided into a plurality of fragments divides the database into a plurality of fragments, the fragments are placed on different servers, and in a system of an underlying public chain, transactions on a network are divided into different fragments which are composed of different nodes on the network. Thus, only a small portion of the incoming transaction needs to be processed, and a large amount of validation work can be done by processing in parallel with other nodes on the network. Segmenting the network into pieces allows more transactions to be processed and verified at the same time, so as the network grows, it becomes possible to block chain process more and more transactions.
And (3) node: nodes in the blockchain typically refer to computers that download the relevant cryptocurrency (bitcoin, Ethereum, Monero, etc.) software to participate in the peer-to-peer network. The structure of the cryptocurrency blockchain is a network architecture between peers (P2P), P2P means that computers participating in the network are peer-to-peer with each other, and in the P2P network, each computer participating in the network can receive the name of a node. In a network, all nodes are responsible for providing network services because of the interconnectivity of the network nodes, allowing interoperability.
It should be noted that, on one hand, the current fragmentation method mainly aims at solving the security problem of the blockchain, and is therefore basically based on a random method, however, although the random fragmentation solves the security problem of the blockchain, due to the random fragmentation mode, the service node that frequently transacts is likely to be randomly allocated to two different fragments, which will cause that the two service nodes need to frequently perform global consensus during transaction, and further cause waste of resources such as communication, operation, and the like, so that the random fragmentation can occur unreasonable problem to a great extent. On the other hand, with the continuous improvement of the supervision mechanism and the application of the blockchain in different scenes, the security of the blockchain does not need to completely depend on random fragmentation, and meanwhile, the random fragmentation method is not completely suitable for all blockchain application scenes.
For example, in a block chain applied in an electric power distributed transaction scenario, due to characteristics of an energy internet distributed electric power transaction scenario, more energy sources, particularly new energy sources, tend to be consumed locally in structure, so a completely random fragmentation method brings more resource requirements for communication, operation and the like to the whole system on a multilevel block chain transaction platform, and meanwhile, due to the business characteristics of electric power transaction and the addition of a supervisor, the necessity for the randomness-based consensus security is gradually reduced.
A blockchain fragmentation method of the present invention is described below with reference to fig. 1, where the method is performed by service nodes in a blockchain for achieving global consensus or a combination of software and/or hardware therein, and as shown in fig. 1, the method includes the following steps:
101. counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period;
102. determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity;
it should be noted that, when the block chain is initially operated, the block chain is initially fragmented, and then on the basis of the initial fragmentation, the transaction number between every two service nodes in each service node of the block chain in the first fragmentation period is counted, and then each fragment of the block chain in the next fragmentation period is determined based on the transaction number, and this operation is repeated in this way, so that dynamic adjustment of the fragments of each service node of the block chain based on the transaction number between the service nodes in the set fragmentation period is realized.
103. Broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
It should be noted that, in each fragmentation cycle, data transmission is generated between service nodes according to service requirements, that is, a point-to-point transaction number between service nodes is formed, the transaction number between every two service nodes is counted, then each fragment of the block chain in the next fragmentation cycle of the current fragmentation cycle is determined based on each transaction number, and finally the determined result is broadcasted in the block chain, so that the service nodes update the fragments where the service nodes are located in the next fragmentation cycle based on the determined result, the adjustment of the block chain fragments in the next fragmentation cycle according to the transaction number between the service nodes in each fragmentation cycle is realized, the unreasonable fragmentation condition caused by random fragmentation is overcome, and the overall resource consumption of the block chain network is reduced, and improves consensus efficiency.
In practical application, the blockchain fragmentation method provided by this embodiment may be applied to various scenarios based on blockchain transaction, for example, an energy internet distributed power transaction scenario, and accordingly, the blockchain may be a blockchain for power transaction management, and the service node may be a power grid company, each distributed power generation user, a power consumption user, and the like. The power generation users and the power utilization users can conduct direct transaction of electric quantity, conduct direct transaction of the power generation users and the power utilization users with a power grid company, conduct electric quantity transaction and the like, and then settlement is conducted on transactions completed in a period through user data recorded and issued to a block chain through intelligent electric meters of all service nodes. In the electric power transaction, the respective nodes of the power generation and utilization users and the nodes at each position deployed by the power grid company can serve as service nodes for global consensus.
Specifically, in a block chain, there are a plurality of service nodes divided according to segments, and in each segment, some nodes in the service nodes, besides processing transaction services required by itself, also serve as common identification group nodes to undertake block generation work in the segment to which they belong, and confirm management work such as cross-segment transaction with other segments, and meanwhile, there are global common identification nodes in the common identification group nodes in each segment, which have functions of performing global common identification, providing segment suggestions of all service nodes in the next segment period, and the like.
Based on this, when a fragmentation period starts, all service nodes Node of the block chainiBy being spanned in the blockchain by global consensus nodesAnd acquiring the fragment information acquired from the determined result of the broadcasting to acquire the fragment of the user in the current fragment period, and then performing subsequent transaction service based on the acquired fragment information.
For example, the service NodeiIs divided into segments SjThe received 'fragment information' is the address of the common group of the fragment to which the self belongs
Figure BDA0003392371900000091
K of the consensus groupiThe individual node, i.e. the consensus group node, assumes fragmentation S during the fragmentation periodjThe inner block generates work and confirms the cross-fragment transaction with other fragments. Further, if NodeiIf finding that the user is not in the fragmented consensus group, submitting the transaction service required by the user to a node in the consensus group, wherein the node in the consensus group distinguishes whether the transaction service is intra-area transaction or cross-area transaction, and carries out consensus with a proper consensus node; if the service NodeiIs selected as a slice SjIn the sharded consensus group, then NodeiThe node as the consensus group receives the consensus group information of all other fragments
Figure BDA0003392371900000101
Figure BDA0003392371900000102
And undertake the corresponding responsibilities, such as: transactions sent to itself are collected and the authenticity of each transaction is known to other patch generating nodes.
In a preferred embodiment of the present invention, the transaction amount between every two service nodes in each segment consensus phase in the current segment period is collected; and then summarizing the transaction quantity between every two service nodes in each fragment consensus stage to obtain the transaction quantity between every two service nodes in each service node of the block chain in the current fragment period.
It can be understood that, in the current fragmentation cycle, a service node serving as a consensus group node counts and records the number of point-to-point transactions of all service nodes in a fragment, and when fragmentation consensus is performed, the consensus group node checks the statistics. And when the global consensus node performs global consensus, counting and recording the point-to-point transaction quantity of all service nodes in the global, and when the global consensus node performs global consensus, verifying the statistics. The global consensus comprises a plurality of fragment consensus, so that the global consensus node is required to summarize the transaction number of each service node counted by the consensus group node in each fragment period to obtain the transaction number between each service node and other service nodes in the block chain. By combining the fragment consensus and the global consensus hierarchical consensus mechanism with the fragment rationality, the consumption of resources such as communication, operation and the like can be further reduced by reducing the global consensus frequency, and the processing speed is increased.
Specifically, the transaction quantity between each service node and another service node in the block chain obtained by the global consensus node may be represented by a matrix using the transaction quantity between each service node as an element, for example:
Figure BDA0003392371900000103
wherein, txi,jIndicating that the service Node is in the current fragmentation periodiTo NodejThe transaction amount of (c).
For example, in the case of an energy internet distributed power trading scenario, txi,jIndicating Node in current slicing periodiSell to NodejThe amount of electricity traded.
More specifically, in the current fragmentation cycle, NodejMay also be sold to NodeiElectric, thus, service NodeiAnd NodejThe number of transactions between should be txi,jAnd txj,iA larger sum indicates more frequent transactions between the two nodes. Therefore, inverting the sum can normalize the number of transactions between two nodes to different values distributed between 0 and 1. With specific reference to equation 1 below:
Figure BDA0003392371900000111
it can be seen that the smaller the value obtained by equation 1, the more close the transaction between the two nodes is, and further, when each service node is mapped in the multidimensional space based on the transaction number between the current service node and other service nodes, the closer the distance between the two nodes in the multidimensional space is, the more frequent the transaction between the two nodes is.
Based on this, in another embodiment of the present invention, each of the service nodes is mapped to each of the points distributed in the multidimensional space one by one, and the coordinates of the points mapped by the service nodes at least include the transaction number between the service node and each of the other service nodes;
based on the distance between each point distributed in the multi-dimensional space, clustering each point distributed in the multi-dimensional space according to the preset fragment quantity candidate values of a plurality of next fragment periods;
based on a preset selection rule, selecting a clustering result corresponding to one fragment quantity candidate value from clustering results corresponding to the fragment quantity candidate values;
determining, based on a result of the selected clustering, respective slices of the block chain in a next slice period of the current slice period.
It should be noted that, in the above embodiment of the present invention, the transaction number between the service nodes in each segment period is mapped as a clustering problem, so as to implement automatic update of the service node segments in each segment period.
Further, in order to ensure that the fragmentation proposal executed in the next fragmentation cycle reduces the resource consumption of the whole blockchain network and improves the forming and executing speed of the transactions among the frequently-transacted nodes, the global consensus node performs respective clustering on each service node based on the preset fragmentation number candidate values of a plurality of next fragmentation cycles, and then selects a best one of the clustering results.
Specifically, based on the transaction amount between the current service node and each of the other service nodes, mapping each of the service nodes to each point distributed in a multidimensional space may be implemented by mapping each of the service nodes to a point in a cartesian coordinate system established in an N-dimensional space; wherein N is the total number of the service nodes in the block chain.
In another embodiment of the present invention, a method for obtaining a plurality of slice number candidates for the next slice period is specifically described, that is, a first slice number candidate for the next slice period obtained according to a predetermined candidate rule, and a plurality of second slice number candidates constructed according to the first slice number reference value.
It will be appreciated that there is also a supervisory node in the blockchain for monitoring and management, which does not transact with other service nodes, nor does it belong to any fragmentation, but is a class of nodes that is distinct from the service nodes. For example, the supervisory node has functions of performing initial fragmentation for a block chain, assigning a fragment to which a new service node newly applies to join the block chain, and the like. Further, the supervision node has an accumulation of prior experience according to an application scenario of the block chain, so that the block chain can be initially fragmented by the prior experience, for example, still taking a power distributed transaction scenario as an example, for a supervision node that uniformly supervises all power suppliers and sellers of a certain cell, the supervision node can fragment the cell according to a single building, fragment every two buildings, fragment the cell according to units, and the like according to an experience of power distributed transaction scenario management. Meanwhile, not only new service nodes applying for adding into the block chain exist in the operation process of the block chain, but also service nodes exiting from the block chain appear, so that the number of the service nodes in the block chain changes in real time, and based on the change, the supervision node, in combination with the prior experience accumulated by the supervision node, may make a judgment that the current fragment is not suitable for more effective operation of the block chain, at the moment, the supervision node declares the change related to the fragment requirement in the block chain, and the change of the fragment requirement acts on the fragment decision made by the global common identification node.
Based on this, in the above embodiment of the present invention, the predetermined candidate rule for obtaining the first fragmentation number candidate value of the next fragmentation cycle is further defined as including:
when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, obtaining a first fragmentation number candidate value of the next fragmentation cycle according to the total amount of the service nodes of the block chain and the number of the service nodes pre-contained in each fragmentation of the next fragmentation cycle;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, taking the fragmentation number of the current fragmentation period as a first fragmentation number candidate value of the next fragmentation period.
It should be noted that when a policing node declares that a fragmentation requirement changes in a blockchain, the most direct result is a change in the number of fragments of the blockchain, so that when the fragmentation requirement of the next fragmentation cycle changes with respect to the fragmentation of the current fragmentation cycle, k ═ N/θ is used according to the total number N of service nodes in the blockchain and the number θ of service nodes included in each of the fragments in the next fragmentation cycle]Obtaining a first fragmentation quantity candidate value in the next fragmentation period; when the fragmentation requirement of the next fragmentation cycle is unchanged relative to the fragmentation of the current fragmentation cycle, that is, the fragmentation number of the block chain is not required to be changed at the supervision node in the next fragmentation cycle, the fragmentation number l of the current fragmentation cycle may be changedlastAs a first fragmentation number candidate for the next fragmentation cycle.
Further, although the fragmentation requirement of the policing node in the next fragmentation period changes relative to the fragmentation in the current fragmentation period, which ultimately results in a change in the number of fragments in the next fragmentation period, the fragmentation requirement change stated by the policing node is not a change in the number of fragments, that is, the policing node does not have the capability of determining the number of fragments in the next fragmentation period, but can only determine whether the number of service nodes included in each fragment is appropriate or not according to information such as the number of transactions in the current fragmentation period.
Therefore, in another embodiment of the present invention, a case that the slice representing the next slice period changes from the slice of the current period is specifically described:
any parameter in a preset parameter set in the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle;
wherein the preset parameter set comprises at least one of the following parameters: the number of the service nodes pre-contained in each fragment, a preset step length for constructing the second fragment number candidate value, and an adjustment parameter for expanding the number of the second fragment number candidate value.
It should be noted that, when determining that the preset parameter is changed, the supervising node broadcasts to all global consensus nodes in the block chain and declares which future fragmentation cycle to start using. While such broadcasting can be done at any time, the broadcast result is confirmed by the handshake between both parties, and the updated parameters will be recorded in the new block to be accepted and used in the claimed period.
Further, after the first fragmentation number candidate value is obtained, a plurality of second fragmentation number candidate values need to be constructed according to the first fragmentation number candidate value, so in another embodiment of the present invention, when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, a plurality of second fragmentation number candidate values which are distributed with equal difference to both sides with the first fragmentation number candidate value as the center are constructed according to the first fragmentation number candidate value of the next fragmentation cycle, the preset step size, and the adjustment parameter;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, constructing a plurality of second fragmentation number candidate values which are distributed towards two sides by equal difference values with the fragmentation number of the current fragmentation period as the center according to the fragmentation number of the current fragmentation period and the adjustment parameter.
It should be noted that, when p ═ 1,2,3, …, ω represents the adjustment parameter, μ represents the step size, and when the slice requirement in the next slice period changes with respect to the slice in the current slice period, a plurality of second slice number candidates distributed with equal difference to both sides around the first slice number candidate k can be obtained by k ± p μ.
When the fragmentation requirement in the next fragmentation cycle is unchanged relative to the fragmentation in the current fragmentation cycle, the fragmentation requirement is changed through llastAnd + -p, a plurality of second fragment quantity candidate values which are distributed towards two sides in an equal difference value manner by taking the fragment quantity of the current fragment period as a center can be obtained.
It can be understood that, based on the distance between each point distributed in the multidimensional space, each point distributed in the multidimensional space is clustered according to the preset candidate value of the number of slices of the next slice period, which may be implemented by applying a clustering algorithm such as K-means. When clustering points distributed in the multi-dimensional space according to the distance between the points, not only the clustering number k + -p mu or l is obtainedlastThe results of ± p clustering also result in the respective cluster centers of the clusters for each clustered result.
Specifically, the closer each cluster is to the cluster center, which means that the closer each point in the divided clusters is, that is, the more the transaction amount between the node and the node, so in another embodiment of the present invention, for each cluster, the distances between each point mapped by the service node in the clustering result and the corresponding cluster center are calculated respectively; summing the distances to obtain a distance sum based on the result of each cluster; and then determining the clustering result with the minimum distance as each fragment of the block chain in the next fragment period of the current fragment period.
It should be noted that, the clustering result with the smallest distance and the smallest distance is determined as each segment of the block chain in the next segment period of the current segment period, which is equivalent to that after clustering candidate values of the number of segments based on a plurality of preset next segment periods respectively, a segment scheme that maximizes the transaction number between the service node and the service node in each segment is selected for updating the segment where the service node is located.
The block chain fragmentation method provided by the invention provides a technical idea which is coupled with service depth and completely fragments by the development of transaction service, and fragments the service nodes in the block chain by mapping the transaction quantity among the service nodes in a preset fragmentation period as a clustering problem, so that the fragments can be adjusted in each fragmentation period to adapt to the change of service, and the resources consumed by global consensus are reduced while the safe and effective execution of the fragment consensus is ensured.
A blockchain fragmentation system provided by the present invention is described below with reference to fig. 2, and a blockchain fragmentation system described below and a blockchain fragmentation method described above may be referred to correspondingly.
The invention provides a block chain fragmentation system, which comprises a global consensus node in a block chain;
the global consensus node is used for counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
It can be understood that a blockchain includes a plurality of service nodes, where some service nodes are not only used to execute their service requirements, but also have a function of achieving global consensus, that is, the global consensus node included in the blockchain fragmentation system of the present invention. The global consensus node counts the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, then determines each fragment of the block chain in the next fragmentation period of the current fragmentation period based on each transaction quantity, and finally broadcasts the determined result in the block chain, so that the service node updates the fragment where the service node is located in the next fragmentation period based on the determined result, and the block chain fragments of the next fragmentation period are adjusted in each fragmentation period according to the transaction quantity between the service nodes, so that the fragment of the block chain is more reasonable in the next fragmentation period, the overall resource consumption of the block chain network is reduced, and the consensus efficiency is improved.
In a preferred embodiment of the present invention, the block chain fragmentation system further includes a supervision node in the block chain;
the supervision node is used for initially fragmenting each service node of the block chain according to a preset fragmentation rule and assigning the added fragmentation in the next fragmentation period for a new service node applying for adding into the block chain in the current fragmentation period according to the preset supervision rule;
and the preset supervision rule is a preset fragmentation rule, or the new service node is added into the fragmentation to which the service node performing the first transaction with the new service node belongs in the next fragmentation period.
It should be noted that, in one block chain, a supervisory node is a node having functions of supervision, management, and the like, which does not belong to any one partition, in the above embodiment of the present invention, the supervisory node performs initial fragmentation on each service node on the block chain, and assigns an added fragment to a new block chain in a next fragmentation period when a new service node applies for adding into the block chain, and the global consensus node determines the fragmentation in each service node of the block chain for the next fragmentation period according to a fragmentation requirement sent by the supervisory node in each fragmentation period on the basis of the initial fragmentation of the supervisory node.
Specifically, as shown in fig. 2, a structure of a blockchain fragmentation system according to an embodiment of the present invention is shown, in which relationships among each service node, a global consensus node, and a supervision node are illustrated.
It can be understood that when a service Nodei,i∈[1,N]N is the total number of nodes, when it is added into the block chain network, it must pass through a supervisory Node _ SupjApplying for joining block chain, after the coordination between supervisory nodes passes the application, informing at least M core service nodes M > (N)consensus-NB). Wherein N isconsensusTotal number of nodes in the consensus group, NBThe maximum number of byzantine nodes that the network can tolerate.
In particular, the supervisory Node _ SupjNodes can be assignediEnter a certain slice S in the next slice periodj,j∈[1,l]The assignment process may be based on a priori experience of the supervisory node; node can also be formed by the newly added NodeiAnother transaction party Node corresponding to the first transactionkAnd determining the fragment to which the newly added node belongs.
Fig. 3 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 3: a processor (processor)310, a communication Interface (communication Interface)320, a memory (memory)330 and a communication bus 340, wherein the processor 310, the communication Interface 320 and the memory 330 communicate with each other via the communication bus 340. The processor 310 may call logic instructions in the memory 330 to perform a blockchain fragmentation method, comprising: counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
In addition, the logic instructions in the memory 330 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, a computer can execute the block chain fragmentation method provided by the above methods, and the method includes: counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
In still another aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the blockchain fragmentation method provided by the above methods, and the method includes: counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for blockchain fragmentation, comprising:
counting the transaction quantity between every two service nodes in each service node of the block chain in the current fragmentation period, wherein each service node of the block chain is divided into a plurality of fragments in the current fragmentation period;
determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity;
broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
2. The blockchain fragmentation method of claim 1, wherein the counting the number of transactions between every two service nodes in each service node of the blockchain in the current fragmentation period comprises:
collecting the transaction quantity between every two service nodes in each fragmentation consensus stage in the current fragmentation period;
and summarizing the transaction quantity between every two service nodes in each fragment consensus stage to obtain the transaction quantity between every two service nodes in each service node of the block chain in the current fragment period.
3. The blockchain fragmentation method of claim 2, wherein said determining respective fragments of the blockchain in a fragmentation period next to the current fragmentation period based on each of the transaction amounts comprises:
mapping each service node to each distributed point in a multidimensional space one by one, wherein the coordinates of the points mapped by the service nodes at least comprise the transaction quantity between the service node and each service node in other service nodes;
based on the distance between each point distributed in the multi-dimensional space, clustering each point distributed in the multi-dimensional space according to the preset candidate value of the slice number of the next slice period;
based on a preset selection rule, selecting a clustering result corresponding to one fragment quantity candidate value from clustering results corresponding to the fragment quantity candidate values;
determining, based on a result of the selected clustering, respective slices of the block chain in a next slice period of the current slice period.
4. The blockchain fragmentation method of claim 3, wherein the candidate values for the number of fragments of the next plurality of fragmentation cycles comprise: a first fragmentation number candidate value of the next fragmentation cycle obtained according to a preset candidate rule and a plurality of second fragmentation number candidate values constructed according to the first fragmentation number reference value;
the predetermined candidate rules include:
when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, obtaining a first fragmentation number candidate value of the next fragmentation cycle according to the total amount of the service nodes of the block chain and the number of the service nodes pre-contained in each fragmentation of the next fragmentation cycle;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, taking the fragmentation number of the current fragmentation period as a first fragmentation number candidate value of the next fragmentation period.
5. The blockchain fragmentation method of claim 4, wherein the fragmentation requirement of the next fragmentation cycle changes with respect to the fragmentation of the current fragmentation cycle, and comprises:
any parameter in a preset parameter set in the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle;
wherein the preset parameter set comprises at least one of the following parameters: the number of the service nodes pre-contained in each fragment, a preset step length for constructing the second fragment number candidate value, and an adjustment parameter for expanding the number of the second fragment number candidate value.
6. The blockchain fragmentation method of claim 5, wherein said plurality of second fragmentation number candidates constructed according to said first fragmentation number reference comprises:
when the fragmentation requirement of the next fragmentation cycle changes relative to the fragmentation of the current fragmentation cycle, constructing a plurality of second fragmentation quantity candidate values which are distributed towards two sides in an equal difference manner by taking the first fragmentation quantity candidate values as the center according to the first fragmentation quantity candidate values of the next fragmentation cycle, the preset step length and the adjustment parameters;
and when the fragmentation requirement of the next fragmentation period is unchanged relative to the fragmentation of the current fragmentation period, constructing a plurality of second fragmentation number candidate values which are distributed towards two sides by equal difference values with the fragmentation number of the current fragmentation period as the center according to the fragmentation number of the current fragmentation period and the adjustment parameter.
7. The blockchain fragmentation method of claim 5, wherein selecting a result of a cluster corresponding to one of the fragment number candidate values from results of clusters corresponding to each of the fragment number candidate values based on a preset selection rule comprises:
for each clustering, respectively calculating the distance between each point mapped by the service node in the clustering result and the corresponding clustering center;
summing the distances to obtain a distance sum based on the result of each cluster;
and determining the clustering result with the minimum distance as each fragment of the block chain in the next fragment period of the current fragment period.
8. A block chain fragmentation system is characterized by comprising a global consensus node in a block chain;
the global consensus node is configured to count a transaction amount between every two service nodes in each service node of the block chain in a current fragmentation period, where each service node of the block chain is divided into multiple fragments in the current fragmentation period; determining each fragment of the block chain in the next fragment period of the current fragment period based on each transaction quantity; broadcasting the determined result in the block chain, so that the service node updates the fragment where the service node is located based on the determined result in the next fragment period.
9. The blockchain sharding system of claim 8, further comprising: a supervisory node in the blockchain;
the supervision node is used for initially fragmenting each service node of the block chain according to a preset fragmentation rule and assigning the added fragmentation in the next fragmentation period for a new service node applying for adding into the block chain in the current fragmentation period according to the preset supervision rule;
and the preset supervision rule is a preset fragmentation rule, or the new service node is added into the fragmentation to which the service node performing the first transaction with the new service node belongs in the next fragmentation period.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program performs the steps of the block chain fragmentation method of any of claims 1 to 7.
CN202111475185.8A 2021-12-03 2021-12-03 Block chain fragmentation method and system and electronic equipment Pending CN114490020A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111475185.8A CN114490020A (en) 2021-12-03 2021-12-03 Block chain fragmentation method and system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111475185.8A CN114490020A (en) 2021-12-03 2021-12-03 Block chain fragmentation method and system and electronic equipment

Publications (1)

Publication Number Publication Date
CN114490020A true CN114490020A (en) 2022-05-13

Family

ID=81492699

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111475185.8A Pending CN114490020A (en) 2021-12-03 2021-12-03 Block chain fragmentation method and system and electronic equipment

Country Status (1)

Country Link
CN (1) CN114490020A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115473895A (en) * 2022-09-01 2022-12-13 北京大数据先进技术研究院 Digital object warehouse node consensus group division method and device under ubiquitous environment
CN116012164A (en) * 2023-03-17 2023-04-25 安徽中科晶格技术有限公司 Block chain cross-fragment transaction method based on virtual account
CN116258609A (en) * 2023-05-15 2023-06-13 国网数字科技控股有限公司 Electric power system transaction cooperation method, device and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115473895A (en) * 2022-09-01 2022-12-13 北京大数据先进技术研究院 Digital object warehouse node consensus group division method and device under ubiquitous environment
CN115473895B (en) * 2022-09-01 2023-09-12 北京大数据先进技术研究院 Method and device for dividing digital object warehouse node consensus groups under ubiquitous environment
CN116012164A (en) * 2023-03-17 2023-04-25 安徽中科晶格技术有限公司 Block chain cross-fragment transaction method based on virtual account
CN116258609A (en) * 2023-05-15 2023-06-13 国网数字科技控股有限公司 Electric power system transaction cooperation method, device and storage medium

Similar Documents

Publication Publication Date Title
CN114490020A (en) Block chain fragmentation method and system and electronic equipment
CN110868440B (en) Block chain male chain
CN109522362B (en) Incomplete data synchronization method, system and equipment based on block chain data
CN109150972B (en) Working method of consensus mechanism of double-layer partitioned efficient block chain
CN111654465A (en) Power service cross-domain credible authentication system and method based on block chain
EP4318362A1 (en) Blockchain-based data processing method, apparatus and device, and storage medium
CN113553375B (en) Partitioned storage device and method for image type block chain
CN110213038B (en) Method and system for forming consensus of block chain
CN114938292B (en) Multi-level optimization PBFT consensus method based on node credibility
CN110874351A (en) Workload certification cooperative work method, block chain node and block chain system
CN113626875A (en) Knowledge graph file storage method for block chain fragment enabling
Sohrabi et al. On the scalability of blockchain systems
Aloqaily et al. Towards blockchain-based hierarchical federated learning for cyber-physical systems
CN114978684A (en) PBFT consensus method based on improved agglomeration type hierarchical clustering
CN114202422A (en) Block chain fragmentation method, block chain system and cross-fragmentation transaction processing method
CN112417052B (en) Data synchronization method, device, equipment and storage medium in block chain network
CN110071966B (en) Block chain networking and data processing method based on cloud platform
Wang et al. A fast and secured peer-to-peer energy trading using blockchain consensus
CN116963077A (en) Block chain slicing method for spectrum transaction
CN111177262A (en) Block chain consensus method, related device and system
CN115048224A (en) Computing power reuse management method and device based on multiple cloud service providers
CN114997865A (en) Platform transaction method and device based on block chain system
CN112988852B (en) Block chain-based data management method, device and medium
CN115460224A (en) Calculation power resource scheduling method and device based on block chain technology
CN116204110A (en) Block processing method, device and equipment based on block chain, medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination