Transaction processing method, device, equipment and storage medium

By using blockchain technology in the trading system, the decentralized commodity purchase process has solved the problem of high concurrency pressure on the server by online purchase activities, and achieved efficient utilization of resources and system stability.

CN114116888BActive Publication Date: 2024-12-31CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111266167.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2024-12-31
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The high concurrent pressure on the server caused by online rush-up activities to waste resources during non-rush-up activities and may exceed the load cap during rush-up activities, causing system crash.

Method used

By introducing blockchain technology into the trading system, the customer nodes can establish a creation block in response to the central node, generate blocks, and determine the difficulty target value based on the equity value of the customer node, perform hashing operations to generate order information, and mount it to the zone On the blockchain, a decentralized commodity purchase process is implemented to reduce the amount of requests and concurrency to the central node.

Benefits of technology

It reduces the pressure on the central node during the rush to purchase goods, reduces resource waste, ensures the normal participation of the client in the rush to purchase activities, and improves the load capacity of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114116888B_ABST
    Figure CN114116888B_ABST
Patent Text Reader

Abstract

The present disclosure is about a transaction processing method, device, equipment and storage medium, wherein the method includes: the client node establishes a genesis block in response to the central node of the transaction system, generates a first block, and obtains the commodity information carried by the block body of the genesis block; determines the corresponding difficulty target value according to the equity value of the client node; performs a hash operation on the random parameter to solve the target value of the random parameter; when the target value of the random parameter is solved, generates the first order information according to the commodity information and stores the first order information in the first block; mounts the first block on the blockchain where the genesis block is located. In the present disclosure, the central node is only responsible for the access of new client nodes, the establishment of genesis blocks and the synchronization of main chain information, without processing the user's order request, which can reduce the client node's request to the central node and reduce the concurrency, thereby reducing or alleviating the pressure on the central node when the commodity is snapped up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of blockchain technology, and in particular to transaction processing methods, devices, equipment and storage media. Background Art

[0002] With the rapid development of social economy, e-commerce has also developed rapidly and gradually matured. At present, the competition in e-commerce is fierce. In order to attract and retain customers, various marketing activities emerge in an endless stream. For example, online rush buying activities are a relatively effective marketing activity that can attract a large number of customers to participate in the activity. However, online rush buying activities will cause huge concurrency pressure on the online rush buying system. In order to cope with the above high-concurrency online rush buying activities, the system can adopt server-side capacity expansion, load balancing, Redis cache and other means.

[0003] However, the above solutions all rely on the background server. When there is no rush buying activity, there is no high concurrency pressure on the system, that is, the concurrency of the system is not large. In this case, the server resources set up to solve the rush buying activities with high concurrency will be wasted; and in some popular rush buying activities, it is still possible to exceed the system's carrying limit and cause the system to crash.

[0004] Therefore, it is very important to alleviate the high concurrency pressure of rush buying activities on the server. Summary of the invention

[0005] The present disclosure provides a transaction processing method, device, equipment and storage medium to at least solve one of the technical problems in the related art to a certain extent. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a transaction processing method is provided, which is applied to a client node in a transaction system, comprising:

[0007] In response to the central node of the trading system establishing a genesis block, generating a first block, and obtaining commodity information carried in a block body of the genesis block;

[0008] Determine a corresponding difficulty target value according to the equity value of the client node; wherein the equity value is inversely related to the difficulty target value;

[0009] Performing a hash operation on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value;

[0010] When the target value of the random parameter is obtained by solving the calculation, first order information is generated according to the commodity information and the first order information is stored in the first block;

[0011] The first block is mounted on the blockchain where the genesis block is located.

[0012] In a possible implementation of the embodiment of the present disclosure, mounting the first block to the blockchain where the genesis block is located includes:

[0013] Broadcasting the first block to adjacent nodes in the transaction system, so that the adjacent nodes receiving the broadcast verify the first block;

[0014] When the first block is verified, the first block is mounted to the blockchain where the genesis block is located.

[0015] In a possible implementation of the embodiment of the present disclosure, when the target value of the random parameter is obtained by solving the calculation, before generating order information according to the commodity information and storing the order information in the first block, the method further includes:

[0016] If the target value of the random parameter is not obtained by solving, the solving is suspended if the second block broadcasted by the neighboring node is received;

[0017] Verifying the second block;

[0018] When the second block is verified and the commodity inventory in the second order information stored in the second block is not zero, the solution is continued.

[0019] In a possible implementation of the embodiment of the present disclosure, the verifying the second block includes:

[0020] Reading a block header of the second block to obtain a value to be verified obtained by the adjacent node solving the random parameter and a difficulty target value of the second block;

[0021] A hash operation is performed on the to-be-checked value of the random parameter to determine whether a hash value obtained by the hash operation is less than a difficulty target value of the second block.

[0022] In a possible implementation of the embodiment of the present disclosure, the verifying the second block includes:

[0023] When there are at least two second blocks, the block with the longest chain in the blockchain is selected for verification.

[0024] In a possible implementation of the embodiment of the present disclosure, the equity value of the customer node is determined by weighting the customer level of the customer node, the activity of the customer node, and the number of transactions participated in by the customer node.

[0025] In a possible implementation of the embodiment of the present disclosure, determining the corresponding difficulty target value according to the equity value of the client node includes:

[0026] According to the total duration of the most recent round of rush purchases and the length of the blockchain created by the most recent round of rush purchases, the basic difficulty value used in the most recent round of rush purchases is adjusted to determine the basic difficulty value used in this round of rush purchases;

