CN111988432A - Block chain transaction processing method and device, electronic equipment and storage medium - Google Patents

Block chain transaction processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111988432A
CN111988432A CN202010925659.3A CN202010925659A CN111988432A CN 111988432 A CN111988432 A CN 111988432A CN 202010925659 A CN202010925659 A CN 202010925659A CN 111988432 A CN111988432 A CN 111988432A
Authority
CN
China
Prior art keywords
transaction
channel
transactions
blocks
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
CN202010925659.3A
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.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202010925659.3A priority Critical patent/CN111988432A/en
Publication of CN111988432A publication Critical patent/CN111988432A/en
Pending legal-status Critical Current

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/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • 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
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computational Linguistics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application provides a method and a device for processing a block chain transaction, electronic equipment and a storage medium, which are applied to the technical field of block chains, wherein the method for processing the block chain transaction comprises the following steps: acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged; storing the transaction in a cache channel corresponding to the application channel; and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node. The embodiment of the application is also beneficial to improving the processing performance of the system on high-frequency transaction under the condition of ensuring the efficiency of generating the block by the consensus node.

Description

Block chain transaction processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing blockchain transaction transactions, an electronic device, and a storage medium.
Background
The blockchain is essentially a decentralized database, and is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The block chain generally needs to pack transaction transactions into blocks, in the alliance chain, the packed executor is a consensus node, the consensus node responds to transaction requests in real time, packs a certain amount of transaction transactions into blocks, and then sends the blocks to a data node for processing. The real-time block generation ensures the efficiency of block generation, but the generated blocks are small and numerous, and the processing performance of the system on high-frequency transactions is reduced to a certain extent.
Disclosure of Invention
In view of the above problems, the present application provides a method, an apparatus, an electronic device, and a storage medium for processing a blockchain transaction, which are beneficial to improving the performance of processing a high-frequency transaction by a system while ensuring the efficiency of generating a block by a consensus node.
In order to achieve the above object, a first aspect of the embodiments of the present application provides a method for processing a blockchain transaction, where the method includes:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
With reference to the first aspect, in a possible implementation manner, the consuming the transaction transactions from the cache channel through a coroutine corresponding to the application channel, and packaging the transaction transactions into one or more blocks according to an inventory of the transaction transactions includes:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
With reference to the first aspect, in a possible implementation manner, the packaging the transaction transactions in the first cache structure into the one or more blocks according to an inventory of the transaction transactions in the cache channel includes:
under the condition that the stock of the transaction transactions in the cache channel is not empty, acquiring the number and the total size of the transaction transactions in the first cache structure, and when the number of the transaction transactions in the first cache structure reaches the block preset transaction number or the total size of the transaction transactions in the first cache structure reaches the block preset transaction size, packaging the transaction transactions in the first cache structure into blocks to obtain one or more blocks;
and sending a blocking instruction to a sequencing service under the condition that the stock of the transaction transactions in the cache channel is empty, and packaging all the transaction transactions in the first cache structure into blocks to obtain the one or more blocks when the blocking instruction is consumed from the cache channel.
With reference to the first aspect, in one possible implementation, after packaging the transaction transactions into one or more blocks according to the inventory of the transaction transactions, the method further includes:
storing the one or more blocks in a preset second cache structure;
and when the number of the cached blocks in the second cache structure reaches a preset number of blocks, writing all the blocks in the second cache structure into a local account book.
With reference to the first aspect, in a possible implementation manner, the sending the one or more blocks to the data node includes:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
With reference to the first aspect, in a possible implementation manner, before acquiring a transaction request initiated by a data node in an application channel, the method further includes:
creating the cache channel for the application channel; and the number of the first and second groups,
and opening the coroutine for the application channel.
A second aspect of the embodiments of the present application provides a device for processing a blockchain transaction, where the device includes:
the transaction request acquisition module is used for acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
the transaction caching module is used for storing the transaction in a caching channel corresponding to the application channel;
and the block generation module is used for consuming the transaction transactions from the cache channel through the coroutines corresponding to the application channel, packaging the transaction transactions into one or more blocks according to the stock of the transaction transactions, and sending the one or more blocks to the data node.
A third aspect of embodiments of the present application provides an electronic device, which includes an input device, an output device, and a processor, and is adapted to implement one or more instructions; and a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the steps of:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
A fourth aspect of embodiments of the present application provides a computer storage medium having one or more instructions stored thereon, the one or more instructions adapted to be loaded by a processor and to perform the following steps:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
The above scheme of the present application includes at least the following beneficial effects: compared with the prior art, the transaction request initiated by the data node in the application channel is obtained, wherein the transaction request comprises the transaction to be packaged; storing the transaction in a cache channel corresponding to the application channel; and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node. Therefore, the transaction affairs are stored in the cache channel, the transaction affairs are consumed in a single corotation way, the block is generated according to the stock of the transaction affairs in the cache channel, and the processing performance of the system on the high-frequency transaction is improved under the condition that the efficiency of generating the block by the consensus node is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 application, 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 network system architecture according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a method for processing a blockchain transaction according to an embodiment of the present disclosure;
FIG. 3 is a diagram illustrating depositing transaction transactions into a cache channel according to an embodiment of the disclosure;
fig. 4 is a flowchart illustrating another method for processing a blockchain transaction according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a block chain transaction processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another block chain transaction processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of another block chain transaction processing apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all 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 application.
The terms "comprising" and "having," and any variations thereof, as appearing in the specification, claims and drawings of this application, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
An embodiment of the present application provides a block chain transaction processing scheme, which may be implemented based on a network system architecture shown in fig. 1, please refer to fig. 1, where the network system may specifically be a block chain network, and the block chain network may include a plurality of nodes, for example: when one node initiates a transaction, the other nodes can perform consensus on the transaction through a consensus algorithm and generate a block, and the block comprising the transaction can be stored in a local account book. In some scenarios, the blockchain network may be an alliance chain formed by a plurality of private chains, where the alliance chain is managed by a plurality of organization organizations, each node in the blockchain network has an entity organization corresponding to the node, and the node includes a consensus node (adapter node) and a data node (peer node), the consensus node performs consensus sequencing on transactions initiated by the data node, packages the transaction transactions into blocks according to a preset condition, and sends the generated blocks to the data node for processing. The bottom layer architecture of the blockchain network provides a high-performance kernel module, and the kernel module can support the consensus node to execute the blockchain transaction processing scheme so as to solve the problem that the performance of the whole blockchain network system is influenced when a large number of blocks are generated in the prior art.
Based on the network system architecture shown in fig. 1, the following describes the block chain transaction processing method provided in the embodiment of the present application in detail with reference to other drawings.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a method for processing a blockchain transaction according to an embodiment of the present invention, where the method for processing a blockchain transaction is applied to a consensus node, as shown in fig. 2, including steps S21-S23:
s21, a transaction request initiated by the data node in the application channel is obtained, wherein the transaction request comprises the transaction to be packaged.
In the embodiment of the present application, an application channel refers to a blockchain in a blockchain network, a data node in each application channel initiates a transaction reception request to a consensus node through a preset request mechanism, where the transaction reception request is used to request the consensus node to package transaction transactions (for example, an organization a corresponding to a data node 1 needs to transfer a money from an account of the organization a to an organization B corresponding to a data node N) into a block, where the request mechanism may be long polling, long connection, and the like, and is not particularly limited.
S22, storing the transaction affairs in the buffer channel corresponding to the application channel.
In the embodiment of the application, each application channel has a one-to-one corresponding cache channel, when the consensus node is started, the consensus node creates one cache channel for each application channel, the cache channels are used for storing all transaction transactions acquired in the application channels, and the cache channels are between the receipt of the transaction transactions and the processing of the transaction transactions, so that the receiving of the transaction transactions and the decoupling of the processing of the transaction transactions are realized. As shown in fig. 3, after acquiring the transaction a, the transaction B, the transaction C, the transaction D, and the transaction E that have been signed and endorsed, the consensus node performs consensus sequencing on the transaction a, the transaction B, the transaction C, the transaction D, and the transaction E, and adds the transaction a, the transaction B, the transaction C, the transaction D, and the transaction E to the corresponding cache channels according to the transaction sequence.
S23, the transaction affairs are consumed from the cache channel through the coroutine corresponding to the application channel, the transaction affairs are packed into one or more blocks according to the stock of the transaction affairs, and the one or more blocks are sent to the data node.
In this embodiment of the present application, when the consensus node is started, a coroutine is also started for each application channel, the coroutine executes the operations of consuming transaction transactions and packing into blocks, and the coroutine consumes transaction transactions in the cache channel according to a first-in first-out principle, that is, the consumption transactions in the cache channel will be consumed first, for example: the transaction that was first consumed coroutines in FIG. 3 is transaction A, then transaction B, and so on.
In a possible implementation manner, the consuming the transaction transactions from the cache channel through the coroutine corresponding to the application channel, and packaging the transaction transactions into one or more blocks according to the stock of the transaction transactions includes:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
The first cache structure is a preset cache region, and is used for storing transaction transactions consumed from the cache channel and preparing for the packaging block, specifically, some parameters can be set for the first cache structure, for example: a threshold number of transaction transactions, a threshold total size of transaction transactions, etc. When the coroutine is in the packaging block, firstly, whether the stock of the transaction transactions in the cache channel is empty is judged, under the condition that the stock of the transaction transactions in the cache channel is not empty, the number and the total size of the transaction transactions in the first cache structure are obtained, when the number of the transaction transactions reaches the block preset transaction number (namely the threshold value of the number of the transaction transactions which can be contained in one block, for example, 95 transactions), or when the total size of the transaction transactions reaches the block preset transaction size (namely the threshold value of the total size of the transaction transactions which can be contained in one block, for example, 1M, 2M and the like), the transaction transactions in the first cache structure are immediately packaged into the block, and finally, the transaction transactions in the cache channel are packaged into one or more blocks. The block preset transaction number and the block preset transaction size play a role of aggregating blocks, and the number of generated blocks can be effectively controlled.
On the other hand, under the condition that the stock of the transaction transactions in the cache channel is empty, it is described that when the current data node does not submit a new transaction, a block cutting instruction is sent to the ordering service, the block cutting instruction is used for indicating that the stock of the transaction transactions in the cache channel by the coroutine is empty, the transaction transactions in the first cache structure are immediately generated into a block, that is, when the coroutine consumes the block cutting instruction from the cache channel, the transaction transactions in the first cache structure are directly packed into the block, and the time effectiveness is guaranteed without waiting until the number or the total size of the transaction transactions reaches the block preset transaction number or the block preset transaction size.
It can be seen that, in the embodiment of the present application, a transaction request initiated by a data node in an application channel is obtained, where the transaction request includes a transaction to be packaged; storing the transaction in a cache channel corresponding to the application channel; and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node. Therefore, the transaction affairs are stored in the cache channel, the transaction affairs are consumed in a single corotation way, the block is generated according to the stock of the transaction affairs in the cache channel, and the processing performance of the system on the high-frequency transaction is improved under the condition that the efficiency of generating the block by the consensus node is ensured.
Referring to fig. 4, fig. 4 is a flowchart illustrating another method for processing a blockchain transaction according to an embodiment of the present application, as shown in fig. 4, including steps S41-S46:
s41, the data node initiates a transaction request, wherein the transaction request comprises the transaction to be packaged;
s42, the consensus node acquires a transaction request initiated by the data node in the application channel to obtain the transaction;
s43, the consensus node stores the transaction in a cache channel corresponding to the application channel;
s44, the consensus node continuously consumes the transaction affairs from the cache channel through a coroutine, and stores the transaction affairs obtained through consumption in a preset first cache structure;
s45, the consensus node packs the transaction affairs in the first cache structure into one or more blocks according to the stock of the transaction affairs in the cache channel through the coroutine;
s46, the common identification node sends the one or more blocks to the data node.
In one possible embodiment, the method for transmitting the one or more blocks to the data node by the common node comprises:
the common identification node stores the one or more blocks in a preset second cache structure;
and when the number of the blocks cached in the second cache structure reaches a preset number of the blocks, the consensus node writes all the blocks in the second cache structure into a local account book.
In this embodiment, the second cache structure stores another cache region of the block when the generated block is written into the local account book, and similarly, the second cache structure also has set parameters, such as: a block number threshold. After one or more blocks are generated by the consensus node, the blocks are firstly stored in the second cache structure, when the number of the blocks in the second cache structure reaches a preset block number (namely a block number threshold), all the blocks in the second cache structure are written into a local account book together, and therefore, the original multiple disk IO (Input/Output) is combined into one disk IO, and the influence of the disk IO on the system performance can be reduced.
In one possible embodiment, the sending the one or more blocks to the data node includes:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
In the embodiment, when the consensus node generates one or more blocks, the distribution interface acquires the information of the one or more blocks, uniformly packages the one or more blocks and sends the one or more blocks to the data node for processing, instead of distributing the one or more blocks to the data node in a single-block manner, so that the network occupancy rate can be reduced, and the processing performance of the system on high-frequency transactions can be improved.
The specific implementation of some steps in S41-S46 has already been described in the embodiment shown in fig. 2, and is not repeated here to avoid repetition.
Based on the above description of the embodiment of the blockchain transaction processing method, please refer to fig. 5, where fig. 5 is a schematic structural diagram of a blockchain transaction processing apparatus according to an embodiment of the present application, and as shown in fig. 5, the apparatus includes:
a transaction request obtaining module 51, configured to obtain a transaction request initiated by a data node in an application channel, where the transaction request includes a transaction to be packaged;
the transaction cache module 52 is configured to store the transaction in a cache channel corresponding to the application channel;
the block generation module 53 is configured to consume the transaction transactions from the cache channel through a coroutine corresponding to the application channel, package the transaction transactions into one or more blocks according to the stock of the transaction transactions, and send the one or more blocks to the data node.
In a possible implementation manner, in the aspect that the transaction is consumed from the cache channel through the coroutine corresponding to the application channel, and the transaction is packed into one or more blocks according to the stock of the transaction, the block generating module 53 is specifically configured to:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
In a possible implementation manner, in terms of packaging the transaction transactions in the first cache structure into the one or more chunks according to the inventory of the transaction transactions in the cache channel, the chunk generating module 53 is specifically configured to:
under the condition that the stock of the transaction transactions in the cache channel is not empty, acquiring the number and the total size of the transaction transactions in the first cache structure, and when the number of the transaction transactions in the first cache structure reaches the block preset transaction number or the total size of the transaction transactions in the first cache structure reaches the block preset transaction size, packaging the transaction transactions in the first cache structure into blocks to obtain one or more blocks;
and sending a blocking instruction to a sequencing service under the condition that the stock of the transaction transactions in the cache channel is empty, and packaging all the transaction transactions in the first cache structure into blocks to obtain the one or more blocks when the blocking instruction is consumed from the cache channel.
In a possible embodiment, as shown in fig. 6, the apparatus further comprises: a block cache module 54 and a block write module 55;
the block cache module 54 is configured to store the one or more blocks in a preset second cache structure;
the block writing module 55 is configured to write all blocks in the second cache structure into a local book when the number of blocks cached in the second cache structure reaches a preset number of blocks.
In a possible implementation manner, in terms of sending the one or more blocks to the data node, the block generating module 53 is specifically configured to:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
In a possible embodiment, as shown in fig. 7, the apparatus further comprises: a cache channel creation module 56 and a coroutine opening module 57;
the cache channel creating module 56 is configured to create the cache channel for the application channel;
the coroutine starting module 57 is configured to start the coroutine for the application channel.
According to an embodiment of the present application, the units in the blockchain transaction processing apparatuses shown in fig. 5 to 7 may be respectively or entirely combined into one or several additional units to form the blockchain transaction processing apparatus, or some unit(s) therein may be further split into multiple units with smaller functions to form the blockchain transaction processing apparatus, which may achieve the same operation without affecting the achievement of the technical effect of the embodiment of the present application. The units are divided based on logic functions, and in practical application, the functions of one unit can be realized by a plurality of units, or the functions of a plurality of units can be realized by one unit. In other embodiments of the present application, the transaction processing device based on block chain may also include other units, and in practical applications, these functions may also be implemented by being assisted by other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, the blockchain transaction processing apparatus devices shown in fig. 5 to 7 may be constructed by running a computer program (including program codes) capable of executing the steps involved in the respective methods shown in fig. 2 or fig. 4 on a general-purpose computing device, such as a computer, including a Central Processing Unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM), and the like, as well as a storage element, and implementing the blockchain transaction processing method of the embodiment of the present application. The computer program may be recorded on a computer-readable recording medium, for example, and loaded and executed in the above-described computing apparatus via the computer-readable recording medium.
Based on the description of the method embodiment and the device embodiment, the embodiment of the application further provides an electronic device. Referring to fig. 8, the electronic device includes at least a processor 801, an input device 802, an output device 803, and a computer storage medium 804. The processor 801, the input device 802, the output device 803, and the computer storage medium 804 within the electronic device may be connected by a bus or other means.
A computer storage medium 804 may be stored in the memory of the electronic device, the computer storage medium 804 being for storing a computer program comprising program instructions, the processor 801 being for executing the program instructions stored by the computer storage medium 804. The processor 801 (or CPU) is a computing core and a control core of the electronic device, and is adapted to implement one or more instructions, and in particular, to load and execute the one or more instructions so as to implement a corresponding method flow or a corresponding function.
In one embodiment, the processor 801 of the electronic device provided by the embodiment of the present application may be configured to perform a series of blockchain transaction transactions:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
In another embodiment, the processor 801 executes the coroutine corresponding to the application channel, consumes the transaction transactions from the cache channel, and packages the transaction transactions into one or more blocks according to the stock of the transaction transactions, including:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
In another embodiment, the packing the transaction transactions in the first cache structure into the one or more blocks according to the inventory of the transaction transactions in the cache channel by the processor 801 includes:
under the condition that the stock of the transaction transactions in the cache channel is not empty, acquiring the number and the total size of the transaction transactions in the first cache structure, and when the number of the transaction transactions in the first cache structure reaches the block preset transaction number or the total size of the transaction transactions in the first cache structure reaches the block preset transaction size, packaging the transaction transactions in the first cache structure into blocks to obtain one or more blocks;
and sending a blocking instruction to a sequencing service under the condition that the stock of the transaction transactions in the cache channel is empty, and packaging all the transaction transactions in the first cache structure into blocks to obtain the one or more blocks when the blocking instruction is consumed from the cache channel.
In yet another embodiment, after packaging the transaction transactions into one or more blocks according to the inventory of transaction transactions, the processor 801 is further configured to:
storing the one or more blocks in a preset second cache structure;
and when the number of the cached blocks in the second cache structure reaches a preset number of blocks, writing all the blocks in the second cache structure into a local account book.
In another embodiment, the processor 801 performs the sending of the one or more blocks to the data node, including:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
In yet another embodiment, before obtaining the transaction request initiated by the data node in the application channel, the processor 801 is further configured to:
creating the cache channel for the application channel; and the number of the first and second groups,
and opening the coroutine for the application channel.
By way of example, the electronic devices may be servers, cloud servers, computer hosts, server clusters, and the like, and may include, but are not limited to, the processor 801, the input device 802, the output device 803, and the computer storage medium 804. It will be appreciated by those skilled in the art that the schematic diagrams are merely examples of an electronic device and are not limiting of an electronic device and may include more or fewer components than those shown, or some components in combination, or different components.
It should be noted that, since the steps in the above-mentioned method for processing blockchain transaction are implemented when the processor 801 of the electronic device executes the computer program, the embodiments of the method for processing blockchain transaction are all applicable to the electronic device, and all can achieve the same or similar beneficial effects.
An embodiment of the present application further provides a computer storage medium (Memory), which is a Memory device in an electronic device and is used to store programs and data. It is understood that the computer storage medium herein may include a built-in storage medium in the terminal, and may also include an extended storage medium supported by the terminal. The computer storage medium provides a storage space that stores an operating system of the terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), suitable for loading and execution by processor 801. The computer storage medium may be a high-speed RAM memory, or may be a non-volatile memory (non-volatile memory), such as at least one disk memory; alternatively, it may be at least one computer storage medium located remotely from the processor 801. In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by processor 801 to implement the corresponding steps described above with respect to the blockchain transaction processing method; in particular implementations, one or more instructions in the computer storage medium are loaded and executed by the processor 801 to perform the steps of:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 801, further perform the steps of:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 801, further perform the steps of:
under the condition that the stock of the transaction transactions in the cache channel is not empty, acquiring the number and the total size of the transaction transactions in the first cache structure, and when the number of the transaction transactions in the first cache structure reaches the block preset transaction number or the total size of the transaction transactions in the first cache structure reaches the block preset transaction size, packaging the transaction transactions in the first cache structure into blocks to obtain one or more blocks;
and sending a blocking instruction to a sequencing service under the condition that the stock of the transaction transactions in the cache channel is empty, and packaging all the transaction transactions in the first cache structure into blocks to obtain the one or more blocks when the blocking instruction is consumed from the cache channel.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 801, further perform the steps of:
storing the one or more blocks in a preset second cache structure;
and when the number of the cached blocks in the second cache structure reaches a preset number of blocks, writing all the blocks in the second cache structure into a local account book.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 801, further perform the steps of:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
In one example, one or more instructions in the computer storage medium, when loaded by the processor 801, further perform the steps of:
creating the cache channel for the application channel; and the number of the first and second groups,
and opening the coroutine for the application channel.
Illustratively, the computer program of the computer storage medium includes computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
It should be noted that, since the computer program of the computer storage medium is executed by the processor to implement the steps in the above-mentioned blockchain transaction processing method, all the embodiments of the blockchain transaction processing method are applicable to the computer storage medium, and can achieve the same or similar beneficial effects.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for processing blockchain transaction, the method comprising:
acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
storing the transaction in a cache channel corresponding to the application channel;
and through the coroutine corresponding to the application channel, the transaction transactions are consumed from the cache channel, the transaction transactions are packaged into one or more blocks according to the stock of the transaction transactions, and the one or more blocks are sent to the data node.
2. The method of claim 1, wherein the consuming the transaction transactions from the cache channel through the coroutines corresponding to the application channel, and packing the transaction transactions into one or more blocks according to the inventory of the transaction transactions comprises:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
3. The method of claim 2, wherein packaging the transaction transactions in the first cache structure into the one or more chunks according to the inventory of the transaction transactions in the cache channel comprises:
under the condition that the stock of the transaction transactions in the cache channel is not empty, acquiring the number and the total size of the transaction transactions in the first cache structure, and when the number of the transaction transactions in the first cache structure reaches the block preset transaction number or the total size of the transaction transactions in the first cache structure reaches the block preset transaction size, packaging the transaction transactions in the first cache structure into blocks to obtain one or more blocks;
and sending a blocking instruction to a sequencing service under the condition that the stock of the transaction transactions in the cache channel is empty, and packaging all the transaction transactions in the first cache structure into blocks to obtain the one or more blocks when the blocking instruction is consumed from the cache channel.
4. The method of any of claims 1-3, wherein after packaging the transaction transactions into one or more blocks according to the inventory of transaction transactions, the method further comprises:
storing the one or more blocks in a preset second cache structure;
and when the number of the cached blocks in the second cache structure reaches a preset number of blocks, writing all the blocks in the second cache structure into a local account book.
5. The method of any one of claims 1-3, wherein sending the one or more blocks to the data node comprises:
sending the information of the one or more blocks to a distribution interface;
and packaging the one or more blocks together through the distribution interface and then sending the one or more blocks to the data node.
6. The method of claim 1, wherein prior to obtaining a transaction request initiated by a data node in an application channel, the method further comprises:
creating the cache channel for the application channel; and the number of the first and second groups,
and opening the coroutine for the application channel.
7. A blockchain transaction processing apparatus, the apparatus comprising:
the transaction request acquisition module is used for acquiring a transaction request initiated by a data node in an application channel, wherein the transaction request comprises a transaction to be packaged;
the transaction caching module is used for storing the transaction in a caching channel corresponding to the application channel;
and the block generation module is used for consuming the transaction transactions from the cache channel through the coroutines corresponding to the application channel, packaging the transaction transactions into one or more blocks according to the stock of the transaction transactions, and sending the one or more blocks to the data node.
8. The apparatus of claim 7, wherein in terms of consuming the transaction transactions from the cache channel through a coroutine corresponding to the application channel, and packaging the transaction transactions into one or more chunks according to an inventory of the transaction transactions, the chunk generation module is specifically configured to:
continuously consuming the transaction transactions from the cache channel through the coroutine, and storing the transaction transactions obtained by consumption in a preset first cache structure;
and packaging the transaction transactions in the first cache structure into the one or more blocks according to the stock of the transaction transactions in the cache channel.
9. An electronic device comprising an input device and an output device, further comprising:
a processor adapted to implement one or more instructions; and the number of the first and second groups,
a computer storage medium having stored thereon one or more instructions adapted to be loaded by the processor and to perform the method of any of claims 1-6.
10. A computer storage medium having stored thereon one or more instructions adapted to be loaded by a processor and to perform the method of any of claims 1-6.
CN202010925659.3A 2020-09-03 2020-09-03 Block chain transaction processing method and device, electronic equipment and storage medium Pending CN111988432A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010925659.3A CN111988432A (en) 2020-09-03 2020-09-03 Block chain transaction processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010925659.3A CN111988432A (en) 2020-09-03 2020-09-03 Block chain transaction processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111988432A true CN111988432A (en) 2020-11-24

