CN112988738B - Data slicing method and device for block chain - Google Patents

Data slicing method and device for block chain Download PDF

Info

Publication number
CN112988738B
CN112988738B CN201911293729.1A CN201911293729A CN112988738B CN 112988738 B CN112988738 B CN 112988738B CN 201911293729 A CN201911293729 A CN 201911293729A CN 112988738 B CN112988738 B CN 112988738B
Authority
CN
China
Prior art keywords
transaction
module
transaction type
storage
hash
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911293729.1A
Other languages
Chinese (zh)
Other versions
CN112988738A (en
Inventor
程司雷
陈浩栋
曹京奇
张磊
刘晓赫
王辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911293729.1A priority Critical patent/CN112988738B/en
Publication of CN112988738A publication Critical patent/CN112988738A/en
Application granted granted Critical
Publication of CN112988738B publication Critical patent/CN112988738B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • 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)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the present disclosure disclose a data slicing method and apparatus for blockchain. One embodiment of the method comprises the following steps: the method comprises the steps of mounting a storage corresponding to a core module and a storage corresponding to a partition module, wherein the core module is a necessary module of all nodes in a block chain, and the partition module is a selectable module of each node in the block chain; in response to receiving a transaction request including a transaction type, determining whether a transaction of the transaction type needs to be performed according to the shard role; if so, executing the transaction of the transaction type to obtain a transaction execution result; if the transaction type belongs to the slicing transaction, writing the transaction execution result into the storage corresponding to the slicing module, otherwise writing into the storage corresponding to the core module; and taking the hash stored correspondingly by the core module as the application state hash to be put into the block head for global consistency consensus, and writing the storage hash of the segmentation module into the position of the corresponding segmentation in the block head. This embodiment achieves completion of the splitting operation within a single chain.

Description