[0027] For any client node, the difficulty target value corresponding to the client node in the current round of rush purchase is determined according to the equity value of the client node and the basic difficulty value adopted in the current round of rush purchase.

[0028] In a possible implementation of the embodiment of the present disclosure, the first block includes a block header and a block body;

[0029] The block header of the first block includes a plurality of combinations of the following: a hash value of a parent block, a hash value of the current block, a timestamp indicating a time when the block was generated, the difficulty target value, a target value of the random parameter, the equity value, and a hash value of a block body of the first block;

[0030] The block body of the first block includes the first order information.

[0031] In a possible implementation of the embodiment of the present disclosure, the first order information includes: commodity information, and at least one of a node address of the client node, a digital signature of the client node, and a public key of the client node;

[0032] The product information includes at least one of a product number, an order timestamp, a total number of products, and product inventory.

[0033] According to a second aspect of an embodiment of the present disclosure, a transaction processing device is provided, which is applied to a client node in a transaction system, including:

[0034] A generating unit, configured to generate a first block in response to a central node of the trading system establishing a genesis block, and obtain commodity information carried in a block body of the genesis block;

[0035] A determination unit, configured to determine a corresponding difficulty target value according to the equity value of the client node; wherein the equity value is in an inverse relationship with the difficulty target value;

[0036] A computing unit configured to perform a hash operation on a random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, a hash value obtained by the hash operation is less than the difficulty target value;

[0037] a storage unit configured to generate first order information according to the commodity information and store the first order information in the first block when the target value of the random parameter is obtained by solving the calculation;

[0038] The mounting unit is configured to mount the first block to the blockchain where the genesis block is located.

[0039] In a possible implementation of the embodiment of the present disclosure, the mounting unit is configured as follows:

[0040] Broadcasting the first block to adjacent nodes in the transaction system, so that the adjacent nodes receiving the broadcast verify the first block;

[0041] When the first block is verified, the first block is mounted to the blockchain where the genesis block is located.

[0042] In a possible implementation of the embodiment of the present disclosure, the device further includes:

[0043] a pausing unit configured to suspend solving if a second block broadcasted by the neighboring node is received when the target value of the random parameter is not solved;

[0044] a verification unit, configured to verify the second block;

[0045] The solving unit is configured to continue solving the problem if the second block is verified and the commodity inventory in the second order information stored in the second block is not zero.

[0046] In a possible implementation of the embodiment of the present disclosure, the verification unit is configured to:

[0047] Reading a block header of the second block to obtain a value to be verified obtained by the adjacent node solving the random parameter and a difficulty target value of the second block;

[0048] A hash operation is performed on the to-be-verified value of the random parameter to determine whether a hash value obtained by the hash operation is less than a difficulty target value of the second block.

[0049] In a possible implementation of the embodiment of the present disclosure, the verification unit is configured to:

[0050] When there are at least two second blocks, the block with the longest chain in the blockchain is selected for verification.

[0051] In a possible implementation of the embodiment of the present disclosure, the equity value of the customer node is determined by weighting the customer level of the customer node, the activity of the customer node, and the number of transactions participated in by the customer node.

[0052] In a possible implementation manner of the embodiment of the present disclosure, the determining unit is configured to:

[0053] According to the total duration of the most recent round of rush purchases and the length of the blockchain created by the most recent round of rush purchases, the basic difficulty value used in the most recent round of rush purchases is adjusted to determine the basic difficulty value used in this round of rush purchases;

[0054] For any client node, the difficulty target value corresponding to the client node in the current round of rush purchase is determined according to the equity value of the client node and the basic difficulty value adopted in the current round of rush purchase.

[0055] In a possible implementation of the embodiment of the present disclosure, the first block includes a block header and a block body;

[0056] The block header of the first block includes a plurality of combinations of the following: a hash value of a parent block, a hash value of the current block, a timestamp indicating a time when the block was generated, the difficulty target value, a target value of the random parameter, the equity value, and a hash value of a block body of the first block;

[0057] The block body of the first block includes the first order information.

[0058] In a possible implementation of the embodiment of the present disclosure, the first order information includes: commodity information, and at least one of a node address of the client node, a digital signature of the client node, and a public key of the client node;

[0059] The product information includes at least one of a product number, an order timestamp, a total number of products, and product inventory.

[0060] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the transaction processing method as described in the above embodiment of the present disclosure.

[0061] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the transaction processing method as described in the above embodiment of the present disclosure.

[0062] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising: a computer program, wherein when the computer program is executed by a processor, the transaction processing method as described in the above embodiment of the present disclosure is implemented.

[0063] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0064] The client node establishes a genesis block in response to the central node of the trading system, generates the first block, and obtains the commodity information carried by the block body of the genesis block; determines the corresponding difficulty target value according to the equity value of the client node; performs a hash operation on the random parameter to solve the target value of the random parameter, wherein, when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value; when the target value of the random parameter is solved, the first order information is generated according to the commodity information and the first order information is stored in the first block; the first block is mounted on the blockchain where the genesis block is located. In the present disclosure, the central node is only responsible for the access of new client nodes, the establishment of genesis blocks and the synchronization of main chain information, without processing the user's order request. The process of rushing to buy goods is "decentralized", which can reduce the client node's request to the central node and reduce the concurrency, thereby reducing or alleviating the pressure on the central node during the rush to buy goods.

