CN111475572B - Block generation method, device, equipment and medium - Google Patents

Block generation method, device, equipment and medium Download PDF

Info

Publication number
CN111475572B
CN111475572B CN202010254531.9A CN202010254531A CN111475572B CN 111475572 B CN111475572 B CN 111475572B CN 202010254531 A CN202010254531 A CN 202010254531A CN 111475572 B CN111475572 B CN 111475572B
Authority
CN
China
Prior art keywords
parallel
block
transaction data
basic
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.)
Active
Application number
CN202010254531.9A
Other languages
Chinese (zh)
Other versions
CN111475572A (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.)
Baidu International Technology Shenzhen Co ltd
Original Assignee
Baidu International Technology Shenzhen 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 Baidu International Technology Shenzhen Co ltd filed Critical Baidu International Technology Shenzhen Co ltd
Priority to CN202010254531.9A priority Critical patent/CN111475572B/en
Publication of CN111475572A publication Critical patent/CN111475572A/en
Application granted granted Critical
Publication of CN111475572B publication Critical patent/CN111475572B/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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a block generation method, a device, equipment and a medium, and relates to a block chain technology. Wherein the method comprises the following steps: processing a basic transaction request in a basic block chain to obtain basic transaction data, and processing a parallel transaction request in a parallel block chain to obtain parallel transaction data; constructing a current parallel block according to the parallel transaction data; and constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block. The embodiment of the application can optimize the block data storage mode aiming at the multi-chain scene.

Description