Data slicing method and device for block chain
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a data slicing method and apparatus for blockchains.
Background
Blockchains are a type of distributed software that achieve global consistency of order of execution of operations through a consensus mechanism in a decentralized distributed network. Subject to consensus mechanisms, which require agreement among the entire network nodes, the throughput of a blockchain can generally only reach an upper limit of a few hundred to a few thousand and cannot be extended as traffic increases. The nature of data slicing is formally proposed to address the scalability of blockchain networks.
By slicing, the number of transactions each network node needs to process is greatly reduced, thus making it possible to increase the expansion mechanism of the blockchain processing capability by adding network nodes.
The existing slicing technology adopts a double-layer or multi-layer root chain and sub-chain structure, deployment and maintenance are complex, and the routing of transactions between different sub-chains is relatively time-consuming, so that if business dependency exists between the sub-chains, more cross-chain operations are needed to complete the execution of a single transaction, the complexity of a system is increased, and the execution efficiency is reduced.
For a new generation of schemes for quickly constructing customized blockchain through modularized software architecture represented by Cosmos-SDK, the generic blockchain architecture-oriented slicing scheme such as Ethernet 2.0 is not suitable, and corresponding solutions are also lacking at present.
Disclosure of Invention
Embodiments of the present disclosure propose a data slicing method and apparatus for a blockchain.
In a first aspect, embodiments of the present disclosure provide a data slicing method for a blockchain, comprising: the method comprises the steps of mounting a storage corresponding to a core module and mounting the storage corresponding to a segmentation module according to a pre-designated segmentation role, wherein the core module is a necessary module of all nodes in a block chain, and the segmentation module is a selectable module of all nodes in the block chain; in response to receiving a transaction request including a transaction type, determining whether a transaction of the transaction type needs to be performed according to the shard role; if so, executing the transaction of the transaction type to obtain a transaction execution result; if the transaction type belongs to the slicing transaction, writing the transaction execution result into the storage corresponding to the slicing module, otherwise writing into the storage corresponding to the core module; and taking the hash stored correspondingly by the core module as the application state hash to be put into the block head for global consistency consensus, and writing the storage hash of the segmentation module into the position of the corresponding segmentation in the block head.
In some embodiments, determining whether a transaction of a transaction type needs to be performed according to the shard role includes: if the transaction type is a core transaction, then a transaction of the transaction type needs to be performed.
In some embodiments, determining whether a transaction of a transaction type needs to be performed according to the shard role includes: if the transaction type is not the core transaction, matching the transaction type with the transaction type allocated by the slicing characters; if the match is successful, a transaction of the transaction type needs to be performed.
In some embodiments, the method further comprises: and writing the storage hash of the partition module which is not operated by the node into a null value.
In some embodiments, the method further comprises: in response to receiving the stored hashes of the shard modules from other nodes, detecting whether the same shard is running as the node; and if the two parties run the same fragment, performing consensus verification of the storage hash of the fragment module.
In some embodiments, the fragmentation module prohibits writing to the core module or other external device.
In a second aspect, embodiments of the present disclosure provide a data slicing apparatus for a blockchain, comprising: the system comprises a mounting unit, a storage unit and a storage unit, wherein the mounting unit is configured to mount storage corresponding to a core module and mount storage corresponding to a fragmentation module according to a pre-designated fragmentation role, the core module is a requisite module of all nodes in a blockchain, and the fragmentation module is a selectable module of all nodes in the blockchain; a determining unit configured to determine whether a transaction of a transaction type needs to be performed according to the shard role in response to receiving a transaction request including the transaction type; the execution unit is configured to execute the transaction of the transaction type if required to obtain a transaction execution result; the storage unit is configured to write the transaction execution result into the storage corresponding to the fragmentation module if the transaction type belongs to the fragmentation transaction, or write the transaction execution result into the storage corresponding to the core module if the transaction type belongs to the fragmentation transaction; the submitting unit is configured to put the hash stored correspondingly by the core module into the block head as the application state hash for global consistency consensus, and write the storage hash of the segmentation module into the position of the corresponding segmentation in the block head.
In some embodiments, the determining unit is further configured to: if the transaction type is a core transaction, then a transaction of the transaction type needs to be performed.
In some embodiments, the determining unit is further configured to: if the transaction type is not the core transaction, matching the transaction type with the transaction type allocated by the slicing characters; if the match is successful, a transaction of the transaction type needs to be performed.
In some embodiments, the commit unit is further configured to: and writing the storage hash of the partition module which is not operated by the node into a null value.
In some embodiments, the apparatus further comprises a shard consensus unit configured to: in response to receiving the stored hashes of the shard modules from other nodes, detecting whether the same shard is running as the node; and if the two parties run the same fragment, performing consensus verification of the storage hash of the fragment module.
In some embodiments, the fragmentation module prohibits writing to the core module or other external device.
In a third aspect, embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method as in any of the first aspects.
In a fourth aspect, embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as in any of the first aspects.
The embodiment of the disclosure provides a data slicing method and a data slicing device for a blockchain, and provides a slicing scheme based on a business module. Unlike the common method that one piece corresponds to one sub-chain in the prior art, the method can finish the operation of the piece in a single chain, and greatly simplifies the deployment and maintenance work of the block chain. According to the technical scheme, the processing capacity of the blockchain node can be effectively improved under the condition of limited hardware computing storage resources, and different blockchain participation nodes can concentrate on service logic concerned by the blockchain node.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings:
FIGS. 1a, 1b are diagrams of exemplary system architectures in which an embodiment of the present disclosure may be applied;
FIG. 2 is a flow chart of one embodiment of a data slicing method for a blockchain in accordance with the present disclosure;
FIG. 3 is a blockchain hierarchical software architecture for a data slicing method of blockchains in accordance with the present disclosure;
FIG. 4 is a schematic diagram of one application scenario of a data slicing method for blockchains in accordance with the present disclosure;
FIG. 5 is a schematic diagram of one embodiment of a data slicing apparatus for blockchains in accordance with the present disclosure;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1a, 1b illustrate an exemplary system architecture 100 to which embodiments of the data slicing method for a blockchain or the data slicing apparatus for a blockchain of the present disclosure may be applied.
As shown in fig. 1a, the system architecture 100 may include a local terminal 101, a consensus node 102, a third party server 103, and a consensus terminal 104. The local terminal 101, the consensus node 102, the third party server 103 and the consensus terminal 104 communicate with each other via a network. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
FIG. 1b is a diagram illustrating a network architecture for a data slicing method for a blockchain. A consensus node may be shared by one user or with other users.
The user may have the local terminal 101 interact with the consensus node 102, the third party server 103 and the consensus terminal 104 via a network, to receive or send messages etc. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the local terminal 101 and the consensus terminal.
The local terminal 101 and the consensus terminal 104 may be hardware or software. When the local terminal 101 and the consensus terminal 104 are hardware, various electronic devices can be supported for the consensus request. Any terminal equipment connected to a node within the service organization may be used as the local terminal 101, i.e. the local terminal 101 and the consensus terminal 104 may be interchanged. The public identification request of the privacy state can be actively initiated by a certain user through the terminal, and the public identification request of the privacy state can be initiated by each node in the service organization under the control of the third-party server.
The consensus nodes A, B, C belong to the same service organization S. The same optional transaction is performed within the business organization S.
The blockchain system is composed of a consensus layer and an application layer. The consensus layer mainly encapsulates various types of consensus algorithms of network nodes (i.e., consensus nodes). The verification and validation of the transaction is completed in a short time by voting of the consensus nodes. For a transaction, if the effective number reaches a certain threshold, for example, a node exceeding two thirds of the organization members can reach consensus, we can consider that the whole network can reach consensus for the node.
As shown in fig. 3, the modular blockchain software architecture is divided into:
consensus layer: and the common-knowledge state machine is responsible for constructing the P2P network and the data broadcasting and maintaining the block chain thereof, and the common-knowledge state machine stores data such as block data, common-knowledge parameters, a verifier set and the like.
Application layer: the application layer operates above the consensus layer and is responsible for verifying and executing transactions received and validated in the consensus layer. The application layer is again constituted by App, module, store. The App is an execution inlet of the application layer and is responsible for analyzing the transaction and forwarding the transaction to a corresponding Module to complete the execution; the Module is an independent functional Module which is divided from service functions of the blockchain and is responsible for processing and executing the transaction of the service type and completing the updating of the blockchain consensus state machine; the Store is used for managing the storage partition mounted under the system and each different Module, is responsible for persistence of the blockchain consensus state machine, and gives the state hash to the consensus layer to complete consistency check. Store includes levelDB and prefixDB where levelDB is the underlying real database and prefixDB is the abstract package above to partition the DB.
It should be noted that the consensus node may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server.
The third party server 103 may provide node management functions such as adding/deleting nodes, assigning sharded roles for each node, and the like.
Data slicing can reduce the storage pressure of blockchain nodes and reduce the number of transactions that need to be performed. The invention divides the business module into a core module and a segmentation module in the application layer. For the core module, any node in the network must store and execute the corresponding transaction; for the fragmentation module, the network node decides whether to store and execute the corresponding transaction according to its own fragmentation type.
The slicing module is an optional module, and the node allows selecting a loaded module list at the time of starting. For example, the following optional modules exist in the system:
wherein record may represent a "certification" function, service may represent a "service" function, and Contract represents a "contract" function.
The sharding role defines the sharding type of the blockchain node and describes the module list of the loading operation when the node is started. The node can self-define the slicing roles according to the requirements, can self-select the loaded module list, and can also use the preset slicing roles. At present, the system creates a plurality of preset sharding roles full, record-service, contact-only, which respectively represent all nodes for storing all sharding modules, sharding nodes for storing record and service modules, and sharding nodes for storing evm intelligent contract modules.
The sharded role as part of the application layer configuration information needs to be specified at the start of the node and registered in the context of the application.
It should be noted that, the data slicing method for blockchain provided by the embodiments of the present disclosure is generally performed by the consensus node 102, and any node in the service organization may initiate a consensus request. Accordingly, the data slicing means for the blockchain is typically provided in the consensus node 102.
It should be understood that the number of local terminals, consensus nodes, third party servers and consensus terminals in fig. 1 is merely illustrative. There may be any number of local terminals, consensus nodes, third party servers and consensus terminals, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a data slicing method for blockchains in accordance with the present disclosure is shown. The data slicing method for the blockchain comprises the following steps:
and step 201, mounting the storage corresponding to the core module, and mounting the storage corresponding to the segmentation module according to the pre-designated segmentation role.
In the present embodiment, an execution body of the data slicing method for a blockchain (e.g., a consensus node shown in fig. 1 a) is specified with a slicing role in advance. The node performs the functions of the assigned roles in addition to the functions of the core module. The core module is a necessary module of all nodes in the blockchain, such as a transfer module, a parameter management module, an on-chain self-care module, a like module and the like. The slicing module is an optional module of each node in the blockchain, such as a certification storing module, a business function module and the like.
The blockchain node may specify the shard role of the node at startup, such as CHAIN START-node-role= "contact-only" or CHAIN START-node-role= "record, contact". The node will firstly mount all the memories corresponding to the core modules, and then decide which memories to mount according to the slicing roles specified by the command line, namely the node-role of the current node. In the subsequent initialization process, whether to call the method of the corresponding slicing module is determined according to the node-role of the current node. Different from the core module, the implementation of the slicing module needs to strictly prohibit writing to other core modules or other external parts, and only the application state of the slicing module can be changed. This limitation is to limit the change of the application state by the slicing module to its own sandbox environment, so as to avoid pollution to the global state.
The mounting refers to registering names and paths stored by corresponding modules in the app. A store is created for use by this module and then registered in the app's root multi store.
Step 202, in response to receiving a transaction request including a transaction type, determining whether a transaction of the transaction type needs to be performed according to the shard role.
In this embodiment, after receiving the transaction request, the transaction type is parsed. Transaction types may include core transactions and sharded transactions 2 major classes, which in turn may be subdivided into different minor classes depending on the particular transaction. If the core transaction is the core transaction, the execution result of the core transaction is obtained after the execution of the core transaction no matter what the slicing role of the current node is. If the transaction is a sliced transaction, matching is carried out according to the specific sliced type and the transaction type designated by the sliced role, and if the matching is successful, the transaction of the transaction type is required to be executed. For example, if the current node's shard role is "contact-only", i.e., only contract transactions are performed, if the "record" shard transaction request is received, then the shard transaction is not performed. If a "connect" fragmented transaction request is received, it is necessary to execute the fragmented transaction request.
Step 203, if so, executing the transaction of the transaction type to obtain a transaction execution result.
In this embodiment, if it is determined in step 202 that the received transaction request needs to be executed, execution can be started, otherwise execution is not required.
Step 204, if the transaction type belongs to the sliced transaction, writing the transaction execution result into the storage corresponding to the sliced module, otherwise writing into the storage corresponding to the core module.
In this embodiment, TAGSHARDING is added to the transaction execution results to identify whether the transaction is a fragmented transaction. After receiving the transaction execution result in the consensus layer, parsing TAGSHARDING, if the transaction is a fragmented transaction, not storing the execution result (otherwise, the transaction execution result sets of different nodes are inconsistent, resulting in consensus collision).
And 205, taking the hash stored correspondingly by the core module as an application state hash to be put into the block head for global consistency consensus, and writing the storage hash of the segmentation module into the position of the corresponding segmentation in the block head.
In this embodiment, in the update block status stage, the storage of the core module and the partition module needs to be committed separately. According to the Hash calculation method agreed in the prior art, a Hash value, such as merck Hash, is calculated according to the stored data of each module. The corresponding stored merck Hash of the core module is used as an application state Hash to be put into a block header for global consistency consensus; different nodes write the stored merck Hash of the running partition module into the corresponding partition position in the block head, and the partition Hash which is not running is written with a null value, so that the common-identification layer only performs common-identification verification on the Hash of the partition module when the two parties run the same partition. Each shard Hash may be identified by a string of characters and a separator.
With continued reference to fig. 4, fig. 4 is a schematic diagram of an application scenario of the data slicing method for a blockchain according to the present embodiment. In the application scenario of fig. 4, three nodes are assigned different sharding roles. Node a needs to perform fragmented transaction 1, node B needs to perform fragmented transaction 1 and fragmented transaction 2, and node C needs to perform fragmented transaction 2. The node A, B, C must execute the core transaction, and generate AppHash after obtaining the core transaction results of the respective nodes. The node A, B, C also executes the sliced transaction respectively, and generates sliced Hash after the sliced transaction result is obtained. Wherein, node A obtains fragment 1Hash in addition to AppHash, node B obtains fragment 1Hash and fragment 2Hash in addition to AppHash, and node C obtains fragment 2Hash in addition to AppHash. Finally node A, B, C may be consensus via AppHash. Fragment 1Hash of node a and fragment 1Hash of node B may be verified. The fragment 2Hash of node B and the fragment 2Hash of node C may be verified. While no identical shards between node a and node C are verifiable.
The method provided by the embodiment of the disclosure enables the blockchain node to effectively improve the processing capability under the condition of limited hardware computing storage resources, and enables different blockchain participation nodes to concentrate on service logic focused by the blockchain participation nodes.
With further reference to fig. 5, as an implementation of the method illustrated in the foregoing figures, the present disclosure provides an embodiment of a data slicing apparatus for a blockchain, which corresponds to the method embodiment illustrated in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the data slicing apparatus 500 for a blockchain of the present embodiment includes: mounting unit 501, determining unit 502, executing unit 503, storing unit 504 and submitting unit 505. The mounting unit 501 is configured to mount a storage corresponding to a core module, and mount the storage corresponding to a partition module according to a pre-designated partition role, where the core module is a necessary module of all nodes in the blockchain, and the partition module is an optional module of each node in the blockchain; a determining unit 502 configured to determine whether a transaction of a transaction type needs to be performed according to the shard role in response to receiving a transaction request including the transaction type; an execution unit 503 configured to execute a transaction of a transaction type if necessary, to obtain a transaction execution result; the storage unit 504 is configured to write the transaction execution result into the storage corresponding to the fragmentation module if the transaction type belongs to the fragmentation transaction, or write the transaction execution result into the storage corresponding to the core module if the transaction type belongs to the fragmentation transaction; and the submitting unit 505 is configured to put the hash stored by the core module corresponding to the application state hash into the block header for global consistency consensus, and write the stored hash of the segmentation module into the position of the corresponding segmentation in the block header.
In this embodiment, specific processes of the mounting unit 501, the determining unit 502, the executing unit 503, the storing unit 504, and the submitting unit 505 of the data slicing apparatus 500 for blockchain may refer to steps 201, 202, 203, 204, and 205 in the corresponding embodiment of fig. 2.
In some optional implementations of the present embodiment, the determining unit 502 is further configured to: if the transaction type is a core transaction, then a transaction of the transaction type needs to be performed.
In some optional implementations of the present embodiment, the determining unit 502 is further configured to: if the transaction type is not the core transaction, matching the transaction type with the transaction type allocated by the slicing characters; if the match is successful, a transaction of the transaction type needs to be performed.
In some optional implementations of the present embodiment, the submitting unit 505 is further configured to: and writing the storage hash of the partition module which is not operated by the node into a null value.
In some optional implementations of the present embodiment, the apparatus 500 further includes a shard consensus unit (not shown in the drawings) configured to: in response to receiving the stored hashes of the shard modules from other nodes, detecting whether the same shard is running as the node; and if the two parties run the same fragment, performing consensus verification of the storage hash of the fragment module.
In some alternative implementations of the present embodiment, the fragmentation module prohibits writing to the core module or other external device.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., consensus terminal in fig. 1) 600 suitable for use in implementing an embodiment of the present disclosure is shown. The consensus terminal illustrated in fig. 6 is merely an example and should not impose any limitation on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 6 may represent one device or a plurality of devices as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 601. It should be noted that, the computer readable medium according to the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In an embodiment of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. Whereas in embodiments of the present disclosure, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: the method comprises the steps of mounting a storage corresponding to a core module and mounting the storage corresponding to a segmentation module according to a pre-designated segmentation role, wherein the core module is a necessary module of all nodes in a block chain, and the segmentation module is a selectable module of all nodes in the block chain; in response to receiving a transaction request including a transaction type, determining whether a transaction of the transaction type needs to be performed according to the shard role; if so, executing the transaction of the transaction type to obtain a transaction execution result; if the transaction type belongs to the slicing transaction, writing the transaction execution result into the storage corresponding to the slicing module, otherwise writing into the storage corresponding to the core module; and taking the hash stored correspondingly by the core module as the application state hash to be put into the block head for global consistency consensus, and writing the storage hash of the segmentation module into the position of the corresponding segmentation in the block head.
Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments described in the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes a mount unit, a determination unit, an execution unit, a storage unit, and a commit unit. The names of these units do not limit the unit itself in some cases, for example, the mount unit may also be described as "mount a storage corresponding to the core module, and mount a storage corresponding to the partition module according to a pre-designated partition role".
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which any combination of features described above or their equivalents is contemplated without departing from the inventive concepts described. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).