[0065] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0067] Figure 1 It is a flowchart of a refined current limiting processing method for rush buying activities in high-concurrency scenarios in related technologies.

[0068] Figure 2 It is a flowchart of a method for optimizing product reservation and rush purchase in related technology.

[0069] Figure 3 It is a flowchart of the transaction processing method shown in the first embodiment of the present disclosure.

[0070] Figure 4 It is a schematic diagram of the structure of the block body in the first embodiment of the present disclosure.

[0071] Figure 5 It is a flowchart of the transaction processing method shown in the second embodiment of the present disclosure.

[0072] Figure 6It is a schematic diagram of the structure of the blockchain in the second embodiment of the present disclosure.

[0073] Figure 7 It is a flowchart of the transaction processing method shown in the third embodiment of the present disclosure.

[0074] Figure 8 Schematic diagram of network discovery and synchronization of new nodes in the fourth embodiment of the present disclosure.

[0075] Fig. 9 It is a structural diagram of the transaction processing device shown in the fifth embodiment of the present disclosure.

[0076] Fig.10 It is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0077] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0078] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0079] Online shopping is a very common marketing activity. The current online shopping system has high requirements for the server side. The reason is that the traditional online shopping system needs a central system to verify the authenticity of the shopping operation transaction and manage the inventory of goods. During the shopping activity, the high concurrency requires high performance of the central system. In order to cope with the impact of high concurrency, the central system needs to be equipped with a large number of server resources. However, during non-shopping activities, the above server resources will be wasted.

[0080] Therefore, it is very important to minimize the number of requests from the client to the server and reduce the concurrency during online shopping activities while ensuring that the client can participate in the shopping activities normally.

[0081] Compared with the traditional centralized system, the decentralized function of blockchain can effectively alleviate the high concurrency pressure on the server caused by the current centralized system's rush-buying model.

[0082] In related technologies, the following solutions are mainly used to alleviate the high concurrency pressure of the rush purchase mode on the server:

[0083] The first method is to perceive the emotional information of the user when watching a video on the first terminal or the second terminal. If the emotional information is that the user likes the product in the video, the purchase information of the product is displayed on the second terminal based on the underlying blockchain service, and the purchase operation is performed after the user chooses to purchase the product.

[0084] However, the first solution mentioned above only uses blockchain to store the purchase information of goods, and does not fully utilize the decentralized function of blockchain, and does not solve the high concurrency problem in online shopping scenarios.

[0085] The second type is that consumers enter the physical store to choose pre-purchased goods, and the shopping guide in the merchant introduces the characteristics of the goods to the consumers. Multiple merchants form an alliance to create a membership card public key chain through a third-party platform. Consumers can obtain the membership card public key chain sent by the third-party platform after spending a certain amount (that is, the consumer information can be entered into the blockchain network, and the blockchain network verifies the consumer information. After the verification is completed, the consumer can obtain the membership card public key chain). Consumers accumulate points in the membership card public key chain to enjoy discount activities of different merchants.

[0086] However, the second solution mentioned above uses blockchain to store consumer information and obtains the public key chain of the membership card through consumption. It is essentially a membership system that relies on a third-party platform to create a public key chain. During large-scale membership activities, there is a concurrency bottleneck problem.

[0087] The third type, such as Figure 1 As shown, you can set up a software load balancing node; set a certain number of tokens for different rush-buying activities and store them in redis; after starting a rush-buying activity, perform the following steps:

[0088] 1) Get the number of people participating in the rush purchase;

[0089] 2) Probabilistic flow control to allow user requests that can access redis;

[0090] 3) Perform token bucket flow control on user requests to access redis and obtain tokens;

[0091] 4) Users who have obtained a token will be subject to a two-second click limit and proceed to step 5), while users who have not obtained a token will be subject to a two-second click limit and execute the above steps 1) to 4);

[0092] 5) Leaky bucket current limiting, forwarding user requests to the real address of the backend;

[0093] 6) The purchase is successful, the product inventory is reduced, and steps 1) to 6) are repeated until the product inventory is zero.

[0094] However, the third solution mentioned above uses current limiting measures (such as probability current limiting, token bucket current limiting, two-second click current limiting, leaky bucket current limiting) that still rely on the server to make logical judgments and require corresponding server resources. When there is no rush buying activity, these server resources are idle, resulting in a waste of resources. During the rush buying activity, even if there is sufficient inventory when the user submits the request, the server will often reject the user's request due to current limiting measures, resulting in a poor user experience. Moreover, after the request is rejected by the server, the user will often re-initiate the request, which increases the pressure on the server.

[0095] Fourthly, in order to improve the purchase success rate of users who have participated in the purchase activity many times but failed to purchase, the purchase order requests of these users can be processed preferentially. Specifically, Figure 2 As shown, a table A can be added to the database, and an opportunity value field Y can be added to table A to save the user data who participated in the rush purchase activity once or more but failed to purchase successfully in table A; synchronize table A in the database to the redis cache library, match the rush purchase page with the user information in the redis cache library, and if the match is successful, calculate the opportunity value of the user who failed to purchase successfully through the formula Y=aX+D, a is a fixed percentage and a positive value, which is set by the system, X is the number of user participations, and D is the number of times the activity is held; sort the successfully matched users from high to low according to their opportunity values, and submit the order rush purchase requests triggered by the successfully matched users in sequence according to the sorting results.

