Resource transfer method and device, computer equipment and storage medium
By obtaining the resource processing messages completed before and for resource transfer, the problems of low resource transfer efficiency and transaction blockage in asynchronous message processing are solved, and efficient resource transfer processing is achieved.
Patent Information
- Application Number
- CN202410031975.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-08
- Publication Date
- 2025-07-08
AI Technical Summary
In the prior art, due to network delay and system failure, the asynchronous message processing mechanism leads to low efficiency in resource transfer processing, which is prone to transaction blocking problems.
By obtaining the resource processing messages completed before, determining the resource transfer account and transfer to the account, and when the resource transfer account does not support the transfer amount of resources, obtain the resource processing messages completed before for resource transfer to ensure the timing order of resource transfer processing and reduce blockage.
On the premise of ensuring the processing timing of resource transfer, the processing efficiency of resource transfer is improved and blocking problems are reduced.
Smart Images

Figure CN120278711A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technologies, and particularly to a resource transfer method, apparatus, computer device, storage medium, and computer program product. Background Art
[0002] With the development of computer technologies, more and more users choose to perform resource transfer operations on various resources through computer devices, such as shopping payment operations, fund transfer operations, digital product transfers, etc. In resource transfer processing, an asynchronous processing mechanism is usually adopted to process transaction requests. Specifically, for a large number of triggered resource transfer operations, after completing the resource transfer logic processing, corresponding asynchronous messages are generated, and the actual resource transfer processing is performed according to the asynchronous messages.
[0003] However, due to reasons such as network latency and system failures, it may not be possible to process asynchronous messages in the order of resource transfer logic processing, thereby causing transaction blocking problems and resulting in low efficiency of resource transfer processing. Summary of the Invention
[0004] Based on this, it is necessary to provide a resource transfer method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the efficiency of resource transfer processing for the above technical problems.
[0005] In a first aspect, the present application provides a resource transfer method. The method includes:
[0006] Obtain a first resource processing message generated when the first resource logical transfer processing is completed, and determine a first resource transfer-out account, a first resource transfer-in account, and a first resource transfer amount corresponding to the first resource processing message;
[0007] When the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtain a second resource processing message for resource transfer in to the first resource transfer-out account; the second resource processing message is generated when the second resource logical transfer processing is completed; the second resource logical transfer processing is completed before the first resource logical transfer processing;
[0008] Perform resource transfer in to the first resource transfer-out account according to the second resource processing message;
[0009] Perform resource transfer from the first resource transfer-out account after resource transfer in to the first resource transfer-in account according to the first resource transfer amount to obtain the resource transfer result of the first resource processing message.
[0010] In a second aspect, the present application further provides a resource transfer apparatus. The apparatus includes:
[0011] A first message acquisition module, configured to acquire a first resource processing message generated when the first resource logical transfer processing is completed, and determine a first resource transfer-out account, a first resource transfer-in account, and a first resource transfer amount corresponding to the first resource processing message;
[0012] A second message acquisition module, configured to, when the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, acquire a second resource processing message for resource transfer in to the first resource transfer-out account; the second resource processing message is generated when the second resource logical transfer processing is completed; the second resource logical transfer processing is completed before the first resource logical transfer processing;
[0013] A second message processing module, configured to perform resource transfer in to the first resource transfer-out account according to the second resource processing message;
[0014] A first message processing module, configured to perform resource transfer from the first resource transfer-out account after resource transfer in to the first resource transfer-in account according to the first resource transfer amount, to obtain a resource transfer result of the first resource processing message.
[0015] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the above resource transfer method are implemented.
[0016] In a fourth aspect, the present application further provides a computer-readable storage medium. On the computer-readable storage medium, a computer program is stored, and when the computer program is executed by a processor, the steps of the above resource transfer method are implemented.
[0017] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the above resource transfer method are implemented.
[0018] For the first resource processing message generated when the first resource logical transfer processing is completed, the corresponding first resource transfer-out account, first resource transfer-in account, and first resource transfer amount are determined. When the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, a second resource processing message for resource transfer in to the first resource transfer-out account is obtained. The second resource processing message is generated when the second resource logical transfer processing is completed, and the second resource logical transfer processing is completed before the first resource logical transfer processing. Resource transfer in is performed on the first resource transfer-out account according to the second resource processing message, and resource transfer is performed from the first resource transfer-out account after resource transfer in to the first resource transfer-in account according to the first resource transfer amount, so as to obtain the resource transfer result of the first resource processing message. For the first resource processing message for which the corresponding first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, resource transfer in is performed on the first resource transfer-out account through the second resource processing message that has completed resource logical transfer processing first, and resource transfer processing corresponding to the first resource processing message is performed through the first resource transfer-out account after resource transfer in. It is possible to reduce the blocking problem of resource transfer processing on the premise of ensuring the timing sequence of resource transfer processing for the resource transfer-out account, thereby improving the processing efficiency of resources. Brief Description of the Drawings
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0020] Figure 1 It is an application environment diagram of the resource transfer method in an embodiment;
[0021] Figure 2 It is a flowchart of the resource transfer method in an embodiment;
[0022] Figure 3 It is a timing diagram of the resource transfer method in an embodiment;
[0023] Figure 4 It is a flowchart of determining the second resource processing message in an embodiment;
[0024] Figure 5 It is a timing diagram of the resource transfer method in another embodiment;
[0025] Figure 6Schematic diagram of the timing of resource transfer transactions in an embodiment;
[0026] Figure 7 Schematic diagram of the disorderly execution of resource transfer transactions in an embodiment;
[0027] Figure 8 Schematic diagram of a digital resource trading system executing a transaction in an embodiment;
[0028] Figure 9 Structural block diagram of a resource transfer device in an embodiment;
[0029] Figure 10 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0031] The resource transfer method provided by the embodiments of the present application can be applied to, for example Figure 1In the application environment shown. Among them, the terminal 102 communicates with the resource logical transfer server 104 through the network, and the resource logical transfer server 104 communicates with the server 106 through the network. The data storage system can store the data that the respective connected servers need to process. The data storage system can be set up separately, integrated on the corresponding server, or placed on the cloud or other servers. Users can trigger resource logical transfer processing through the held terminal 102. For example, users can make a shopping payment through the terminal 102 to trigger the resource logical transfer server 104 to perform resource logical transfer processing and generate corresponding resource processing messages. The resource logical transfer server 104 can send the resource processing messages generated after completing the resource logical transfer processing to the server 106. For the first resource processing message generated in the case of completing the first resource logical transfer processing, the server 106 determines its corresponding first resource transfer-out account, first resource transfer-in account, and first resource transfer amount. In the case where the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, the server 106 obtains a second resource processing message for resource transfer into the first resource transfer-out account. The second resource processing message is generated in the case of completing the second resource logical transfer processing, and the second resource logical transfer processing is completed before the first resource logical transfer processing; the server 106 performs resource transfer into the first resource transfer-out account according to the second resource processing message, and through the first resource transfer-out account after resource transfer in, performs resource transfer to the first resource transfer-in account according to the first resource transfer amount to obtain the resource transfer result of the first resource processing message, so that the server 106 realizes the actual resource transfer processing for the resource processing message.
[0032] Among them, the terminal 102 can be but is not limited to various desktop computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The resource logical transfer server 104 and the server 106 can be implemented by an independent server or a server cluster composed of multiple servers.
[0033] Specifically, blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a string of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0034] The underlying blockchain platform may include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for managing the identity information of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and maintaining the correspondence between the real identity of users and blockchain addresses (permission management). And under authorized circumstances, it supervises and audits the transaction situations of certain real identities, and provides rule configuration for risk control (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and after reaching a consensus on valid requests, records them in storage. For a new business request, the basic service first performs interface adaptation parsing and authentication processing (interface adaptation), then encrypts the business information through a consensus algorithm (consensus management), and after encryption, transmits it to the shared ledger completely and consistently (network communication), and performs record storage; the smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define contract logic through a certain programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, it calls keys or other events to trigger execution, completes the contract logic, and also provides functions for contract upgrade and cancellation; the operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation during the product release process, and visual output of the real-time status during product operation, such as: alarms, monitoring network conditions, monitoring the health status of node devices, etc. The platform product service layer provides the basic capabilities and implementation frameworks of typical applications. Developers can build on these basic capabilities and overlay the characteristics of the business to complete the blockchain implementation of the business logic. The application service layer provides application services based on the blockchain solution for business participants to use.
[0035] In an exemplary embodiment, as Figure 2 shown, a resource transfer method is provided. This method is executed by a computer device, and specifically, it can be executed alone by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, taking this method applied to Figure 1 the server in as an example for illustration, it includes the following steps 202 to step 208. Among them:
[0036] Step 202, obtain a first resource processing message generated when the first resource logical transfer processing is completed, and determine the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount corresponding to the first resource processing message.
[0037] Among them, a resource is an asset that can be exchanged for a subject matter, and specifically can be any one of digital resources, physical resources, or virtual resources. A digital resource is a resource obtained by digitizing a physical resource, and the digital resource can be stored in a digital resource account. Virtual resources can specifically include, but are not limited to, at least one of various virtual assets, funds, stocks, bonds, virtual image products, virtual recharge cards, game equipment, etc. A physical resource can be an item with an actual form that can be owned by a user, and specifically can include, but are not limited to, a house, a vehicle, an electronic product, a toy, a handicraft, or a signed photo, etc. Resource transfer refers to the exchange process of resources, including a resource transfer-in party and a resource transfer-out party. The resource is transferred from the resource transfer-out party to the resource transfer-in party. For example, during the payment process of shopping, funds are transferred as resources.
[0038] Resource logical transfer processing refers to performing a logical transfer process on a resource without the need to complete the actual resource transfer process of the actual corresponding account, that is, the resource logical transfer processing does not perform an actual transfer process on the resources in the user's resource account, but performs a logically virtual resource transfer process. For example, logical resource transfer processing can be implemented through a balance system, and actual resource transfer processing can be implemented through a bookkeeping system. The resource accounts held by the user can be bound to the balance system and the bookkeeping system respectively. When a resource transfer process is triggered, the balance system can first perform a logical transfer process on the resource account to generate a corresponding resource processing message. The resource processing message can carry logical resource transfer information, specifically including information such as the resource transfer-out account, the resource transfer-in account, and the resource transfer amount, etc.; the balance system can instruct the bookkeeping system to perform an actual resource transfer process on the resource account according to the resource processing message, that is, perform a real transfer process on the resources in the resource account.
[0039] A resource processing message is generated correspondingly when the resource logical transfer process is completed. The resource processing message may carry resource transfer information for the resource logical transfer process. The resource transfer information can be used to describe the resource transfer operations involved in the resource logical transfer process, and may specifically include the resource transfer account and the resource transfer amount, etc. The resource processing message is used to instruct the server to perform actual resource transfer processing for the resource logical transfer process, so as to implement the resource transfer process based on the asynchronous mechanism. The resource processing message may carry logical resource transfer information. Specifically, according to the logical resource transfer information, information such as the resource transfer-out account, the resource transfer-in account, and the resource transfer amount for the resource logical transfer process can be determined. The resource transfer-out account refers to the resource account from which resources are transferred out during the resource transfer process. The resource transfer-in account refers to the resource account into which resources are transferred in during the resource transfer process. The resource transfer amount refers to the quantity of resources transferred from the resource transfer-out account to the resource transfer-in account. The first resource processing message is the resource processing message that the server is currently performing resource transfer processing for. Specifically, the first resource processing message may be determined by the server from multiple received resource processing messages, or may be the resource processing message currently received by the server. The first resource processing message is generated when the first resource logical transfer process is completed, and the first resource processing message may carry corresponding information such as the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount.
[0040] In an application, such as Figure 3 shown, the user can trigger resource transfer processing through the terminal. The balance system server performs resource logical transfer processing according to the trigger operation of the terminal. After the resource logical transfer processing is successful, the balance system server generates a resource processing message. The balance system server prompts the terminal that the resource transfer is successful. However, at this time, only the balance system server has completed the resource logical transfer processing in the balance system, and no actual resource transfer processing has been performed on the resource account. That is, the resources in the resource account held by the user at this time have not changed. The balance system server further sends the resource processing message to the accounting system server so that the accounting system server performs resource transfer processing on the resource account according to the resource processing message. That is, the accounting system server performs actual resource transfer processing on the resource account according to the resource processing message, and at this time, the resources in the resource account held by the user will change accordingly. In addition, in specific implementation, the balance system server may also generate a resource processing message while prompting the terminal that the resource transfer is successful, or may generate a resource processing message after prompting the terminal that the resource transfer is successful.
[0041] Specifically, the server may require a first resource processing message for resource transfer processing. The obtained first resource processing message is generated when the first resource logical transfer processing is completed, and the first resource processing message can be used to describe the first resource logical transfer processing. In specific implementation, the first resource processing message can be obtained by the server from the resource logical transfer server. Specifically, it can be sent by the resource logical transfer server to the server. For example, when a preset trigger condition is met, specifically when the number of generated resource processing messages reaches a preset quantity, or reaches a preset processing message sending period, it is considered that the preset trigger condition is met, and thus multiple generated resource processing messages are sent to the server. The server can determine the first resource processing message for resource transfer processing from the received resource processing messages. In addition, the first resource processing message can also be obtained by the server actively requesting it from the resource logical transfer server. Specifically, when the server meets a preset trigger condition, the server requests the resource logical transfer server to obtain the first resource processing message. The server can parse the first resource processing message to determine the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount corresponding to the first resource logical transfer processing. Based on the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount, the server can perform actual resource transfer processing.
[0042] Step 204, when the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtain a second resource processing message for resource transfer in to the first resource transfer-out account; the second resource processing message is generated when the second resource logical transfer processing is completed; the second resource logical transfer processing is completed before the first resource logical transfer processing.
[0043] Among them, the second resource processing message is a resource processing message generated when the second resource logical transfer processing is completed. The second resource logical transfer processing is completed before the first resource logical transfer processing. The timing of the second resource logical transfer processing described by the second resource processing message is before the first resource logical transfer processing. That is, the resource logical transfer server first performs the second resource logical transfer processing. After the second resource logical transfer processing is completed and the second resource processing message is generated, the resource logical transfer server performs the first resource logical transfer processing and generates the first resource processing message after the first resource logical transfer processing is completed. The second resource processing message is obtained for resource transfer in to the first resource transfer-out account, that is, the resource transfer-in account corresponding to the second resource processing message is the first resource transfer-out account. The second resource logical transfer processing is a resource transfer processing for resource transfer in to the first resource transfer-out account.
[0044] Optionally, the server may make a determination for the first resource transfer-out account based on the first resource transfer amount to determine whether the first resource transfer-out account supports resource transfer according to the first resource transfer amount. Specifically, it may be determined whether the resource amount in the first resource transfer-out account is not less than the first resource transfer amount. If the resource amount in the first resource transfer-out account is less than the first resource transfer amount, it may be determined that the resource amount in the first resource transfer-out account is insufficient, that is, the first resource transfer-out account cannot complete the resource transfer process corresponding to the first resource processing message. Then the server may obtain a second resource processing message for resource transfer into the first resource transfer-out account. In specific implementation, the server may determine each resource processing message for resource transfer into the first resource transfer-out account, and according to the timing sequence of the resource logical transfer processing corresponding to each resource processing message, obtain the second resource processing message whose timing is before the first resource logical transfer processing. The obtained second resource processing message may include one or more.
[0045] Step 206: Perform resource transfer into the first resource transfer-out account according to the second resource processing message.
[0046] Among them, the second resource processing message is used for resource transfer into the first resource transfer-out account, that is, the resource transfer-out account corresponding to the second resource processing message is the first resource transfer-out account. Specifically, the server may perform resource transfer processing based on the second resource processing message. Specifically, the server may perform resource transfer into the first resource transfer-out account according to the corresponding second resource logical transfer processing of the second resource processing message, so as to supplement the resource amount in the first resource transfer-out account, so that the first resource transfer-out account after resource transfer can support resource transfer according to the first resource transfer amount, and thus can perform resource transfer processing for the first resource processing message.
[0047] Step 208: Perform resource transfer from the first resource transfer-out account after resource transfer into the first resource transfer-in account according to the first resource transfer amount to obtain the resource transfer result of the first resource processing message.
[0048] Exemplarily, after performing resource transfer into the first resource transfer-out account according to the second resource processing message, the server may perform resource transfer processing on the first resource transfer-out account after resource transfer. Specifically, it may perform resource transfer from the first resource transfer-out account after resource transfer into the first resource transfer-in account according to the first resource transfer amount, so as to obtain the resource transfer result of the first resource processing message. In addition, when the first resource transfer-out account does not support resource transfer according to the first resource transfer amount, the server may directly perform resource transfer from the first resource transfer-out account into the first resource transfer-in account according to the first resource transfer amount, so as to obtain the resource transfer result of the first resource processing message.
[0049] In the above resource transfer method, for the first resource processing message generated when the first resource logical transfer processing is completed, determine the corresponding first resource transfer-out account, first resource transfer-in account, and first resource transfer amount. When the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtain a second resource processing message for resource transfer in to the first resource transfer-out account. The second resource processing message is generated when the second resource logical transfer processing is completed, and the second resource logical transfer processing is completed before the first resource logical transfer processing. Perform resource transfer in to the first resource transfer-out account according to the second resource processing message, and perform resource transfer to the first resource transfer-in account according to the first resource transfer amount through the first resource transfer-out account after the resource transfer in, to obtain the resource transfer result of the first resource processing message. For the first resource processing message whose corresponding first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, perform resource transfer in to the first resource transfer-out account through the second resource processing message that has completed the resource logical transfer processing first, and perform the resource transfer processing corresponding to the first resource processing message through the first resource transfer-out account after the resource transfer in, which can reduce the blocking problem of resource transfer processing on the premise of ensuring the resource transfer processing timing sequence for the resource transfer-out account, thereby improving the processing efficiency of resources.
[0050] In an exemplary embodiment, when the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtaining a second resource processing message for resource transfer in to the first resource transfer-out account includes: when the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount, query the resource transfer record of the first resource transfer-out account; the resource transfer record includes each resource processing message associated with the first resource transfer-out account; determine the second resource processing message for resource transfer in to the first resource transfer-out account from each resource processing message according to the generation order of each resource processing message.
[0051] Among them, the resource holding amount refers to the quantity of resources held by the resource account. The resource transfer record is used to record each resource processing message associated with the first resource transfer-out account, and specifically may include the resource processing message for resource transfer-in to the first resource transfer-out account and the resource processing message for resource transfer-out by the first resource transfer-out account. The generation sequence refers to the chronological order of generating each resource processing message, and specifically may be determined according to the generation serial number or timestamp of each resource processing message. Specifically, when the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount, it can be considered that the first resource transfer-out account does not support resource transfer-out according to the first resource transfer amount, that is, the quantity of resources held by the first resource transfer-out account is insufficient to transfer out resources according to the first resource transfer amount, and the corresponding resource transfer processing cannot be completed, which may be a blocking problem caused by the processing timing sequence of the first resource transfer message.
[0052] For example, the initial resource quantity held by resource account A is 20, while the initial resource quantity held by each of resource account B and resource account C is 0. In resource logical transfer process 1, 20 resource quantity is transferred from resource account A to resource account B. At this time, the resource quantity held by resource account A becomes 0, the resource quantity held by resource account B becomes 20, and the resource quantity held by resource account C remains 0. In resource logical transfer process 2, 20 resource quantity is transferred from resource account B to resource account C. At this time, the resource quantity held by resource account A remains 0, the resource quantity held by resource account B becomes 0, and the resource quantity held by resource account C becomes 20. Resource logical transfer process 1 and resource logical transfer process 2 respectively generate resource processing message 1 and resource processing message 2. When the server performs actual resource transfer processing for resource processing message 1 and resource processing message 2, if the server first receives resource processing message 2, that is, the server determines resource processing message 2 as the first resource processing message for resource transfer processing, and the first resource logical transfer is resource logical transfer process 2, the first resource transfer-out account is resource account B, the first resource transfer-in account is resource account C, and the first resource transfer amount is 20. At this time, the resource quantity held by resource account A is 20, and the resource quantity held by each of resource account B and resource account C is 0. Then resource account B cannot transfer 20 resource quantity to resource account C, that is, resource account B does not support resource transfer-out according to the resource transfer amount corresponding to resource processing message 2. That is, the server cannot perform actual resource transfer processing for resource processing message 2, and needs to wait until the processing of resource processing message 1 is completed before it can ensure the normal processing of resource processing message 2.
[0053] The server can query the resource transfer records of the first resource transfer-out account. The resource transfer records include various resource processing messages associated with the first resource transfer-out account, that is, the resource transfer records include resource transfer processing messages for transferring resources into or out of the first resource transfer-out account. In a specific implementation, the server can send a request to the resource logical transfer server to obtain the resource transfer records of the first resource transfer-out account. The server can determine the generation order of each resource processing message, such as determining the generation sequence number or timestamp of each resource processing message, so as to determine the generation order of each resource processing message. According to the generation order of each resource processing message, the server determines a second resource processing message from each resource processing message. The determined second resource processing message is used to transfer resources into the first resource transfer-out account, and the second resource processing message is generated when the second resource logical transfer processing is completed, and the second resource logical transfer processing is completed before the first resource logical transfer processing. In a specific application, the number of determined second resource processing messages can be one or more, and the total transfer amount of the resource transfer amounts corresponding to the determined second resource processing messages is not less than the first resource transfer amount. Thus, after transferring resources into the first resource transfer-out account according to the second resource processing message, it is ensured that the first resource transfer-out account after resource transfer can support resource transfer according to the first resource transfer amount.
[0054] In this embodiment, when the server determines that the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount, according to the generation order of each resource processing message in the resource transfer records of the first resource transfer-out account, the second resource processing message is determined. Thus, after transferring resources into the first resource transfer-out account through the second resource processing message that has completed the resource logical transfer processing first, and then performing resource transfer processing on the first resource processing message, it is possible to reduce the blocking problem of resource transfer processing on the premise of ensuring the resource transfer processing time sequence of the resource transfer-out account, thereby improving the processing efficiency of resources.
[0055] In an exemplary embodiment, as Figure 4 shown, the process of determining the second resource processing message, that is, determining the second resource processing message for transferring resources into the first resource transfer-out account from each resource processing message according to the generation order of each resource processing message, includes:
[0056] Step 402, determine, from each resource processing message, the incoming resource processing message for transferring resources into the first resource transfer-out account.
[0057] Among them, the transferred resource processing message is a resource processing message for resource transfer to the first resource transfer-out account, that is, the resource transfer-in account corresponding to the transferred resource processing message is the first resource transfer-out account corresponding to the first resource processing message. Exemplarily, for each resource processing message in the resource transfer record, the server can respectively determine the resource transfer-in account corresponding to each resource processing message, and determine the resource processing message whose resource transfer-in account is the first resource transfer-out account as the transferred resource processing message for resource transfer to the first resource transfer-out account.
[0058] Step 404, determine the processing order of the resource logical transfer processing corresponding to the transferred resource processing message.
[0059] Among them, each transferred resource processing message describes the corresponding resource logical transfer processing, and the processing order refers to the time order of the resource logical transfer processing corresponding to the transferred resource processing message. Optionally, for the determined transferred resource processing message, the server can determine the processing order of the resource logical transfer processing corresponding to the transferred resource processing message. Specifically, the server can query the generation serial number or timestamp of the transferred resource processing message to determine the processing order of the resource logical transfer processing corresponding to the transferred resource processing message.
[0060] Step 406, determine the second resource processing message from the transferred resource processing messages according to the processing order of the first resource logical transfer processing and the processing order of the resource logical transfer processing corresponding to the transferred resource processing message.
[0061] Specifically, the server compares the processing order of the first resource logical transfer process with the processing orders of the resource logical transfer processes corresponding to each incoming resource processing message respectively, so as to determine a second resource processing message from the incoming resource processing messages. For example, the server may determine, as the second resource processing message, an incoming resource processing message whose processing order is before that of the first resource logical transfer process. In a specific application, the server may also determine the second resource processing message from the incoming resource processing messages in combination with the first resource transfer amount corresponding to the first resource processing message. In a specific implementation, the server may determine the resource transfer amount corresponding to each incoming resource processing message, and determine, as the second resource processing message, an incoming resource processing message whose resource transfer amount is not less than the first resource transfer amount. When determining multiple second resource processing messages, the server may determine the total transfer amount of the resource transfer amounts of the multiple incoming resource processing messages, and when the total transfer amount is not less than the first resource transfer amount, may determine the multiple incoming resource processing messages as the second resource processing messages. In addition, the server may also determine the resource quantity difference between the resource holding amount of the first resource transfer-out account and the first resource transfer amount, and determine the second resource processing message from the incoming resource processing messages according to the resource quantity difference. For example, the server may determine, as the second resource processing message, an incoming resource processing message whose resource transfer amount is not less than the resource quantity difference. When the second resource processing message includes multiple incoming resource processing messages, the total transfer amount of the resource transfer amounts of the multiple incoming resource processing messages is not less than the resource quantity difference.
[0062] In this embodiment, the server selects, from each resource processing message, an incoming resource processing message for resource transfer into the first resource transfer-out account, and determines a second resource processing message based on the processing order of the incoming resource processing message. After the second resource processing message that has completed the resource logical transfer process first transfers resources into the first resource transfer-out account, the resource transfer process for the first resource processing message is performed. This can reduce the blocking problem of the resource transfer process while ensuring the timing sequence of the resource transfer process for the transfer-out account, thereby improving the processing efficiency of the resources.
[0063] In an exemplary embodiment, resource transfer into the first resource transfer-out account according to the second resource processing message includes: determining a second resource transfer-out account and a second resource transfer amount corresponding to the second resource processing message; when the second resource transfer-out account supports resource transfer out according to the second resource transfer amount, performing resource transfer into the first resource transfer-out account through the second resource transfer-out account according to the second resource transfer amount.
[0064] Among them, the second resource processing message may carry information such as the corresponding second resource transfer-out account, second resource transfer-in account, and second resource transfer amount. The second resource processing message is for resource transfer into the first resource transfer-out account, that is, the first resource transfer-out account serves as the second resource transfer-in account corresponding to the second resource processing message. Specifically, the server can parse the second resource processing message to determine the second resource transfer-out account and the second resource transfer amount corresponding to the second resource processing message. The server can make a determination on the second resource transfer-out account based on the second resource transfer amount to determine whether the second resource transfer-out account supports resource transfer according to the second resource transfer amount. Specifically, it can be determined whether the resource amount in the second resource transfer-out account is not less than the second resource transfer amount. If the resource amount in the second resource transfer-out account is not less than the second resource transfer amount, it can be determined that the resource amount in the second resource transfer-out account is sufficient, that is, the second resource transfer-out account can complete the resource transfer processing corresponding to the resource processing message. Then the server can transfer resources from the second resource transfer-out account to the first resource transfer-out account according to the second resource transfer amount, that is, the server can transfer the resources of the second resource transfer amount from the second resource transfer-out account to the first resource transfer-out account.
[0065] Furthermore, by transferring resources from the first resource transfer-out account after resource transfer-in according to the first resource transfer amount to the first resource transfer-in account, the resource transfer result of the first resource processing message is obtained, including: determining the resources to be transferred out that match the first resource transfer amount from the first resource transfer-out account after resource transfer-in; transferring the resources to be transferred out to the first resource transfer-in account through the first resource transfer-out account to obtain the resource transfer result of the first resource processing message.
[0066] Among them, the resources to be transferred out are the resources that need to be transferred from the first resource transfer-out account to the first resource transfer-in account. The resources to be transferred out match the first resource transfer amount. Specifically, the quantity of the resources to be transferred out is the first resource transfer amount. Optionally, the server can determine the resources to be transferred out from the first resource transfer-out account after resource transfer-in, and the resources to be transferred out match the first resource transfer amount. The server can transfer the determined resources to be transferred out to the first resource transfer-in account through the first resource transfer-out account, thereby obtaining the resource transfer result of the first resource processing message.
[0067] In a specific application, such as Figure 5As shown, for the first resource processing message, the server can determine the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount corresponding to the first resource processing message. When the server determines that the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount, it is considered that the first resource transfer-out account does not support resource transfer according to the first resource transfer amount. Then the server can obtain a second resource processing message, which is used to transfer resources into the first resource transfer-out account, and the second resource logical transfer process described in the second resource processing message is completed before the first resource logical transfer process. The server determines the second resource transfer-out account and the second resource transfer amount corresponding to the second resource processing message, and transfers resources from the second resource transfer-out account to the first resource transfer-out account according to the second resource transfer amount. The server further transfers resources to the first resource transfer-out account according to the first resource transfer amount for the first resource transfer-out account after the resource transfer.
[0068] In this embodiment, when the second resource transfer-out account corresponding to the second resource processing message supports resource transfer according to the second resource transfer amount, the server transfers resources of the second resource transfer amount from the second resource transfer-out account to the first resource transfer-out account, and transfers resources from the first resource transfer-out account to the first resource transfer-in account according to the first resource transfer amount, so as to reduce the blocking problem of resource transfer processing on the premise of ensuring the resource transfer processing time sequence for the resource transfer-out account, thereby improving the resource processing efficiency.
[0069] In an exemplary embodiment, the resource transfer method further includes: when the second resource transfer-out account does not support resource transfer according to the second resource transfer amount, performing resource transfer processing on the prior resource processing message for the second resource processing message until the second resource transfer-out account supports resource transfer according to the second resource transfer amount; wherein, the prior resource processing message is a resource processing message generated when the prior resource logical transfer process is completed and used to transfer resources into the second resource transfer-out account; the prior resource logical transfer process is completed before the second resource logical transfer process.
[0070] Among them, the prior resource processing message is a resource processing message for transferring resources to the second resource transfer-out account, and the source logical transfer processing described in the prior resource processing message is completed before the second resource logical transfer processing. Specifically, the server can determine the second resource transfer-out account based on the second resource transfer amount to determine whether the second resource transfer-out account supports resource transfer according to the second resource transfer amount. Specifically, it can be determined whether the resource amount in the second resource transfer-out account is not less than the second resource transfer amount. If the resource amount in the second resource transfer-out account is less than the second resource transfer amount, it can be determined that the resource amount in the second resource transfer-out account is insufficient, that is, the second resource transfer-out account cannot complete the resource transfer processing corresponding to the resource processing message. Then the server can obtain the prior resource processing message of the second resource processing message and perform resource transfer processing for the prior resource processing message until the second resource transfer-out account supports resource transfer according to the second resource transfer amount. At this time, the server can perform resource transfer to the first resource transfer-out account according to the second resource processing message. In a specific implementation, the server can obtain the resource processing message for transferring resources to the second resource transfer-out account and determine the prior resource processing message whose time sequence is before the second resource processing message from the obtained resource processing messages.
[0071] In this embodiment, the server performs resource transfer processing for the prior resource processing message of the second resource processing message until the second resource transfer-out account supports resource transfer according to the second resource transfer amount, so as to reduce the blocking problem of resource transfer processing on the premise of ensuring the time sequence of resource transfer processing for the resource transfer-out account, thereby improving the processing efficiency of resources.
[0072] In an exemplary embodiment, determining the first resource transfer-out account, the first resource transfer-in account, and the first resource transfer amount corresponding to the first resource processing message includes: determining the smart contract deployed in the blockchain network for determining resource transfer information; extracting resource transfer information from the first resource processing message based on the smart contract; the resource transfer information includes an account identifier and the first resource transfer amount; and determining the first resource transfer-out account and the first resource transfer-in account according to the account identifier.
[0073] Among them, a smart contract is a contract written in the form of code that can be automatically executed on a blockchain; it can achieve multiple functions, such as transferring funds, verifying identities, creating digital identities, etc. A smart contract is a contract that runs in the cyberspace relying on a computer. It is disseminated, verified, or executed in an informatized manner, read and executed by a computer, and has the characteristics of self-service. A smart contract is a computer protocol designed to disseminate, verify, or execute a contract in an informatized manner, which allows for trustworthy transactions without a third party. These transactions are monitorable and irreversible. That is, a smart contract is a set computer program that can automatically execute the content of a trustworthy contract without the participation of a third-party intermediary. All operations are publicly visible and irreversible. The decentralization of the blockchain and the anti-tampering of data determine that smart contracts are more suitable to be implemented on the blockchain.
[0074] The resource transfer information is the information carried in the first resource processing message used to describe the corresponding logical transfer processing of the first resource, and specifically may include an account identifier and the first resource transfer amount. The account identifier is the identifier of the resource account involved in the logical transfer processing of the first resource, and specifically may include identifiers for differentiating different resource accounts, such as the account name and account number of the resource account; the first resource transfer amount is the amount of resources transferred between the resource accounts identified by the account identifier in the logical transfer processing of the first resource.
[0075] Exemplarily, the server may determine a smart contract pre-deployed in the blockchain network for determining resource transfer information. The server may detect whether the execution trigger condition of the smart contract is satisfied. When it is determined that the execution trigger condition is satisfied, the server may determine the corresponding first resource transfer-out account, first resource transfer-in account, and first resource transfer amount from the first resource processing message based on the smart contract. For example, the server may parse the first resource processing message. For instance, the server may parse each field of the first resource processing message to extract the resource transfer information from the first resource processing message. The resource transfer information may include an account identifier and the first resource transfer amount. The account identifier may include a transfer-out account identifier and a transfer-in account identifier. The server determines the first resource transfer-out account and the first resource transfer-in account based on the account identifier. Specifically, the server may query the resource account list according to the account identifier to determine the first resource transfer-out account and the first resource transfer-in account corresponding to the first resource processing message from the resource account list.
[0076] In this embodiment, the server extracts the resource transfer information including the account identifier and the first resource transfer amount from the first resource processing message based on the smart contract, and determines the first resource transfer-out account and the first resource transfer-in account according to the account identifier, thereby accurately determining the resource transfer information corresponding to the first resource processing message and ensuring the accuracy of the resource transfer processing.
[0077] In an exemplary embodiment, obtaining a first resource processing message generated when completing the first resource logical transfer process includes: determining a smart contract deployed in the blockchain network for resource transfer processing; when the execution trigger condition of the smart contract is satisfied, obtaining the first resource processing message from at least two obtained resource processing messages based on the smart contract.
[0078] Wherein, the execution trigger condition refers to the condition for triggering the execution of the smart contract, which can be set according to actual needs, and can be specifically defined according to actual needs when deploying the smart contract. For example, the execution trigger condition may include that the number of resource processing messages received by the server reaches a preset message quantity threshold, or reaches a preset message processing cycle, etc. The server can obtain multiple resource processing messages to be subjected to resource transfer processing, and each resource processing message can be obtained by the server from a resource logical transfer server.
[0079] Exemplarily, the server can determine a smart contract pre-deployed in the blockchain network for resource transfer processing and determine the execution trigger condition of the smart contract. The server detects whether the execution trigger condition of the smart contract is satisfied. For example, it can monitor whether the obtained resource processing messages reach the preset message quantity threshold, or whether they reach the preset message processing cycle. When it is determined that the execution trigger condition is satisfied, the server can obtain the first resource processing message from at least two obtained resource processing messages. In a specific implementation, the server can determine the message reception order of receiving each resource processing message from the server performing the resource logical transfer process, and specifically can determine the message reception order of each resource processing message according to the time stamps of each resource processing message. The server processes each resource processing message in sequence according to the message reception order by calling the smart contract. Specifically, the server can sequentially determine the first resource processing message for resource transfer from the resource processing messages in the order from first to last according to the message reception order.
[0080] Furthermore, obtaining a second resource processing message for resource transfer into the first resource transfer-out account includes: obtaining, from at least two resource processing messages, the second resource processing message for resource transfer into the first resource transfer-out account according to the respective generation orders of the at least two resource processing messages.
[0081] Among them, the generation order refers to the chronological order of generating each resource processing message, which can be specifically determined according to the generation sequence number or timestamp of each resource processing message. Specifically, the server can determine the generation order of each resource processing message, and according to the generation order of each resource processing message, obtain a second resource processing message whose generation order is before the first resource processing message from at least two obtained resource processing messages. Among them, the second resource processing message is used to transfer resources to the first resource transfer-out account, and the resource logical transfer process described in the second resource processing message is completed before the first resource logical transfer process. In addition, when the server determines that there is no resource processing message in the at least two obtained resource processing messages that is used to transfer resources to the first resource transfer-out account and whose generation order is before the first resource processing message, it can be determined that the server has not obtained a resource processing message that meets the conditions. Then the server can query the resource transfer record of the first resource transfer-out account and obtain the second resource processing message based on the resource transfer record.
[0082] In this embodiment, when the execution trigger condition of the smart contract is satisfied, the server obtains the first resource processing message from the multiple obtained resource processing messages, and obtains the second resource processing message according to the generation order of each resource processing message. The second resource processing message can be directly obtained from the already obtained resource processing messages, which improves the acquisition efficiency of the second resource processing message, and thus helps to improve the processing efficiency of resource transfer.
[0083] In an exemplary embodiment, the resource transfer method further includes: calling a smart contract deployed in the blockchain network for recording the resource transfer result, and recording the resource transfer result of the first resource processing message into the blockchain network.
[0084] Exemplarily, the server calls a smart contract pre-deployed in the blockchain network, and stores the resource transfer result of the first resource processing message through this smart contract. Specifically, the resource transfer result of the first resource processing message can be uploaded to the blockchain network for consensus processing, so as to record the resource transfer result into the blockchain network. In this embodiment, the server records the resource transfer result of the first resource processing message into the blockchain network by calling the smart contract, which can store the resource transfer result in a timely manner and ensure the security of the resource transfer result.
[0085] This application also provides an application scenario, which applies the above resource transfer method. Specifically, the application of the resource transfer method in this application scenario is as follows:
[0086] In existing digital resource trading systems, an asynchronous message processing mechanism is usually adopted to handle trading requests. However, due to reasons such as network latency and system failures, the arrival order of messages may be inconsistent with the sending order, leading to trading blockage problems. Among them, a digital resource trading system refers to a system used to implement trading functions such as buying, selling, exchanging, and transferring digital resources. Asynchronous messages refer to messages that are transmitted between different nodes during the digital resource trading process. Different from synchronous messages, the sending and receiving of asynchronous messages are relatively independent and do not block trading. Specifically, in existing digital resource trading systems, after a transaction is normally completed through a normal balance system, an asynchronous message processing mechanism is usually adopted to handle trading requests for digital resource accounting. In the asynchronous case, due to reasons caused by distributed system factors such as concurrency, blockage, and timeout, out-of-order problems may occur when the transaction is executed downstream, and out-of-order situations may lead to transaction deadlock blockage. The trading timing problem refers to the problem that a transaction cannot be successfully completed due to the time delay of message transmission between different nodes during the digital resource trading process.
[0087] As Figure 6 shown, assume that the initial resource amounts held by both Account A and Account B are 0. Between Account A and Account B, Transaction 1 is triggered in sequence to recharge Account A with 100 resources. At this time, the resource amount held by Account A increases by 100 (+100); Transaction 2 is for Account A to transfer 100 to Account B. Then the resource amount held by Account A decreases by 100 (-100), while the resource amount held by Account B increases by 100 (+100); Transaction 3 is for Account B to transfer 100 to Account A. Then the resource amount held by Account A increases by 100 (+100), while the resource amount held by Account B decreases by 100 (-100); Transaction 4 is to withdraw 100 from Account A. Then the resource amount held by Account A decreases by 100 (-100). That is, for Transactions 1 to 4, the normal trading timing is Transaction 1 - Transaction 2 - Transaction 3 - Transaction 4, while the timing of Transaction 1 - Transaction 4 - Transaction 2 - Transaction 3 belongs to abnormal timing, which may lead to transaction deadlock blockage and thus affect the resource processing efficiency.
[0088] Based on this, the resource transfer method provided in this embodiment is a method for using the single-dimensional transaction timing of the balance system to execute the timing of the digital resource trading system for an asynchronous parallel digital resource trading and accounting system. This method mainly aims at the transaction blocking problem caused by timing issues in the digital resource trading system implemented by asynchronous messages. By introducing a single-dimensional timing and maintaining concurrency, it can achieve the decoupling and smooth execution of transactions. Specifically, the resource transfer method provided in this embodiment sorts by the transaction flow of the debit side of the balance system as a single dimension. The sorting directly uses the automatically incremented serial number or timestamp of the balance system. Since the balance system records accounts based on the initially successful transactions, the timing will definitely contribute to the successful completion of the transaction. Moreover, when the balance system implements transaction accounting, the debit side is often synchronous, but the credit side may be asynchronous. Therefore, it is possible to directly select the debit side transaction flow order as the standard for execution, which can ensure the transaction timing, and at the same time, concurrency is supported between accounts, that is, transaction accounting processing can be synchronously performed separately between each account.
[0089] Specifically, as Figure 7 shown, among accounts A, B, C, D, E, F, and G, six resource transfer transaction processes of transactions 1 - 6 are triggered in sequence. Among them, transaction 1 is a resource transfer from account A to account B, transaction 2 is a resource transfer from account B to account C, transaction 3 is a resource transfer from account C to account D, transaction 4 is a resource transfer from account D to accounts E and F respectively, transaction 5 is a resource transfer from account F to account G, and transaction 6 is a resource transfer from account G to account A. Among them, transaction 1 - transaction 2 - transaction 3 - transaction 4 - transaction 5 - transaction 6 is the normal transaction order. If it is asynchronously transferred to the digital resource trading system, the timing may become transaction 4 - transaction 2 - transaction 3 - transaction 6 - transaction 5 - transaction 1. If no processing is done and it is executed out of order, it may fail due to insufficient digital resources, that is, insufficient balance. Based on this, all transactions are executed in the order of the debit side transaction flow, and the executed position points of the debit side are recorded.
[0090] Specifically, when each transaction arrives at the digital resource trading system in the order of Transaction 4 - Transaction 2 - Transaction 3 - Transaction 6 - Transaction 5 - Transaction 1, for Transaction 4, the debiting party is Account D. The digital resource trading system queries the transaction record of Account D, that is, queries the resource transfer record of Account D. Since the balance system has been successfully executed according to the original transaction order, the order of execution in the balance system must be the credit of Transaction 3, which occurs before the debit of Transaction 4. Queuing and executing according to the transaction record of debiting Account D, if the record position of the credit of Transaction 3 has not been executed, first execute the record of Transaction 3, update the execution position, and then execute Transaction 4, which can ensure the successful execution of Transaction 4. For Transaction 2, the debiting party is Account B. The digital resource trading system queries the transaction record of Account B. Since the balance system has been successfully executed according to the original transaction order, the order of execution in the balance system must be the credit of Transaction 1, which occurs before the debit of Transaction 2. Queuing and executing according to the transaction record of debiting Account B, if the record position of the credit of Transaction 1 has not been executed, first execute the record of Transaction 1, update the execution position, and then execute Transaction 2, which can ensure the successful execution of Transaction 2. For Transaction 3, the debiting party is Account C. The digital resource trading system queries the transaction record of Account C. Since the balance system has been successfully executed according to the original transaction order, the order of execution in the balance system must be the credit of Transaction 2, which occurs before the debit of Transaction 3. Queuing and executing according to the transaction record of Account C, if the record position of the credit of Transaction 2 has not been executed, first execute the record of Transaction 2, update the execution position, and then execute Transaction 3, which can ensure the successful execution of Transaction 3. For Transaction 6, the debiting party is Account G. The digital resource trading system queries the transaction record of Account G. Since the balance system has been successfully executed according to the original transaction order, the order of execution in the balance system must be the credit of Transaction 5, which occurs before the debit of Transaction 6. Queuing and executing according to the transaction record of debiting Account G, if the record position of the credit of Transaction 5 has not been executed, first execute the record of Transaction 5, update the execution position, and then execute Transaction 6, which can ensure the successful execution of Transaction 6. For Transaction 1, the debiting party is Account A. The digital resource trading system queries the transaction record of Account A. Since the balance system has been successfully executed according to the original transaction order, Transaction 1 is the first transaction of Account A, and it can be directly executed successfully.
[0091] For the resource transfer method provided in this embodiment, when the digital resource trading system executes, it first traces back and executes the transactions that are completed earlier in time sequence, supports independent parallel execution among various accounts, and ensures that there will be no transaction blocking and transaction deadlock problems caused by insufficient balance. It realizes the transaction time sequence based on the single - dimension time sequence of the balance system. By using a single dimension, it avoids transaction time - sequence problems while improving the concurrency among different accounts, thereby improving the transaction processing efficiency.
[0092] This application also provides an application scenario, which applies the above - mentioned resource transfer method. Specifically, the application of the resource transfer method in this application scenario is as follows:
[0093] In the existing digital resource trading system, usually after a transaction is successfully completed through the normal balance system, the asynchronous message processing mechanism is used to process the transaction requests for digital resource accounting. The resource transfer method provided in this embodiment is applied to the transaction synchronization processing between the balance system and the digital resource trading system. The balance system and the digital resource trading system can be implemented asynchronously and in parallel. The balance system can quickly generate transaction records, and the digital resource trading system can perform actual digital resource transfer processing based on the transaction records. Specifically, the transaction flow is recorded in the balance system, and in the digital resource trading system, digital resource transfer processing needs to be performed according to the transaction flow recorded in the balance system. Specifically for the transaction record, it is determined whether the previous transaction has completed the digital resource transfer processing according to the transaction flow of the debiting party in the transaction record. If so, the digital resource trading system performs resource transfer processing for this transaction record, so as to achieve the accurate synchronization of the transaction time sequence between the digital resource trading system and the balance system, and the respective processes of the digital resource trading system and the balance system can be implemented asynchronously and in parallel.
[0094] Specifically, as Figure 8 shown, first, the user can access the digital resource trading system, which is a system for managing the digital resources held by each user. The transfer of digital resources in the digital resource trading system needs to refer to the transaction records generated in the balance system. The user can apply for a resource account from the digital resource trading system and transfer a certain number of digital accounts. The user can conduct transactions through the held resource account. The transactions can be online transactions or offline transactions. Each time the user conducts a transaction, a corresponding transaction record will be generated by the balance system. The balance system transmits the transaction record to the digital resource trading system. Specifically, the balance system only records the generated transaction records and does not involve the actual transfer of digital resources. The balance system can transmit the generated transaction records to the digital resource trading system so that the digital resource trading system can perform resource transfer processing for the user's resource account based on the transaction records. The digital resource trading system determines the transaction time sequence. Specifically, for the transaction records received by the digital resource trading system, due to differences such as network fluctuations and transmission paths, the time sequence of the transaction records received by the digital resource trading system is not necessarily strictly consistent with the time sequence of the transaction records generated in the balance system. At this time, it is necessary to determine the transaction time sequence of the received transaction records and perform resource transfer processing according to the correct time sequence. The digital resource trading system can determine whether the previous transaction has completed the actual resource transfer processing according to the transaction flow of the debiting party in the transaction record. If so, the digital resource trading system performs corresponding actual resource transfer processing for this transaction record. The digital resource trading system further synchronizes the transaction records, that is, after determining the time sequence of the transaction records, the digital resource trading system synchronizes in sequence according to the time sequence of the transaction records, that is, completes the resource transfer processing between the corresponding resource accounts.
[0095] Specifically, when a user makes a transaction payment through a resource account, the balance system generates a transaction record for the transaction. The transaction record can record the transaction time, information of both parties to the transaction, transaction amount, transaction category, etc., so as to describe the transaction comprehensively. When the user makes a transaction through the held resource account, the balance system sends the generated transaction record to the digital resource trading system, so that the digital resource trading system can perform real resource transfer processing based on the transaction record. When digital resources are widely used, the concurrency of digital resource transactions is high, and a huge number of transactions may be generated in a short time, and correspondingly a huge number of transaction records will be generated. However, the real-time performance of the resource transfer processing of the digital resource trading system for digital resources may not meet the requirements, that is, the digital resource trading system may not be able to ensure that each transaction record can complete the corresponding resource transfer processing immediately. The real resource transfer processing of the digital resource trading system will lag behind the generation of transaction records by the balance system, and it is relatively easy to accumulate a large number of transaction records. The balance system sends the generated transaction record to the digital resource trading system. Due to network fluctuations or the influence of the transmission path, the time sequence of the transaction records received by the digital resource trading system may not be strictly consistent with the time sequence of the generation of transaction records in the balance system, that is, the transaction record generated first may be received later. Therefore, the digital resource trading system needs to determine the transaction time sequence for the received transaction record before performing the transfer processing.
[0096] Furthermore, for each transaction record received from the balance system, the digital resource trading system needs to determine the corresponding transaction time sequence. Specifically, for the transaction record to be processed, the digital resource trading system determines the debiting party in the transaction record and queries the transaction flow of the debiting party to determine whether the previous transaction of the debiting party has completed the digital resource transfer processing. If so, it is considered that the current transaction record can be processed, that is, the resource transfer processing is performed on the transaction record in the digital resource trading system. If not, it indicates that there is a previous dependent transaction that has not completed the resource transfer processing. Then the digital resource trading system can add the current transaction record to the transaction record queue, obtain the next transaction record and make a judgment again until it is determined whether the previous transaction of the current transaction record has completed the resource transfer processing of the digital resources, and then perform the transfer processing on the current transaction record, so as to accurately synchronize the transaction time sequence of the digital resource trading system and the balance system, and the respective processing of the digital resource trading system and the balance system can be realized in parallel, thereby reducing the blocking problem of resource transfer processing and improving the processing efficiency of resources on the premise of ensuring the time sequence of resource transfer processing.
[0097] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0098] Based on the same inventive concept, an embodiment of the present application also provides a resource transfer device for implementing the above-mentioned resource transfer method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the resource transfer device provided below can refer to the limitations on the resource transfer method in the above text, and will not be repeated here.
[0099] In an exemplary embodiment, as Figure 9 shown, a resource transfer device 900 is provided, including: a first message acquisition module 902, a second message acquisition module 904, a second message processing module 906, and a first message processing module 908, where:
[0100] The first message acquisition module 902 is configured to acquire a first resource processing message generated when the first resource logical transfer processing is completed, and determine a first resource transfer-out account, a first resource transfer-in account, and a first resource transfer amount corresponding to the first resource processing message;
[0101] The second message acquisition module 904 is configured to, when the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, acquire a second resource processing message for resource transfer in to the first resource transfer-out account; the second resource processing message is generated when the second resource logical transfer processing is completed; the second resource logical transfer processing is completed before the first resource logical transfer processing;
[0102] The second message processing module 906 is configured to perform resource transfer in to the first resource transfer-out account according to the second resource processing message;
[0103] The first message processing module 908 is configured to perform resource transfer from the first resource transfer-out account after resource transfer in to the first resource transfer-in account according to the first resource transfer amount, and obtain the resource transfer result of the first resource processing message.
[0104] In one embodiment, the second message acquisition module 904 is also used to query the resource transfer record of the first resource transfer-out account when the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount; the resource transfer record includes various resource processing messages associated with the first resource transfer-out account; according to the generation order of each resource processing message, the second resource processing message used to transfer resources into the first resource transfer-out account is determined from each resource processing message.
[0105] In one embodiment, the second message acquisition module 904 is also used to determine, from various resource processing messages, a transfer-in resource processing message used to transfer resources into the first resource transfer-out account; determine a processing order of resource logical transfer processing corresponding to the transfer-in resource processing message; and determine a second resource processing message from the transfer-in resource processing message according to the processing order of the first resource logical transfer processing and the processing order of resource logical transfer processing corresponding to the transfer-in resource processing message.
[0106] In one embodiment, the second message processing module 906 is also used to determine the second resource transfer-out account and the second resource transfer amount corresponding to the second resource processing message; when the second resource transfer-out account supports resource transfer according to the second resource transfer amount, resources are transferred into the first resource transfer-out account according to the second resource transfer amount through the second resource transfer-out account; the first message processing module 908 is also used to determine the resources to be transferred out that match the first resource transfer amount from the first resource transfer-out account after the resource transfer; the resources to be transferred out are transferred to the first resource transfer-in account through the first resource transfer-out account, and the resource transfer result of the first resource processing message is obtained.
[0107] In one embodiment, the second message processing module 906 is also used to perform resource transfer processing on the previous resource processing message of the second resource processing message when the second resource transfer-out account does not support resource transfer according to the second resource transfer amount, until the second resource transfer-out account supports resource transfer according to the second resource transfer amount; wherein the previous resource processing message is a resource processing message generated when the previous resource logical transfer processing is completed and is used to transfer resources into the second resource transfer-out account; the previous resource logical transfer processing is completed before the second resource logical transfer processing.
[0108] In one embodiment, the first message acquisition module 902 is also used to determine a smart contract deployed in the blockchain network for determining resource transfer information; extract resource transfer information from the first resource processing message based on the smart contract; the resource transfer information includes an account identifier and a first resource transfer amount; and determine a first resource transfer-out account and a first resource transfer-in account based on the account identifier.
[0109] In one embodiment, the first message acquisition module 902 is further configured to determine an intelligent contract deployed in the blockchain network for resource transfer processing; when the execution trigger condition of the intelligent contract is satisfied, obtain a first resource processing message from at least two acquired resource processing messages based on the intelligent contract; the second message acquisition module 904 is further configured to obtain, from at least two resource processing messages, a second resource processing message for transferring resources to the first resource transfer-out account according to the generation order of each of the at least two resource processing messages.
[0110] In one embodiment, it further includes a resource transfer result storage module, configured to call an intelligent contract deployed in the blockchain network for recording resource transfer results, and record the resource transfer result of the first resource processing message into the blockchain network.
[0111] Each module in the above resource transfer device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0112] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 10 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store resource transfer data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, implements a resource transfer method. Those skilled in the art can understand that Figure 10 the structure shown in
[0113] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the foregoing method embodiments are implemented.
[0114] In one embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.
[0115] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.
[0116] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0117] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.
[0118] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification. The above-described embodiments only represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A resource transfer method, characterized in that, The method includes: Obtaining a first resource processing message generated when the first resource logical transfer process is completed, and determining a first resource transfer-out account, a first resource transfer-in account, and a first resource transfer amount corresponding to the first resource processing message; When the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtaining a second resource processing message for resource transfer in to the first resource transfer-out account; the second resource processing message is generated when the second resource logical transfer process is completed; the second resource logical transfer process is completed before the first resource logical transfer process; Performing resource transfer in to the first resource transfer-out account according to the second resource processing message; Performing resource transfer from the first resource transfer-out account after resource transfer in according to the first resource transfer amount to the first resource transfer-in account, to obtain a resource transfer result of the first resource processing message.
2. The method according to claim 1, wherein The step of, when the first resource transfer-out account does not support resource transfer out according to the first resource transfer amount, obtaining a second resource processing message for resource transfer in to the first resource transfer-out account, includes: When the resource holding amount of the first resource transfer-out account is less than the first resource transfer amount, querying a resource transfer record of the first resource transfer-out account; the resource transfer record includes each resource processing message associated with the first resource transfer-out account; Determining, according to the generation order of each of the resource processing messages, a second resource processing message for resource transfer in to the first resource transfer-out account from the resource processing messages.
3. The method according to claim 2, wherein The step of determining, according to the generation order of each of the resource processing messages, a second resource processing message for resource transfer in to the first resource transfer-out account from the resource processing messages, includes: Determining, from the resource processing messages, a transfer-in resource processing message for resource transfer in to the first resource transfer-out account; Determining a processing order of the resource logical transfer process corresponding to the transfer-in resource processing message; Determining a second resource processing message from the transfer-in resource processing messages according to the processing order of the first resource logical transfer process and the processing order of the resource logical transfer process corresponding to the transfer-in resource processing message.
4. The method according to claim 1, wherein The step of performing resource transfer in to the first resource transfer-out account according to the second resource processing message, includes: Determining a second resource transfer-out account and a second resource transfer amount corresponding to the second resource processing message; When the second resource transfer-out account supports resource transfer out according to the second resource transfer amount, performing resource transfer in to the first resource transfer-out account from the second resource transfer-out account according to the second resource transfer amount; The step of performing resource transfer from the first resource transfer-out account after resource transfer in according to the first resource transfer amount to the first resource transfer-in account, to obtain a resource transfer result of the first resource processing message, includes: Determining, from the first resource transfer-out account after resource transfer in, a to-be-transferred resource matching the first resource transfer amount; Transfer the to-be-transferred resources to the first resource receiving account through the first resource transfer-out account, and obtain the resource transfer result of the first resource processing message.
5. The method according to claim 4, characterized in that, The method further includes: When the second resource transfer-out account does not support resource transfer according to the second resource transfer amount, perform resource transfer processing on the prior resource processing message of the second resource processing message until the second resource transfer-out account supports resource transfer according to the second resource transfer amount; Wherein, the prior resource processing message is a resource processing message generated under the condition of completing the prior resource logical transfer processing and used for resource transfer into the second resource transfer-out account; the prior resource logical transfer processing is completed before the second resource logical transfer processing.
6. The method according to claim 1, characterized in that, The determining the first resource transfer-out account, the first resource receiving account, and the first resource transfer amount corresponding to the first resource processing message includes: Determine the smart contract deployed in the blockchain network for determining resource transfer information; Extract resource transfer information from the first resource processing message based on the smart contract; the resource transfer information includes an account identifier and the first resource transfer amount; Determine the first resource transfer-out account and the first resource receiving account according to the account identifier.
7. The method according to claim 1, characterized in that The obtaining the first resource processing message generated under the condition of completing the first resource logical transfer processing includes: Determine the smart contract deployed in the blockchain network for resource transfer processing; When the execution trigger condition of the smart contract is satisfied, obtain the first resource processing message from at least two resource processing messages obtained based on the smart contract; The obtaining the second resource processing message for resource transfer into the first resource transfer-out account includes: Obtain the second resource processing message for resource transfer into the first resource transfer-out account from the at least two resource processing messages according to the respective generation order of the at least two resource processing messages.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Invoke the smart contract deployed in the blockchain network for recording resource transfer results, and record the resource transfer result of the first resource processing message in the blockchain network.
9. A resource transfer device, characterized in that, The device includes: A first message acquisition module, configured to acquire the first resource processing message generated under the condition of completing the first resource logical transfer processing, and determine the first resource transfer-out account, the first resource receiving account, and the first resource transfer amount corresponding to the first resource processing message; A second message acquisition module, configured to, when the first resource transfer-out account does not support resource transfer according to the first resource transfer amount, acquire the second resource processing message for resource transfer into the first resource transfer-out account; the second resource processing message is generated under the condition of completing the second resource logical transfer processing; the second resource logical transfer processing is completed before the first resource logical transfer processing; A second message processing module, configured to perform resource transfer into the first resource transfer-out account according to the second resource processing message. The first message processing module is configured to perform resource transfer from the first resource transfer-out account after resource transfer-in to the first resource transfer-in account according to the first resource transfer amount, so as to obtain the resource transfer result of the first resource processing message.
10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that, When this computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 8.