CN112395110A - Block chain acceleration response method, device, equipment and storage medium - Google Patents

Block chain acceleration response method, device, equipment and storage medium Download PDF

Info

Publication number
CN112395110A
CN112395110A CN202011311516.XA CN202011311516A CN112395110A CN 112395110 A CN112395110 A CN 112395110A CN 202011311516 A CN202011311516 A CN 202011311516A CN 112395110 A CN112395110 A CN 112395110A
Authority
CN
China
Prior art keywords
block chain
service
service request
block
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011311516.XA
Other languages
Chinese (zh)
Inventor
曾强生
戴斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Smart Government Affair Block Chain Technology Co ltd
Original Assignee
Hunan Smart Government Affair Block Chain Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Smart Government Affair Block Chain Technology Co ltd filed Critical Hunan Smart Government Affair Block Chain Technology Co ltd
Priority to CN202011311516.XA priority Critical patent/CN112395110A/en
Publication of CN112395110A publication Critical patent/CN112395110A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • 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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Abstract

The invention discloses a block chain accelerated response method, which 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, 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. The embodiment of the invention also provides a block chain accelerated response device. By adopting the invention, the block chain response speed can be improved.

Description

Block chain acceleration response method, device, equipment and storage medium
Technical Field
The present invention relates to the field of a block chain, and in particular, to a block chain accelerated response method, apparatus, device, and storage medium.
Background
The blockchain is a distributed book technology, and can also be regarded as a data structure for storing data in time sequence.
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 blockchain application service, and causes poor user experience.
Disclosure of Invention
In order to solve the above problems, an object of the present invention is to provide a method, an apparatus, a device and a storage medium for block chain accelerated response, which can improve the block chain response speed.
Based on this, the invention provides a block chain accelerated response method, which 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, 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.
Wherein the storing the target block data in the buffer and broadcasting the target block data to other block link points comprises: 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 is the corresponding 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.
Wherein the storing the target block data stored in the cache in the memory comprises: querying a current block height in a 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.
If the block to be written corresponding to the next block height of the current block height cannot be inquired from the cache, the block data of the corresponding block height is acquired from other block chain nodes in a P2P communication mode and is written into the memory.
Wherein, after receiving the service request sent by the client, the method further comprises:
generating the account identification code uniquely corresponding to the client identifier according to the service request, wherein the service request carries the service processing request of the account identification code and the service identifier;
detecting whether a service proxy authority of the account identification code exists or not according to a local proxy account;
and if the service agent authority with the account identification code is obtained, processing the service request by adopting a preset service process and achieving consensus in a block chain.
Wherein the processing by adopting the preset service flow and achieving the consensus in the block chain comprises:
processing the service request by adopting a preset service flow, generating a transaction request comprising the service request, service processing time and service processing steps, broadcasting the transaction request to other block chain nodes, and verifying the transaction request by the other block chain nodes;
receiving allowed transaction responses provided from the other blockchain nodes, the service request agreeing in a blockchain when the number of received allowed transaction responses is higher than a predetermined threshold.
When the number of the transaction permission responses is higher than a preset threshold value and less than the number of the blockchain nodes, broadcasting an objection request to the blockchain nodes which do not send the transaction permission responses, and when an objection reply response is received and is higher than the objection threshold value, the service request does not reach a consensus in the blockchain.
The embodiment of the invention also provides a block chain acceleration response device, which comprises:
the receiving module is used for receiving a service request sent by a client;
the processing module is used for processing the service request by adopting a preset service flow and achieving consensus in the block chain;
a feedback module, configured to 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;
the cache module is used for generating target block data according to the consensus result, 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 the storage module is used for storing the target block data stored in the cache into a memory.
The embodiment of the present invention further provides a device for block chain accelerated response, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the block chain accelerated response method when executing the computer program.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the block chain acceleration response method.
By adopting the method and the device, after the service request sent by the client is received, the service request can be processed by adopting the preset service process 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 the storage module reads the 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
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a block chain acceleration response method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a block chain acceleration response apparatus according to an embodiment of the present invention.
Detailed Description
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.
Fig. 1 is a schematic diagram of a block chain acceleration response method according to an embodiment of the present invention, where the method includes:
s101, receiving a service request sent by a client;
the service request includes service content, service executors, service execution deadlines, and the like.
S102, processing the service request by adopting a preset service process and achieving consensus in a block chain;
wherein, after receiving the service request sent by the client, the method further comprises:
generating the account identification code uniquely corresponding to the client identifier according to the service request, wherein the service request carries the service processing request of the account identification code and the service identifier;
detecting whether a service proxy authority of the account identification code exists or not according to a local proxy account;
and if the service agent authority with the account identification code is obtained, processing the service request by adopting a preset service process and achieving consensus in a block chain.
Wherein the processing by adopting the preset service flow and achieving the consensus in the block chain comprises:
processing the service request by adopting a preset service flow, generating a transaction request comprising the service request, service processing time and service processing steps, broadcasting the transaction request to other block chain nodes, and verifying the transaction request by the other block chain nodes;
receiving allowed transaction responses provided from the other blockchain nodes, the service request agreeing in a blockchain when the number of received allowed transaction responses is higher than a predetermined threshold.
When the number of the transaction permission responses is higher than a preset threshold value and less than the number of the blockchain nodes, broadcasting an objection request to the blockchain nodes which do not send the transaction permission responses, and when an objection reply response is received and is higher than the objection threshold value, the service request does not reach a consensus in the blockchain.
S103, 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;
s104, generating target block data according to the consensus result, 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;
wherein the storing the target block data in the buffer and broadcasting the target block data to other block link points comprises: 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 is the corresponding 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.
And S105, storing the target block data stored in the cache in a memory.
Wherein the storing the target block data stored in the cache in the memory comprises: querying a current block height in a 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.
If the block to be written corresponding to the next block height of the current block height cannot be inquired from the cache, the block data of the corresponding block height is acquired from other block chain nodes in a P2P communication mode and is written into the memory.
By adopting the method and the device, after the service request sent by the client is received, the service request can be processed by adopting the preset service process 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 the storage module reads the 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.
Fig. 2 is a schematic diagram of a block chain acceleration response apparatus according to an embodiment of the present invention, where the apparatus includes:
a receiving module 201, configured to receive a service request sent by a client;
a processing module 202, configured to process the service request by using a preset service flow and achieve consensus in a block chain;
a feedback module 203, configured to 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;
the cache module 204 is configured to generate target block data according to the consensus result, store the target block data in a cache, and broadcast the target block data to other block chain nodes, so that the other block chain nodes store the target block data in the cache;
a storage module 205, configured to store the target block data stored in the cache in a memory.
Technical features and technical effects of the block chain accelerated response apparatus provided by the embodiment of the present invention are the same as those of the method provided by the embodiment of the present invention, and are not described herein again.
The embodiment of the present invention further provides a block chain accelerated response device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the block chain accelerated response method when executing the computer program.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, where when the computer program runs, a device in which the computer-readable storage medium is located is controlled to execute the above block chain accelerated response method.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It is noted that, in this document, relational terms such as "first" and "second", and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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, the use of the phrase "comprising a. -. said" to define an element does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and substitutions can be made without departing from the technical principle of the present invention, and these modifications and substitutions should also be regarded as the protection scope of the present invention.