[0096] However, the fourth solution mentioned above gives priority to the order requests of users who have participated in the rush purchase activities many times but failed to purchase. In the first activity, there is a problem of missing user data for unsuccessful purchases, that is, in the first rush purchase activity, there is no user unsuccessful purchase, and the opportunity values ​​of all users are consistent. Secondly, during the rush purchase activity, the server needs to match a large amount of user information and calculate and sort the opportunity values. In the case of too much concurrency, the server may still be unresponsive.

[0097] Therefore, in response to the above-mentioned problems, the present disclosure proposes a transaction processing method, device, equipment and storage medium.

[0098] The transaction processing method, apparatus, device and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0099] Figure 3 It is a flowchart of the transaction processing method shown in the first embodiment of the present disclosure.

[0100] The transaction processing method of the disclosed embodiment may be applied to a client node in a transaction system, and the client node may be a node or client where a client who rushes to buy a product is located.

[0101] like Figure 3 As shown, the transaction processing method may include the following steps S11 to S15.

[0102] In step S11, in response to the central node of the trading system establishing a genesis block, a first block is generated, and commodity information carried in the block body of the genesis block is obtained.

[0103] In the disclosed embodiment, the central node can be a server in the trading system. The central node is only responsible for the access of new client nodes, the establishment of the genesis block and the synchronization of the main chain information, without processing the user's order request. The process of rushing to buy goods is "decentralized", which can reduce the requests of client nodes to the central node and reduce the concurrency, thereby reducing or alleviating the pressure on the central node during the rush to buy goods.

[0104] In the disclosed embodiment, the genesis block refers to the earliest (i.e., first) constructed block in the blockchain.

[0105] In the disclosed embodiment, when a rush to buy a product begins, a genesis block may be created by a central node, and the block body of the genesis block may carry product information, wherein the product information may include product number, total number of products, product inventory and other information.

[0106] In the disclosed embodiment, after the central node of the trading system establishes the genesis block, the client nodes can snap up the goods and generate the first block.

[0107] In step S12, the corresponding difficulty target value is determined according to the equity value of the client node; wherein the equity value and the difficulty target value are inversely related.

[0108] In the embodiment of the present disclosure, the equity value of a customer node can be determined based on at least one of the customer level corresponding to the customer node, the activity level corresponding to the customer node, or the number of transactions participated in (or the number of purchases participated in) corresponding to the customer node.

[0109] In a possible implementation of the embodiment of the present disclosure, the customer level of the customer node, the activity of the customer node and the number of transactions participated in by the customer node may be weighted to obtain a weighted value, which is used as the equity value of the customer node.

[0110] For example, the equity value of a client node can be determined according to the following formula:

[0111] The equity value of the customer node = a×customer level+b×activity+c×number of transactions participated in (or number of purchases participated in);

[0112] Among them, a, b, and c are all weight values, which can be fixed values, or can be dynamically adjusted according to actual application scenarios, and the present disclosure does not impose any restrictions on this.

[0113] In the disclosed embodiment, after determining the equity value of the client node, the difficulty target value corresponding to the client node can be determined according to the equity value of the client node; wherein the equity value and the difficulty target value are inversely related.

[0114] It is understandable that when the customer level corresponding to the customer node is higher, and / or the customer node is more active, and / or the customer node participates in more transactions, it indicates that the customer node is a node corresponding to a customer who frequently purchases goods. In order to stimulate the purchasing desire of such customers, the difficulty value corresponding to such customers purchasing goods can be reduced. Therefore, in the present disclosure, the equity value of the customer node can be inversely related to the difficulty target value, that is, the larger the equity value, the smaller the difficulty target value, and vice versa, the smaller the equity value, the larger the difficulty target value.

[0115] In step S13, a hash operation is performed on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value.

[0116] In the embodiment of the present disclosure, the random parameter is an unknown quantity. A random value can be taken for the random parameter, and a hash operation can be performed on the value to determine whether the hash value obtained by the hash operation is less than the difficulty target value determined in step S12. When the hash value obtained by the hash operation is less than the difficulty target value, the above value can be used as the target value of the random parameter obtained by the solution.

[0117] In step S14, when the target value of the random parameter is obtained by calculation, first order information is generated according to the commodity information, and the first order information is stored in the first block.

[0118] In an embodiment of the present disclosure, when the target value of the random parameter is obtained by solving, it indicates that the customer node obtains the right to purchase the product, and order information can be generated based on the product information, which is recorded as the first order information in the present disclosure, and the first order information can also be stored in the first block.

[0119] The first order information may include product information, and may also include at least one of the node address of the customer node, the digital signature of the customer node and the public key of the customer node, wherein the product information in the first order information may include at least one of the product number, order timestamp, total number of products and product inventory.

[0120] As an example, the first order information may be stored in the block body of the first block, and the structure of the block body of the first block may be as follows: Figure 4 As shown, the node address of the client node, the private key of the client node and the public key of the client node can be allocated by the trading system when the client node logs in to the trading system; a digital signature algorithm (such as an elliptic curve digital signature algorithm) can be used to generate a digital signature of the client node; the node address of the client node can be generated by the public key of the client node through a series of one-way hash encryption algorithms, and used as the identity of the client node in the blockchain; the digital signature of the client node can be used to verify the correctness of the first order information transaction of the client node.

[0121] In step S15, the first block is mounted to the blockchain where the genesis block is located.