Block generation method, device, equipment and medium
Technical Field
The embodiment of the application relates to a computer technology, in particular to a block chain technology, and especially relates to a block generation method, a device, equipment and a medium.
Background
Currently, in the aspect of block data storage, an independent database is usually set for each block chain, so as to store block data, i.e. the account book and the status of each chain are separately stored.
However, as the number of blockchains deployed on blockchain nodes increases, databases increase, consuming significant memory space for blockchain nodes. This also limits the number of blockchains that can be deployed on blockchain nodes given the limited storage space.
Disclosure of Invention
The embodiment of the application discloses a block generation method, a device, equipment and a medium, which are used for optimizing a block data storage mode aiming at a multi-chain scene.
In a first aspect, an embodiment of the present application discloses a block generation method applied to a blockchain node, where a base blockchain and a parallel blockchain are deployed on the blockchain node, the method includes:
processing the basic transaction request in the basic block chain to obtain basic transaction data, and processing the parallel transaction request in the parallel block chain to obtain parallel transaction data;
constructing a current parallel block according to the parallel transaction data;
and constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block.
In a second aspect, an embodiment of the present application discloses a block generating apparatus configured at a blockchain node, where a base blockchain and a parallel blockchain are disposed on the blockchain node, the apparatus comprising:
the transaction data determining module is used for processing the basic transaction request in the basic block chain to obtain basic transaction data, and processing the parallel transaction request in the parallel block chain to obtain parallel transaction data;
the parallel block construction module is used for constructing a current parallel block according to the parallel transaction data;
and the basic block construction module is used for constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block.
In a third aspect, an embodiment of the present application further discloses an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a block generation method according to any one of the embodiments of the present application.
In a fourth aspect, embodiments of the present application further disclose a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a block generation method according to any of the embodiments of the present application.
According to the technical scheme of the embodiment of the application, aiming at the situation that basic blockchains and parallel blockchains are deployed on the blockchain nodes at the same time, by nesting the current parallel blocks in the current basic blocks, the block data storage mode aiming at a multi-chain scene is optimized, so that even if the number of the blockchains deployed on the blockchain nodes is increased, the number of the bottom databases is not required to be increased, the cost of newly creating the blockchains on the blockchain nodes is reduced, and the number of the blockchains which can be deployed on each blockchain node can also be free from the limitation of a storage space.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the application or to delineate the scope of the application. Other features of the present application will become apparent from the description that follows.
Drawings
The drawings are included to provide a better understanding of the present application and are not to be construed as limiting the application. Wherein:
FIG. 1 is a schematic diagram of a blockchain network in accordance with embodiments of the present application;
FIG. 2 is a flow chart of a block generation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a block chain structure according to an embodiment of the present application;
FIG. 4 is a flow chart of another block generation method according to an embodiment of the present application;
FIG. 5 is a schematic block diagram of an embodiment of the present application;
fig. 6 is a schematic structural diagram of a block generating apparatus according to an embodiment of the present application;
fig. 7 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of a blockchain network according to an embodiment of the present application. The network architecture shown in fig. 1 is only for illustrative purposes and should not be construed as limiting the embodiments of the present application in any way. The number of nodes participating in the blockchain network may be as desired. Fig. 1 illustrates, by way of example, a block chain network architecture diagram including 3 block chain nodes. One base blockchain and at least one parallel blockchain may be deployed on each blockchain node. The base blockchain may also be referred to as a parent blockchain or a master blockchain, and the parallel blockchains may also be referred to as child blockchains. Based on the division of the service processing requirements, the basic blockchain and the parallel blockchain can be used for processing different service logics, and the specific division of the basic blockchain and the parallel blockchain is not particularly limited in the embodiment of the application. In addition, aiming at different blockchain nodes, except for the basic blockchain to be deployed, the deployed parallel blockchains can be selected according to actual conditions, namely the number of the parallel blockchains deployed on each blockchain node can be the same or different.
Optionally, in the embodiment of the present application, the same consensus mechanism may be deployed on the base blockchain and the parallel blockchain, and there may be no independent consensus algorithm on the parallel blockchain, so as to ensure that the same blockchain node may generate a block based on transaction data on multiple chains at the same time.
FIG. 2 is a flow chart of a block generation method disclosed in accordance with an embodiment of the present application, which may be applicable to the case of how blocks are packed when multiple blockchains are deployed simultaneously on a blockchain node, for example, when one base blockchain and at least one parallel blockchain are deployed simultaneously. The method disclosed by the embodiment of the application can be executed by a block generating device, and the device can be realized by software and/or hardware and can be configured in a block chain node. The blockchain node may be deployed on any electronic device with computing capabilities.
As shown in fig. 2, the block generating method disclosed in the embodiment of the present application may include:
s101, processing a basic transaction request in a basic block chain to obtain basic transaction data, and processing a parallel transaction request in a parallel block chain to obtain parallel transaction data.
Wherein the base transaction request may be any transaction request initiated by any initiator and transmitted in the base blockchain, and the parallel transaction request may be any transaction request initiated by any initiator and transmitted in the parallel blockchain. The types of transaction requests that are handled by the native node (i.e., referring to the blockchain node currently used to perform the methods of embodiments of the present application) include, but are not limited to, smart contract-based transaction requests. When transaction requests exist in the basic block chain and at least one parallel block chain, the local node needs to process the transaction requests to obtain corresponding transaction data.
Optionally, processing the basic transaction request in the basic blockchain to obtain basic transaction data, and processing the parallel transaction request in the parallel blockchain to obtain parallel transaction data includes:
in the process of processing a basic transaction request in a basic block chain to obtain basic transaction data, monitoring whether a parallel transaction request in a parallel block chain exists on a local node;
and if the parallel transaction request exists, processing the parallel transaction request in the parallel block chain to obtain parallel transaction data. In the process of executing the basic transaction request, the local node can monitor at least one parallel blockchain by utilizing a monitoring program which is pre-deployed in a blockchain network so as to determine whether the parallel transaction request to be processed exists in the at least one parallel blockchain, and if the target parallel blockchain with the parallel transaction request to be processed is currently monitored, the parallel transaction request in the target parallel blockchain is processed to obtain parallel transaction data, so that the transaction data in the parallel blockchain is prevented from being omitted in the process of generating the current block. If the existence of the target parallel blockchain of the pending parallel transaction request is not currently monitored, then the parallel transaction data need not be used in generating the current block.
S102, constructing a current parallel block according to the parallel transaction data.
S103, constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block.
In order to ensure the logical integrity of each chain and the non-tamper-resistance of the data on the plurality of chains, the local node may first generate at least one current parallel block based on the parallel transaction data obtained by processing the parallel transaction request in at least one parallel blockchain in the block packing process, and then use the at least one current parallel block in the generation process of the current base block, thereby achieving the effect of placing the at least one current parallel block in the current base block. Of course, in the process of generating the current parallel block, the data related to the current parallel block, such as the block height of the current base block, the hash value of the parallel transaction data, and the like, can be flexibly selected to be used in the block generation process, so that the data relevance between the base block and the parallel block and the non-tamper modification of the data are further ensured. Different parallel blockchains correspond to respective parallel blocks. Parallel blocks may also be referred to as sub-blocks, micro-blocks, or sub-blocks with respect to the base block.
It should be noted that, in the process of constructing the current base block and the current parallel block, the generation of the current base block and the current parallel block may be respectively completed by adding other related block data, such as a block height, a time stamp, a block hash value, etc., based on the existing transaction data by using a preset block generation policy. The block generation strategy can be used for defining data, block structures and the like required in the block generation process. The data required in the block generation process can be flexibly adjusted according to actual conditions.
Because the current parallel block is parasitic or nested in the current basic block, the current basic block is stored by only using one database in the data storage layer, and the storage of data in the basic block chain and the parallel block chain can be realized at the same time. Every time one parallel blockchain is added on a blockchain node, only some Key-Value pair (Key-Value) storage entries are added in the existing database, a new database is not needed to be built with the increase of the number of the chains, and therefore a new parallel blockchain can be created almost without cost.
Generally, a database is newly built, the overhead of node memory and file handle is larger, for example, more memory is required for new folders, files and database examples, after the technical scheme of the embodiment of the application is adopted, the number of the databases can be reduced, the number of the blockchains which can be deployed on each blockchain node can be free from the limitation of the storage space, the problem that the storage space of the blockchain node is seriously occupied due to the fact that one chain corresponds to one database, and the number of the supportable chains on the blockchain node is further limited is solved, and the more the number of the blockchains supported by each blockchain node is, the multi-core computing capability of a fully utilized processor is facilitated.
Meanwhile, through the technical scheme of the embodiment of the application, as the data of a plurality of blockchains can be stored in one database, namely, the blockchains can commonly access the same database, the atomicity of cross-chain interaction operation is easier to realize, the write-in can be completed through one batch processing of the database, and the realization of complex protocols such as hash time lock, two-stage submission and the like are not needed when a plurality of databases exist at the bottom layer, thereby solving the problems of high difficulty and high complexity of cross-chain data interaction when one chain corresponds to one database.
Fig. 3 is a schematic diagram of a block chain structure according to an embodiment of the present application. Fig. 3 is intended as an example, and should not be construed as limiting the embodiments of the application in any way. As shown in fig. 3, the parallel block A1 and the parallel block C1 are simultaneously parasitic in one base block, the parallel block A2 and the parallel block C2 are each parasitic in a different base block, and the parallel block A3 and the parallel block C3 are simultaneously parasitic in another base block; the plurality of base blocks may form a base block chain structure, the parallel blocks A1, A2 and A3 may form a parallel block chain structure, and the parallel blocks C1, C2 and C3 may form another parallel block chain structure. As can also be seen from fig. 3, the number of parallel blocks included in each base block may be different, i.e. when there is a base transaction request to be processed in the base blockchain, there may be no parallel transaction request or a partial parallel transaction request in at least one parallel blockchain; parallel blocks generated using parallel transaction data need to be correspondingly parasitized in the current base block according to the generation order of the current base block.
Fig. 4 is a flowchart of another block generating method according to an embodiment of the present application, which is further optimized and expanded based on the above technical solution, and may be combined with the above various alternative embodiments. As shown in fig. 4, the method may include:
s201, processing a basic transaction request in a basic block chain to obtain basic transaction data, and processing a parallel transaction request in a parallel block chain to obtain parallel transaction data.
S202, constructing a current parallel block according to the parallel transaction data.
The block includes a block header and a block body, and data included in the block header and the block body can be flexibly set. The local node can respectively construct the block head and the block body of the current parallel block based on the parallel transaction data. The block header of the current parallel block may include at least one of data such as Merkle root (Merkle root) of the current parallel block, ID (e.g. hash value) of the current parallel block, hash value (pre hash) of the last parallel block, height of the current parallel block, and Timestamp (Timestamp); the current parallel block may include, but is not limited to, parallel transaction data in the block body. If one or more transaction requests form a transaction, the zone block may include, but is not limited to, transaction data or the like. The specific calculation mode of the merkel root and the hash value can be realized by adopting the existing related algorithm, and the embodiment of the application is not particularly limited.
Illustratively, constructing the current parallel block from the parallel transaction data includes:
calculating the merkel root of the current parallel block according to the parallel transaction data;
and constructing a block head of the current parallel block according to the Merkel root of the current parallel block and the hash value of the last parallel block, and taking the parallel transaction data as a block body of the current parallel block. The calculation of the merkel root ensures that the parallel transaction data in the current block is not tamper-proof, the current parallel block can point to the previous parallel block through the hash value of the previous parallel block, and the parallel block chain is logically independent and complete even if the parallel block is parasitic in the basic block.
S203, constructing the block head of the current basic block according to the basic transaction data and the parallel transaction data.
Since the parallel blocks are parasitic in the base block, in order to ensure the non-tamper-resistance of the data in the base block chain and the parallel block chain, the block header of the current base block is constructed based on both the base transaction data and the parallel transaction data in the embodiment of the application. The block header of the current base block may include at least one of data such as Merkle root (Merkle root) of the current base block, ID (e.g. hash value) of the current base block, hash value (PreHash) of the previous base block, height of the current base block, and time stamp (Timestamp). The specific calculation mode of the merkel root and the hash value can be realized by adopting the existing related algorithm, and the embodiment of the application is not particularly limited.
Illustratively, constructing the block header of the current base block from the base transaction data and the parallel transaction data includes:
calculating the merkel root of the current basic block according to the basic transaction data and the parallel transaction data;
and constructing the block head of the current basic block according to the Merkel root of the current basic block and the hash value of the last basic block. The calculation of the merkel root ensures the non-tamper-resistance of the basic transaction data and the parallel transaction data in the current area block, the current basic block can point to the last basic block through the hash value of the last basic block, and the logical integrity of the basic block chain is ensured.
S204, constructing a zone block of the current basic block according to the basic transaction data and the current parallel block.
The current parallel block is located in the current base block, so the local node can locally utilize a database to realize simultaneous storage of data in the base block chain and the parallel block chain. In addition, there is no strict execution order limitation between the operations S203 and S204, and the logic order shown in fig. 4 should not be construed as a specific limitation on the embodiment of the present application.
Fig. 5 is a schematic block diagram disclosed in the embodiment of the present application, and as an example, should not be construed as a specific limitation of the embodiment of the present application. As shown in fig. 5, the current base block 52 includes a block header 521 and a block body including a base transaction data (or referred to as transaction data) storage area 522, a first parallel block 53, and a second parallel block 54; the first parallel block 53 includes a block header 531 and a block body 532, and the block body 532 is used to store parallel transaction data obtained by processing a parallel transaction request in a parallel block chain a corresponding to the first parallel block 53; the second parallel block 54 includes a block header 541 and a block 542, and the block 542 is used for storing parallel transaction data obtained by processing a parallel transaction request in a parallel blockchain B corresponding to the second parallel block 54. There is no limitation in any order of "first", "second" in the first parallel block 53 and the second parallel block 54, and only the distinction naming of the different parallel blocks is used.
In addition, after the local node generates the current basic block, the current basic block can be signed by using its own secret key, such as a private key, and then the signed current basic block is transmitted to the blockchain network for verification and storage by other blockchain nodes. Because in the embodiment of the present application, parallel blockchains deployed on each blockchain node may be different, when other blockchain nodes verify a base block sent by a local node, and when transaction data or transaction data which does not participate in or is not interested in the block body of the base block is found, the transaction data or the transaction data can be discarded, that is, data in the block body of the base block is selectively stored.
According to the technical scheme of the embodiment of the application, the current parallel block is firstly constructed based on the parallel transaction data, then, the block head of the current base block is constructed according to the base transaction data and the parallel transaction data, the non-falsification of the data on the base block chain and the parallel block chain is ensured, and the block body of the current base block is constructed according to the base transaction data and the current parallel block, so that the current parallel block is parasitic in the block body of the current base block. According to the embodiment of the application, a block data storage mode aiming at a multi-chain scene is optimized, so that even if the number of the block chains deployed on the block chain nodes is increased, the number of the bottom database is not required to be increased, new parallel block chains can be created almost without cost, the number of the block chains deployed on each block chain node can also get rid of the limitation of storage space, and the problem that the storage space of the block chain link points is seriously occupied due to the fact that one chain corresponds to one database, and the number of the chains supportable on the block chain nodes is further limited is solved; meanwhile, through the technical scheme of the embodiment of the application, the atomicity of the cross-link interaction operation is easier to realize, the write-in can be completed through one batch of processing of the databases, and the realization is not needed to be realized by utilizing complex protocols such as hash time locks, two-stage submission and the like when a plurality of databases exist at the bottom layer, so that the problems of high difficulty and high complexity in realizing the cross-link data interaction when one link corresponds to one database are solved.
Fig. 6 is a schematic structural diagram of a block generating apparatus according to an embodiment of the present application. The embodiment of the application can be applied to the situation of how to pack the blocks when a plurality of blockchains are deployed on the blockchain node at the same time, for example, when one basic blockchain and at least one parallel blockchain are deployed at the same time. The device disclosed by the embodiment of the application can be realized by adopting software and/or hardware and can be configured in a blockchain node. The blockchain node may be deployed on any electronic device with computing capabilities.
As shown in fig. 6, the block generating apparatus 300 disclosed in the embodiment of the present application may include a transaction data determining module 301, a parallel block constructing module 302, and a base block constructing module 303, wherein:
the transaction data determining module 301 is configured to process a basic transaction request in a basic blockchain to obtain basic transaction data, and process a parallel transaction request in a parallel blockchain to obtain parallel transaction data;
a parallel block construction module 302, configured to construct a current parallel block according to the parallel transaction data;
the basic block construction module 303 is configured to construct a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block.
Optionally, the base block construction module 303 includes:
the block head construction unit is used for constructing a block head of the current basic block according to the basic transaction data and the parallel transaction data;
and the zone block construction unit is used for constructing a zone block of the current basic block according to the basic transaction data and the current parallel block.
Optionally, the block header construction unit includes:
a calculating subunit, configured to calculate a merkel root of the current base block according to the base transaction data and the parallel transaction data;
and the construction subunit is used for constructing the block head of the current basic block according to the Merkel root of the current basic block and the hash value of the last basic block.
Optionally, the parallel block construction module 302 includes:
the computing unit is used for computing the merkel root of the current parallel block according to the parallel transaction data;
and the construction unit is used for constructing the block head of the current parallel block according to the merkel root of the current parallel block and the hash value of the last parallel block, and taking the parallel transaction data as the block body of the current parallel block.
Optionally, the transaction data determining module 301 includes:
the basic transaction data determining unit is used for processing basic transaction requests in the basic block chain to obtain basic transaction data;
the monitoring unit is used for monitoring whether parallel transaction requests in the parallel block chain exist on the local node or not in the process of processing the basic transaction requests in the basic block chain to obtain basic transaction data;
and the parallel transaction data determining unit is used for processing the parallel transaction requests in the parallel block chain if the parallel transaction requests exist, so as to obtain the parallel transaction data.
Optionally, the same consensus mechanism is deployed on the base blockchain and the parallel blockchains.
The block generating apparatus 300 disclosed in the embodiment of the present application can execute any block generating method disclosed in the embodiment of the present application, and has the corresponding functional modules and beneficial effects of the executing method. Reference may be made to the description of any method embodiment of the application for details not explicitly described in this embodiment of the application.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 7, fig. 7 is a block diagram of an electronic device for implementing a block generation method in an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the embodiments of the application described and/or claimed herein.
As shown in fig. 7, the electronic device includes: one or more processors 401, memory 402, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the electronic device, including instructions stored in or on memory to display graphical information of a graphical user interface (Graphical User Interface, GUI) on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations, e.g., as a server array, a set of blade servers, or a multiprocessor system. One processor 401 is illustrated in fig. 7.
Memory 402 is a non-transitory computer readable storage medium provided by embodiments of the present application. The memory stores instructions executable by at least one processor to cause the at least one processor to perform the block generation method provided by the embodiments of the present application. The non-transitory computer-readable storage medium of the embodiment of the present application stores computer instructions for causing a computer to execute the block generation method provided by the embodiment of the present application.
The memory 402 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the block generation method in the embodiment of the present application, for example, the transaction data determination module 301, the parallel block construction module 302, and the base block construction module 303 shown in fig. 6. The processor 401 executes various functional applications of the electronic device and data processing, i.e., implements the block generating method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the electronic device, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 402 may optionally include memory remotely located with respect to processor 401, which may be connected via a network to an electronic device for implementing the block generation method of embodiments of the present application. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device for implementing the block generation method in the embodiment of the application can further include: an input device 403 and an output device 404. The processor 401, memory 402, input device 403, and output device 404 may be connected by a bus or otherwise, for example in fig. 7.
The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of an electronic device for implementing the patch generation method of embodiments of the present application, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer stick, one or more mouse buttons, a track ball, a joystick, and the like. The output means 404 may include a display device, auxiliary lighting means, such as light emitting diodes (Light Emitting Diode, LEDs), tactile feedback means, and the like; haptic feedback devices such as vibration motors and the like. The display device may include, but is not limited to, a liquid crystal display (Liquid Crystal Display, LCD), an LED display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be implemented in digital electronic circuitry, integrated circuitry, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs, also referred to as programs, software applications, or code, include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device for providing machine instructions and/or data to a programmable processor, e.g., magnetic discs, optical disks, memory, programmable logic devices (Programmable Logic Device, PLD), including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device for displaying information to a user, for example, a Cathode Ray Tube (CRT) or an LCD monitor; and a keyboard and pointing device, such as a mouse or trackball, by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here, or any combination of such background, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include: local area network (Local Area Network, LAN), wide area network (Wide Area Network, WAN), the internet and blockchain networks.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, aiming at the situation that basic blockchains and parallel blockchains are deployed on blockchain nodes at the same time, by constructing a current parallel block according to parallel transaction data and nesting the current parallel block in constructing the current basic block according to the basic transaction data and the parallel transaction data, a block data storage mode aiming at a multi-chain scene is optimized, so that even if the number of the blockchains deployed on the blockchain nodes is increased, the number of bottom databases is not required to be increased, new parallel blockchains can be created almost without cost, the number of the blockchains which can be deployed on each blockchain node can also get rid of the limitation of storage space, and the problem that one chain corresponds to one database, so that the storage space of the blockchain link points is seriously occupied, and the number of the supportable blockchain nodes is further limited is solved; meanwhile, through the technical scheme of the embodiment of the application, the atomicity of the cross-link interaction operation is easier to realize, the write-in can be completed through one batch of processing of the databases, and the realization is not needed to be realized by utilizing complex protocols such as hash time locks, two-stage submission and the like when a plurality of databases exist at the bottom layer, so that the problems of high difficulty and high complexity in realizing the cross-link data interaction when one link corresponds to one database are solved.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (12)

