Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to specific embodiments of the present disclosure and corresponding drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without making any creative effort belong to the protection scope of the embodiments in the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
It should be noted that, in the embodiment of the present specification, the uplink and the state processing of the block chain are divided into a chain process and an executor process, which are independent of each other; the chain process sends the transaction information to the executor process through the transaction distribution process, executes the block uplink process, processes the transaction information through the state root calculation process to obtain the state root, returns the state root to the chain process, and stores the state root in the block to complete the block uplink process, so that the block uplink and the state root are calculated and separated, the efficiency of transaction processing and block uplink in the block chain can be effectively improved, and the calculation resources are saved.
Example one
Referring to fig. 1, a schematic diagram of a block chain-based uplink and status processing method provided in an embodiment of the present disclosure is shown, where the block chain-based uplink and status processing method in this embodiment includes:
a chain process 101 and an executor process 102; the chain process 101 includes a transaction distribution process 104 and a block uplink process 103, and the executor process 102 includes a contract process 105 and a state root computation process 106.
The chain process 101 and the executor 102 processes each independently and communicate with each other.
According to the uplink and status processing method based on a block chain in this embodiment, when a new transaction is generated on a block chain, the chain process 101 executes a transaction distribution process 104, and in the process of executing the transaction distribution process 104, transaction information is sent to the executor process 102, and the status root calculation process 106 processes the transaction information to obtain a status root (status _ root), and returns the status root to the chain process 101, and stores the status root in a block to complete the uplink block process.
In this embodiment, the link process 101 executes the transaction distribution process 104 while the block uplink process 103 is running simultaneously. Specifically, the block uplink process 103 includes a node handoff block request, each node generates a new block through a consensus algorithm, processes transaction data and generates a block hash value, and adds the block hash value and the new block to a block chain, thereby completing a new block uplink process.
In this embodiment, while the block uplink process 103 is executed, the chain process 101 executes the transaction distribution process 104 to send transaction information to the executor process 102.
In the existing block chain system composed of multiple nodes, a large number of nodes complete the consensus mechanism of new transaction uplink through the workload certification mechanism, which consumes a large amount of computing resources, and as a result, the block uplink is completed at the highest computing speed, which results in a large amount of computing resources being wasted.
In addition, after the consensus mechanism is completed, it is necessary to process the transaction information with a large amount of computation to obtain a state root (state _ root) representing all transaction information, so as to complete the block uplink.
According to the method provided in this embodiment, since the block uplink process 103 and the state root calculation process 106 are separately executed, each node on the node network may process the block uplink process 103 and the state root calculation process 106 in batch or separately, for example, some nodes process the block uplink process 103 exclusively, and perform common identification calculation of workload identification, or other nodes process transaction data to complete the state root calculation, and finally the fastest node obtains the right to perform uplink operation, and simultaneously invokes the execution result of the state root calculation process 106 from other nodes to complete block uplink. Therefore, a single node does not need to consume computation power in the uplink block procedure 103 and the state root computation procedure 106, and the computation speed can be greatly increased for the whole block chain by using the method provided by the embodiment.
It should be noted that, in this embodiment, the executor process 102 further includes a contract flow 105, and the contract flow 105 performs intelligent contract execution on the transaction data provided by the chain process 101, that is, multiple nodes perform a digital signature verification procedure at the same time, so as to ensure the validity of the transaction.
Specifically, in the present embodiment, since the contract process 105 is separated from the block uplink process 103, i.e. the digital signature verification process is separated from the block uplink process, the efficiency of information processing is further improved. For example, some nodes in the node network may be configured to perform the block uplink process 103, and another part may be configured to handle the contract process 105, and the function of verifying the contract validity may also be achieved.
Therefore, according to the method provided in this embodiment, the block uplink process 103 and the status root calculation process 106 are processed separately, and multiple nodes perform intelligent contract verification and participate in status root calculation while performing the block uplink process 103.
When a user performs an electronic money transaction such as a bitcoin, tens of thousands of transactions are often performed in the same section in the entire block chain. In a conventional block uplink mode, after receiving more than thousands of transaction information, a plurality of nodes usually perform intelligent contracts and block uplink on the transaction data together. While each node processes a large amount of transaction data, the joint calculation of the workload certification is also completed, and by adopting the method provided by the embodiment, for a large amount of transactions, the node network can process in batches and in a classified manner, and a large amount of nodes in the node network are respectively corresponding to different calculation processes, so that the calculation efficiency is improved.
Therefore, when multiple transactions are simultaneously carried out on the block chain, the efficiency of transaction processing and block chain linking in the block chain can be effectively improved, the computing resources are saved, and the time for block chain linking is shortened. Optionally, in this embodiment, the chain process 101 corresponds to a chain database 108, the chain database 108 stores block data and transaction data, the executor process 102 corresponds to a state database 109, and the state database 109 stores state root information and account information.
The chain process 101 calls the chain database 108 or outputs data to the chain database 108, and the executor process 102 calls the state database 109 or outputs data to the state database 109.
Optionally, the chain process 101 and the executor process 102 may be capable of communicating with each other, or the chain process 101 and the executor process 102 may also be capable of communicating with other processes, and when communicating with other processes, the information subscribed by the chain process 101 and the executor process 102 includes consensus computing information, network synchronization block information, and proposal pre-execution information.
It should be noted that, in this embodiment, in other embodiments, the consensus computing information may be computed by a consensus module specifically set on the right. That is, the chain process 101 may only include the basic operations in the transaction distribution process 104 and the block uplink process 103, and the workload certification with large computation amount is sent to the consensus module for computation, so as to further improve the computation efficiency.
Optionally, both the chain process 101 and the executor process 102 can be queried by a Remote Call process 107 (RPC), so that the chain process 101 and the executor process 102 can be called by a Remote user.
Example two
Fig. 2 is a schematic structural diagram of a block chain-based uplink and status processing apparatus according to an embodiment of the present disclosure, and the block chain and status processing apparatus according to the embodiment of the present disclosure is described in detail below with reference to fig. 2. It should be noted that, in the present embodiment, the block uplink and status processing apparatus performs the block uplink operation by using the block chain based uplink and status processing method according to the first embodiment of the present invention, but the present invention is not limited thereto.
The present embodiment provides a block chain-based uplink and status processing apparatus, including: a chain module 201 and an actuator module 202. The chain module 201 is configured to process a transaction distribution process and a block uplink process, the executor module 202 is configured to process a contract process and a state root calculation process, the chain module and the executor module perform independent processes and communicate with each other, the chain module 201 sends transaction information to the executor module 202 during execution of the transaction distribution process, the state root calculation process processes the transaction information to obtain a state root, and the state root is returned to the chain module 201 and stored in a block to complete the block uplink process.
In this embodiment, the uplink block flow includes a node handoff block request, each node generates a new block through a consensus algorithm, processes transaction data and generates a block hash value, and adds the block hash value and the new block to a block chain.
Therefore, according to the apparatus provided in this embodiment, the block uplink process and the status root calculation process 106 are processed in the chain module 201 and the executor module 202, respectively, and when the block uplink process is executed, a plurality of nodes perform intelligent contract verification and participate in performing status root calculation, so that when a plurality of transactions are performed simultaneously on the block chain, the efficiency of transaction processing and block uplink in the block chain can be effectively improved, the calculation resources are saved, and the time for block uplink is shortened.
Optionally, in this embodiment, the chain module 201 includes a chain database 108, the chain database 108 stores block data, receipt, transaction data, and other information, the executor module 202 includes a status database 109, and the status database 109 stores status root information and account information. The chain database 108 and the state database 109 can be called independently, and the calculation rate is further improved.
After the executor module 202 executes the uplink block process, the transaction information and receipt obtained after execution are stored in the chain database 108; the executor module 202 serves as an intelligent contract execution engine, provides an execution environment for the operation of a contract flow, and stores the account information and the status root after the contract flow is executed in the status database 108.
Optionally, in this embodiment, the apparatus for processing uplink and status based on a block chain further includes a consensus module and a network synchronization module 205, where the consensus module and the network synchronization module 205 undertake a consensus calculation and a network synchronization function and communicate with the chain module 201 or the executor module 202, but the present invention is not limited thereto, and the consensus calculation and the network synchronization function may also be implemented by being encapsulated in the chain module 201 or the executor module 202.
It should be noted that, in this embodiment, the block chain-based uplink and status processing apparatus may be an electronic device, and in a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a Non-Volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 2, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the content recommendation device on a logic level. And the processor is used for executing the program stored in the memory and is specifically used for executing the method operation executed when the server is taken as an execution main body.
The methods disclosed in fig. 1-2 in the embodiments of the present disclosure may be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware decoding processor, or in a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an interconnection system provided in an embodiment of the present specification, and the interconnection system in the embodiment of the present specification is described in detail below with reference to fig. 3.
The interconnection system provided by the embodiment of the present specification includes an application layer 301 at an upper level and a platform layer 302 at a lower level. The platform layer 301 comprises a chain module 201 and an actuator module 202; the chain module 201 is configured to process a transaction distribution process and a block uplink process, the executor module 202 is configured to process a contract process and a state root calculation process, the chain module 201 and the executor module 202 perform independent processes and communicate with each other, the chain module 201 sends transaction information to the executor module 202 during execution of the transaction distribution process, the state root calculation process processes the transaction information to obtain a state root, and the state root is returned to the chain module 201 and stored in a middle block to complete the block uplink process.
The platform layer 302 provides an interface that the application layer 201 uses to develop applications that employ intelligent contracts. Alternatively, the user may develop an application program such as electronic money using the smart contract at the application layer 301 and call the query data using an interface provided by the platform layer 302.
According to the interconnection system provided in this embodiment, in the platform layer 302, the block uplink process and the state root calculation process 106 are processed in the chain module 201 and the executor module 202, respectively, and while the block uplink process is executed, a plurality of nodes perform intelligent contract verification and participate in performing state root calculation, so that when multiple transactions are performed on the block chain at the same time, the efficiency of transaction processing and block uplink in the block chain can be effectively improved, the calculation resources are saved, and the time used for block uplink is shortened. This also enables applications such as smart contracts, electronic money, etc. located at the application layer 301 to be run at significantly higher speeds.
In short, the above description is only a preferred embodiment of the embodiments of the present disclosure, and is not intended to limit the scope of the embodiments of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the embodiments of the present disclosure should be included in the protection scope of the embodiments of the present disclosure.
The systems, apparatuses, modules or units described in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element described by the phrase "comprising a. -" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in this specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on differences from other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.