[0122] In the disclosed embodiment, the client node may also mount the first block to the blockchain where the genesis block is located, so that the blockchain stores the block information and the order information.

[0123] The transaction processing method of the embodiment of the present disclosure is to establish a genesis block in response to the central node of the transaction system through the client node, generate the first block, and obtain the commodity information carried by the block body of the genesis block; determine the corresponding difficulty target value according to the equity value of the client node; perform hash operation on the random parameter to solve the target value of the random parameter, wherein, when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value; when the target value of the random parameter is solved, generate the first order information according to the commodity information and store the first order information in the first block; mount the first block on the blockchain where the genesis block is located. In the present disclosure, the central node is only responsible for the access of new client nodes, the establishment of genesis blocks and the synchronization of main chain information, without processing the user's order request. The process of rushing to buy goods is "decentralized", which can reduce the client node's request to the central node and reduce the concurrency, thereby reducing or alleviating the pressure on the central node during the rush to buy goods.

[0124] In order to clearly explain how the first block is mounted to the blockchain where the genesis block is located in the above embodiment of the present disclosure, the present disclosure also proposes a transaction processing method.

[0125] Figure 5 It is a flowchart of the transaction processing method shown in the second embodiment of the present disclosure.

[0126] like Figure 5 As shown, the transaction processing method may include the following steps S201-S215.

[0127] In step S201, in response to the central node of the trading system establishing a genesis block, a first block is generated, and commodity information carried in the block body of the genesis block is obtained.

[0128] In step S202, the corresponding difficulty target value is determined according to the equity value of the client node; wherein the equity value and the difficulty target value are inversely related.

[0129] In step S203, a hash operation is performed on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value.

[0130] In step S204, it is determined whether the target value of the random parameter is obtained by solution. If so, step S205 is executed; if not, step S209 is executed.

[0131] In step S205, first order information is generated according to the product information, and the first order information is stored in the first block.

[0132] The execution process of steps S201 to S205 can refer to the execution process of any embodiment of the present disclosure, and will not be repeated here.

[0133] In any embodiment of the present disclosure, the first block may include a block header and a block body, wherein the first order information may be stored in the block body of the first block, and the block header of the first block may include multiple combinations of the following: a hash value of the parent block, a hash value of the current block, a timestamp indicating the time when the block was generated, the difficulty target value, the target value of the random parameter, the equity value, and a hash value of the block body of the first block.

