Transaction information storage method and device, electronic equipment and computer storage medium
Through the use of the serial thread pool and the latest Nonce value, the problem of reuse of Nonce values when multiple uplink tasks are executed at the same time is solved, the success rate and speed of uplink tasks are improved, and hardware resources are saved.
Patent Information
- Application Number
- CN202410464019.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2024-08-30
AI Technical Summary
In digital collection transactions, when multiple uploading tasks are executed at the same time, the same Nonce value will be reused, resulting in only one uploading task succeeding and other uploading tasks failing, resulting in slow uploading tasks, low success rates, and a waste of hardware. resource.
A serial thread pool is used to arrange and execute on-chain tasks in sequence, obtain the latest Nonce value from the blockchain, and ensure that each on-chain task uses the latest Nonce value before being uploaded to the chain to avoid repeated use.
Ensure that uplink tasks are executed in order, avoid reusing Nonce values, improve the success rate and speed of uplink tasks, and save hardware resources.
Smart Images

Figure CN118568168A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a method for storing transaction information, a device for storing transaction information, an electronic device, and a computer-readable storage medium. Background Art
[0002] Digital collections are digital assets based on blockchain technology. After the transaction of digital collections is completed, the transaction information needs to be written into the blockchain for solidification and record, ensuring the transparency and non-tamperability of the transaction. However, the transaction of digital collections is instantaneous and highly concurrent. After the transaction is completed, it needs to be quickly uploaded to the blockchain and ensure the success of the upload. This requires the system to ensure the speed and success rate of the upload.
[0003] Currently, after the transaction of digital collections is completed, the business side will submit the task of uploading the collection to the chain, that is, the transaction information of the digital collections will be stored in the blockchain.
[0004] When uploading, the blockchain will use the Nonce (Number used once, a non-repeated random number used once) value for verification, where the Nonce value is automatically generated by the blockchain, one uploading task corresponds to one Nonce value, and the blockchain automatically updates the Nonce value after executing an uploading task. However, when an uploading task using the Nonce value is not completed, the blockchain cannot update the Nonce value, so that multiple uploading tasks currently being executed simultaneously will use the same Nonce value at the same time, resulting in the first uploading task using the Nonce value among multiple uploading tasks to succeed, and other uploading tasks to fail, so that the business side needs to repeat the above process for other failed uploading tasks, which not only results in a slower overall speed and lower success rate of uploading tasks, but also wastes hardware resources on the business side. Summary of the invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide a method for storing transaction information, a device for storing transaction information, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0006] In order to solve the above problem, an embodiment of the present invention discloses a method for storing transaction information, the method comprising:
[0007] Obtaining the target on-chain task currently ranked first from a preset serial thread pool; the serial thread pool is used to store the on-chain tasks arranged in sequence;
[0008] Get the latest verification value from the blockchain;
[0009] Submit the target on-chain task to the blockchain based on the latest verification value, and store the latest verification value, so that the blockchain executes the target on-chain task to store transaction information.
[0010] An embodiment of the present invention discloses a storage device for transaction information, the device comprising:
[0011] An acquisition module, used to acquire a target on-chain task from a preset serial thread pool; the serial thread pool is used to store on-chain tasks arranged in sequence;
[0012] The acquisition module is also used to obtain the latest verification value from the blockchain;
[0013] A submission module, configured to submit the target on-chain task to the blockchain based on the latest verification value, so that the blockchain executes the target on-chain task to store transaction information;
[0014] A storage module is used to store the latest test value.
[0015] Correspondingly, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the various steps of the above-mentioned transaction information storage method embodiment when executed by the processor.
[0016] Accordingly, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each step of the above-mentioned transaction information storage method embodiment is implemented.
[0017] The embodiments of the present invention include the following advantages:
[0018] Obtain the target on-chain task that is currently ranked first from the preset serial thread pool; the serial thread pool is used to store on-chain tasks arranged in order; obtain the latest verification value from the blockchain; submit the target on-chain task to the blockchain based on the latest verification value, and store the latest verification value. Through the above method, multiple on-chain tasks can be stored in order in the serial thread pool, and each on-chain task is executed in sequence, ensuring that even if there are multiple on-chain tasks, the current on-chain task that is ranked first can be executed, and the next on-chain task will be executed in sequence after the current on-chain task is completed, and there will be no situation where multiple on-chain tasks are executed at the same time. This solves the problem in the prior art that when multiple on-chain tasks are executed at the same time, multiple on-chain tasks will reuse the same verification value, resulting in only one on-chain task being successful, and other on-chain tasks failing and needing to be retried continuously, which in turn leads to the overall slow speed and low success rate of on-chain tasks, and also saves hardware resources on the business side. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of a framework of a method for storing transaction information of the present invention;
[0020] Figure 2 is a schematic diagram of a serial thread pool of the present invention;
[0021] Figure 3 is a flowchart of a method for storing transaction information according to an embodiment of the present invention;
[0022] Figure 4 It is a timing diagram of the steps of a method for storing transaction information of the present invention;
[0023] Figure 5 It is a structural block diagram of an embodiment of a storage device for transaction information of the present invention. DETAILED DESCRIPTION
[0024] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] One of the core concepts of the embodiment of the present invention is to set up a serial thread pool for storing sequentially arranged chain tasks. Multiple chain tasks can be stored in the serial thread pool in order, and each chain task is executed in sequence. In this way, it is ensured that even if there are multiple chain tasks, the first chain task in the order is executed currently. After the current chain task is completed, the next chain task is executed in sequence, and the situation of executing multiple chain tasks at the same time will not occur. This solves the problem in the prior art that when multiple chain tasks are executed at the same time, multiple chain tasks will reuse the same Nonce value, resulting in only one chain task being successful, and other chain tasks failing and needing to be retried continuously, which leads to the overall slow speed and low success rate of the chain tasks, and also saves hardware resources on the business side.
[0026] Reference Figure 1 , showing a schematic diagram of the framework of a method for storing transaction information of the present invention, the method is applied to the business side, and the business side may include a business server and a cache server.
[0027] like Figure 1 As shown, the business server interacts with the client to process the transaction request initiated by the user. After receiving the transaction request from the user, the business server initiates the on-chain task to the cache server. The cache server interacts with the blockchain through the Spark interface to complete the on-chain task.
[0028] The cache server can use a cache solution, such as Redis. Since Redis is a single-threaded execution in a concurrent scenario, the cache server can not only be used to record the test value, but also ensure the speed and reliability of obtaining the test value. Of course, in addition to Redis, other cache solutions are also applicable to the embodiments of the present invention. In actual applications, they can be set according to actual needs, and the embodiments of the present invention do not limit this. Moreover, in addition to being a Nonce value, the test value can also be a value in other forms. In actual applications, it can also be set according to actual needs, and the embodiments of the present invention do not limit this.
[0029] Since blockchain uses distributed locks, it is necessary to set a lock timeout for the on-chain task when executing the on-chain task. When the time taken to complete the on-chain task exceeds the lock timeout, a deadlock will occur, resulting in the failure of the on-chain task. However, the time taken to complete the on-chain task is uncertain, so it is difficult to set a suitable lock timeout in actual applications, resulting in a high failure rate of the on-chain task.
[0030] In response to the above problems, Figure 2 As shown, a serial thread pool is set in the cache server, and the serial thread pool includes 1 core thread. In this way, when multiple business servers initiate chain tasks, multiple chain tasks can be stored in the serial thread pool in sequence, and the cache server can execute each chain task in sequence, so there is no need to set a lock timeout for each chain task, which solves the problem of high failure rate of chain tasks due to the inability to set a suitable lock timeout in the prior art.
[0031] At the same time, combined with the high-speed cache solution, it ensures that even if there are multiple chain tasks, only one chain task needs to be executed currently. After the current chain task is completed, the next chain task will be executed in sequence, and there will be no situation where multiple chain tasks are executed at the same time. This solves the problem in the prior art that when multiple chain tasks are executed at the same time, multiple chain tasks will reuse the same test value, resulting in only one chain task being successful, and other chain tasks failing and needing to be retried continuously, which in turn leads to the overall slow speed of the chain tasks and a low success rate. The problem also saves hardware resources on the business side.
[0032] Reference Figure 3 , shows a flowchart of a method for storing transaction information according to an embodiment of the present invention, which may specifically include the following steps:
[0033] Step 301, obtaining the target on-chain task currently ranked first from a preset serial thread pool; the serial thread pool is used to store on-chain tasks arranged in sequence.
[0034] Specifically, the cache server can obtain the first chaining task currently in the queue (referred to as the "target chaining task") from the serial thread pool as the chaining task to be processed. The serial thread pool is used to store chaining tasks arranged in sequence, that is, at a certain moment, there may be no chaining task in the serial thread pool, or there may be multiple chaining tasks.
[0035] It should be noted that the order of chain tasks in the serial thread pool can be the generation time of the chain tasks. For example, the generation time of chain task A is 2023-08-22-12:00:00, the generation time of chain task B is 2023-08-22-11:59:00, and the generation time of chain task C is 2023-08-22-12:02:00. Then the order of chain tasks in the serial thread pool is B, A, and C. Of course, in addition to the generation time, the sorting can also be based on other methods. In actual applications, it can be set according to actual needs, and the embodiment of the present invention does not limit this.
[0036] Step 302, obtain the latest verification value from the blockchain.
[0037] After obtaining the target on-chain task, the latest test value can be obtained from the blockchain. In the blockchain, one test value corresponds to one on-chain task. The latest test value obtained may be the test value used when the on-chain task is being executed, or it may be an unused test value. When the on-chain task is completed, the blockchain can automatically update the test value, so the latest test value obtained at this time is the updated test value.
[0038] For example, when executing on-chain task 1, verification value A is being used. If on-chain task 2 is executed at this time, the latest verification value obtained is A. After on-chain task 1 is completed, the blockchain updates verification value A to verification value B. At this time, on-chain task 2 is executed, and the latest verification value obtained is B.
[0039] Step 303: submit the target on-chain task to the blockchain based on the latest verification value, and store the latest verification value.
[0040] After obtaining the latest verification value, you can decide how to submit the target on-chain task to the blockchain based on the latest verification value. At the same time, store the latest verification value for detection when executing the next on-chain task.
[0041] In the embodiment of the present invention, submitting the target on-chain task to the blockchain based on the latest verification value includes:
[0042] Detect whether the target on-chain task is the first on-chain task;
[0043] When it is detected that the target on-chain task is not the first on-chain task, the latest verification value is used to detect whether to submit the target on-chain task to the blockchain;
[0044] If the detection passes, the target on-chain task is submitted to the blockchain.
[0045] Specifically, before submitting the target on-chain task to the blockchain, it can be detected whether the target on-chain task is the first on-chain task. If it is not the first on-chain task, the latest test value is used to detect whether to submit the target on-chain task to the blockchain. If the test passes, the target on-chain task is submitted to the blockchain; if the test fails, the latest test value will be continuously obtained and tested until the test passes (detailed later), and then the target on-chain task is submitted to the blockchain.
[0046] It should be noted that the reason for the detection is: if it is the first on-chain task, then there is no need to execute the check value corresponding to the previous on-chain task, and the latest check value can be directly obtained from the regional chain; if it is not the first on-chain task, then it means that the previous on-chain task may not have been completed. In order to prevent the failure of the on-chain task due to the use of the same check value, the check value needs to be tested to ensure that the check value is the latest and unique.
[0047] In the embodiment of the present invention, the step of detecting whether the target on-chain task is a first-time on-chain task includes:
[0048] Detect whether the time interval between obtaining the target on-chain task and obtaining the previous on-chain task of the target on-chain task exceeds a time interval threshold;
[0049] If so, it is determined that the target on-chain task is the first on-chain task; if not, it is determined that the target on-chain task is not the first on-chain task.
[0050] Specifically, it can be detected whether it is the first time to obtain the target on-chain task from the serial thread pool within a preset time period. If yes, it means that the target on-chain task is the first on-chain task. If not, it means that the target on-chain task is not the first on-chain task. For example, it can be detected whether the target on-chain task is the first on-chain task executed within 1 hour of the current time.
[0051] It should be noted that in actual applications, under normal circumstances, the time taken to complete an on-chain task will not exceed a certain time threshold. Based on this, a time interval threshold that exceeds the time threshold can be set. In this way, if the time interval between obtaining the target on-chain task and obtaining the previous on-chain task of the target on-chain task exceeds the time interval threshold, then it can be determined that the previous on-chain task has been completed. The characteristic of the blockchain is that the inspection value is automatically updated after the on-chain task is completed. Therefore, if it is the first on-chain task, the latest inspection value obtained is the updated inspection value, not the inspection value used by the previous on-chain task, so there is no need to use the latest inspection value to detect whether to submit the target on-chain task to the blockchain.
[0052] For example, the time taken to complete an on-chain task will not exceed 30 minutes. The time interval threshold is set to 1 hour. If the time interval between obtaining the target on-chain task B and obtaining the previous on-chain task A of the target on-chain task exceeds 1 hour, then it can be determined that the on-chain task A has been completed and the target on-chain task B is the first on-chain task.
[0053] In an embodiment of the present invention, it also includes:
[0054] When it is detected that the target on-chain task is a first-time on-chain task, the target on-chain task is submitted to the blockchain.
[0055] As mentioned above, if the target on-chain task is the first on-chain task, then it can be determined that the previous on-chain task has been completed and the blockchain has updated the verification value. At this time, there is no need to use the latest verification value to detect whether to submit the target on-chain task to the blockchain. The target on-chain task can be submitted directly to the blockchain.
[0056] In the embodiment of the present invention, the step of using the latest verification value to detect whether to submit the target on-chain task to the blockchain includes:
[0057] Detecting whether the latest check value is the same as a target check value in a preset cache; the target check value is a check value corresponding to a previous on-chain task of the target on-chain task;
[0058] When it is detected that the latest inspection value is different from the target inspection value, the detection passes; otherwise, the detection fails.
[0059] Specifically, after the latest test value is obtained, it can be detected whether the latest test value is the same as the current test value in the preset cache (referred to as the "target test value").
[0060] The preset cache may be deployed in a cache server to store the verification value.
[0061] It should be noted that the target check value will change with the completion of the previous on-chain task, that is, the target check value is not fixed. When the target on-chain task is not the first on-chain task, the target check value in the cache is the check value corresponding to the previous on-chain task. Therefore, when executing the target on-chain task, it is necessary to first detect whether the latest check value obtained from the blockchain is the same as the target check value in the cache. If they are the same, it means that the previous on-chain task in the blockchain has not been completed. At this time, if the target on-chain task continues to be submitted to the blockchain, the blockchain will still use the check value corresponding to the previous on-chain task to execute the on-chain task, and the target on-chain task will definitely fail; if they are not the same, it means that the previous on-chain task in the regional chain has been completed. Therefore, when it is detected that the latest check value is different from the target check value, the test passes; when it is detected that the latest check value is the same as the target check value, the test fails.
[0062] When the detection passes, the target on-chain task can be submitted to the blockchain, and the latest inspection value can be stored. At the same time, the target inspection value in the preset cache is deleted, that is, the target inspection value in the preset cache is updated to the latest inspection value.
[0063] In an embodiment of the present invention, it also includes:
[0064] When it is detected that the latest verification value is the same as the target verification value, the steps of obtaining the latest verification value from the blockchain and detecting whether the target on-chain task is the first on-chain task are repeated; when it is detected that the target on-chain task is not the first on-chain task, detecting whether the latest verification value is the same as the target verification value in the preset cache, until the latest verification value is different from the target verification value.
[0065] Specifically, when it is detected that the latest inspection value is the same as the target inspection value, it means that the previous on-chain task has not been completed, so the latest inspection value from the blockchain can be obtained repeatedly to detect whether the target on-chain task is the first on-chain task; when it is detected that the target on-chain task is not the first on-chain task, the step of detecting whether the latest inspection value is the same as the target inspection value in the preset cache is performed until the latest inspection value is different from the target inspection value, which means that the previous on-chain task has been completed and the detection has passed. At this time, the target on-chain task can be submitted to the blockchain.
[0066] Furthermore, when submitting a target on-chain task to the blockchain, the latest verification value can be submitted to the blockchain at the same time, and the blockchain can verify the uniqueness and order of the transaction based on the latest verification value.
[0067] In the embodiment of the present invention, before obtaining the target on-chain task currently ranked first from the preset serial thread pool, the method further includes:
[0068] In response to at least one storage request to store transaction information of a transaction object in the blockchain, generating at least one on-chain task to be stored;
[0069] Based on the generation time of the uplink task, the at least one uplink task to be stored is stored in the serial thread pool; the serial thread pool is a thread pool with 1 thread.
[0070] Specifically, after obtaining at least one storage request sent by the business server to store the transaction information of the transaction object in the blockchain, the cache server can generate at least one on-chain task (recorded as "on-chain task to be stored"), and then store at least one on-chain task to be stored in the serial thread pool, thereby ensuring the sequentiality of multiple on-chain tasks.
[0071] Among them, the transaction objects include but are not limited to digital collections, and the transaction information includes but is not limited to the transaction time, buyer and seller, and identity information of the transaction objects.
[0072] In an embodiment of the present invention, multiple chain tasks can be stored in a serial thread pool in sequence, and each chain task can be executed in sequence, ensuring that even if there are multiple chain tasks, the first chain task can be executed currently, and the next chain task will be executed in sequence after the current chain task is completed. There will be no situation where multiple chain tasks are executed at the same time. This solves the problem in the prior art that when multiple chain tasks are executed at the same time, multiple chain tasks will reuse the same check value, resulting in only one chain task being successful, and other chain tasks failing and needing to be retried continuously, which in turn leads to the overall slower speed of the chain tasks. It also saves hardware resources on the business side.
[0073] Furthermore, a serial thread pool is provided in the cache server, and the serial thread pool includes one core thread. Thus, when multiple business servers initiate chain tasks, the multiple chain tasks can be stored in the serial thread pool in sequence, and the cache server can execute each chain task in sequence, thereby eliminating the need to set a lock timeout for each chain task, thereby solving the problem in the prior art of a high failure rate of chain tasks due to the inability to set a suitable lock timeout.
[0074] For ease of understanding, Figure 4 As shown, taking an on-chain task and submitting the on-chain task together with the inspection value as an example, the complete process of the embodiment of the present invention is described as follows:
[0075] 1) The client initiates a storage request to the business server;
[0076] 2) The business server obtains the storage request and generates a chain-up task;
[0077] 3) The business server initiates an on-chain task to the cache server;
[0078] 4) The cache server obtains the target on-chain task;
[0079] 5) The cache server obtains the latest verification value from the blockchain;
[0080] 6) The cache server detects whether the target on-chain task is the first on-chain task. If so, execute 7); if not, execute 9);
[0081] 7) The cache server submits the target on-chain task and the latest verification value to the blockchain;
[0082] 8) The cache server stores the latest test value and deletes the target test value in the cache;
[0083] 9) Check whether the latest check value obtained is the same as the target check value in the cache. If not, execute 7). If so, execute 5).
[0084] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0085] Reference Figure 5 , shows a structural block diagram of an embodiment of a storage device for transaction information of the present invention, which may specifically include the following modules:
[0086] The acquisition module 501 is used to acquire the target on-chain task from a preset serial thread pool; the serial thread pool is used to store the on-chain tasks arranged in sequence;
[0087] The acquisition module 501 is also used to obtain the latest verification value from the blockchain;
[0088] The submission module 502 is used to submit the target on-chain task to the blockchain based on the latest verification value, so that the blockchain executes the target on-chain task to store transaction information; the storage module 403 is used to store the latest verification value.
[0089] In the embodiment of the present invention, it is characterized in that the submitting module includes:
[0090] A first detection submodule, used to detect whether the target on-chain task is a first-time on-chain task;
[0091] A second detection submodule is used to detect whether to submit the target on-chain task to the blockchain using the latest verification value when it is detected that the target on-chain task is not the first on-chain task;
[0092] The submission submodule is used to submit the target on-chain task to the blockchain if the detection passes.
[0093] In the embodiment of the present invention, the submitting submodule is further used for:
[0094] When it is detected that the target on-chain task is a first-time on-chain task, the target on-chain task is submitted to the blockchain.
[0095] In the embodiment of the present invention, the second detection submodule is specifically used to:
[0096] Detecting whether the latest check value is the same as a target check value in a preset cache; the target check value is a check value corresponding to a previous on-chain task of the target on-chain task;
[0097] When it is detected that the latest inspection value is different from the target inspection value, the detection passes; otherwise, the detection fails.
[0098] In the embodiment of the present invention, the second detection submodule is further configured to:
[0099] When it is detected that the latest inspection value is the same as the target inspection value, the acquisition module and the submission module are repeatedly called until the latest inspection value is different from the target inspection value.
[0100] In the embodiment of the present invention, the storage module is specifically used for:
[0101] The latest inspection value is stored in a preset cache, and the target inspection value in the preset cache is deleted; the target inspection value is the inspection value corresponding to the previous on-chain task of the target on-chain task.
[0102] In the embodiment of the present invention, the first detection submodule is specifically used to:
[0103] Detect whether the time interval between obtaining the target on-chain task and obtaining the previous on-chain task of the target on-chain task exceeds a time interval threshold;
[0104] If so, it is determined that the target on-chain task is the first on-chain task; if not, it is determined that the target on-chain task is not the first on-chain task.
[0105] In an embodiment of the present invention, it also includes:
[0106] A generating module, configured to generate a plurality of on-chain tasks to be stored in response to at least one storage request for storing transaction information of a transaction object in the blockchain before acquiring the target on-chain task currently ranked first from a preset serial thread pool;
[0107] The storage module is further used to store the multiple uplink tasks to be stored in the serial thread pool based on the generation time of the uplink tasks; the serial thread pool includes 1 thread.
[0108] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0109] An embodiment of the present invention further provides an electronic device, including:
[0110] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, each process of the above-mentioned transaction information storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0111] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned transaction information storage method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0112] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0113] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0114] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0115] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0116] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0117] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0118] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0119] A method for storing transaction information and a device for storing transaction information provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for storing transaction information, characterized in that: The method comprises: Obtaining the target on-chain task currently ranked first from a preset serial thread pool; the serial thread pool is used to store the on-chain tasks arranged in sequence; Get the latest verification value from the blockchain; Submit the target on-chain task to the blockchain based on the latest verification value, and store the latest verification value, so that the blockchain executes the target on-chain task to store transaction information.
2. The method for storing transaction information according to claim 1, characterized in that: Submitting the target on-chain task to the blockchain based on the latest verification value includes: Detect whether the target on-chain task is the first on-chain task; When it is detected that the target on-chain task is not the first on-chain task, the latest verification value is used to detect whether to submit the target on-chain task to the blockchain; If the detection passes, the target on-chain task is submitted to the blockchain.
3. The method for storing transaction information according to claim 2, characterized in that: Also includes: When it is detected that the target on-chain task is a first-time on-chain task, the target on-chain task is submitted to the blockchain.
4. The method for storing transaction information according to claim 2, characterized in that: The using the latest verification value to detect whether to submit the target on-chain task to the blockchain includes: Detecting whether the latest check value is the same as a target check value in a preset cache; the target check value is a check value corresponding to a previous on-chain task of the target on-chain task; When it is detected that the latest inspection value is different from the target inspection value, the detection passes; otherwise, the detection fails.
5. The method for storing transaction information according to claim 4, characterized in that: Also includes: When it is detected that the latest verification value is the same as the target verification value, the steps of obtaining the latest verification value from the blockchain and detecting whether the target on-chain task is the first on-chain task are repeated; when it is detected that the target on-chain task is not the first on-chain task, detecting whether the latest verification value is the same as the target verification value in the preset cache, until the latest verification value is different from the target verification value.
6. The method for storing transaction information according to claim 1, characterized in that: The storing of the latest inspection value comprises: The latest inspection value is stored in a preset cache, and the target inspection value in the preset cache is deleted; the target inspection value is the inspection value corresponding to the previous on-chain task of the target on-chain task.
7. The method for storing transaction information according to claim 2, characterized in that: The detecting whether the target on-chain task is a first-time on-chain task includes: Detect whether the time interval between obtaining the target on-chain task and obtaining the previous on-chain task of the target on-chain task exceeds a time interval threshold; If so, it is determined that the target on-chain task is the first on-chain task; if not, it is determined that the target on-chain task is not the first on-chain task.
8. The method for storing transaction information according to claim 1, characterized in that: Before obtaining the target chain task currently ranked first from the preset serial thread pool, it also includes: In response to at least one storage request to store transaction information of a transaction object in the blockchain, generating a plurality of on-chain tasks to be stored; Based on the generation time of the uplink tasks, the multiple uplink tasks to be stored are stored in the serial thread pool; the serial thread pool includes 1 thread.
9. A storage device for transaction information, characterized in that: The device comprises: An acquisition module, used to acquire a target on-chain task from a preset serial thread pool; the serial thread pool is used to store on-chain tasks arranged in sequence; The acquisition module is also used to obtain the latest verification value from the blockchain; A submission module, configured to submit the target on-chain task to the blockchain based on the latest verification value, so that the blockchain executes the target on-chain task to store transaction information; A storage module is used to store the latest test value.
10. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the transaction information storage method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the transaction information storage method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Server and block chain transaction confirmation method and device thereof, and storage medium
CN108764906A
Block chain transaction data processing method and device, electronic device and medium
CN109784930A
Utilizing nonce table to resolve concurrent blockchain transaction failure
CN110431580A
Block chain transaction processing method, device, equipment and system
CN112258188A
Transaction processing method and system in block chain
CN117036017A
