CN110830581B - Method for improving block chain response speed, block chain application system and related equipment - Google Patents

Method for improving block chain response speed, block chain application system and related equipment Download PDF

Info

Publication number
CN110830581B
CN110830581B CN201911102891.0A CN201911102891A CN110830581B CN 110830581 B CN110830581 B CN 110830581B CN 201911102891 A CN201911102891 A CN 201911102891A CN 110830581 B CN110830581 B CN 110830581B
Authority
CN
China
Prior art keywords
block
block chain
consensus
service request
module
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
CN201911102891.0A
Other languages
Chinese (zh)
Other versions
CN110830581A (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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201911102891.0A priority Critical patent/CN110830581B/en
Publication of CN110830581A publication Critical patent/CN110830581A/en
Application granted granted Critical
Publication of CN110830581B publication Critical patent/CN110830581B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method for improving block chain response speed, a block chain application system and related equipment, which are used for improving the block chain response speed. The method provided by the embodiment of the invention comprises the following steps: receiving a service request sent by a client; processing the service request by adopting a preset service flow, and achieving consensus in a block chain; returning a response message corresponding to the service request to the client, wherein the response message comprises a consensus result of the service corresponding to the service request; generating target block data according to the consensus result of the service request, storing the target block data in a cache, and broadcasting the target block data to other block chain nodes so that the other block chain nodes store the target block data in the cache; and storing the target block data stored in the cache in a memory.

Description

Method for improving block chain response speed, block chain application system and related equipment
Technical Field
The present invention relates to the field of block chain technologies, and in particular, to a method for increasing a block chain response speed, a block chain application system, and a related device.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm.
The flow of the present block chain technical solution is shown in fig. 1, when a transaction or data calls the blockchain application service, the flow of the blockchain application service is as follows: the client sends an accounting request (tx. Request) - > each node (Peer) independently verifies- > the intelligent contract module (contract) generates a simulation result- > the multiple nodes achieve consensus and generate a block after confirming the consensus (consensus) > the block is stored in the hard disk (storage) - > the client response (tx. Response) is returned.
In the prior art, a response result corresponding to a service request is returned to a client after a new block is stored in a hard disk, the new block and the block height thereof are broadcasted to other nodes, the other nodes can acquire the latest block height, and then the height of the next block is configured to continue generating the new block. The process of writing the new block into the hard disk prolongs the response time of calling the block chain application service, and causes poor user experience.
Disclosure of Invention
The embodiment of the invention provides a method for improving block chain response speed, a block chain application system and related equipment, which are used for improving the block chain response speed.
A first aspect of an embodiment of the present invention provides a method for increasing a block chain response speed, where the method is applied to a target node in a block chain, and may include:
receiving a service request sent by a client;
processing the service request by adopting a preset service flow and achieving consensus in a block chain;
returning a response message corresponding to the service request to the client, wherein the response message comprises a consensus result of the service corresponding to the service request;
generating target block data according to the consensus result of the service request, storing the target block data in a cache, and broadcasting the target block data to other block link nodes so that the other block link nodes store the target block data in the cache;
and storing the target block data stored in the cache in a memory.
Optionally, as a possible implementation manner, in the embodiment of the present invention, processing the service request by using a preset service flow and reaching consensus in a block chain includes:
forwarding the service request to block chain link points except the target node, so that each block chain link point executes an intelligent contract corresponding to the service request to obtain respective simulation results;
receiving a plurality of simulation results returned by block chain link points except the target node;
and adopting a preset consensus algorithm to achieve consensus on the service request according to the simulation results.
Optionally, as a possible implementation manner, in an embodiment of the present invention, the storing the target block data in a cache, and broadcasting the target block data to other block chain nodes includes:
storing the generated target block data into a cache in a Key-Value healthy Value pair mode, wherein the Key Value is the block height, and the Value corresponds to the target block data;
and broadcasting the block height and the corresponding target block data to other block chain nodes, and storing the block height and the corresponding target block data in respective caches by the other block chain nodes.
Optionally, as a possible implementation manner, in an embodiment of the present invention, the storing the target block data stored in the cache in a memory includes:
querying a current block height in memory;
and inquiring a block to be written corresponding to the next block height of the current block height from the cache in a polling mode, and storing the block to be written into a memory.
Optionally, as a possible implementation manner, in the embodiment of the present invention, if the required block height cannot be found from the cache for multiple times, the block data with the corresponding block height is obtained from other block link nodes in a P2P communication manner, and then is written into the memory.
A second aspect of an embodiment of the present invention provides a block chain application system, which may include:
a node module, an intelligent contract module, a consensus module, a storage module and a cache module, wherein,
the node module is used for providing an entrance of the block chain service, receiving a request of a client and distributing the request of the client to a corresponding function module;
the intelligent contract module is used for realizing the management of the intelligent contract;
the consensus module is used for processing the service request by adopting a preset service flow, achieving consensus in a block chain, generating target block data according to a consensus result of the service request, and returning a response message corresponding to the service request to the client, wherein the response message comprises a consensus result of a service corresponding to the service request; broadcasting the target block data to other block chain nodes so that the other block chain nodes store the target block data in a cache;
the cache module is used for storing the target block data achieving the consensus in a cache;
and the storage module is used for storing the target block data stored in the cache into the memory.
Optionally, as a possible implementation manner, the intelligent contract module in the embodiment of the present invention is configured to forward the service request to other block link nodes except the target node, so that each block link node executes an intelligent contract corresponding to the service request to obtain a respective simulation result;
the consensus module is used for receiving a plurality of simulation results returned by the block chain link points except the target node; and adopting a preset consensus algorithm to achieve consensus on the service request according to the simulation results.
Optionally, as a possible implementation manner, the node module, the intelligent contract module, the consensus module, and the storage module in the embodiment of the present invention operate in a corresponding node container, an intelligent contract container, a consensus container, and a storage container.
A third aspect of the embodiments of the present application provides a block link point device, including the block chain application system as in any one of the possible implementations of the second aspect and the second aspect.
A fourth aspect of the embodiments of the present application provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor, when executing the computer program, implements the steps in the method according to any one of the first aspect and the possible implementation manners of the first aspect.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the embodiment of the invention, after receiving the service request sent by the receiving client, the target node can adopt the preset service flow to process the service request to achieve consensus in the block chain, and the consensus can be simultaneously executed when the confirmed block returns to the client, is written into the cache operation, and when the storage module reads cache data and writes the cache data into the memory, so that the response time of the block chain service is greatly shortened, the performance and the throughput of the block chain service are improved, and the user experience is improved.
Drawings
FIG. 1 is a block chain business process diagram in the prior art;
FIG. 2 is a diagram of a block chain response speed improving method according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a block chain service flow in an embodiment of a method for improving a block chain response speed according to the present invention;
FIG. 4 is a diagram of a block chain application system according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a computer device according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method for improving block chain response speed, a block chain application system and related equipment, which are used for improving the block chain response speed.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a detailed process in the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a method for increasing a block chain response speed in the embodiment of the present invention may include:
201. receiving a service request sent by a client;
when a user needs to invoke the blockchain service, a corresponding service request can be sent to any node in the blockchain through the client. For convenience of identification, the node receiving the service request is taken as a target node, and the target node may be a terminal device or a server to which the user belongs, or a terminal device or a server provided by a service provider, which is not limited herein.
202. Processing the service request by adopting a preset service process, and achieving consensus in the block chain;
after receiving the service request, the target node may process the service request by using a preset service flow and achieve consensus in the block chain, where the specific preset service flow may refer to an existing block chain scheme for consensus, or may be a consensus flow customized according to a user requirement, and is not limited herein.
As an exemplary, optional, possible implementation manner, in the embodiment of the present invention, processing the service request by using a preset service flow, and reaching a consensus in the block chain may include:
the target node forwards the service request to other block chain nodes except the target node, so that each block chain node executes the intelligent contract corresponding to the service request to obtain a respective simulation result, and the execution result is used for indicating whether the service request conforms to the service rule or not; the target node receives a plurality of simulation results returned by other block chain nodes except the target node; and the target node adopts a preset consensus algorithm to achieve consensus on the service request according to a plurality of simulation results. Wherein the result of the consensus may be a success or failure of the service request.
It can be understood that, different from the existing scheme, after all block chain nodes except the target node execute the intelligent contract corresponding to the service request to obtain respective simulation results, it is not necessary to broadcast the respective simulation results to the nodes except the target node, but only necessary to send the respective simulation results to the target node through P2P communication, and the target node performs a consensus algorithm to determine whether all block chain nodes except the target node agree on the service request, so that the number of broadcast messages in the block chain can be greatly reduced. After the target node determines the consensus result, the consensus result and the simulation results of all the nodes may be broadcast to the blockchain for the other nodes to verify.
203. Returning a response message corresponding to the service request to the client, wherein the response message comprises a consensus result of the service corresponding to the service request;
after determining the consensus result, the target node may return a response message corresponding to the service request to the client, where the response message includes the consensus result of the service corresponding to the service request, that is, whether the service corresponding to the service request is successful or not.
204. Generating target block data according to the consensus result of the service request, storing the target block data in a cache, and broadcasting the target block data to other block link nodes so that the other block link nodes store the target block data in the cache;
after the service request has achieved consensus in the blockchain, the target block may be stored in the cache region of the target node, and then the target block and its block height are broadcast to all blockchain nodes other than the target node, so that all blockchain nodes store the target block and its block height in the cache region.
Optionally, as a possible implementation manner, in the embodiment of the present invention, the storing the target block in the cache area may include: and storing the newly generated block data into a cache region in a Key-Value healthy Value pair mode, wherein the Key Value uses the height of the block, and the Value corresponds to the whole data of the target block. And broadcasting the block height and the corresponding target block data to other block chain nodes, and storing the block height and the corresponding target block data in respective caches by the other block chain nodes.
205. And storing the target block data stored in the cache in a memory.
Furthermore, each block link point can be sorted according to the height of the block, and the block data in the local cache is sequentially written into the memory. The memory may be a local hard disk.
Optionally, as a possible implementation manner, in the embodiment of the present invention, the current block height in the memory may be queried; and inquiring a block to be written corresponding to the next block height of the current block height from the cache in a polling mode, and storing the block to be written into a memory.
Particularly, if the required block height cannot be searched from the cache for many times, the block data of the corresponding block height is acquired from other block chain nodes in a P2P communication mode and then written into the memory.
In the embodiment of the invention, after receiving the service request sent by the receiving client, the target node can adopt the preset service process to process the service request to achieve consensus in the block chain, and after the consensus is completed, the confirmed block returns to the client, is written into the cache operation, and the storage module reads the cache data and writes the cache data into the hard disk. And if the service request achieves consensus in the block chain, inquiring the current height of the block chain in the cache region of the target node, determining the height of the target block corresponding to the service request, and broadcasting the target block and the height of the block thereof to all the block chain nodes except the target node, so that all the block chain nodes store the target block and the height of the block thereof in the cache region. Because the read-write performance of the cache region is far greater than that of the hard disk, the new block is written into the cache region, the new block writing speed is increased, and compared with the existing scheme, the latest block height can be inquired without waiting for the new block to be written into the hard disk, so that the latest block height can be quickly inquired by the block chain link points, the waiting time for inquiring the latest block height when the new block is generated is reduced, and the generation speed of the new block is increased.
It should be understood that, in various embodiments of the present invention, the sequence numbers of the above steps do not mean the execution sequence, and the execution sequence of each step should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. For example, steps 203 and 204 may be performed simultaneously.
For convenience of understanding, the method for increasing the block chain response speed in the embodiment of the present invention will be described below with reference to a specific application example.
In the embodiment of the invention, a blockchain application program of the same node is divided into a node module, an intelligent contract module, a consensus module, a storage module and a cache module, wherein the node module is used for providing an inlet of blockchain service, receiving a request of a client and distributing the request of the client to a corresponding functional module; the intelligent contract module is used for realizing the management of the intelligent contract (such as the registration, creation, calling and inquiry of the intelligent contract); the consensus module is used for realizing a block chain consensus mechanism; the storage module is used for writing the block data achieving the consensus into the hard disk; and the cache module is used for writing the block data achieving the consensus into the cache.
Referring to fig. 3, the specific steps include: 1. a node (Peer) module in a target node in a block chain (block chain) receives a service request (tx. Request) of a client; 2. the node module forwards the service request to all block chain nodes except the target node, so that each block chain node calls a respective intelligent contract module (contract) to obtain a respective simulation result, and the execution result is used for indicating whether the service request conforms to the service rule; 3. all the block chain nodes except the target node return respective simulation results to a consensus module (consensus) in the target node, and a preset consensus algorithm is adopted to determine whether all the block chain nodes except the target node achieve consensus on the service request in a plurality of simulation results (the situation needs to be determined according to an actual consensus mechanism, for example, more than half of the nodes achieve consensus, and the block chain is determined to achieve consensus); 4. after ensuring that all nodes (or most nodes) have agreed, meaning that the request submitted by the client is definitely in a certain block, the consensus module may perform: 1. returning the result to the client (forwarding to the client through the node module); 2. storing the block data into a cache (cache); 3. the block data is broadcasted to other block link nodes by the P2P technology, and the other block link nodes can also store the data in the cache after receiving the block data; 5. and writing the data in the cache into a local storage space (such as a hard disk).
Optionally, as a possible implementation manner, to ensure that the block data can be successfully stored in the hard disk, the storage module (storage) may use a polling manner (the newly generated block data is stored in the cache by a Key-Value Key Value pair at the consensus module, the Key Value uses the height num of the block, and the Value uses the entire data of the block itself), since the height of the block is increased and is sequentially increased from 1 to N, the storage module passes through the field of the block height, for example, the search is started from the height 1, if the block data is searched from the cache and is not stored in the hard disk, the block with the height 1 is written in the hard disk, and then the block with the height 2 is continuously searched, and so on. Because the common identification block is not notified to the storage module, when the storage module cannot inquire the block with the next height, the storage module firstly selects to sleep for a period of time (assuming that the period of time is 1 second), then continuously inquires the block with a certain height of the cache, and if the block cannot be inquired for many times or the cache fails (such as communication problem or downtime), the block with the corresponding height is pulled from other nodes in a P2P mode, and then the block is written into the hard disk, so that the process is ended.
Alternatively, as a possible implementation manner, to ensure that the block data can be successfully stored in the hard disk, a message queue (e.g. kafka, a high-throughput distributed publish-subscribe message system) may be used instead of polling. The simple process is as follows:
a. the consensus module first publishes a topic, say block, in the message queue. The storage module subscribes to this topic.
b. The consensus module generates a block good and sends the height of the block (num) to the topic specified in the message queue. And stores the block data into a cache.
c. Since the storage module subscribes to the topic of the block, the storage module receives the message which is just commonly published to obtain the height num of the block, and then queries the block data corresponding to the num in the cache by using the condition of the num. And finally, writing the block into the hard disk.
Optionally, on the basis of any of the above embodiments, in order to further improve the response speed of the blockchain application program, the method for improving the response speed of the blockchain in the embodiment of the present invention further includes:
and respectively packaging the node module, the intelligent contract module and the consensus module into container mirror images by adopting an application container engine, and operating the container mirror images to respectively generate a node container, an intelligent contract container, a consensus container and a storage container.
In practical application, after the node module, the intelligent contract module and the consensus module are containerized, at least one container can be simultaneously applied to the same module according to requirements, and because the containers are in an isolated state and are not in the same process, a plurality of containers of the same module can execute corresponding functions in parallel, so that the service processing efficiency of program functions is greatly improved.
Referring to fig. 4, an embodiment of the present invention further provides a block chain application system, including: a node module 401, an intelligent contract module 402, a consensus module 403, a storage module 404, a caching module 405, wherein,
a node module 401, configured to provide an entry for a block chain service, receive a request from a client, and distribute the request to a corresponding function module; an intelligent contract module 402 for implementing management of intelligent contracts (e.g., registration, creation, invocation, query of intelligent contracts); a consensus module 403, configured to process the service request by using a preset service flow, achieve consensus in a block chain, generate target block data according to a consensus result of the service request, and return a response message corresponding to the service request to the client, where the response message includes a consensus result of a service corresponding to the service request; broadcasting the target block data to other block link nodes so that the other block link nodes store the target block data in a cache; a storage module 404, configured to write the agreed block data into the memory; the cache module 405 is configured to write the agreed block data into the cache.
Optionally, as a possible implementation manner, the intelligent contract module in the embodiment of the present invention is configured to forward the service request to other block link nodes except the target node, so that each block link node executes an intelligent contract corresponding to the service request to obtain a respective simulation result;
the consensus module is used for receiving a plurality of simulation results returned by the block chain link points except the target node; and adopting a preset consensus algorithm to achieve consensus on the service request according to a plurality of simulation results.
Optionally, as a possible implementation manner, in the block chain application system in the embodiment of the present invention, the storage module is further configured to query a current block chain height in the local hard disk; the storage module is further configured to query a block to be written corresponding to the next block chain height of the current block chain height from the buffer area in a polling manner, and store the block to be written in the memory.
Optionally, as a possible implementation manner, in the block chain application system in the embodiment of the present invention, after the consensus module generates the new block, the block height of the new block is sent to the storage module, so that the storage module queries the new block in the cache area according to the height of the new block, and writes the new block into the hard disk.
Optionally, as a possible implementation manner, in the block chain application system in the embodiment of the present invention, the node module, the intelligent contract module, and the consensus module may all operate in a corresponding node container, an intelligent contract container, a consensus container, and a storage container. Therefore, decoupling is realized in the reprogramming realization of each container, the realization logic is simple, the code amount is reduced, and the subsequent iterative development cost is reduced. Secondly, the application container engine is adopted to pack each module into a container mirror image, and the container mirror image is operated to generate a container corresponding to each module, so that the same block chain node can operate a plurality of same containers simultaneously according to actual performance requirements, and the performance of the block chain system is improved.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiment of the present application further provides a block chain node device, where the block chain node device may be a terminal device with computing capability, such as a mobile phone and a tablet, and the block chain node device includes the block chain application system shown in fig. 4.
The embodiment of the present application further provides a computer device, as shown in fig. 5, for convenience of description, only a portion related to the embodiment of the present application is shown, and details of the specific technology are not disclosed, please refer to the method portion of the embodiment of the present application. Referring to fig. 5, the computer device 5 includes: memory 510, processor 520, wired or wireless network module 530, and computer programs stored in the memory and executable on the processor. The processor, when executing the computer program, implements the steps in each of the above-described embodiments of the method for increasing block chain response speed, such as steps 201 to 205 shown in fig. 2. Alternatively, the processor, when executing the computer program, implements the functions of the modules or units in the blockchain application system embodiments described above.
Those skilled in the art will appreciate that the configuration shown in fig. 5 does not constitute a limitation of a computer device, and that computer device 5 may include more or fewer components than shown, or combine certain components, or have a different arrangement of components, e.g., block link points may also include input-output devices, buses, etc.
The Processor may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be used to store computer programs and/or modules, and the processor may implement various functions of the blockchain node by running or executing the computer programs and/or modules stored in the memory, as well as by invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (7)

1. A method for improving response speed of a block chain is applied to a target node in the block chain, and is characterized in that the method comprises the following steps:
receiving a service request sent by a client;
processing the service request by adopting a preset service flow, and achieving consensus in a block chain;
returning a response message corresponding to the service request to the client, wherein the response message comprises a consensus result of the service corresponding to the service request;
generating target block data according to the consensus result of the service request;
storing the generated target block data into a cache in a Key-Value Key Value pair mode, wherein Key is the block height, and Value is the target block data; broadcasting the block height and the corresponding target block data to other block chain nodes, and storing the block height and the corresponding target block data in respective caches by the other block chain nodes;
storing the target block data stored in the cache in a memory according to the sorting of the block heights;
wherein, storing the target block data stored in the cache in the memory comprises:
querying a current block height in memory;
inquiring a block to be written corresponding to the next block height of the current block height from a cache in a polling mode, and storing the block to be written into a memory; if the required block height can not be inquired from the cache for many times, the block data with the corresponding block height is acquired from other block chain nodes in a P2P communication mode and then written into the memory.
2. The method of claim 1, wherein processing the service request using a predetermined service flow and reaching consensus in a block chain comprises:
forwarding the service request to block chain link points outside the target node, so that each block chain link point executes an intelligent contract corresponding to the service request to obtain a respective simulation result;
receiving a plurality of simulation results returned by the block chain link points except the target node;
and adopting a preset consensus algorithm to achieve consensus on the service request according to the simulation results.
3. A blockchain application system, comprising:
a node module, an intelligent contract module, a consensus module, a storage module and a cache module, wherein,
the node module is used for providing an entrance of the block chain service, receiving a request of a client and distributing the client request to a corresponding functional module;
the intelligent contract module is used for realizing the management of the intelligent contract;
a consensus module, configured to process the service request by using a preset service flow, achieve consensus in a block chain, generate target block data according to a consensus result of the service request, and return a response message corresponding to the service request to the client, where the response message includes a consensus result of a service corresponding to the service request; broadcasting the block height and the corresponding target block data to other block chain nodes, and storing the block height and the corresponding target block data in respective caches by the other block chain nodes;
the cache module is used for storing the generated target block data into a cache in a Key-Value Key Value pair mode, wherein Key is the block height, and Value is the target block data;
the storage module is used for storing the target block data stored in the cache in the memory according to the sorting of the block heights;
the storage module is specifically used for querying the current block chain height in the local hard disk according to the sorting of the block heights; inquiring a block to be written corresponding to the next block chain height of the current block chain height from the buffer area in a polling mode, and storing the block to be written into a memory; if the required block height can not be inquired from the cache for many times, the block data with the corresponding block height is acquired from other block chain nodes in a P2P communication mode and then written into the memory.
4. The system of claim 3,
the intelligent contract module is used for forwarding the service request to other block chain nodes except the target node so that each block chain node executes the intelligent contract corresponding to the service request to obtain respective simulation results;
the consensus module is used for receiving a plurality of simulation results returned by the block chain link points except the target node; and adopting a preset consensus algorithm to achieve consensus on the service request according to the simulation results.
5. The system according to any one of claims 3 to 4,
the node module, the intelligent contract module, the consensus module and the storage module run in the corresponding node container, the intelligent contract container, the consensus container and the storage container.
6. A blockchain link point device comprising a blockchain application system according to any one of claims 3 to 5.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method according to any of claims 1-2.
CN201911102891.0A 2019-11-12 2019-11-12 Method for improving block chain response speed, block chain application system and related equipment Active CN110830581B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911102891.0A CN110830581B (en) 2019-11-12 2019-11-12 Method for improving block chain response speed, block chain application system and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911102891.0A CN110830581B (en) 2019-11-12 2019-11-12 Method for improving block chain response speed, block chain application system and related equipment

Publications (2)

Publication Number Publication Date
CN110830581A CN110830581A (en) 2020-02-21
CN110830581B true CN110830581B (en) 2022-11-22

Family

ID=69554362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911102891.0A Active CN110830581B (en) 2019-11-12 2019-11-12 Method for improving block chain response speed, block chain application system and related equipment

Country Status (1)

Country Link
CN (1) CN110830581B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111522876B (en) * 2020-04-07 2024-02-20 金蝶软件(中国)有限公司 Block chain consensus method, device, computer equipment and block chain link point
CN111510484B (en) * 2020-04-10 2023-07-04 金蝶软件(中国)有限公司 Block chain processing method, system, device, computer equipment and storage medium
CN111625593B (en) * 2020-04-21 2023-09-08 金蝶软件(中国)有限公司 Block chain-based data processing method and device and computer equipment
CN111563124B (en) * 2020-05-08 2023-06-23 中国工商银行股份有限公司 Operation processing method, device and system based on block chain
CN112395110A (en) * 2020-11-20 2021-02-23 湖南智慧政务区块链科技有限公司 Block chain acceleration response method, device, equipment and storage medium
CN112612816B (en) * 2020-12-01 2023-06-30 网易(杭州)网络有限公司 Service result query method, device, equipment and medium of Ethernet alliance chain
CN114296831A (en) * 2021-12-30 2022-04-08 迅鳐成都科技有限公司 Dynamic loading method, device and system for block chain consensus algorithm and storage medium
CN114997866A (en) * 2022-05-26 2022-09-02 成都质数斯达克科技有限公司 Service contract generation method, device, equipment and readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10375105B2 (en) * 2017-03-03 2019-08-06 International Business Machines Corporation Blockchain web browser interface
CN108985757B (en) * 2017-11-27 2021-03-30 京东数字科技控股有限公司 Information processing method, device and system, storage medium and electronic equipment
CN109274754B (en) * 2018-10-11 2021-05-04 上海保险交易所股份有限公司 Method, apparatus, and storage medium for synchronizing data in a blockchain network
CN109447635B (en) * 2018-10-15 2022-02-01 北京京东尚科信息技术有限公司 Information storage method and device for block chain
CN110222116B (en) * 2019-05-07 2022-02-01 北京奇艺世纪科技有限公司 Control method and device for transaction data storage and storage medium

Also Published As

Publication number Publication date
CN110830581A (en) 2020-02-21

Similar Documents

Publication Publication Date Title
CN110830581B (en) Method for improving block chain response speed, block chain application system and related equipment
CN108196961B (en) Asynchronous message processing method, terminal, system and storage medium
CN108449410B (en) Message management method, system and related device in cloud platform
CN106550003B (en) Load balancing control method, device and system
CN111340470B (en) Block chain transaction processing method, node and contract container
CN111291079A (en) Data query method and device
CN102947799A (en) Delivering messages from message sources to subscribing recipients
CN111163130B (en) Network service system and data transmission method thereof
US8095495B2 (en) Exchange of syncronization data and metadata
CN110968586A (en) Distributed transaction processing method and device
CN107835203B (en) Message packet delivery method, device, storage medium and terminal
CN110597887A (en) Data management method, device and storage medium based on block chain network
CN103152390A (en) Method and device and nodes and system for node configuration of distributed storage system
CN110955857A (en) Service processing method and device for high concurrency environment
CN111490890A (en) Hierarchical registration method, device, storage medium and equipment based on micro-service architecture
CN112182378A (en) Message pushing method, device, terminal and medium
CN112055347A (en) Multi-gateway cooperative work method and system
CN111767481A (en) Access processing method, device, equipment and storage medium
CN116233254A (en) Business cut-off method, device, computer equipment and storage medium
US8386452B2 (en) Data combination system and data combination method
US10193790B2 (en) Systems and methods for an intelligent, distributed, autonomous, and scalable resource discovery, management, and stitching
CN110995890B (en) Domain name request scheduling method and device
CN110876852B (en) Network game data processing method and system for micro-service
CN112231405A (en) Data storage device
CN117057799B (en) Asset data processing method, device, equipment and storage medium

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