[0134] As an example, the structure of the first block can be as follows Figure 6 As shown, the block header may include the hash value of the parent block, the hash value of the current block, the block sequence number, the timestamp indicating the time when the block was generated, the difficulty target value, the target value of the random parameter (i.e. Figure 6 The meaning of each parameter in the block header can be shown in Table 1.

[0135] Table 1 Data structure of block header

[0136] Fields byte illustrate The hash value of the parent block 32 Reference the hash value of the previous block The hash value of this block 32 The hash value of the current block Serial number 4 The block number, or height, indicates the position of the current block in the blockchain. Timestamp 4 Block generation time Difficulty Target 4 Difficulty target value of Proof of Work (POW) Target value of random parameter 4 The random number of the block to achieve the proof of work Equity Value 4 Block Proof of Stake (POS) equity value Hash value of the block body 32 The hash value of the block body of the current block

[0137] In step S206, the first block is broadcast to the neighboring nodes in the transaction system, so that the neighboring nodes that receive the broadcast verify the first block.

[0138] In the disclosed embodiment, the client node may broadcast the first block to the neighboring nodes in the transaction system. Accordingly, the neighboring nodes may verify the first block after receiving the broadcast information.

[0139] As a possible implementation method, the adjacent node can read the block header of the first block, obtain the target value of the random parameter and the target value of the difficulty, and perform a hash operation on the target value of the random parameter in the block header of the first block to determine whether the hash value obtained by the hash operation is less than the target value of the difficulty in the block header of the first block. If so, it is determined that the first block has been verified, and if not, it is determined that the first block has failed the verification.

[0140] In step S207, it is determined whether the first block has passed the verification. If so, step S208 is executed. If not, step S203 and subsequent steps are executed again.

[0141] In step S208, the first block is mounted to the blockchain where the genesis block is located.

[0142] In the embodiment of the present disclosure, if the first block is verified, the client node can mount the first block to the blockchain where the genesis block is located. If the first block is not verified, the client node needs to re-execute step S203 and subsequent steps.

[0143] In step S209, if the second block broadcasted by the adjacent node is received, the solution is suspended.

[0144] In an embodiment of the present disclosure, when a client node is performing a hash operation on a random parameter and has not yet solved the target value of the random parameter, if the client node receives a second block broadcast by an adjacent node, the client node may suspend the solution to verify the second area.

[0145] In step S210 , the second block is verified.

[0146] In a first possible implementation manner of the embodiment of the present disclosure, when the number of second blocks is one, the client node can read the block header of the second block, obtain the value to be verified obtained by solving the random parameter by the adjacent node and the difficulty target value of the second block, and perform a hash operation on the value to be verified of the random parameter to determine whether the hash value obtained by the hash operation is less than the difficulty target value of the second block. If so, it is determined that the second block verification has passed; if not, it is determined that the second block verification has failed.

[0147] In a second possible implementation of the embodiment of the present disclosure, when the number of the second blocks is at least two, the client node may select the block with the longest chain in the blockchain where it is located for verification. The verification method is the same as the first possible implementation method mentioned above and will not be elaborated here.

[0148] In step S211, it is determined whether the second block has passed the verification. If so, step S212 is executed; if not, step S215 is executed.

[0149] In step S212, it is determined whether the commodity inventory in the second order information stored in the second block is zero, if not, step S213 is executed, and if yes, step S214 is executed.

[0150] In step S213, the solution is continued.

[0151] In the embodiment of the present disclosure, when the second block verification is passed, if the commodity inventory in the second order information stored in the second block is not zero, the client node can continue to solve until the target value of the random parameter is solved, and step S204 and subsequent steps can be executed.

[0152] In step S214, the solving is stopped.

[0153] In the embodiment of the present disclosure, when the second block is verified, if the inventory of goods in the second order information stored in the second block is zero, the rush purchase activity ends and the client node can stop solving.

[0154] In step S215, the adjacent nodes are notified to re-perform a hash operation on the random parameter to obtain a target value of the random parameter.

[0155] In the embodiment of the present disclosure, when the verification of the second block fails, the processing process of the adjacent node is similar to the processing process of the client node in step S203, and the random parameter needs to be re-hashed to obtain the target value of the random parameter. When the target value of the random parameter is obtained, the second order information is generated according to the product information, and the second order information is stored in the second block so that the client node can re-verify the second block.

[0156] It should be noted that the above-mentioned possible implementation methods can be executed separately or in combination, and the embodiments of the present disclosure are not limited to this.

[0157] The transaction processing method of the disclosed embodiment verifies the first block and / or the second block, and only mounts the block to the blockchain where the genesis block is located if the verification is passed, thereby ensuring the validity and legality of the rush to buy goods.

[0158] In a possible implementation of the embodiment of the present disclosure, when the equity value is inversely proportional to the difficulty target value, Figure 7 The difficulty target value is determined in the manner shown.

[0159] Figure 7 It is a flowchart of the transaction processing method shown in the third embodiment of the present disclosure.

[0160] like Figure 7As shown, the transaction processing method may include the following steps S31-S36.

[0161] In step S31, in response to the central node of the trading system establishing a genesis block, a first block is generated, and commodity information carried in the block body of the genesis block is obtained.

[0162] The execution process of step S31 can refer to the above embodiment and will not be described in detail here.

[0163] In step S32, the basic difficulty value used in the most recent round of rush buying is adjusted according to the total duration of the most recent round of rush buying and the length of the blockchain created in the most recent round of rush buying to determine the basic difficulty value used in this round of rush buying.

[0164] For example, mark the basic difficulty value used in this round of rush purchase as the basic difficulty value i The basic difficulty value used in the latest round of rush purchase is the basic difficulty value i-1 , the basic difficulty value can be determined according to the following formula i :

[0165] Basic Difficulty Value i =Basic Difficulty Value i-1 × the total duration of the most recent round of rush buying / the length of the blockchain created by the most recent round of rush buying (i.e. the number of blocks);

[0166] In step S33, for any client node, a difficulty target value corresponding to the client node in this round of rush purchase is determined according to the equity value of the client node and the basic difficulty value adopted in this round of rush purchase.

[0167] In the disclosed embodiment, for each client node, the difficulty target value corresponding to the client node in the current round of rush purchase can be determined according to the equity value of the client node and the basic difficulty value adopted in the current round of rush purchase. The difficulty target value is inversely proportional to the equity value.

[0168] For example, for each client node, the difficulty target value corresponding to the client node in this round of rush purchase can be determined according to the following formula:

[0169] Difficulty target value = basic difficulty value i / Equity value;

[0170] In step S34, a hash operation is performed on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value.

[0171] In step S35, when the target value of the random parameter is obtained by solving the calculation, the first order information is generated according to the commodity information and the first order information is stored in the first block.

[0172] In step S36, the first block is mounted to the blockchain where the genesis block is located.

[0173] The execution process of steps S34 to S36 can refer to any of the above embodiments and will not be described in detail here.

[0174] With the above Figures 3 to 7 Corresponding to the transaction processing method provided in the embodiment, the present disclosure also provides a transaction processing device. Figures 3 to 7 The transaction processing method provided in the embodiment corresponds to the embodiment, so the implementation method of the transaction processing method is also applicable to the transaction processing device provided in the embodiment of the present disclosure, and will not be described in detail in the embodiment of the present disclosure.

[0175] Fig. 9 It is a structural diagram of the transaction processing device shown in the fifth embodiment of the present disclosure.

[0176] Reference Fig. 9 The transaction processing device 900 can be applied to a client node in a transaction system, and includes: a generation unit 901, a determination unit 902, a calculation unit 903, a storage unit 904 and a mounting unit 905.

[0177] The generation unit 901 is configured to generate a first block in response to a central node of the trading system establishing a genesis block, and obtain commodity information carried in a block body of the genesis block.

[0178] The determination unit 902 is configured to determine a corresponding difficulty target value according to the equity value of the client node; wherein the equity value is in an inverse relationship with the difficulty target value.

[0179] The operation unit 903 is configured to perform a hash operation on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value.

[0180] The storage unit 904 is configured to generate first order information according to the product information and store the first order information in the first block when the target value of the random parameter is obtained by calculation.

[0181] The mounting unit 905 is configured to mount the first block to the blockchain where the genesis block is located.

[0182] In a possible implementation of the embodiment of the present disclosure, the mounting unit 905 is configured to: broadcast the first block to the adjacent nodes in the transaction system, so that the adjacent nodes that receive the broadcast verify the first block; if the first block is verified, mount the first block to the blockchain where the genesis block is located.

[0183] In a possible implementation of the embodiment of the present disclosure, the transaction processing device 900 may further include:

[0184] The pausing unit is configured to suspend the solving if a second block broadcasted by an adjacent node is received when the target value of the random parameter has not been solved.

[0185] The verification unit is configured to verify the second block.

[0186] The solving unit is configured to continue solving the problem if the second block is verified and the commodity inventory in the second order information stored in the second block is not zero.

[0187] In a possible implementation of the embodiment of the present disclosure, the verification unit is configured to: read the block header of the second block to obtain the value to be verified obtained by the adjacent node solving the random parameter and the difficulty target value of the second block; perform a hash operation on the value to be verified of the random parameter to determine that the hash value obtained by the hash operation is less than the difficulty target value of the second block.

[0188] In a possible implementation of the embodiment of the present disclosure, the verification unit is configured to: when there are at least two second blocks, select the block with the longest chain in the blockchain for verification.

[0189] In a possible implementation of the embodiment of the present disclosure, the equity value of the client node is determined by weighting the client level of the client node, the activity of the client node, and the number of transactions in which the client node participates.

[0190] In a possible implementation of the embodiment of the present disclosure, the determination unit 902 is configured to: adjust the basic difficulty value adopted in the most recent round of rush purchase process according to the total duration of the most recent round of rush purchase process and the length of the blockchain created in the most recent round of rush purchase process to determine the basic difficulty value adopted in this round of rush purchase process; for any client node, determine the difficulty target value corresponding to the client node in this round of rush purchase process according to the equity value of the client node and the basic difficulty value adopted in this round of rush purchase process.

[0191] In a possible implementation of the embodiment of the present disclosure, the first block includes a block header and a block body; wherein the block header of the first block includes multiple combinations of the following: a hash value of a parent block, a hash value of the current block, a timestamp indicating a time when the block was generated, a difficulty target value, a target value of a random parameter, a stake value, and a hash value of the block body of the first block; the block body of the first block includes first order information.

[0192] In a possible implementation of an embodiment of the present disclosure, the first order information includes: product information, and also includes at least one of the node address of the customer node, the digital signature of the customer node, and the public key of the customer node; wherein the product information includes: at least one of the product number, the order timestamp, the total number of products, and the product inventory.

[0193] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0194] The transaction processing device of the embodiment of the present disclosure establishes a genesis block in response to the central node of the transaction system through the client node, generates the first block, and obtains the commodity information carried by the block body of the genesis block; determines the corresponding difficulty target value according to the equity value of the client node; performs a hash operation on the random parameter to solve the target value of the random parameter, wherein, when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value; when the target value of the random parameter is solved, generates the first order information according to the commodity information and stores the first order information in the first block; mounts the first block on the blockchain where the genesis block is located. In the present disclosure, the central node is only responsible for the access of new client nodes, the establishment of genesis blocks and the synchronization of main chain information, without processing the user's order request. The process of rushing to buy commodities is "decentralized", which can reduce the client node's request to the central node and reduce the concurrency, thereby reducing or alleviating the pressure on the central node during the rush to buy commodities.

