A method, platform, device and storage medium for processing concurrent data
By introducing composite key-value pairs into the blockchain platform to handle concurrent transactions, the inefficiency problem of multiple transactions modifying the same data simultaneously is solved, achieving successful processing of each concurrent transaction and improving transaction efficiency, thus promoting the commercial application of blockchain technology.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-09-29
- Publication Date
- 2026-08-04
AI Technical Summary
In a blockchain platform, when multiple concurrent transactions modify the same data at the same time, some transactions may fail to successfully modify the ledger data, resulting in low write operation efficiency.
By introducing composite key-value pairs to handle concurrent transactions, client nodes preprocess the received concurrent transactions, and ledger nodes create key-value pairs and composite key-value pairs for transaction proposals, and write the transaction results to the blockchain according to the processing order.
Every concurrent transaction can be successfully processed, reducing the amount of invalid transaction data, improving the transaction processing efficiency of electronic devices in high-concurrency scenarios, and promoting the commercialization of blockchain technology.
Smart Images

Figure CN115878270B_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the field of blockchain, and in particular to a method for processing concurrent data, a platform for processing concurrent data, an electronic device, and a computer-readable storage medium. Background Technology
[0002] Blockchain technology, also known as distributed ledger technology, is an emerging technology in which multiple computing devices jointly participate in "accounting" and maintain a complete distributed database. Due to its decentralized, transparent, and interconnected nature, allowing each computing device to participate in database recording and enabling rapid data synchronization, blockchain technology is widely used in numerous fields. Consortium blockchains, as a type of blockchain, offer advantages such as high data processing efficiency, strong controllability, and strong privacy features, making them suitable for building commercial applications. However, compared to traditional databases, blockchains are significantly inferior in terms of transaction throughput and real-time performance. To commercialize blockchain technology, various technical means are typically employed to optimize its performance. Optimization of blockchain performance can be approached from multiple angles. Considering that many business processes in real-world applications are concurrent, improving the blockchain's ability to handle concurrent transactions can effectively optimize its performance. In related technologies, two main approaches are used to improve the blockchain's ability to handle concurrent transactions. The first approach addresses the inherent structural characteristics of the blockchain by modifying its chain structure. For example, this involves dividing the blockchain into a main chain and multiple sub-chains, and distributing transactions across different chains. The second approach optimizes the concurrency performance of the blockchain platform. For instance, this involves parallel optimization in the transaction verification module and adding caching at the Committer node. Clearly, the first approach targets public blockchains. Because public blockchains are permissionless, nodes can freely join and leave, and all can participate in data reading and writing. This necessitates a more stringent consensus mechanism, resulting in public blockchains processing data much slower than consortium blockchains. Therefore, public blockchains have limitations in terms of user authorization and application scenario construction for commercial applications. The second approach considers optimization solutions at the level of a single transaction's process, without addressing concurrency conflicts. Conflicts when two transactions need to access the same resources simultaneously are not discussed, limiting its ability to handle conflicting concurrent transactions. Therefore, designing a solution for resolving conflicting concurrent transactions on a blockchain platform can effectively promote the commercialization of blockchain technology.
[0003] It's important to note that blockchain platforms employ version control to prevent data inconsistency caused by multiple write requests simultaneously. When multiple requests attempt to modify the same data at the same time, the platform will process one request and successfully modify the value, while the remaining requests will return errors and fail to update successfully. Therefore, when multiple transactions simultaneously request to modify the same data in the ledger, some transactions may fail to modify the data, resulting in low efficiency for write operations in concurrent scenarios. Summary of the Invention
[0004] In view of this, this application provides a method for processing concurrent data, a platform for processing concurrent data, an electronic device, and a computer-readable storage medium, which solves the problem of low efficiency of write operations in concurrent scenarios in related technologies.
[0005] To achieve the above objectives, the technical solution of this application is implemented as follows:
[0006] A concurrent data processing platform, the method comprising:
[0007] The client node preprocesses the received concurrent transactions to obtain the transaction proposals corresponding to the concurrent transactions; wherein the concurrent transactions process the same transaction data, and the transaction proposals corresponding to the concurrent transactions include at least the transaction proposal P corresponding to the first transaction i that is responded to in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ;
[0008] The transaction proposal P is created through the ledger node. i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, and v i This represents the transaction value corresponding to transaction i;
[0009] The transaction proposal P is created through the accounting node. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, and v j This represents the transaction value corresponding to transaction j;
[0010] The ledger node processes the key-value pairs (k, v) according to the processing order of the concurrent transactions. i The corresponding transaction i;
[0011] Upon completion of transaction i, the composite key-value pair ((k,d),v) is processed by the ledger node. jThe corresponding transaction j is recorded in the blockchain through the ledger node, and the transaction result corresponding to the concurrent transaction is written into the blockchain.
[0012] A concurrent data processing platform, the platform comprising:
[0013] A client node is used to preprocess received concurrent transactions to obtain transaction proposals corresponding to the concurrent transactions; wherein the concurrent transactions process the same transaction data, and the transaction proposals corresponding to the concurrent transactions include at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ;
[0014] The ledger node is also used to create the transaction proposal P. i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, and v i This represents the transaction value corresponding to transaction i;
[0015] The ledger node is also used to create the transaction proposal P. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, and v j This represents the transaction value corresponding to transaction j;
[0016] The ledger node is also used to process the key-value pairs (k, v) according to the processing order of the concurrent transactions. i The corresponding transaction i;
[0017] The ledger node is also used to process the composite key-value pair ((k,d),v) after the transaction i has been processed. j The corresponding transaction j is recorded, and the transaction result corresponding to the concurrent transaction is written into the blockchain.
[0018] An electronic device, the electronic device comprising:
[0019] Memory, used to store executable instructions;
[0020] The processor, when executing executable instructions stored in the memory, implements the steps of the concurrent data processing method described above.
[0021] A computer-readable storage medium storing one or more applications, which can be executed by one or more processors to implement the steps of the concurrent data processing method described above.
[0022] The concurrent data processing method, platform, electronic device, and computer-readable storage medium provided in this application preprocess the received concurrent transactions through a client node to obtain transaction proposals corresponding to the concurrent transactions. The concurrent transactions process the same data, and each transaction proposal includes at least the transaction proposal P corresponding to the first responded transaction i in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ; Create transaction proposals P through ledger nodes i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, v i Represent the transaction value corresponding to transaction i; create a transaction proposal P through the ledger node. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, v j Represents the transaction value corresponding to transaction j; the key-value pair (k, v) is processed by the ledger node according to the processing order of concurrent transactions. i The corresponding transaction i; after transaction i is processed, the composite key-value pair ((k,d),v) is processed through the ledger node. j The corresponding transaction j is written to the blockchain through the ledger node. In other words, this application introduces a composite key-value pair approach for concurrent transactions, solving the problem in related technologies where some transactions fail to modify the same data in the ledger when multiple transactions are initiated simultaneously, leading to low write efficiency in concurrent scenarios. This ensures that every concurrent transaction is successfully processed, reducing the amount of invalid transactions and improving the efficiency of electronic devices in processing transactions. Furthermore, by effectively handling all transactions in conflicting situations, the performance of the Hyperledger Fabric blockchain platform in high-concurrency scenarios is improved, accelerating the commercialization of blockchain technology. Attached Figure Description
[0023] Figure 1 A functional architecture diagram of the blockchain network service platform provided for this application;
[0024] Figure 2 A schematic diagram illustrating the electronic device provided in this application accessing the blockchain network service platform;
[0025] Figure 3 A flowchart illustrating a concurrent data processing method provided in this application;
[0026] Figure 4 A flowchart illustrating a concurrent data processing method provided in this application;
[0027] Figure 5 A flowchart illustrating a concurrent data processing method provided in this application;
[0028] Figure 6 A schematic diagram of the structure of a concurrent data processing platform provided for the implementation of this application;
[0029] Figure 7 A schematic diagram of the structure of an electronic device provided for the implementation of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0031] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art to which the embodiments of this application pertain. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit the application.
[0032] Before providing a further detailed description of this application, the nouns and terms used in the embodiments of this invention will be explained, and the nouns and terms used in the embodiments of this invention are subject to the following interpretations.
[0033] 1) A transaction, equivalent to the computer term "thing," includes three different transaction types: Deploy, Invoke, and Query. Deployment transactions are used to install specified chaincode on nodes in the blockchain network. Invoke and query transactions are used to invoke the chaincode with the deployed number to perform operations on the relevant data of a target account in the ledger. These operations include adding, querying, and modifying key-value pairs in an account, or adding a new account to the ledger. This does not refer solely to transactions in a business context; however, given the conventional use of the term "transaction" in blockchain technology, this embodiment of the invention follows this convention.
[0034] 2) A block is a data structure that records the ledger data updated by the exchange within a certain period of time. It is marked with a timestamp and a unique identifier of the previous block (such as a digital fingerprint). After the block is verified by the consensus of the nodes in the blockchain network, it will be appended to the end of the blockchain to become a new block.
[0035] 3) Blockchain is a chain-like data structure where blocks are linked sequentially. Each block references the hash value of the previous block or a subset thereof, thus cryptographically ensuring the immutability and unforgeability of recorded transactions. Blockchains include public blockchains, consortium blockchains, and private blockchains. Consortium blockchains are partially decentralized, controlled by multiple centers where a few authoritative institutions jointly maintain a distributed ledger. Compared to public blockchains, consortium blockchains offer more efficient concurrency handling, require fewer blocks, and have faster on-chain speeds.
[0036] 4) A blockchain network is a set of decentralized nodes that incorporate new blocks into the blockchain through consensus.
[0037] 5) Ledger: The sum of data recorded in a blockchain network at the account level, including ledger data, ledger status, ledger status proof, and block index.
[0038] 6) Ledger data, the actual block data storage, is a series of orderly and tamper-proof records of transactions in the blockchain. It can be represented as a file in a file system. When the smart contract called in the transaction is executed, it updates the account / data in the account.
[0039] 7) Ledger state, also known as state data, refers to the state of the ledger data. It can be represented in the form of key-value pairs in a database. Real-time ledger state is used to represent the latest record of key-value pairs updated by the consensus exchange, while historical ledger state is used to represent the historical record of key-value pairs.
[0040] 8) Consensus is a process in a blockchain network used to reach an agreement on the transaction results among multiple nodes involved. Mechanisms for achieving consensus include Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof-of-Stake (DPoS), and Proof of Elapsed Time (PoET).
[0041] 9) Smart Contracts, also known as Chaincode, are programs deployed in a blockchain network that are triggered to execute based on conditions. They are used to manipulate the ledger by querying, adding, and modifying data to enable querying or updating the ledger.
[0042] The following describes an exemplary functional architecture of the blockchain network service platform implementing embodiments of the present invention. See [link to documentation]. Figure 1 , Figure 1 The functional architecture diagram of the blockchain network service platform provided in this embodiment of the invention is shown. The blockchain network service platform 100 includes a resource layer 110, a block layer 120, a service layer 130, an interface layer 140, and an application layer 150, which will be described below.
[0043] Resource layer 110 encapsulates various forms of resources on the machine, such as computing resources, storage resources, and network resources, for developers to deploy blockchain networks according to business needs. The types of resources can include various machines, such as physical hosts, servers, or clusters, or virtual machines such as public clouds or private clouds, or both.
[0044] Computing resources include various forms of processors, such as central processing units (CPUs), application-specific integrated circuits (ASICs), application-specific integrated circuits (ASICs), and various forms of field-programmable gate arrays (FPGAs).
[0045] Storage resources include various types of storage media, such as volatile and non-volatile memories. Non-volatile memories can be read-only memory (ROM) or programmable read-only memory (PROM). Volatile memories can be random access memory (RAM), which is used for external cache.
[0046] Network resources include various chips used to implement wired / wireless network communication, such as wired communication processors and wireless communication processors.
[0047] Resource layer 110 is constructed as a cluster of nodes running containers by deploying a management system with container clusters (e.g., Kubernetes). This shields the differences in the underlying resources of resource layer 110 and provides a unified interface to the outside world, thus eliminating the need for various complex calls. Applications of the blockchain network (including various codes that implement the blockchain network) run in isolation in containers. The dependencies of application execution are encapsulated in the containers, so they can be easily scheduled (e.g., when a node fails, or when the application needs to be migrated to a new machine) to run on any node in the cluster.
[0048] Block layer 120 encapsulates different solutions for implementing blockchain networks, such as Hyperledger Fabric, Stellar, Ethereum, and the self-developed JD Chain. These solutions standardize the architecture for implementing blockchain networks and the mechanisms for achieving consensus. In the blockchain network service platform 100, these solutions can be provided in the way of applications in the application store to support developers to quickly deploy them according to their needs.
[0049] Service layer 130 encapsulates various services of the blockchain network service platform. Featured services include rapid deployment of the blockchain network, account authentication, enterprise deployment, unified authentication, microservices, and development interfaces; contract management includes upload verification, contract deployment, contract upgrade, contract list, contract library, and contract templates; monitoring and maintenance includes node management, service upgrade, transaction management, block browsing, account auditing, and account management.
[0050] Interface layer 140 provides developers with ways to access the blockchain network service platform 100 for deployment and management of the blockchain network, including web-based access via a developer's browser and embedding software development kits (SDKs) / application program interfaces (APIs) in the client.
[0051] Application layer 150 encapsulates applications that support different businesses (including traceability, public welfare, evidence storage, electronic invoices, movable property valuation, transaction calculation, and digital copyright, etc.). It provides modular and reusable applications in the application store, allowing developers to select and deploy them on the blockchain network according to their needs to record various data generated in different business processes.
[0052] See Figure 2 , Figure 2This is a schematic diagram of an electronic device 200 provided in this application accessing a blockchain network service platform 100 via a network 300. The SDK / Web 220 interface of the electronic device 200 is connected to the corresponding SDK / Web interface of the interface layer 140 in the blockchain network service platform 100, which supports the remote deployment of a blockchain network supporting specific businesses on the local device 200. The management pages of various functions of the blockchain network service platform 100 are displayed in the graphical interface 210 of the electronic device 200.
[0053] See Figure 3 , Figure 3 This is a flowchart illustrating the concurrent data processing method provided in this application, which is applied to... Figure 2 The electronic device 200 shown; the method for processing concurrent data includes the following steps:
[0054] Step 301: The received concurrent transactions are preprocessed by the client node to obtain the transaction proposals corresponding to the concurrent transactions.
[0055] Among them, concurrent transactions need to process the same transaction data, and the transaction proposal corresponding to a concurrent transaction must include at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transaction. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j .
[0056] In this embodiment, after receiving multiple concurrent transactions, the client node in the electronic device preprocesses each concurrent transaction to obtain a transaction proposal corresponding to each transaction. A transaction proposal is a request to perform a certain function on the blockchain, also known as a "transaction request." The preprocessing operation involves the processing operations required to send transaction data to the blockchain. For example, preprocessing operations may include calculating the unsigned plaintext of the transaction data to be processed, calculating signature data and the transaction data to be sent to confirm the signature, obtaining the identity document (ID) of the transaction data to be processed, generating a unique transaction identifier corresponding to the transaction, performing a locking operation on the transaction data to be processed, and starting a listener through the client node.
[0057] In this embodiment, the electronic device preprocesses the received concurrent transactions through a client node to obtain n preprocessed transaction proposals; and verifies the n preprocessed transaction proposals, obtaining the verified transaction proposal as a transaction proposal. Here, n is a preset value, a positive integer. The specific value can be determined by those skilled in the art based on the actual application; for example, optionally, the value of n can be from 5 to 20.
[0058] For example, a user initiates a transaction through an electronic device, and the transaction can be an object in the following format:
[0059] {
[0060] user-id:"1234567891231",
[0061] timestamp:1398250549123
[0062] tx-data:tx-data
[0063] }
[0064] Here, `user-id` represents the user identifier, `timestamp` represents the transaction timestamp, and `tx-data` represents the transaction content of the current transaction. The transaction content includes transaction data and transaction value. The client node in the electronic device preprocesses the object in the above format to obtain the transaction proposal corresponding to the transaction. For example, the transaction proposal can be in the following format:
[0065] {
[0066] user-id:"1234567891231",
[0067] timestamp:1398250549123
[0068] tx-data-key:key1,
[0069] tx-data-value:value1,
[0070] lock-id:l1,
[0071] transaction-id:”1231231”,
[0072] }
[0073] In this dataset, user-id represents the user identifier, timestamp represents the transaction timestamp, tx-data-key represents the transaction data identifier, tx-data-value represents the transaction value corresponding to the transaction, lock-id represents the lock identifier, and transaction-id represents the transaction identifier corresponding to the transaction. The tx-data-key and tx-data-value are obtained by analyzing the transaction content (tx-data) of the current transaction.
[0074] Step 302: Create a transaction proposal P through the accounting node. i key-value pairs (k, v) i ).
[0075] Where k represents the identifier of the transaction data, v i The value representing transaction i.
[0076] In this embodiment, the ledger node, or peer node, refers to a type of node in a blockchain network responsible for verifying and storing block data. Simultaneously, smart contracts can also be installed and executed on peer nodes to perform read and write operations on the ledger.
[0077] In this embodiment of the application, transaction proposal P i The transaction node uses an identifier k to identify the transaction data. Based on this identifier k, it determines the transaction data and the transaction value corresponding to the first transaction i to be responded to in the concurrent transactions. For example, the ledger node determines that transaction i modifies transaction data, such as Amy's account information, according to the transaction value, for example, Amy receiving a transfer of 10 yuan. Further, the ledger node creates a transaction proposal P. i key-value pairs (k, v) i For example, (Amy, 10), and store it in a non-state database.
[0078] For example, the status database can be Redis. The identifier of the transaction data stored in Redis and the transaction value corresponding to transaction i constitute a key-value pair. The identifier of the transaction data (i.e., the key value) includes the last N digits of the customer identifier (customer number, customer ID, customer number) + customer identifier + transaction date. The last N digits of the customer identifier realize the discreteness of the transaction data. N is a positive integer, and the value of N can be determined according to empirical requirements. N can be equal to 4.
[0079] Step 303: Create a transaction proposal P through the ledger node. j The composite key-value pair ((k,d),v j ).
[0080] Where d represents the transaction identifier corresponding to transaction j, v j The transaction value corresponding to transaction j.
[0081] Among them, the transaction proposal P j View as a business proposal P i The collection of all subsequent business proposals.
[0082] In this embodiment of the application, transaction proposal P jThe transaction node contains an identifier k for the transaction data and a transaction identifier (e.g., Tx2) corresponding to transaction j, which is different from the first responded transaction i. The ledger node determines the transaction data based on the identifier k and determines the transaction value corresponding to transaction j. For example, the ledger node determines that transaction j modifies the transaction data, such as Amy's account information, according to the transaction value, for example, Amy receiving a transfer of 10 yuan. Further, the ledger node creates a transaction proposal P. j key-value pairs ((k,d),v) j For example, ((Amy, Tx2), 10), and store them in the state database. It should be noted that related technologies handle at least two conflicting transactions using key-value pairs. However, when the key-value pairs of conflicting transactions are stored in the state database, some transactions are found to be invalid and are not updated, while others are tagged as "invalid transactions" and added to the blockchain. This application introduces a composite key-value pair approach, which ensures that multiple conflicting transactions are successfully processed and the database is updated, thus improving efficiency.
[0083] For example, the state database can be Redis. The identifier of the transaction data stored in Redis and the transaction value corresponding to transaction i constitute a composite key-value pair. The identifier of the transaction data, i.e., the composite key value, includes the last N digits of the customer identifier (customer number, customer ID, customer number) + customer identifier + transaction date + transaction identifier. The last N digits of the customer identifier realize the discreteness of the transaction data, and the transaction identifier realizes the uniqueness of the transaction. N is a positive integer, and the value of N can be determined according to empirical requirements. N can be equal to 4.
[0084] Step 304: Process key-value pairs (k, v) according to the processing order of concurrent transactions through the ledger nodes. i The corresponding transaction i.
[0085] In this embodiment of the application, transaction proposal P i In the proposal P j Previously processed. Transaction proposal P j For the proposal P i The subsequent set of transaction proposals I, the processing order of transaction proposals in I is determined by the holding state of the lock tokens of the transactions.
[0086] In some embodiments, transaction proposal P j For the proposal P i The subsequent set of transaction proposals I is determined by the size of the timestamp corresponding to the time the transaction was initiated.
[0087] In this embodiment of the application, the accounting node processes key-value pairs (k, v) iFor transaction i, obtain the transaction result corresponding to transaction i, append the block containing the transaction result to the local blockchain, and modify the world state.
[0088] Step 305: If transaction i has been processed, process the composite key-value pair ((k,d),v). j The corresponding transaction j is recorded, and the transaction results of the concurrent transactions are written to the blockchain.
[0089] In this embodiment of the application, the accounting node processes the key-value pair (k,v) i After the corresponding transaction i, process the composite key-value pair ((k,d),v) according to the processing order. j For the corresponding transaction j, obtain the transaction result corresponding to transaction j, append the block containing the transaction result to the local blockchain, and modify the world state.
[0090] The concurrent data processing method provided in this application preprocesses the received concurrent transactions through the client node to obtain the transaction proposals corresponding to the concurrent transactions; wherein, the concurrent transactions are processing the same transaction data, and the transaction proposals corresponding to the concurrent transactions include at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ; Create transaction proposals P through ledger nodes i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, v i Represent the transaction value corresponding to transaction i; create a transaction proposal P through the ledger node. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, v j Represents the transaction value corresponding to transaction j; the key-value pair (k, v) is processed by the ledger node according to the processing order of concurrent transactions. i The corresponding transaction i; after transaction i is processed, the composite key-value pair ((k,d),v) is processed through the ledger node. jThe corresponding transaction j is written to the blockchain through the ledger node. In other words, this application introduces a composite key-value pair approach for concurrent transactions, solving the problem in related technologies where some transactions fail to modify the same data in the ledger when multiple transactions are initiated simultaneously, leading to low write efficiency in concurrent scenarios. This ensures that every concurrent transaction is successfully processed, reducing the amount of invalid transactions and improving the efficiency of electronic devices in processing transactions. Furthermore, by effectively handling all transactions in conflicting situations, the performance of the Hyperledger Fabric blockchain platform in high-concurrency scenarios is improved, accelerating the commercialization of blockchain technology.
[0091] See Figure 4 , Figure 4 This is a flowchart illustrating the concurrent data processing method provided in this application, which is applied to... Figure 2 The electronic device 200 shown; the method for processing concurrent data includes the following steps:
[0092] Step 401: Obtain the identifier k of the transaction data through the client node.
[0093] Step 402: Generate the transaction identifier corresponding to each transaction in the concurrent transactions.
[0094] Step 403: Based on the identifier of the transaction data and the transaction identifier corresponding to each transaction, generate a transaction proposal corresponding to each transaction.
[0095] Among them, concurrent transactions need to process the same transaction data, and the transaction proposal corresponding to a concurrent transaction must include at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transaction. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j .
[0096] In this embodiment, if a client node receives at least two concurrent transactions, the client node obtains the transaction data to be processed by the at least two concurrent transactions and generates a transaction identifier for each concurrent transaction. The client node performs a locking operation on the transaction data, generating a lock identifier corresponding to the transaction data. Then, the client node determines from the at least two concurrent transactions that the first concurrent transaction has successfully locked the transaction data, and obtains the transaction proposal P corresponding to the first concurrent transaction through the accounting node based on the identifier of the transaction data and the transaction value of the first concurrent transaction. i Here, the first concurrent transaction is the first transaction i to be responded to among concurrent transactions. After the transaction data is locked, the ledger node obtains the transaction proposal P corresponding to the remaining transactions based on the transaction data identifier, the transaction identifiers of the remaining transactions, and the transaction values of the remaining transactions. jHere, the first concurrent transaction and the remaining transactions constitute at least two concurrent transactions. Transaction proposal P j This is the set of all transaction proposals corresponding to the remaining transactions.
[0097] In some embodiments, when a client node receives a transaction, it obtains the transaction data to be processed for that transaction and generates a transaction identifier for that transaction. When the client node detects a lock identifier in the transaction data, it obtains the transaction proposal P corresponding to the remaining transactions based on the identifier of the transaction data, the transaction identifier of that transaction, and the transaction value of that transaction. j .
[0098] In other embodiments, when a client node receives a transaction, it obtains the transaction data to be processed and generates a transaction identifier for that transaction. When the client node detects that the transaction data does not have a lock identifier (i.e., the transaction data is not occupied / locked by other transactions), it performs a locking operation on the transaction data, generating a lock identifier for the transaction data. The accounting node then obtains the transaction proposal P corresponding to the transaction based on the transaction identifier and the transaction value. i .
[0099] Step 404: The client node determines that the transaction data corresponding to the identifier k of the transaction data is locked, and calls the listening interface function through the client node to listen to the processing progress of concurrent transactions.
[0100] In this embodiment, the client node performs a locking operation on the transaction data corresponding to the identifier k of the transaction data, generating a lock identifier for the transaction data. For example, the identifier k of the transaction data is used as the Redis key. If the client node detects multiple concurrent transactions with the same transaction data, for any one of these concurrent transactions, the client node inserts the value of the identifier k of the transaction data into Redis. If the identifier k of the transaction data is successfully inserted into Redis, a True response is returned, indicating that the current transaction has successfully locked the transaction data and obtained the corresponding lock identifier. If the identifier k of the transaction data is not successfully inserted into Redis, a False response is returned, indicating that the transaction data is being operated on by another transaction, and the locking has failed. It should be noted that this application utilizes a locking mechanism to enable conflicting transactions to be detected at the beginning of the transaction process, optimizing the performance of the Hyperledger Fabric blockchain platform in handling concurrent conflicts. Furthermore, the locking mechanism implemented using Redis minimizes the impact of high-speed data storage on the time overhead of electronic devices processing data.
[0101] In this embodiment, the client node performs Redis locking on the transaction data. If the lock is successfully acquired, the accounting node can then process the key-value pair (k, v) corresponding to transaction i. iThe electronic device's accounting node processes key-value pairs (k, v). i When dealing with transaction i, the transaction data is locked first. Only after the lock is successfully locked will transaction i be responded to, in order to prevent concurrent modification of the transaction data.
[0102] In this embodiment, the client node determines that the transaction data corresponding to the identifier k is locked. The client node then calls a listening interface function to start a listener, which monitors the processing progress of concurrent transactions, specifically when the transaction data is successfully written to the blockchain. Furthermore, if the listener detects that the transaction (ledger data) has been written to a block, the identifier can be unlocked.
[0103] In this embodiment, the ChannelEventHub listening interface provided by Hyperledger Fabric is used. Transaction processing in Hyperledger Fabric is a lengthy process; therefore, applications must design their transaction lifecycle handling asynchronously. This application primarily uses the registerTxEvent interface to register specific transaction events to listen to the transaction flow. When an electronic device receives and responds to concurrent transactions, the client node automatically registers a transaction listener and returns a specific sequence number as the listener's identifier. After the listener detects that a concurrent transaction has been written to the blockchain, the listener will call the listening interface function to unlock the lock identifier corresponding to the transaction.
[0104] In this embodiment of the application, the processing progress of concurrent transactions includes whether the ledger data corresponding to the concurrent transaction has been successfully written into the blockchain, and whether the ledger data corresponding to the concurrent transaction has not been successfully written into the blockchain.
[0105] Step 405: Determine the transaction proposal P through the accounting node. i There is no lock identifier l corresponding to the identifier k of the transaction data. A transaction proposal P is created through the ledger node. i key-value pairs (k, v) i ).
[0106] Where k represents the identifier of the transaction data, v i The value representing transaction i.
[0107] In this embodiment of the application, after the client node generates the transaction proposal corresponding to each transaction, such as transaction proposal P... i and business proposal P j Regarding the proposal P i The client node generates transaction proposal P i Then, the proposal P will be submitted. iThe identifier k of the transaction data is passed to the ledger node, which then needs to determine the transaction proposal P. i The key-value pair is generated by determining whether the transaction data identifier k contains the corresponding lock identifier l. The ledger node determines the transaction proposal P. i If there is no lock identifier l corresponding to the identifier k of the transaction data, create a transaction proposal P. i key-value pairs (k, v) i ).
[0108] Step 406: Determine the transaction proposal P through the accounting node. j The lock identifier l corresponding to the identifier k of the transaction data exists, and a transaction proposal P is created through the ledger node. j The composite key-value pair ((k,d),v j ).
[0109] Where d represents the transaction identifier corresponding to transaction j, v j The value representing transaction j.
[0110] In this embodiment of the application, after the client node generates the transaction proposal corresponding to each transaction, such as transaction proposal P... i and business proposal P j Regarding the proposal P j The client node generates transaction proposal P j Then, the proposal P will be submitted. j The transaction data identifier k and the corresponding ownership identifier l are transmitted to the ledger node, which then needs to determine the transaction proposal P. j The key-value pair is generated by determining whether the transaction data identifier k contains the corresponding lock identifier l. The ledger node determines the transaction proposal P. j The lock identifier l corresponding to the identifier k of the transaction data exists, and a transaction proposal P is created through the ledger node. j The composite key-value pair ((k,d),v j ).
[0111] It should be noted that while this application utilizes a locking mechanism to detect invalid transactions with concurrent conflicts earlier, users still need to re-initiate these transactions, which does not improve the user experience. In other words, when multiple conflicting transactions are initiated simultaneously, only one transaction can successfully update the blockchain ledger, while the others need to be re-initiated. Therefore, this application optimizes the index storage method of the blockchain ledger database by adopting a composite database pair to avoid concurrent conflicts.
[0112] Step 407: Record transaction proposal P through the ledger node. i key-value pairs (k, v) i ) and business proposal P jThe composite key-value pair ((k,d),v j (to endorse)
[0113] In this embodiment, the ledger node generates key-value pairs corresponding to transaction data, first verifies the signature and determines whether the user has the right to execute the operation, and then endorses all key-value pairs to simulate the execution of the smart contract. Since a transaction can only call one smart contract and sign the simulated result of the call, this process of signing one by one and verifying the signature of each transaction in the block requires the ledger node to separately sign the transaction proposal P. i key-value pairs (k, v) i ), and proposal P j The composite key-value pair ((k,d),v j The smart contract is executed by simulating endorsement. Finally, the result of the endorsement simulation is sent to the client node.
[0114] Step 408: Record the endorsed transaction proposal P through the ledger node. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Return it to the client node.
[0115] Step 409: Send transaction proposal P through the client node. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Send it to the sorting node.
[0116] In this embodiment, after receiving the endorsement results for each transaction proposal from the accounting node, the client node determines whether the endorsement results of each transaction proposal are consistent and verifies whether each transaction proposal is executed in accordance with the specified endorsement strategy. If each transaction proposal does not have sufficient endorsements, processing is aborted; otherwise, the client node releases the transaction proposal P. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j They are packaged together to form a transaction, signed, and sent to the sorting node.
[0117] Step 410: Generate the processing order of concurrent transactions by sorting nodes.
[0118] In this embodiment, the sorting node can determine the processing order of each transaction based on the holding status of the lock identifier of the transaction; or it can determine the processing order of each transaction based on the size of the timestamp corresponding to the time when the transaction was initiated; this application does not impose any limitations on this.
[0119] Step 411: Based on the processing order, the sorting nodes package the key-value pairs of the transaction proposals corresponding to concurrent transactions into a new block, and send the packaged new block to the accounting nodes through the sorting nodes.
[0120] In this embodiment of the application, the sorting node sorts the received transaction proposal P. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Consensus is established, and the key-value pairs of transaction proposals corresponding to concurrent transactions are packaged together to generate a new block, which is then sent to the ledger node.
[0121] Step 412: Determine the transaction proposal P through the accounting node. i There is no lock identifier l corresponding to the identifier k of the transaction data. The key-value pair (k, v) is transferred through the ledger node. i It is saved to the blockchain's state database to update the ledger.
[0122] Step 413: Determine the transaction proposal P through the accounting node. j The lock identifier l corresponding to the identifier k of the transaction data exists in the ledger node, and the composite key-value pair ((k,d),v) is transferred through the ledger node. j It is saved to the blockchain's state database to update the ledger.
[0123] In this embodiment, after determining the processing order of concurrent transactions, the ledger node processes the transaction proposals corresponding to the concurrent transactions sequentially. Because transaction proposal P... i and business proposal P j Generate different key-value pairs, i.e., transaction proposal P i The corresponding key-value pairs (k, v) i ), Transaction Proposal P j The corresponding composite key-value pair ((k,d),v) j Therefore, the ledger node needs to determine whether the transaction proposal contains the lock identifier l corresponding to the identifier k of the transaction data, and thus determine which key-value pair will be written to the blockchain's state database. The transaction proposal P is determined by the ledger node. i There is no lock identifier l corresponding to the identifier k of the transaction data. The key-value pair (k, v) is transferred through the ledger node. i The transaction proposal P is saved to the blockchain's state database to update the ledger. The transaction proposal P is determined by the accounting nodes. j The lock identifier l corresponding to the identifier k of the transaction data exists in the ledger node, and the composite key-value pair ((k,d),v) is transferred through the ledger node. jThe data is saved to the blockchain's state database to update the ledger. Clearly, this application optimizes the indexing method of related technologies by using composite key-value pairs, ensuring that each concurrent transaction's corresponding key-value pair is effectively stored in the database—a reasonable storage strategy. This prevents multiple invalid key-value pairs from appearing in the database, reducing the storage overhead of electronic devices. Simultaneously, it employs a database indexing method and modifies the storage method for conflicting transactions, allowing them to be temporarily stored in the database without affecting the execution of other transactions.
[0124] Step 414: If the transaction results corresponding to the concurrent transactions representing the processing progress are written to the blockchain, the client node calls the listening interface function to unlock the transaction data and release the listening interface function.
[0125] In this embodiment, if the listening interface function detects that the processing progress of a concurrent transaction is such that the transaction result corresponding to the concurrent transaction has been written to the blockchain (i.e., the transaction (ledger data) has been written to a block), the client node calls the listening interface function, passing the lock identifier l corresponding to the transaction data as a parameter to unlock the transaction data. For example, the lock identifier l corresponding to the transaction data is passed as a parameter to check if the lock exists. If it exists, the lock identifier l can be deleted from Redis. Finally, the listening interface function is released, i.e., the listener is closed.
[0126] In this embodiment of the application, after the transaction data is successfully written to the blockchain, the electronic device will periodically update ((k,d),v) j Securely interact with (k,v) via smart contracts i The merged files will be removed. Updates can be scheduled daily or weekly.
[0127] In some embodiments, for a proposal initiated by a client node, only one piece of data in the state database is modified, i.e., transaction T generates proposal P, which corresponds to the key-value pair (k,v) in the state database. If two transactions T are initiated simultaneously... i and T j This will generate two proposals P. i and P j , corresponding to the corresponding key-value pair (k i ,v i ) and (k j ,v j If k i =k jThis is a case of concurrent conflict. To effectively avoid conflicts and ensure the successful execution of both proposals, we optimized the database indexes. For conflicting transactions, we transformed (k,v) into ((k,d),v), where (k,d) is a composite key generated from k and d, and d represents the transaction ID. This is a randomly generated unique identifier. For transaction T... i and T j Without losing generality, we assume that in T j Previously processed T i Then (k) j ,v j ) changed to (k j ',v j ), where k j ' indicates a compound bond (k j ,d j Therefore, k j and k j 'They are not equal, so trade T at this time' i and T j All of these can be successfully updated into the blockchain ledger, thus avoiding concurrent conflicts.
[0128] See Figure 5 , Figure 5 This is a flowchart illustrating the concurrent data processing method provided in this application, which is applied to... Figure 2 The electronic device 200 shown includes a client node, a peer node, and an orderer node. The method for processing concurrent data includes the following steps:
[0129] Step 501: The Client node receives concurrent transactions.
[0130] Step 502: The Client node preprocesses concurrent transactions;
[0131] Step 503: The Client node determines whether the transaction data is locked; if the transaction data is not locked, proceed to step 504. If the transaction data is not locked, proceed to step 505.
[0132] Step 504: The Client node locks the transaction data and executes step 505.
[0133] Step 505: Start the listener on the Client node.
[0134] Step 506: The Client node creates a proposal and sends it to the Peer node.
[0135] Step 507: Peer nodes generate key-value pairs based on the proposal; for example, generating key-value pairs (k,v) and (k',v). Here, k' is a composite key composed of (k,d). k represents the identifier of the transaction data, v represents the transaction value corresponding to the transaction, and d represents the transaction identifier corresponding to the transaction.
[0136] Step 508: Peer nodes endorse the proposal to obtain the proposal result.
[0137] Step 509: The Peer node sends the proposal results to the Client node, and the Client node collects the proposals.
[0138] Step 510: The Client node sends the collected proposals to the Orderer node, and the Orderer node sorts the proposals.
[0139] Step 511: The Orderer node sends the sorted proposals to the Peer nodes, and the Peer nodes verify the proposals.
[0140] Step 512: Peer nodes store the key-value pairs in the proposal to the state database and update the ledger.
[0141] Step 513: After the Client node detects that the transaction data corresponding to the transaction has been successfully written to the blockchain, it closes the listener and unlocks the transaction data.
[0142] Step 514: Peer nodes periodically update key-value pairs in the state database, for example, changing (k',v) to (k,v).
[0143] Based on the foregoing embodiments, this application provides a concurrent data processing platform, which can be applied to... Figure 3 , Figure 4 In the concurrent data processing method provided in the corresponding embodiment, refer to Figure 6 As shown, the concurrent data processing platform 6 includes:
[0144] Client node 601 is used to preprocess the received concurrent transactions to obtain the transaction proposals corresponding to the concurrent transactions. The concurrent transactions involve the same transaction data, and each transaction proposal includes at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ;
[0145] Ledger node 602 is used to create transaction proposal P. i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, vi Represents the transaction value corresponding to transaction i;
[0146] Ledger node 602 is also used to create transaction proposals P. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, v j This represents the transaction value corresponding to transaction j;
[0147] Ledger node 602 is also used to process key-value pairs (k, v) according to the processing order of concurrent transactions. i The corresponding transaction i;
[0148] Ledger node 602 is also used to process composite key-value pairs ((k,d),v) after transaction i has been processed. j The corresponding transaction j is recorded, and the transaction results of the concurrent transactions are written to the blockchain.
[0149] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0150] Client node 601 is used to obtain the identifier k of the transaction data;
[0151] Client node 601 is also used to generate the transaction identifier corresponding to each transaction in concurrent transactions;
[0152] Client node 601 is also used to generate a transaction proposal for each transaction based on the identifier of the transaction data and the transaction identifier corresponding to each transaction.
[0153] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0154] Client node 601 is used to determine that the transaction data corresponding to the identifier k of the transaction data is locked, and calls the listening interface function to listen to the processing progress of concurrent transactions;
[0155] Client node 601 is also used to write the transaction results corresponding to concurrent transactions that represent the processing progress to the blockchain, call the listening interface function to unlock the transaction data, and release the listening interface function.
[0156] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0157] Ledger node 602 is used to determine transaction proposal P. i If there is no lock identifier l corresponding to the identifier k of the transaction data, create a transaction proposal P. i key-value pairs (k, v) i ).
[0158] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0159] Ledger node 602 is used to determine transaction proposal P. j The lock identifier l corresponding to the identifier k of the transaction data exists, and a transaction proposal P is created through the ledger node. j The composite key-value pair ((k,d),v j ).
[0160] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0161] Ledger node 602 is used for transaction proposal P. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j To endorse;
[0162] Ledger node 602 is also used to post the endorsed transaction proposal P i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Returned to the client node;
[0163] Client node 601 is used to transmit transaction proposal P i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Send it to the sorting node;
[0164] Sorting node 603 is used to generate the processing order of concurrent transactions;
[0165] The sorting node 603 is also used to package the key-value pairs of transaction proposals corresponding to concurrent transactions into new blocks based on the processing order, and send the packaged new blocks to the accounting nodes through the sorting node.
[0166] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0167] Ledger node 602 is used to determine transaction proposal P. i There is no lock identifier l corresponding to the identifier k of the transaction data. The key-value pair (k, v) is transferred through the ledger node. i It is saved to the blockchain's state database to update the ledger.
[0168] In other embodiments of this application, the concurrent data processing platform 6 further includes:
[0169] Ledger node 602 is used to determine transaction proposal P through the ledger node. j The lock identifier l corresponding to the identifier k of the transaction data exists in the ledger node, and the composite key-value pair ((k,d),v) is transferred through the ledger node. j It is saved to the blockchain's state database to update the ledger.
[0170] It should be noted that the specific implementation process of the steps executed by client node 601, accounting node 602, and sorting node 603 in this embodiment can be referred to Figure 3 , Figure 4 The implementation process of the concurrent data processing method provided in the corresponding embodiment will not be described in detail here.
[0171] This application provides an electronic device that can be applied to... Figure 3 , Figure 4 In a corresponding embodiment of a concurrent data processing method, referring to Figure 7 As shown, the electronic device 200 includes: a processor 701, a memory 702, and a communication bus 703, wherein:
[0172] The communication bus 703 is used to realize the communication connection between the processor 701 and the memory 702.
[0173] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0174] The client node preprocesses the received concurrent transactions to obtain the corresponding transaction proposals. Since the concurrent transactions involve the same data, each transaction proposal must include at least the transaction proposal P corresponding to the first transaction i to be responded to in the concurrent transactions. i And the transaction proposal P corresponding to transaction j, which is different from transaction i. j ;
[0175] Create a transaction proposal P through the ledger node. i key-value pairs (k, v) i ); where k represents the identifier of the transaction data, v i Represents the transaction value corresponding to transaction i;
[0176] Create a transaction proposal P through the ledger node. j The composite key-value pair ((k,d),v j ); where d represents the transaction identifier corresponding to transaction j, v j This represents the transaction value corresponding to transaction j;
[0177] The ledger nodes process key-value pairs (k, v) according to the order in which concurrent transactions are processed. i The corresponding transaction i;
[0178] Once transaction i is completed, the composite key-value pair ((k,d),v) is processed through the ledger node. j The corresponding transaction j is recorded, and the transaction results corresponding to the concurrent transactions are written to the blockchain through the ledger node.
[0179] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0180] Obtain the identifier k of the transaction data through the client node;
[0181] Generate a transaction identifier for each transaction in the concurrent transactions;
[0182] Based on the identifiers in the transaction data and the corresponding transaction identifiers for each transaction, a transaction proposal is generated for each transaction.
[0183] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0184] The client node determines that the transaction data corresponding to the identifier k is locked, and the client node calls the listening interface function to monitor the processing progress of concurrent transactions.
[0185] If the processing progress indicates that the transaction results corresponding to concurrent transactions are written to the blockchain, the client node calls the listening interface function to unlock the transaction data and release the listening interface function.
[0186] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0187] Transaction proposal P is determined through the accounting node. i There is no lock identifier l corresponding to the identifier k of the transaction data. A transaction proposal P is created through the ledger node. i key-value pairs (k, v) i ).
[0188] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0189] Transaction proposal P is determined through the accounting node. j The lock identifier l corresponding to the identifier k of the transaction data exists, and a transaction proposal P is created through the ledger node. j The composite key-value pair ((k,d),v j ).
[0190] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0191] Through the ledger node, the transaction proposal P is processed. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j To endorse;
[0192] The endorsed transaction proposal P is recorded through the ledger node. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Returned to the client node;
[0193] The transaction proposal P is transmitted through the client node. i key-value pairs (k, v) i ) and business proposal P j The composite key-value pair ((k,d),v j Send it to the sorting node;
[0194] The processing order of concurrent transactions is generated by sorting nodes;
[0195] Based on the processing order, the sorting nodes package the key-value pairs of the transaction proposals corresponding to concurrent transactions into new blocks, and then send the packaged new blocks to the accounting nodes.
[0196] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0197] Transaction proposal P is determined through the accounting node. i There is no lock identifier l corresponding to the identifier k of the transaction data. The key-value pair (k, v) is transferred through the ledger node. i It is saved to the blockchain's state database to update the ledger.
[0198] The processor 701 is used to execute a processing program for concurrent data stored in the memory 702 to perform the following steps:
[0199] Transaction proposal P is determined through the accounting node. j The lock identifier l corresponding to the identifier k of the transaction data exists in the ledger node, and the composite key-value pair ((k,d),v) is transferred through the ledger node. j It is saved to the blockchain's state database to update the ledger.
[0200] It should be noted that the specific implementation process of the steps executed by the processor in this embodiment can be referred to Figure 3 , Figure 4The implementation process of the concurrent data processing method provided in the corresponding embodiment will not be described in detail here.
[0201] Based on the foregoing embodiments, embodiments of this application provide a computer-readable storage medium that stores one or more applications, which can be executed by one or more processors to achieve, as Figure 3 , Figure 4 The corresponding implementation provides a method for processing concurrent data.
[0202] It should be noted that the aforementioned computer-readable storage media can be ROM, PROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Ferromagnetic Random Access Memory (FRAM), Flash Memory, Magnetic Surface Memory, Optical Disc, or Compact Disc Read-Only Memory (CD-ROM), etc.; or it can be various electronic devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0203] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0204] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0205] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0206] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer application products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer application instructions. These computer application instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0207] These computer application instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0208] These computer application instructions can also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0209] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method of processing data in parallel, characterized by, The method includes: The client node preprocesses the received concurrent transactions to obtain the corresponding transaction proposals; wherein the concurrent transactions are initiated simultaneously to process the same data in the ledger, and the corresponding transaction proposals include at least the first transaction among the concurrent transactions to be responded to. Corresponding transaction proposals and the transaction Different transactions Corresponding transaction proposals ; The client node determines the identifier of the transaction data. The corresponding transaction data is locked, and the client node calls the listening interface function to monitor the processing progress of the concurrent transactions; The transaction proposal is created through the ledger node. key-value pairs ; wherein, the The identifier representing the transaction data, the Characterizing the transaction The corresponding transaction value; The transaction proposal is created through the accounting node. Composite bond pairs ; wherein, the Characterizing the transaction The corresponding transaction identifier, the Characterizing the transaction The corresponding transaction value; The ledger node processes the key-value pairs according to the processing order of the concurrent transactions. Corresponding transactions ; In the transaction Once processing is complete, the composite key-value pair is processed through the accounting node. The corresponding transaction The transaction results corresponding to the concurrent transactions are written into the blockchain through the accounting node. If the processing progress indicates that the transaction result corresponding to the concurrent transaction is written into the blockchain, the client node calls the listening interface function to unlock the transaction data and release the listening interface function.
2. The method according to claim 1, characterized in that, The step of preprocessing the received concurrent transactions through the client node to obtain the transaction proposal corresponding to the concurrent transactions includes: The identifier of the transaction data is obtained through the client node. ; Generate a transaction identifier corresponding to each transaction in the concurrent transactions; Based on the identifier of the transaction data and the transaction identifier corresponding to each transaction, a transaction proposal corresponding to each transaction is generated.
3. The method according to claim 1, characterized in that, The transaction proposal is created through the ledger node. key-value pairs ,include: The transaction proposal is determined through the accounting node. The identifier for the transaction data does not exist in the database. Corresponding lock identifier The transaction proposal is created through the ledger node. key-value pairs .
4. The method according to claim 1, characterized in that, The transaction proposal is created through the accounting node. Composite bond pairs ,include: The transaction proposal is determined through the accounting node. The identifier of the transaction data exists in the middle. Corresponding lock identifier The transaction proposal is created through the ledger node. Composite bond pairs .
5. The method according to claim 1, characterized in that, The key-value pairs are processed by the ledger node according to the processing order of the concurrent transactions. Corresponding transactions Previously, the method included: The transaction proposal is processed through the ledger node. key-value pairs and the aforementioned transaction proposal Composite bond pairs To endorse; The endorsed transaction proposal is processed through the accounting node. key-value pairs and the aforementioned transaction proposal Composite bond pairs Returned to the client node; The transaction proposal is transmitted through the client node. key-value pairs and the aforementioned transaction proposal Composite bond pairs Send to the sorting node; The processing order of the concurrent transactions is generated through the sorting node; Based on the processing order, the sorting node packages the key-value pairs of the transaction proposals corresponding to the concurrent transactions into a new block, and then sends the packaged new block to the accounting node.
6. The method according to claim 1, characterized in that, The key-value pairs are processed by the ledger node according to the processing order of the concurrent transactions. Corresponding transactions ,include: The transaction proposal is determined through the accounting node. The identifier for the transaction data does not exist in the database. Corresponding lock identifier The key-value pairs are recorded through the ledger node. Saved to the state database of the blockchain to update the ledger.
7. The method according to claim 1, characterized in that, The transaction Once processing is complete, the composite key-value pair is processed through the accounting node. The corresponding transaction ,include: The transaction proposal is determined through the accounting node. The identifier of the transaction data exists in the middle. Corresponding lock identifier The composite key-value pair is processed through the ledger node. Saved to the state database of the blockchain to update the ledger.
8. A concurrent data processing platform, characterized in that, The concurrent data processing platform includes: A client node is used to preprocess received concurrent transactions to obtain transaction proposals corresponding to the concurrent transactions; wherein the concurrent transactions are initiated simultaneously to request processing of the same data in the ledger, and the transaction proposals corresponding to the concurrent transactions include at least the first transaction among the concurrent transactions that receives a response. Corresponding transaction proposals and the transaction Different transactions Corresponding transaction proposals ; The client node is used to determine the identifier of the transaction data. The corresponding transaction data is locked, and the client node calls the listening interface function to monitor the processing progress of the concurrent transactions; The ledger node is also used to create the aforementioned transaction proposal. key-value pairs ; wherein, the The identifier representing the transaction data, the Characterizing the transaction The corresponding transaction value; The ledger node is also used to create the transaction proposal. Composite bond pairs ; wherein, the Characterizing the transaction The corresponding transaction identifier, the Characterizing the transaction The corresponding transaction value; The ledger node is also used to process the key-value pairs according to the processing order of the concurrent transactions. Corresponding transactions ; The accounting node is also used in the transaction Once processing is complete, process the composite key-value pairs. Corresponding transactions The transaction results corresponding to the concurrent transactions are then written into the blockchain. If the processing progress indicates that the transaction result corresponding to the concurrent transaction is written into the blockchain, the client node is used to call the listening interface function to unlock the transaction data and release the listening interface function.
9. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the concurrent data processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the concurrent data processing method as described in any one of claims 1 to 7.