Family

ID=73447034

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010925659.3A Pending CN111988432A (en) 2020-09-03 2020-09-03 Block chain transaction processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111988432A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254168A (en) * 2021-06-11 2021-08-13 北京百度网讯科技有限公司 Operation method, device, equipment and storage medium of block chain system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107992356A (en) * 2017-12-13 2018-05-04 上海壹账通金融科技有限公司 Block chain affairs block processes method, electronic device and readable storage medium storing program for executing
CN110336779A (en) * 2019-05-07 2019-10-15 弦子科技(北京)有限公司 A kind of construction method, device and the electronic equipment of block chain
CN112039987A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Method and device for processing blocks in block chain, node equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107992356A (en) * 2017-12-13 2018-05-04 上海壹账通金融科技有限公司 Block chain affairs block processes method, electronic device and readable storage medium storing program for executing
CN110336779A (en) * 2019-05-07 2019-10-15 弦子科技(北京)有限公司 A kind of construction method, device and the electronic equipment of block chain
CN112039987A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Method and device for processing blocks in block chain, node equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254168A (en) * 2021-06-11 2021-08-13 北京百度网讯科技有限公司 Operation method, device, equipment and storage medium of block chain system
US11588654B2 (en) 2021-06-11 2023-02-21 Beijing Baidu Netcom Science Technology Co., Ltd. Method and apparatus for operating blockchain system, device and storage medium