Claims (10)

1. A data slicing method for a blockchain, comprising:
the method comprises the steps of mounting a storage corresponding to a core module and mounting a storage corresponding to a segmentation module according to a pre-designated segmentation role, wherein the core module is a necessary module of all nodes in a blockchain, and the segmentation module is a selectable module of each node in the blockchain;
In response to receiving a transaction request including a transaction type, determining whether a transaction of the transaction type needs to be performed according to a shard role;
If so, executing the transaction of the transaction type to obtain a transaction execution result;
If the transaction type belongs to the slicing transaction, writing the transaction execution result into a storage corresponding to the slicing module, otherwise writing into a storage corresponding to the core module;
The hash stored correspondingly by the core module is used as an application state hash to be put into the block head for global consistency consensus, and the stored hash of the segmentation module is written into the position of the corresponding segmentation in the block head;
wherein the determining whether the transaction of the transaction type needs to be executed according to the slicing roles comprises:
if the transaction type is a core transaction, executing the transaction of the transaction type;
If the transaction type is not a core transaction, matching the transaction type with the transaction type allocated by the slicing characters;
If the match is successful, a transaction of the transaction type needs to be performed.
2. The method of claim 1, wherein the method further comprises:
and writing the storage hash of the partition module which is not operated by the node into a null value.
3. The method of claim 2, wherein the method further comprises:
In response to receiving the stored hashes of the shard modules from other nodes, detecting whether the same shard is running as the node;
And if the two parties run the same fragment, performing consensus verification of the storage hash of the fragment module.
4. A method according to any of claims 1-3, wherein the fragmentation module inhibits writing to a core module or other external.
5. A data slicing apparatus for a blockchain, comprising:
The system comprises a mounting unit, a storage unit and a storage unit, wherein the mounting unit is configured to mount storage corresponding to a core module and mount storage corresponding to a fragmentation module according to a pre-designated fragmentation role, the core module is a necessary module of all nodes in a blockchain, and the fragmentation module is a selectable module of each node in the blockchain;
A determining unit configured to determine whether a transaction of a transaction type is required to be executed according to a shard role in response to receiving a transaction request including the transaction type;
the execution unit is configured to execute the transaction of the transaction type if required to obtain a transaction execution result;
The storage unit is configured to write the transaction execution result into the storage corresponding to the segmentation module if the transaction type belongs to the segmentation transaction, or write the transaction execution result into the storage corresponding to the core module if the transaction type belongs to the segmentation transaction;
The submitting unit is configured to put the hash stored correspondingly by the core module into the block head as the application state hash for global consistency consensus, and write the stored hash of the segmentation module into the position of the corresponding segmentation in the block head;
wherein the determining unit is further configured to:
if the transaction type is a core transaction, executing the transaction of the transaction type;
If the transaction type is not a core transaction, matching the transaction type with the transaction type allocated by the slicing characters;
If the match is successful, a transaction of the transaction type needs to be performed.
6. The apparatus of claim 5, wherein the submit unit is further configured to:
and writing the storage hash of the partition module which is not operated by the node into a null value.
7. The apparatus of claim 6, wherein the apparatus further comprises a shard consensus unit configured to:
In response to receiving the stored hashes of the shard modules from other nodes, detecting whether the same shard is running as the node;
And if the two parties run the same fragment, performing consensus verification of the storage hash of the fragment module.
8. The apparatus of one of claims 5-7, wherein the fragmentation module inhibits writing to a core module or other external.
9. An electronic device, comprising:
One or more processors;
A storage device having one or more programs stored thereon,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-4.
10. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1-4.
CN201911293729.1A 2019-12-16 2019-12-16 Data slicing method and device for block chain Active CN112988738B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911293729.1A CN112988738B (en) 2019-12-16 2019-12-16 Data slicing method and device for block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911293729.1A CN112988738B (en) 2019-12-16 2019-12-16 Data slicing method and device for block chain