[0195] In an exemplary embodiment, an electronic device is also provided.

[0196] Among them, electronic equipment includes:

[0197] processor;

[0198] a memory for storing processor-executable instructions;

[0199] The processor is configured to execute instructions to implement the transaction processing method proposed in any of the aforementioned embodiments.

[0200] As an example, Fig.10 is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present disclosure, such as Fig.10 As shown, the electronic device 200 may further include:

[0201] The memory 210 and the processor 220, the bus 230 connecting different components (including the memory 210 and the processor 220), the memory 210 stores a computer program, and when the processor 220 executes the program, the transaction processing method described in the embodiment of the present disclosure is implemented.

[0202] Bus 230 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0203] The electronic device 200 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 200, including volatile and non-volatile media, removable and non-removable media.

[0204] The memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and / or cache memory 250. The server 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 260 may be used to read and write non-removable, non-volatile magnetic media ( Fig.10 not shown, usually called a "hard drive"). Although Fig.10 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 230 via one or more data medium interfaces. The memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0205] A program / utility 280 having a set (at least one) of program modules 270 may be stored, for example, in the memory 210, such program modules 270 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 270 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0206] The electronic device 200 may also communicate with one or more external devices 290 (e.g., keyboard, pointing device, display 291, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and / or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed via an input / output (I / O) interface 292. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) via a network adapter 293. As shown, the network adapter 293 communicates with other modules of the electronic device 200 via a bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0207] The processor 220 executes various functional applications and data processing by running the programs stored in the memory 210 .

[0208] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the transaction processing method of the embodiment of the present disclosure, and will not be repeated here.

[0209] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the method proposed in any of the above embodiments. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0210] In an exemplary embodiment, a computer program product is also provided, including a computer program, characterized in that when the computer program is executed by a processor, the method proposed in any of the above embodiments is implemented.