1. A block generation method applied to a blockchain node having a base blockchain and a parallel blockchain disposed thereon, the method comprising:
processing the basic transaction request in the basic block chain to obtain basic transaction data, and processing the parallel transaction request in the parallel block chain to obtain parallel transaction data;
constructing a current parallel block according to the parallel transaction data;
constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block;
wherein, according to the basic transaction data, the parallel transaction data and the current parallel block, a current basic block is constructed, including:
constructing a block header of the current basic block according to the basic transaction data and the parallel transaction data;
and constructing a block body of the current basic block according to the basic transaction data and the current parallel block.
2. The method of claim 1, wherein constructing the block header of the current base block from the base transaction data and the parallel transaction data comprises:
calculating the merkel root of the current basic block according to the basic transaction data and the parallel transaction data;
and constructing a block head of the current basic block according to the merkel root of the current basic block and the hash value of the last basic block.
3. The method of claim 1, wherein constructing a current parallel block from the parallel transaction data comprises:
calculating the merkel root of the current parallel block according to the parallel transaction data;
and constructing a block head of the current parallel block according to the merkel root of the current parallel block and the hash value of the last parallel block, and taking the parallel transaction data as a block body of the current parallel block.
4. The method of claim 1, wherein processing the base transaction request in the base blockchain to obtain base transaction data and processing the parallel transaction request in the parallel blockchain to obtain parallel transaction data comprises:
in the process of processing the basic transaction request in the basic block chain to obtain basic transaction data, monitoring whether a parallel transaction request in the parallel block chain exists on a local node or not;
and if the parallel transaction request exists, processing the parallel transaction request in the parallel block chain to obtain the parallel transaction data.
5. The method of claim 1, wherein the base blockchain and the parallel blockchain are deployed with the same consensus mechanism.
6. A block generation apparatus disposed at a blockchain node having a base blockchain and a parallel blockchain disposed thereon, the apparatus comprising:
the transaction data determining module is used for processing the basic transaction request in the basic block chain to obtain basic transaction data, and processing the parallel transaction request in the parallel block chain to obtain parallel transaction data;
the parallel block construction module is used for constructing a current parallel block according to the parallel transaction data;
the basic block construction module is used for constructing a current basic block according to the basic transaction data, the parallel transaction data and the current parallel block;
wherein, the basic block construction module includes:
the block head construction unit is used for constructing a block head of the current basic block according to the basic transaction data and the parallel transaction data;
and the block body construction unit is used for constructing a block body of the current basic block according to the basic transaction data and the current parallel block.
7. The apparatus of claim 6, wherein the tile head construction unit comprises:
a calculating subunit, configured to calculate a merkel root of the current base block according to the base transaction data and the parallel transaction data;
and the construction subunit is used for constructing the block head of the current basic block according to the merkel root of the current basic block and the hash value of the last basic block.
8. The apparatus of claim 6, wherein the parallel block construction module comprises:
the computing unit is used for computing the merkel root of the current parallel block according to the parallel transaction data;
and the construction unit is used for constructing the block head of the current parallel block according to the merkel root of the current parallel block and the hash value of the last parallel block, and taking the parallel transaction data as the block body of the current parallel block.
9. The apparatus of claim 6, wherein the transaction data determination module comprises:
the basic transaction data determining unit is used for processing basic transaction requests in the basic block chain to obtain the basic transaction data;
the monitoring unit is used for monitoring whether parallel transaction requests in the parallel block chain exist on the local node or not in the process of processing the basic transaction requests in the basic block chain to obtain basic transaction data;
and the parallel transaction data determining unit is used for processing the parallel transaction request in the parallel block chain if the parallel transaction data exists, so as to obtain the parallel transaction data.
10. The apparatus of claim 6, wherein the base blockchain and the parallel blockchain are deployed with a same consensus mechanism.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the block generation method of any one of claims 1-5.
12. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the block generation method of any one of claims 1-5.
CN202010254531.9A 2020-04-02 2020-04-02 Block generation method, device, equipment and medium Active CN111475572B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010254531.9A CN111475572B (en) 2020-04-02 2020-04-02 Block generation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010254531.9A CN111475572B (en) 2020-04-02 2020-04-02 Block generation method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN111475572A CN111475572A (en) 2020-07-31
CN111475572B true CN111475572B (en) 2023-08-29