Claims (10)

1. A block chain accelerated response method, comprising:
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, 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.
2. The method of claim 1, wherein storing the target block data in a buffer and broadcasting the target block data to other block link points comprises: 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 is the corresponding 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.
3. The method according to claim 2, wherein said storing said target block data stored in said cache in said memory comprises: querying a current block height in a 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.
4. The method as claimed in claim 3, wherein if the block to be written corresponding to the next block height of the current block height cannot be searched from the cache, the method further comprises obtaining the block data of the corresponding block height from other blockchain nodes through the communication manner of P2P and writing the block data into the memory.
5. The block chain acceleration response method of claim 1, characterized in that, after receiving the service request sent by the client, the method further comprises:
generating the account identification code uniquely corresponding to the client identifier according to the service request, wherein the service request carries the service processing request of the account identification code and the service identifier;
detecting whether a service proxy authority of the account identification code exists or not according to a local proxy account;
and if the service agent authority with the account identification code is obtained, processing the service request by adopting a preset service process and achieving consensus in a block chain.
6. The method according to claim 1, wherein said employing a predetermined business process and achieving consensus in the blockchain comprises:
processing the service request by adopting a preset service flow, generating a transaction request comprising the service request, service processing time and service processing steps, broadcasting the transaction request to other block chain nodes, and verifying the transaction request by the other block chain nodes;
receiving allowed transaction responses provided from the other blockchain nodes, the service request agreeing in a blockchain when the number of received allowed transaction responses is higher than a predetermined threshold.
7. The blockchain accelerated response method of claim 6, wherein when the number of the transaction allowed responses is higher than a predetermined threshold and less than the number of blockchain nodes, an objection request is broadcasted to the blockchain nodes that did not send a transaction allowed response, and when an objection reply response is received that is higher than an objection threshold, the service request is not agreed in the blockchain.
8. A block chain acceleration response apparatus, comprising:
the receiving module is used for receiving a service request sent by a client;
the processing module is used for processing the service request by adopting a preset service flow and achieving consensus in the block chain;
a feedback module, configured to 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;
the cache module is used for generating target block data according to the consensus result, 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 the storage module is used for storing the target block data stored in the cache into a memory.
9. An apparatus for block chain accelerated response, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the block chain accelerated response method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the block chain accelerated response method according to any one of claims 1 to 7.
CN202011311516.XA 2020-11-20 2020-11-20 Block chain acceleration response method, device, equipment and storage medium Pending CN112395110A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011311516.XA CN112395110A (en) 2020-11-20 2020-11-20 Block chain acceleration response method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011311516.XA CN112395110A (en) 2020-11-20 2020-11-20 Block chain acceleration response method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112395110A true CN112395110A (en) 2021-02-23