[0211] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0212] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A transaction processing method, characterized in that: Applied to a client node in a transaction system, the method comprises: In response to the central node of the trading system establishing a genesis block, generating a first block, and obtaining commodity information carried in a block body of the genesis block; According to the total duration of the most recent round of rush purchases and the length of the blockchain created by the most recent round of rush purchases, the basic difficulty value used in the most recent round of rush purchases is adjusted to determine the basic difficulty value used in this round of rush purchases; For any client node, according to the equity value of the client node and the basic difficulty value adopted in the current round of rush purchase, determine the difficulty target value corresponding to the client node in the current round of rush purchase; wherein the equity value and the difficulty target value are inversely related; Performing a hash operation on the random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, the hash value obtained by the hash operation is less than the difficulty target value; When the target value of the random parameter is obtained by solving the calculation, first order information is generated according to the commodity information and the first order information is stored in the first block; Broadcasting the first block to adjacent nodes in the transaction system, so that the adjacent nodes receiving the broadcast verify the first block; When the first block is verified, the first block is mounted to the blockchain where the genesis block is located.

2. The method according to claim 1, characterized in that In the case where the target value of the random parameter is obtained by solving the calculation, before generating order information according to the commodity information and storing the order information in the first block, the method further includes: If the target value of the random parameter is not obtained by solving, the solving is suspended if the second block broadcasted by the neighboring node is received; Verifying the second block; When the second block is verified and the commodity inventory in the second order information stored in the second block is not zero, the solution is continued.

3. The method according to claim 2, characterized in that The verifying the second block includes: Reading a block header of the second block to obtain a value to be verified obtained by the adjacent node solving the random parameter and a difficulty target value of the second block; A hash operation is performed on the to-be-checked value of the random parameter to determine whether a hash value obtained by the hash operation is less than a difficulty target value of the second block.

4. The method according to claim 2, characterized in that: The verifying the second block includes: When there are at least two second blocks, the block with the longest chain in the blockchain is selected for verification.

5. The method according to any one of claims 1 to 4, characterized in that: The equity value of the client node is determined by weighting the client level of the client node, the activity of the client node, and the number of transactions in which the client node participates.

6. The method according to any one of claims 1 to 4, characterized in that: The first block includes a block header and a block body; The block header of the first block includes a plurality of combinations of the following: a hash value of a parent block, a hash value of the current block, a timestamp indicating a time when the block was generated, the difficulty target value, a target value of the random parameter, the equity value, and a hash value of a block body of the first block; The block body of the first block includes the first order information.

7. The method according to any one of claims 1 to 4, characterized in that: The first order information includes: commodity information, and at least one of a node address of the client node, a digital signature of the client node, and a public key of the client node; The product information includes at least one of a product number, an order timestamp, a total number of products, and product inventory.

8. A transaction processing device, characterized in that: Client nodes used in trading systems include: A generating unit, configured to generate a first block in response to a central node of the trading system establishing a genesis block, and obtain commodity information carried in a block body of the genesis block; The determination unit is configured to adjust the basic difficulty value used in the most recent round of rush purchase process according to the total duration of the most recent round of rush purchase process and the length of the blockchain created in the most recent round of rush purchase process, so as to determine the basic difficulty value used in the current round of rush purchase process; for any client node, determine the difficulty target value corresponding to the client node in the current round of rush purchase process according to the equity value of the client node and the basic difficulty value used in the current round of rush purchase process; wherein the equity value and the difficulty target value are inversely related; A computing unit configured to perform a hash operation on a random parameter to obtain a target value of the random parameter, wherein when the random parameter takes the target value, a hash value obtained by the hash operation is less than the difficulty target value; a storage unit configured to generate first order information according to the commodity information and store the first order information in the first block when the target value of the random parameter is obtained by solving the calculation; The mounting unit is configured to broadcast the first block to the adjacent nodes in the transaction system, so that the adjacent nodes that receive the broadcast verify the first block; if the first block is verified, the first block is mounted on the blockchain where the genesis block is located.

9. The device according to claim 8, characterized in that The device also includes: a pausing unit configured to suspend solving if a second block broadcasted by the neighboring node is received when the target value of the random parameter is not solved; a verification unit, configured to verify the second block; The solving unit is configured to continue solving the problem if the second block is verified and the commodity inventory in the second order information stored in the second block is not zero.

10. The device according to claim 9, characterized in that The verification unit is configured to: Reading a block header of the second block to obtain a value to be verified obtained by the adjacent node solving the random parameter and a difficulty target value of the second block; A hash operation is performed on the to-be-checked value of the random parameter to determine whether a hash value obtained by the hash operation is less than a difficulty target value of the second block.

11. The device according to claim 9, characterized in that The verification unit is configured to: When there are at least two second blocks, the block with the longest chain in the blockchain is selected for verification.

12. The device according to any one of claims 8 to 11, characterized in that: The equity value of the client node is determined by weighting the client level of the client node, the activity of the client node, and the number of transactions in which the client node participates.

13. The device according to any one of claims 8 to 11, characterized in that: The first block includes a block header and a block body; The block header of the first block includes a plurality of combinations of the following: a hash value of a parent block, a hash value of the current block, a timestamp indicating a time when the block was generated, the difficulty target value, a target value of the random parameter, the equity value, and a hash value of a block body of the first block; The block body of the first block includes the first order information.

14. The device according to any one of claims 8 to 11, characterized in that: The first order information includes: commodity information, and at least one of a node address of the client node, a digital signature of the client node, and a public key of the client node; The product information includes at least one of a product number, an order timestamp, a total number of products, and product inventory.

15. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the transaction processing method according to any one of claims 1 to 7.

16. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the transaction processing method according to any one of claims 1 to 7.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the transaction processing method according to any one of claims 1 to 7 is implemented.