Family

ID=71749855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010254531.9A Active CN111475572B (en) 2020-04-02 2020-04-02 Block generation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN111475572B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3668036A1 (en) * 2018-12-14 2020-06-17 Siemens Aktiengesellschaft Creation of a blockchain with blocks comprising an adjustable number of transaction blocks and multiple intermediate blocks

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107909369A (en) * 2017-10-13 2018-04-13 布比(北京)网络技术有限公司 Based on the common recognition method, apparatus merchandised across chain and storage medium
WO2018076760A1 (en) * 2016-10-27 2018-05-03 上海亿账通区块链科技有限公司 Block chain-based transaction processing method, system, electronic device, and storage medium
CN108959621A (en) * 2018-07-18 2018-12-07 百度在线网络技术(北京)有限公司 A kind of implementation method, device, equipment and the storage medium of block chain network
CN108985774A (en) * 2018-07-18 2018-12-11 百度在线网络技术(北京)有限公司 A kind of motivational techniques, device, equipment and the storage medium of block chain network
CN109858285A (en) * 2018-12-07 2019-06-07 上海异势信息科技有限公司 Processing method, device, equipment and the medium of block chain data
CN110516006A (en) * 2019-08-26 2019-11-29 杭州复杂美科技有限公司 Parallel chain block generation method, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019055585A1 (en) * 2017-09-12 2019-03-21 Kadena Llc Parallel-chain architecture for blockchain systems

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018076760A1 (en) * 2016-10-27 2018-05-03 上海亿账通区块链科技有限公司 Block chain-based transaction processing method, system, electronic device, and storage medium
CN107909369A (en) * 2017-10-13 2018-04-13 布比(北京)网络技术有限公司 Based on the common recognition method, apparatus merchandised across chain and storage medium
CN108959621A (en) * 2018-07-18 2018-12-07 百度在线网络技术(北京)有限公司 A kind of implementation method, device, equipment and the storage medium of block chain network
CN108985774A (en) * 2018-07-18 2018-12-11 百度在线网络技术(北京)有限公司 A kind of motivational techniques, device, equipment and the storage medium of block chain network
CN109858285A (en) * 2018-12-07 2019-06-07 上海异势信息科技有限公司 Processing method, device, equipment and the medium of block chain data
CN110516006A (en) * 2019-08-26 2019-11-29 杭州复杂美科技有限公司 Parallel chain block generation method, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
小艺."其实你需要的不是公链,而是平行链 ".《中国贸易新闻网》.2018,第1-2页. *