Publications (2)

Publication Number Publication Date
CN112988738A CN112988738A (en) 2021-06-18
CN112988738B true CN112988738B (en) 2024-05-07

Family

ID=76343249

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911293729.1A Active CN112988738B (en) 2019-12-16 2019-12-16 Data slicing method and device for block chain

Country Status (1)

Country Link
CN (1) CN112988738B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055064B (en) * 2023-03-17 2023-06-23 安徽中科晶格技术有限公司 Method, system, medium and equipment for multi-block simultaneous consensus in block chain segmentation

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018161478A1 (en) * 2017-03-09 2018-09-13 上海亿账通区块链科技有限公司 Fragmentation processing method for use with multi-block chains, device, server and storage medium
CN109687953A (en) * 2018-12-24 2019-04-26 杭州复杂美科技有限公司 Classification of business transaction method, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018161478A1 (en) * 2017-03-09 2018-09-13 上海亿账通区块链科技有限公司 Fragmentation processing method for use with multi-block chains, device, server and storage medium
CN109687953A (en) * 2018-12-24 2019-04-26 杭州复杂美科技有限公司 Classification of business transaction method, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
多区块链交易分发和事件处理的系统方案;刘雄文;;计算机科学(S2);全文 *

Also Published As

Publication number Publication date
CN112988738A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN109886693B (en) Consensus realization method, device, equipment and medium for block chain system
KR20220006623A (en) Blockchain consensus method, device and system
US11900074B2 (en) Method and apparatus for implementing an end-to-end API design and development module integrating with firmwide tools and processes
CN113765982A (en) Request response method, device, system, server and storage medium
WO2022247201A1 (en) Data query method and apparatus
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN111598575A (en) Business process control method and device, electronic equipment and readable storage medium
CN112714158A (en) Transaction processing method, relay network, cross-link gateway, system, medium, and device
CN111831461A (en) Method and device for processing business process
CN114328132A (en) Method, device, equipment and medium for monitoring state of external data source
CN115334025A (en) Decentralized instant messaging method, decentralized instant messaging device, decentralized instant messaging equipment and storage medium
CN115017169A (en) Management method and system of multi-cloud management platform
CN112988738B (en) Data slicing method and device for block chain
US11645109B2 (en) Managing failures in edge computing environments
US20220129306A1 (en) Managing task flow in edge computing environment
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
CN111813529B (en) Data processing method, device, electronic equipment and storage medium
CN113779004A (en) Data verification method and device
CN111951112A (en) Intelligent contract execution method based on block chain, terminal equipment and storage medium
CN111681011A (en) Data processing method, block chain system, computer system and medium
CN111767149A (en) Scheduling method, device, equipment and storage equipment
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
US20230208659A1 (en) Blockchain apparatus and method for mobile edge computing
CN113541987A (en) Method and device for updating configuration data
CN110096543A (en) Data manipulation method, device, server and the medium of application program

Legal Events

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