Family

ID=74607585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011311516.XA Pending CN112395110A (en) 2020-11-20 2020-11-20 Block chain acceleration response method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112395110A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818414A (en) * 2021-04-16 2021-05-18 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190036710A1 (en) * 2017-07-26 2019-01-31 Alibaba Group Holding Limited Digital certificate management method and apparatus, and electronic device
CN109922079A (en) * 2019-03-29 2019-06-21 北京金山安全软件有限公司 Service agent method and device based on block chain
US20190281026A1 (en) * 2018-03-12 2019-09-12 The Boeing Company Blockchain fortified aircraft communications addressing and reporting system (acars) communication
CN110830581A (en) * 2019-11-12 2020-02-21 金蝶软件(中国)有限公司 Method for improving block chain response speed, block chain application system and related equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190036710A1 (en) * 2017-07-26 2019-01-31 Alibaba Group Holding Limited Digital certificate management method and apparatus, and electronic device
US20190281026A1 (en) * 2018-03-12 2019-09-12 The Boeing Company Blockchain fortified aircraft communications addressing and reporting system (acars) communication
CN109922079A (en) * 2019-03-29 2019-06-21 北京金山安全软件有限公司 Service agent method and device based on block chain
CN110830581A (en) * 2019-11-12 2020-02-21 金蝶软件(中国)有限公司 Method for improving block chain response speed, block chain application system and related equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818414A (en) * 2021-04-16 2021-05-18 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107911487B (en) Information pushing method and device, server and readable storage medium
CN105847447B (en) Message pushing method and device
CN111046310B (en) Page processing method, device, server and computer readable storage medium
CN110222116B (en) Control method and device for transaction data storage and storage medium
CN110830581B (en) Method for improving block chain response speed, block chain application system and related equipment
CN110264348B (en) Processing method, device and storage medium for transaction uplink
CN107832329A (en) Page resource acquisition methods and terminal device
CN110018996B (en) Snapshot rollback method and related device of distributed storage system
CN108880972B (en) Information processing method, server and terminal
CN107179940B (en) Task execution method and device
CN109040263B (en) Service processing method and device based on distributed system
CN111104664A (en) Risk identification method of electronic equipment and server
CN104408068A (en) Report form data processing method and related equipment
CN105095263B (en) method and device for generating card number
CN111008087B (en) Message processing method and device
CN112395110A (en) Block chain acceleration response method, device, equipment and storage medium
CN111355765B (en) Network request processing and sending method and device
CN111190899A (en) Buried point data processing method and device, server and storage medium
CN102984138B (en) A kind of methods, devices and systems obtaining object
CN112865927B (en) Message delivery verification method, device, computer equipment and storage medium
CN105989096A (en) Account information clearing method and apparatus
CN103327026A (en) Data updating method and updating system
CN107566216B (en) Monitoring method, device and service system
CN106412018B (en) Message pushing method and device
CN110798358A (en) Distributed service identification method and device, computer readable medium and electronic equipment

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