Similar Documents

Publication Publication Date Title
EP3667496B1 (en) Distributed computing system, data transmission method and device in distributed computing system
CN112039987B (en) Method and device for processing blocks in block chain, node equipment and storage medium
KR101906912B1 (en) Cloud-based build service
CN108388479A (en) Postpone information push method, device, computer equipment and storage medium
US20160127492A1 (en) Non-volatile memory express over ethernet
EP4080362A2 (en) Method and apparatus for creating a container
CN107395665A (en) A kind of block chain service handling and business common recognition method and device
US10860245B2 (en) Method and apparatus for optimizing data storage based on application
US8713287B2 (en) Off-loading of processing from a processor blade to storage blades based on processing activity, availability of cache, and other status indicators
CN109309726A (en) Document generating method and system based on mass data
CN101652750B (en) Data processing device, distributed processing system and data processing method
CN114201421B (en) Data stream processing method, storage control node and readable storage medium
CN104102693A (en) Object processing method and device
CN106855861A (en) File merging method and device and electronic equipment
CN113411404A (en) File downloading method, device, server and storage medium
EP3384384A1 (en) Methods and devices for acquiring data using virtual machine and host machine
CN105653209A (en) Object storage data transmitting method and device
CN112099728B (en) Method and device for executing write operation and read operation
CN111988432A (en) Block chain transaction processing method and device, electronic equipment and storage medium
CN113312182B (en) Cloud computing node, file processing method and device
CN109299043A (en) Method, device, equipment and storage medium for deleting large files of distributed cluster system
CN117370046A (en) Inter-process communication method, system, device and storage medium
CN109783201A (en) Method for interchanging data and its system
CN116361031A (en) Message transmission method, system, device, processor and electronic equipment
CN109862069B (en) Message processing method and device

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