Also Published As

Publication number Publication date
CN111475572A (en) 2020-07-31

Similar Documents

Publication Publication Date Title
US11657091B2 (en) Method and apparatus for querying shortest path of graph, and storage medium
CN111368326B (en) Vehicle data processing method and device, electronic equipment and storage medium
JP2022008781A (en) Decentralized training method, system, device, storage medium and program
CN111488202B (en) Transaction processing method, device, equipment, system and medium of multi-chain system
CN111475262B (en) Transaction request processing method, device, equipment and medium in blockchain
US20210209417A1 (en) Method and apparatus for generating shared encoder
EP3832493B1 (en) Method, apparatus, electronic device and readable storage medium for data query
CN111782365B (en) Timed task processing method, device, equipment and storage medium
EP3832574A2 (en) Method and apparatus for processing transaction requests in blockchain, device and medium
CN111277647A (en) Block chain network member management method, device, equipment and medium
CN111258957B (en) Method, device, equipment and medium for updating distributed file system catalog
EP3848816A1 (en) Method, apparatus, and storage medium for storing determinant text
EP3869339B1 (en) Data storage method and apparatus for blockchain, device, and medium
KR20210125893A (en) Method and device for processing transaction request in blockchain, electronic apparatus, and storage medium
WO2024001024A1 (en) Method for executing transaction in blockchain system, and blockchain system and nodes
US11349638B2 (en) Privacy transaction processing method, electronic device and storage medium
CN111475572B (en) Block generation method, device, equipment and medium
US20230394483A1 (en) Blockchain-based data processing method and apparatus
CN111625949A (en) Simulation engine system, simulation processing method, device and medium
CN104580428A (en) Data routing method, data management device and distributed storage system
EP3869377A1 (en) Method and apparatus for data processing based on smart contract, device and storage medium
CN111737534B (en) File processing method, device and equipment
KR20210040322A (en) Scheduling method and apparatus, device and storage medium
CN111352706B (en) Data access method, device, equipment and storage medium
CN111598571A (en) Transaction processing method, device, equipment and storage medium of block chain

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