Blockchain-based resource allocation method and device
Through blockchain technology and smart contracts, the main allocation contract and appointment allocation contract are created to automatically perform resource allocation, solving the problem of insufficient allocation reliability in the centralized system, and realizing trustworthy execution and on-time triggering of resource allocation.
Patent Information
- Application Number
- CN202210654605.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-06-10
AI Technical Summary
The existing resource reservation allocation process relies on a centralized system and cannot confirm whether the allocation information has been recorded and sent before sending, resulting in insufficient allocation reliability.
Using blockchain technology, resource allocation is realized through smart contracts, main allocation contracts and appointment allocation contracts are created, resource allocation operations are automatically performed, and allocation is triggered at appointment time to ensure that allocation information is permanently stored and tamper-proof on the blockchain.
It improves the credible execution and reliability of the resource allocation process, ensures that appointment allocation information is executed on time, and avoids the risks of centralized systems.
Smart Images

Figure CN114970917B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of blockchain technology, and particularly to a resource allocation method based on blockchain. One or more embodiments of this specification simultaneously relate to a resource allocation system based on blockchain, a resource allocation device based on blockchain, a computing device, and a computer-readable storage medium. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, is a new technology in which several computing devices jointly participate in "recording accounts" and jointly maintain a complete distributed database. Due to the characteristics of blockchain technology such as decentralization, openness and transparency, each computing device can participate in database records, and data synchronization can be quickly carried out between computing devices, blockchain technology has been widely applied in many fields.
[0003] Currently, the process of resource reservation and allocation is mostly based on a centralized system. The centralized system locally stores the reservation and allocation information of customers and sends it to the resource allocation participants for processing at the reservation time. However, whether there is a reservation record in the centralized system and whether the reservation and allocation information will be sent to the resource allocation participants later, neither the resource allocation participants nor the users can confirm before sending, that is, the reliability of resource allocation cannot be effectively guaranteed. Therefore, an effective method is urgently needed to solve such problems. Summary of the Invention
[0004] In view of this, the embodiments of this specification provide a resource allocation method based on blockchain. One or more embodiments of this specification simultaneously relate to a resource allocation system based on blockchain, a resource allocation device based on blockchain, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0005] According to the first aspect of the embodiments of this specification, a resource allocation method based on blockchain is provided, which is applied to a blockchain node and includes:
[0006] Invoking an allocation main contract based on the received resource allocation request, executing the query logic declared in the allocation main contract, and querying a corresponding reservation and allocation contract according to a pre-stored contract query address;
[0007] Determining whether the reservation and allocation contract contains the to-be-processed allocation information of the first user according to the user identifier of the first user carried in the resource allocation request;
[0008] If so, obtaining the to-be-processed allocation information, and executing the allocation logic declared in the allocation main contract, and performing the resource allocation operation of the first user according to the to-be-processed allocation information.
[0009] Optionally, after performing the resource allocation operation of the first user according to the to-be-processed allocation information, the method further includes:
[0010] Execute the allocation logic declared in the allocation master contract, and perform the resource allocation operation of the first user according to the allocation information carried in the resource allocation request.
[0011] Optionally, the resource allocation method based on the blockchain further includes:
[0012] Create an allocation master contract and a reserved allocation contract;
[0013] Determine a first contract address corresponding to the reserved allocation contract and a second contract address corresponding to the allocation master contract;
[0014] Update the allocation master contract based on the first contract address and update the reserved allocation contract based on the second contract address.
[0015] Optionally, after obtaining the to-be-processed allocation information, the method further includes:
[0016] Determine the reserved allocation time included in the to-be-processed allocation information;
[0017] When it is determined that the reserved allocation time is reached or it is determined that the current time is later than the reserved allocation time, execute the allocation logic declared in the allocation master contract, and perform the resource allocation operation of the first user according to the to-be-processed allocation information.
[0018] Optionally, the resource allocation method based on the blockchain further includes:
[0019] Receive a reserved resource allocation request submitted by the first user;
[0020] Update the reserved allocation contract according to the to-be-processed allocation information carried in the reserved resource allocation request.
[0021] Optionally, the resource allocation method based on the blockchain further includes:
[0022] Receive a reserved fund allocation request submitted by the first user;
[0023] Perform consensus processing on the to-be-processed allocation information carried in the reserved fund allocation request, where the to-be-processed allocation information includes an allocation fund amount, an allocation fund account, a reserved allocation time, and allocation participants;
[0024] In response to the notification information that the to-be-processed allocation information passes the consensus, update the reserved allocation contract according to the to-be-processed allocation information.
[0025] Optionally, the blockchain-based resource allocation method further includes:
[0026] Receiving a resource allocation request sent by a target blockchain node, where the resource allocation request includes a first contract address corresponding to a reserved allocation contract;
[0027] Correspondingly, invoking the allocation main contract based on the received resource allocation request includes:
[0028] Invoking the reserved allocation contract based on the first contract address, executing the invocation logic declared in the reserved allocation contract, and invoking the allocation main contract according to a pre-stored second contract address.
[0029] Optionally, the resource allocation request is sent by a business party through the target blockchain node;
[0030] Correspondingly, the method further includes:
[0031] Determining whether the business party is included in the allocation participants in the to-be-processed allocation information;
[0032] If not, after performing the resource allocation operation of the first user according to the to-be-processed allocation information, allocating corresponding reward resources to the target blockchain node.
[0033] Optionally, the blockchain-based resource allocation method further includes:
[0034] Receiving a query request for a reserved allocation contract submitted by a business party;
[0035] Determining the to-be-processed allocation information of at least one user included in the reserved allocation contract;
[0036] Determining whether the business party is included in the allocation participants in the to-be-processed allocation information of a second user, where the second user is one of the at least one user;
[0037] If not, returning the reserved allocation time in the to-be-processed allocation information of the second user to respond to the query request;
[0038] If so, returning the to-be-processed allocation information of the second user to respond to the query request.
[0039] According to the second aspect of the embodiments of the present specification, a blockchain-based resource allocation system is provided, including:
[0040] A client and at least one blockchain node;
[0041] The client is configured to query the reservation transfer contract stored in the target blockchain node, and when it is determined that the reservation transfer time corresponding to the transfer information to be processed in the reservation transfer contract is reached, send a resource transfer request to the target blockchain node, where the target blockchain node is one of the at least one blockchain node;
[0042] The target blockchain node is configured to receive the resource transfer request, call the reservation transfer contract based on the first contract address carried in the resource transfer request, execute the call logic declared in the reservation transfer contract, call the transfer main contract according to the pre-stored second contract address, execute the transfer logic declared in the transfer main contract, obtain and execute the resource transfer operation of the target user according to the transfer information to be processed.
[0043] Optionally, the target blockchain node is further configured to:
[0044] Execute the query sub-logic declared in the transfer main contract, query the corresponding reservation transfer contract according to the pre-stored first contract address, and obtain the transfer information to be processed included in the reservation transfer contract;
[0045] Execute the transfer sub-logic declared in the transfer main contract, and execute the resource transfer operation of the target user according to the transfer information to be processed.
[0046] According to the third aspect of the embodiments of the present specification, a blockchain-based resource transfer device is provided, which is applied to a blockchain node and includes:
[0047] A query module, configured to call the transfer main contract based on the received resource transfer request, execute the query logic declared in the transfer main contract, and query the corresponding reservation transfer contract according to the pre-stored contract query address;
[0048] A determination module, configured to determine whether the transfer information to be processed of the target user is included in the reservation transfer contract according to the user identifier of the target user carried in the resource transfer request;
[0049] If the operation result of the confirmation module is yes, then run the execution module;
[0050] The execution module is configured to obtain the transfer information to be processed, execute the transfer logic declared in the transfer main contract, and execute the resource transfer operation of the target user according to the transfer information to be processed.
[0051] According to the fourth aspect of the embodiments of the present specification, a computing device is provided, including:
[0052] A memory and a processor;
[0053] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the blockchain-based resource allocation method.
[0054] According to a fifth aspect of the embodiments of the present specification, there is provided a computer-readable storage medium storing computer-executable instructions, which when executed by a processor implement the steps of the blockchain-based resource allocation method.
[0055] In one embodiment of the present specification, by invoking a transfer master contract based on a received resource transfer request, executing the query logic declared in the transfer master contract, querying a corresponding reservation transfer contract according to a pre-stored contract query address, and determining whether the reservation transfer contract contains pending transfer information of the first user according to the user identification of the first user carried in the resource transfer request. If so, the pending transfer information is obtained, and the transfer logic declared in the transfer master contract is executed, and the resource transfer operation of the first user is performed according to the pending transfer information.
[0056] Based on the permanent preservation and anti-tampering characteristics of the blockchain, and at the same time using the characteristics of automatic execution of blockchain smart contracts in the embodiments of the present specification, the execution of the resource transfer process is automatically executed using a transfer master contract, which is beneficial to ensuring the trusted execution of the resource transfer process. In addition, in the embodiments of the present specification, the transfer master contract and the reservation transfer contract are automatically associated to ensure that every time a transfer contract is triggered, it can be checked whether there is pending transfer information that has expired in the reservation transfer contract. If so, it can be triggered simultaneously to ensure that the pending transfer information can be executed after expiration. Description of the Drawings
[0057] Figure 1 is an architecture diagram of a blockchain-based resource allocation system provided by an embodiment of the present specification;
[0058] Figure 2 is a processing flow chart of a blockchain-based resource allocation method provided by an embodiment of the present specification;
[0059] Figure 3 is a processing process flow chart of a blockchain-based resource allocation method provided by an embodiment of the present specification;
[0060] Figure 4 is a schematic diagram of a blockchain-based resource allocation device provided by an embodiment of the present specification;
[0061] Figure 5 is a structural block diagram of a computing device provided by an embodiment of the present specification. Detailed Embodiments
[0062] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of the present specification. Therefore, the present specification is not limited by the specific implementations disclosed below.
[0063] The terms used in one or more embodiments of the present specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present specification. The singular forms "a", "the", and "said" used in one or more embodiments of the present specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present specification refers to and includes any or all possible combinations of one or more of the associated listed items.
[0064] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of the present specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0065] First, the noun terms related to one or more embodiments of the present specification are explained.
[0066] Reservation transfer: Here, it means that the fund transfer request is not initiated immediately, but is reserved to be initiated at a certain future time according to the user's needs.
[0067] Since the current fund reservation transfer method is based on a centralized system. The centralized system locally stores the user's reservation transfer request and sends it to the bank for processing until the expected time. Whether the centralized system has a reservation record and whether it will be initiated later cannot be confirmed by the bank and the user before the actual initiation. Based on this, the embodiments of the present specification provide a method for resource transfer based on blockchain. By using a smart contract to store the reservation transfer request on the chain, it is ensured that the reservation transfer request can be perceived by each participating party in advance and the relevant transfer operation can be executed after confirming that the reservation transfer time has arrived.
[0068] In the present specification, a method for resource transfer based on blockchain is provided. The present specification also relates to a resource transfer system based on blockchain, a resource transfer device based on blockchain, a computing device, and a computer-readable storage medium, which will be described in detail one by one in the following embodiments.
[0069] Figure 1 Shows an architecture diagram of a blockchain-based resource allocation system provided according to an embodiment of this specification, including:
[0070] A client 102 and at least one blockchain node 104;
[0071] The client 102 is configured to query a reservation allocation contract stored in the target blockchain node 104, and when it is determined that the reservation allocation time corresponding to the pending allocation information in the reservation allocation contract is reached, send a resource allocation request to the target blockchain node 104, where the target blockchain node 104 is one of the at least one blockchain node 104;
[0072] The target blockchain node 104 is configured to receive the resource allocation request, call the reservation allocation contract based on the first contract address carried in the resource allocation request, execute the call logic declared in the reservation allocation contract, call the allocation main contract according to the pre-stored second contract address, execute the allocation logic declared in the allocation main contract, obtain and execute the resource allocation operation of the target user according to the pending allocation information.
[0073] Optionally, the target blockchain node 104 is further configured to:
[0074] Execute the query sub-logic declared in the allocation main contract, query the corresponding reservation allocation contract according to the pre-stored first contract address, and obtain the pending allocation information included in the reservation allocation contract;
[0075] Execute the allocation sub-logic declared in the allocation main contract, and execute the resource allocation operation of the target user according to the pending allocation information.
[0076] Specifically, in the embodiments of this specification, each participating party (bank and institutions that need to participate in the transaction) communicates with the blockchain network and does not need to communicate directly with other participating parties;
[0077] There are a reservation allocation contract and an allocation main contract in the blockchain. The allocation main contract contains the first contract address of the reservation allocation contract. When a user initiates a transaction, the allocation main contract can query whether the user has an expired reservation order. If so, it can automatically execute the transaction of the reservation order first as a fallback trigger logic; the reservation allocation contract maintains the reservation allocation requests that each user hopes to perform. As long as the user submits a reservation allocation request, the associated bank participating party of the allocation can query it through the allocation contract interface, and there will be no problem of loss or tampering by the centralized custody system.
[0078] Among them, the process for the user to submit a reservation order is:
[0079] 1. The user adds a reservation transfer order by calling the add interface of the reservation transfer contract.
[0080] 2. The reservation transfer contract maintains the transfer orders for price increases of each user (supporting multiple reservation transfer orders).
[0081] 3. The content of the reservation transfer order is similar to that of a normal transfer. In the case where the resource is funds, the reservation transfer order includes information such as the receiving and paying accounts, currency amounts, and participating banks involved in the transaction. In addition, it is the expected time for the transaction to be executed.
[0082] 4. After the user submits, the submission request will conduct consensus on the blockchain. After the consensus is completed, the submitted reservation transfer order will be stored in the block.
[0083] 5. The participating parties involved in this transaction (the submitting user, bank, etc.) can confirm that the transaction has completed consensus and been stored on the chain through the query interface of the transfer reservation contract.
[0084] Among them, the query interface can perform authentication to ensure that only the participating parties of this transaction can query the sensitive information of the transaction.
[0085] 6. Institutions such as banks, if they monitor a transaction that they need to process in the future, can prepare for the reservation order in advance (such as preparing sufficient liquidity funds in advance and conducting relevant inspections).
[0086] In addition, the embodiments of this specification can also adopt the method triggered by the participating parties:
[0087] 1. All participating parties (users, banks) of a reservation transfer set up a timing task in their own business systems. When the time set in the reservation transfer order is reached, the timing task is triggered.
[0088] 2. After being triggered, a participating party (any one, which can be the user's system or the bank's system) calls the interface of the transfer main contract to initiate a transfer (without passing in any transaction details, only passing in the reservation transfer order number).
[0089] 3. After receiving the request, the transfer main contract queries in the reservation transfer contract based on the reservation transfer order number passed in by the user to determine whether the current time has reached the set value.
[0090] 4. If it has reached, the transfer main contract reads the transaction element information from the reservation order and initiates a transfer according to the normal process; if it has not reached, it directly rejects the execution.
[0091] On the other hand, the embodiments of this specification also provide a passive triggering method as a fallback. That is, when any user calls the transfer master contract to initiate a transaction, the transfer master contract first detects the reserved transfer contract and queries whether there are any reserved orders that have reached the due time. If so, the reserved orders that have reached the due time are executed together with the currently requested transaction. This can ensure that as long as there is a transaction in the entire system, the expired reserved transfer orders will not remain unprocessed all the time.
[0092] In addition, institutions such as banks, if they monitor a transaction that needs to be processed by themselves in the future, can prepare for the reserved order in advance (such as preparing sufficient liquidity funds in advance and conducting relevant inspections).
[0093] In the embodiments of this specification, the method of each participating party's business system creating its own timing task and triggering the execution by calling the smart contract interface when the time comes can also be further extended. The monitoring permission can be opened to all users on the chain. Everyone can read the reserved time of the transfer order and then call the transfer master contract to trigger it. Whoever successfully triggers the transfer master contract will be given a certain reward on the chain to encourage the participating parties to maintain the transactions on the chain.
[0094] However, the embodiments of this specification need to ensure that non-direct participants in each transaction can only obtain the triggering time of the transaction and cannot read other privacy information of the transaction.
[0095] In addition, the embodiments of this specification use blockchain smart contracts to deposit the reserved orders, ensuring that the reservation is immediately recorded on the chain. All participating parties can query it, and it cannot be tampered with. It also ensures that the reserved orders can be triggered on time, avoiding risks such as centralized system malicious behavior and downtime, and ensuring that the reserved orders can be executed on time.
[0096] Figure 2 The flowchart of a blockchain-based resource transfer method provided according to an embodiment of this specification is shown, including steps 202 to 206.
[0097] Step 202, call the transfer master contract based on the received resource transfer request, execute the query logic declared by the transfer master contract, and query the corresponding reserved transfer contract according to the pre-stored contract query address.
[0098] Specifically, the blockchain-based resource transfer method provided by the embodiments of this specification is applied to blockchain nodes.
[0099] Among them, both the transfer master contract and the reservation transfer contract are smart contracts. A smart contract is a computer protocol written on a blockchain that is transmitted and verified through information-based means and will execute once certain predefined conditions are met. Therefore, in the embodiments of this specification, the blockchain node can create a transfer master contract and a reservation transfer contract, so that when receiving a user's resource transfer request and determining that the resource transfer request meets the execution conditions of the transfer master contract or the reservation transfer contract, the logic declared in the transfer master contract or the reservation transfer contract is executed to perform resource transfer.
[0100] Based on the characteristics of permanent preservation and anti-tampering of the blockchain in the embodiments of this specification, and at the same time using the characteristic of automatic execution of blockchain smart contracts, the execution of resource transfer is automatically executed using smart contracts to ensure the trustworthy execution of the resource transfer request.
[0101] In addition, the transfer master contract is used to receive and process the resource transfer requests submitted by users, while the reservation transfer contract is used to store the to-be-processed transfer information included in the users' reservation transfer requests. Therefore, if the first user has a reservation need for resource transfer, the to-be-processed transfer information can be first submitted to the blockchain, and the blockchain node receives the reservation resource transfer request submitted by the first user;
[0102] The reservation transfer contract is updated according to the to-be-processed transfer information carried in the reservation resource transfer request.
[0103] Specifically, if a user submits a reservation resource transfer request, after the blockchain node receives the reservation resource transfer request, the to-be-processed transfer information carried in the reservation resource transfer request can be added to the reservation transfer contract, specifically, the reservation transfer contract is updated according to the to-be-processed transfer information carried in the reservation resource transfer request.
[0104] In practical applications, the user can generate a reservation transfer order based on the to-be-processed transfer information and upload the reservation transfer order to the blockchain node, and the blockchain node can provide an adding interface for the reservation transfer order for the user so that the user can add a reservation transfer order by calling the adding interface of the reservation transfer order. After the blockchain node receives the reservation transfer order, the reservation transfer contract can be updated based on the to-be-processed transfer information included in the reservation transfer order.
[0105] Among them, the reservation transfer contract maintains the reservation transfer orders submitted by each user, that is, each reservation transfer contract can support multiple reservation transfer orders. The content of each reservation transfer order is similar to the content of normal transfer. In the case of transferring funds for resources, the reservation transfer order can include information such as the receiving and paying accounts, currency amounts, and participating banks involved in the transaction. In addition, it is the expected resource transfer execution time.
[0106] Based on this, after receiving the user's resource allocation request, in order to ensure the timely execution of the user's reserved allocation request, the blockchain node can query whether there is a pending reserved allocation request of this user in the reserved allocation contract, that is, whether there is pending allocation information of this user. If it exists, the pending reserved allocation request can be executed first.
[0107] In specific implementation, the blockchain node can first create an allocation master contract and a reserved allocation contract;
[0108] Determine the first contract address corresponding to the reserved allocation contract and the second contract address corresponding to the allocation master contract;
[0109] Update the allocation master contract based on the first contract address and update the reserved allocation contract based on the second contract address.
[0110] Specifically, before receiving the user's resource allocation request, an allocation master contract and a reserved allocation contract can be created first. After creation, the first contract address of the reserved allocation contract can be stored in the allocation master contract, and the second contract address of the allocation master contract can be stored in the reserved allocation contract, so that the allocation master contract can call the reserved allocation contract according to this first contract address, and the reserved allocation contract can call the allocation master contract based on this second contract address.
[0111] Therefore, after receiving the user's resource allocation request, the blockchain node can call the allocation master contract and execute the query logic declared in the allocation master contract. According to the first contract address of the reserved allocation contract stored in advance, it can call and query whether the reserved allocation contract contains the pending allocation information of this user to ensure that the user's reserved allocation request can be executed after it arrives.
[0112] Alternatively, in the case where the allocated resource is funds, in the embodiments of this specification, the blockchain node can receive the reserved fund allocation request submitted by the first user;
[0113] Perform consensus processing on the pending allocation information carried in the reserved fund allocation request, where the pending allocation information includes the allocated fund amount, the allocated fund account, the reserved allocation time, and the allocation participants;
[0114] In response to the notification information that the pending allocation information passes the consensus, update the reserved allocation contract according to the pending allocation information.
[0115] Specifically, the blockchain node can provide an interface for adding a reserved allocation form for the user, so that the user can add a reserved allocation form by calling the interface for adding a reserved allocation form, and the reserved allocation form is generated based on the pending allocation information submitted by the user's reserved fund allocation.
[0116] Among them, the reservation transfer contract maintains the reservation transfer orders submitted by each user. That is, each reservation transfer contract can support multiple reservation transfer orders. The content of each reservation transfer order is similar to that of a normal transfer. In the case of transferring funds for resources, the reservation transfer order can include information such as the receiving and paying accounts, currency amounts, and participating banks involved in the transaction. In addition, it is the expected resource transfer execution time.
[0117] Based on this, after receiving a user's reservation fund transfer request, the blockchain node needs to send the to-be-processed transfer information carried in the reservation fund transfer request to each blockchain node in the blockchain for consensus. After the consensus is passed, this part of the to-be-processed transfer information can be stored in the block, that is, update the reservation transfer contract according to the to-be-processed transfer information.
[0118] The parties involved in this fund transfer (such as the user who submits the reservation fund transfer request, the bank participating in the fund transfer, etc.) can query and confirm through the query interface of the reservation transfer contract that the to-be-processed transfer information corresponding to the reservation fund transfer request has passed the consensus and been stored on the blockchain.
[0119] Step 204, according to the user identification of the first user carried in the resource transfer request, determine whether the reservation transfer contract contains the to-be-processed transfer information of the first user.
[0120] If so, execute step 206; if not, execute the transfer logic declared in the transfer main contract, and perform the resource transfer operation of the first user according to the transfer information carried in the resource transfer request.
[0121] Specifically, as mentioned above, to ensure the timely execution of the user's reservation transfer request, after receiving the user's resource transfer request, the blockchain node can call the transfer main contract and execute the query logic declared in the transfer main contract. According to the first contract address of the reservation transfer contract pre-stored by it, call and query whether the reservation transfer contract contains the to-be-processed transfer information of the user. If it exists, the to-be-executed reservation transfer request can be executed first to ensure that it can be executed after the user's reservation transfer request arrives; if it does not exist, based on the transfer information included in the resource transfer request submitted by the user, perform the resource transfer operation on the user.
[0122] Step 206, obtain the to-be-processed transfer information, and execute the transfer logic declared in the transfer main contract, and perform the resource transfer operation of the first user according to the to-be-processed transfer information.
[0123] Specifically, as described above, when determining whether the pending allocation information of the user is included in the appointment allocation contract, the blockchain node may first obtain the pending allocation information and execute the allocation logic declared in the allocation main contract, and perform the resource allocation operation of the user according to the pending allocation information.
[0124] In the case where the resource is funds, since the pending allocation information may include the allocated fund amount, the allocated fund account, the appointment allocation time, the allocation participants, etc., therefore, performing the resource allocation operation means that the allocation participant transfers the funds corresponding to the allocated fund amount from the allocated fund account A to the allocated fund account B.
[0125] Specifically, when implementing, after performing the resource allocation operation corresponding to the appointment allocation request, the resource allocation operation corresponding to the resource allocation request can be executed, specifically, executing the allocation logic declared in the allocation main contract, and performing the resource allocation operation of the first user according to the allocation information carried in the resource allocation request.
[0126] Since the user may submit the resource allocation information when submitting the resource allocation request, that is, the resource allocation information may be carried in the resource allocation request, therefore, after the blockchain node receives the resource allocation information, the specific resource allocation process is similar to the specific processing process after the blockchain node obtains the pending allocation information, and will not be elaborated here.
[0127] In addition, after obtaining the pending allocation information, it further includes:
[0128] Determine the appointment allocation time included in the pending allocation information;
[0129] When it is determined that the appointment allocation time is reached, or when it is determined that the current time is later than the appointment allocation time, execute the allocation logic declared in the allocation main contract, and perform the resource allocation operation of the first user according to the pending allocation information.
[0130] Specifically, after the blockchain node determines that there is pending allocation information of the user in the appointment allocation contract, it can further determine whether the current time reaches the appointment allocation time included in the pending allocation information. If it has not reached, no processing is performed; if it is determined that the current time reaches the appointment allocation time, or the current time is later than the appointment allocation time, the allocation logic declared in the allocation main contract can be executed, and the corresponding resource allocation operation can be performed according to the pending allocation information.
[0131] In addition, to ensure that the user's appointment resource allocation request can be triggered, the embodiment of the present specification may also receive a resource allocation request sent by the target blockchain node, where the resource allocation request includes the first contract address corresponding to the appointment allocation contract;
[0132] Correspondingly, invoking the allocation master contract based on the received resource allocation request includes:
[0133] Invoking the reservation allocation contract based on the first contract address, executing the invocation logic declared in the reservation allocation contract, and invoking the allocation master contract according to the pre-stored second contract address.
[0134] Specifically, the participant (user or executor performing resource allocation) of the reservation allocation request can query the pending allocation information in the reservation allocation contract, and set a scheduled task in their own business system according to the reservation allocation time in the pending allocation information. When the reservation allocation time arrives, the scheduled task is triggered, that is, a resource allocation request is sent to the blockchain node, and the contract address of the reservation allocation contract is carried in the resource allocation request, so that the blockchain node can invoke the reservation allocation contract based on the contract address, execute the invocation logic declared in the reservation allocation contract, and invoke the allocation master contract according to the second contract address stored in the reservation allocation contract, so as to execute the corresponding resource allocation operation by executing the allocation logic declared in the allocation master contract.
[0135] Furthermore, the resource allocation request can be sent by the business party through the target blockchain node;
[0136] Correspondingly, after performing the resource allocation operation, it can also be determined whether the allocation participant in the pending allocation information includes the business party;
[0137] If not, after performing the resource allocation operation for the first user according to the pending allocation information, corresponding reward resources are allocated to the target blockchain node.
[0138] Specifically, by determining whether the business party initiating the resource allocation request is the allocation participant (user or executor performing the resource allocation operation) of the resource allocation operation, and when the determination result is no, that is, the business party is not the allocation participant of the resource allocation operation, a certain reward is given to the business party on the chain to encourage other business parties to participate in the detection of the reservation allocation time, so as to jointly maintain the transactions on the chain.
[0139] In addition, to ensure the security of the pending allocation information in the reservation allocation contract, the embodiments of this specification can receive the query request of the reservation allocation contract submitted by the business party;
[0140] Determine the pending allocation information of at least one user included in the reservation allocation contract;
[0141] Determine whether the allocation participant in the pending allocation information of the second user includes the business party, where the second user is one of the at least one user;
[0142] Otherwise, return the scheduled transfer time in the transfer information to be processed of the second user to respond to the query request;
[0143] If so, return the transfer information to be processed of the second user to respond to the query request.
[0144] Specifically, to ensure the security of the information on the chain, for each non-direct participant in a transaction, the embodiments of this specification can set that it can only obtain the scheduled transfer time of the user, but cannot read other private information related to the transfer request. Therefore, after receiving the query request for the scheduled transfer contract submitted by the business party, the embodiments of this specification can first determine the transfer information to be processed of at least one user included in the scheduled transfer contract, and determine whether the transfer participant in the transfer information to be processed of any user includes the business party. If it does, the transfer information to be processed of this user can be returned to the business party; if not, only the scheduled transfer time in the transfer information to be processed of this user is returned.
[0145] An embodiment of this specification calls the transfer main contract based on the received resource transfer request, executes the query logic declared in the transfer main contract, queries the corresponding scheduled transfer contract according to the contract query address stored in advance, determines whether the transfer information to be processed of the first user is included in the scheduled transfer contract according to the user identifier of the first user carried in the resource transfer request. If so, obtain the transfer information to be processed, and execute the transfer logic declared in the transfer main contract, and perform the resource transfer operation of the first user according to the transfer information to be processed.
[0146] The resource transfer method based on blockchain provided by the embodiments of this specification stores the scheduled transfer request on the chain by using a smart contract, ensuring that the scheduled transfer request can be perceived by each participant in advance and ensuring that it cannot be tampered with; in addition, the embodiments of this specification design a secure way to crowdsource the process of the transfer information to be processed that is due and needs to trigger the transfer operation, using the method of on-chain participants listening and triggering to ensure that the scheduled transfer request can be executed after it expires; furthermore, the embodiments of this specification automatically associate the transfer main contract and the scheduled transfer contract to ensure that every time the transfer contract is triggered, it can be checked whether there is due transfer information to be processed in the scheduled transfer contract. If so, it can be triggered simultaneously to ensure that the transfer information to be processed can be executed after it expires.
[0147] In addition, based on the permanent preservation and anti-tampering characteristics of the blockchain, the embodiments of this specification confirm the user's reservation request on the blockchain, and at the same time use the automatic execution characteristic of the blockchain smart contract to automatically execute the reservation transfer using the smart contract, which is beneficial to ensuring the trustworthy execution of the resource transfer process.
[0148] The following, in conjunction with the attached Figure 3 , taking the application of the blockchain-based resource allocation method provided in this specification in the fund allocation scenario as an example, further illustrates the blockchain-based resource allocation method. Among them, Figure 3 Figure 4 shows a flowchart of the processing procedure of a blockchain-based resource allocation method provided by an embodiment of this specification. The specific steps include step 302 to step 320.
[0149] Step 302, the blockchain node creates an allocation master contract and a reservation allocation contract, updates the allocation master contract based on the first contract address corresponding to the reservation allocation contract, and updates the reservation allocation contract based on the second contract address corresponding to the allocation master contract.
[0150] Step 304, the user submits a reservation fund allocation request to the blockchain node.
[0151] Step 306, the blockchain node updates the reservation allocation contract according to the to-be-processed allocation information carried in the reservation fund allocation request.
[0152] Step 308, the user submits a fund allocation request to the blockchain node.
[0153] Step 310, the blockchain node calls the allocation master contract based on the received fund allocation request, executes the query logic declared in the allocation master contract, queries the corresponding reservation allocation contract according to the contract query address stored in advance, determines whether the to-be-processed allocation information of the first user is included in the reservation allocation contract according to the user identification carried in the fund allocation request. If so, obtains the to-be-processed allocation information, and executes the allocation logic declared in the allocation master contract, and performs the fund allocation operation of the first user according to the to-be-processed allocation information.
[0154] Step 312, the service direction blockchain node sends a reservation allocation contract query request.
[0155] Step 314, the blockchain node returns the to-be-processed allocation information included in the reservation allocation contract to the service party.
[0156] Step 316, when the service party determines that the reservation allocation time corresponding to the to-be-processed allocation information in the reservation allocation contract is reached, it sends a fund allocation request to the blockchain node.
[0157] Step 318, the blockchain node receives a fund transfer request, calls the reserved transfer contract based on the first contract address carried in the fund transfer request, executes the call logic declared in the reserved transfer contract, calls the main transfer contract based on the pre-stored second contract address, executes the query logic declared in the main transfer contract, queries the corresponding reserved transfer contract according to the pre-stored contract query address, obtains the pending transfer information included in the reserved transfer contract, and executes the transfer logic declared in the main transfer contract, and performs the user's fund transfer operation according to the pending transfer information.
[0158] Step 320, determine whether the transfer participant in the pending transfer information includes the business party. If not, after performing the user's fund transfer operation according to the pending transfer information, allocate the corresponding reward resources to the business party.
[0159] Based on the permanent preservation and anti-tampering characteristics of the blockchain in the embodiments of this specification, and at the same time using the characteristics of automatic execution of blockchain smart contracts, the execution of the fund transfer process is automatically executed using the main transfer contract, which is beneficial to ensuring the trustworthy execution of the fund transfer process. In addition, the embodiments of this specification ensure that every time a transfer contract is triggered, it can be checked whether there is any pending transfer information that has expired in the reserved transfer contract by automatically associating the main transfer contract and the reserved transfer contract. If so, it can be triggered simultaneously to ensure that the pending transfer information can be executed after expiration.
[0160] Corresponding to the above method embodiments, this specification also provides embodiments of a resource transfer device based on the blockchain. Figure 4 The schematic diagram of a resource transfer device based on the blockchain provided by an embodiment of this specification is shown. As Figure 4 shown, the device includes:
[0161] A query module 402, configured to call the main transfer contract based on the received resource transfer request, execute the query logic declared in the main transfer contract, and query the corresponding reserved transfer contract according to the pre-stored contract query address;
[0162] A determination module 404, configured to determine whether the pending transfer information of the target user is included in the reserved transfer contract according to the user identifier of the target user carried in the resource transfer request;
[0163] If the operation result of the confirmation module 404 is yes, then the execution module 406 runs;
[0164] The execution module 406 is configured to obtain the pending transfer information, execute the transfer logic declared in the main transfer contract, and perform the resource transfer operation of the target user according to the pending transfer information.
[0165] Optionally, the blockchain-based resource allocation device further includes a first processing module configured to:
[0166] Execute the allocation logic declared in the allocation master contract, and perform the resource allocation operation of the first user according to the allocation information carried in the resource allocation request.
[0167] Optionally, the blockchain-based resource allocation device further includes a creation module configured to:
[0168] Create an allocation master contract and a reservation allocation contract;
[0169] Determine the first contract address corresponding to the reservation allocation contract and the second contract address corresponding to the allocation master contract;
[0170] Update the allocation master contract based on the first contract address and update the reservation allocation contract based on the second contract address.
[0171] Optionally, the blockchain-based resource allocation device further includes a second processing module configured to:
[0172] Determine the reservation allocation time included in the to-be-processed allocation information;
[0173] When it is determined that the reservation allocation time has arrived or it is determined that the current time is later than the reservation allocation time, execute the allocation logic declared in the allocation master contract and perform the resource allocation operation of the first user according to the to-be-processed allocation information.
[0174] Optionally, the blockchain-based resource allocation device further includes a first update module configured to:
[0175] Receive the reservation resource allocation request submitted by the first user;
[0176] Update the reservation allocation contract according to the to-be-processed allocation information carried in the reservation resource allocation request.
[0177] Optionally, the blockchain-based resource allocation device further includes a second update module configured to:
[0178] Receive the reservation fund allocation request submitted by the first user;
[0179] Perform consensus processing on the to-be-processed allocation information carried in the reservation fund allocation request, where the to-be-processed allocation information includes the allocated fund amount, the allocated fund account, the reservation allocation time, and the allocation participants;
[0180] In response to the notification information that the consensus on the to-be-processed transfer information has passed, update the reserved transfer contract according to the to-be-processed transfer information.
[0181] Optionally, the blockchain-based resource transfer device further includes a receiving module, configured to:
[0182] Receive a resource transfer request sent by a target blockchain node, where the resource transfer request includes a first contract address corresponding to a reserved transfer contract;
[0183] Correspondingly, the query module 402 is further configured to:
[0184] Call the reserved transfer contract based on the first contract address, execute the call logic declared in the reserved transfer contract, and call the transfer main contract according to a pre-stored second contract address.
[0185] Optionally, the resource transfer request is sent by a business party through the target blockchain node;
[0186] Correspondingly, the device further includes a judgment module, configured to:
[0187] Judge whether the transfer participant in the to-be-processed transfer information includes the business party;
[0188] If the operation result of the judgment module is negative, run the execution module;
[0189] The device further includes an allocation module, configured to allocate corresponding reward resources to the target blockchain node.
[0190] Optionally, the blockchain-based resource transfer device further includes a third processing module, configured to:
[0191] Receive a query request for a reserved transfer contract submitted by a business party;
[0192] Determine the to-be-processed transfer information of at least one user included in the reserved transfer contract;
[0193] Determine whether the transfer participant in the to-be-processed transfer information of a second user includes the business party, where the second user is one of the at least one user;
[0194] If not, return the reserved transfer time in the to-be-processed transfer information of the second user to respond to the query request;
[0195] If so, return the to-be-processed transfer information of the second user to respond to the query request.
[0196] The above is a schematic solution of a blockchain-based resource allocation device according to this embodiment. It should be noted that the technical solution of this blockchain-based resource allocation device and the technical solution of the above blockchain-based resource allocation method belong to the same concept. For the details not described in the technical solution of the blockchain-based resource allocation device, reference can be made to the description of the technical solution of the above blockchain-based resource allocation method.
[0197] Figure 5 FIG. 4 shows a structural block diagram of a computing device 500 according to an embodiment of this specification. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 through a bus 530, and a database 550 is used to store data.
[0198] The computing device 500 further includes an access device 540, and the access device 540 enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interfaces (e.g., a network interface card (NIC)), such as an IEEE802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0199] In an embodiment of this specification, the above components of the computing device 500 and Figure 5 other components not shown in FIG. 4 may also be connected to each other, such as through a bus. It should be understood that Figure 5 the shown structural block diagram of the computing device is only for illustrative purposes and is not a limitation on the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0200] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.) or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The computing device 500 may also be a mobile or stationary server.
[0201] Among them, the memory 510 is used to store computer-executable instructions, and the processor 520 is used to execute the following computer-executable instructions to implement the steps of the blockchain-based resource allocation method.
[0202] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above blockchain-based resource allocation method belong to the same concept. For the detailed content not described in the technical solution of the computing device, reference can be made to the description of the technical solution of the above blockchain-based resource allocation method.
[0203] An embodiment of this specification also provides a computer-readable storage medium, which stores computer instructions that, when executed by a processor, are used to implement the steps of the blockchain-based resource allocation method.
[0204] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above blockchain-based resource allocation method belong to the same concept. For the detailed content not described in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above blockchain-based resource allocation method.
[0205] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.
[0206] The computer instructions include computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0207] It should be noted that, for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.
[0208] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0209] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The alternative embodiments do not elaborate on all the details, nor do they limit the invention to the specific embodiments described. Obviously, according to the content of the embodiments of this specification, many modifications and changes can be made. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can well understand and utilize this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A resource allocation method based on blockchain, where there are reservation allocation contracts and main allocation contracts in the blockchain, applied to blockchain nodes, including: Invoking the main allocation contract based on the received resource allocation request, and executing the query logic declared in the main allocation contract, querying the corresponding reservation allocation contract according to the contract query address pre-stored in the main allocation contract; Determining whether the reservation allocation contract contains the pending allocation information of the first user according to the user identifier of the first user carried in the resource allocation request; If so, obtaining the pending allocation information, checking whether there is expired pending allocation information, and if there is, executing the allocation logic declared in the main allocation contract, and performing the resource allocation operation of the first user according to the pending allocation information.
2. The resource allocation method based on blockchain according to claim 1, after performing the resource allocation operation of the first user according to the pending allocation information, further including: Executing the allocation logic declared in the main allocation contract, and performing the resource allocation operation of the first user according to the allocation information carried in the resource allocation request.
3. The resource allocation method based on blockchain according to claim 1, further including: Creating a main allocation contract and a reservation allocation contract; Determining the first contract address corresponding to the reservation allocation contract and the second contract address corresponding to the main allocation contract; Updating the main allocation contract based on the first contract address, and updating the reservation allocation contract based on the second contract address.
4. The resource allocation method based on blockchain according to claim 1, where the checking whether there is expired pending allocation information, and if there is, executing the allocation logic declared in the main allocation contract, and performing the resource allocation operation of the first user according to the pending allocation information includes: Determining the reservation allocation time included in the pending allocation information; When it is determined that the reservation allocation time is reached, or when it is determined that the current time is later than the reservation allocation time, executing the allocation logic declared in the main allocation contract, and performing the resource allocation operation of the first user according to the pending allocation information.
5. The resource allocation method based on blockchain according to claim 1 or 3, further including: Receiving a reservation resource allocation request submitted by the first user; Updating the reservation allocation contract according to the pending allocation information carried in the reservation resource allocation request.
6. The resource allocation method based on blockchain according to claim 1 or 3, further including: Receiving a reservation fund allocation request submitted by the first user; Performing consensus processing on the pending allocation information carried in the reservation fund allocation request, where the pending allocation information includes the allocated fund amount, the allocated fund account, the reservation allocation time, and the allocation participants; Responding to the notification information that the pending allocation information passes the consensus, and updating the reservation allocation contract according to the pending allocation information.
7. The resource allocation method based on blockchain according to claim 1, further including: Receive a resource allocation request sent by a target blockchain node, where the resource allocation request includes a first contract address corresponding to a reserved allocation contract; Correspondingly, the step of invoking an allocation master contract based on the received resource allocation request includes: Invoke the reserved allocation contract based on the first contract address, execute the invocation logic declared in the reserved allocation contract, and invoke the allocation master contract according to a pre-stored second contract address.
8. The blockchain-based resource allocation method according to claim 7, wherein the resource allocation request is sent by a business party through the target blockchain node; Correspondingly, the method further includes: Determine whether the business party is included in the allocation participants in the to-be-processed allocation information; If not, after performing the resource allocation operation of the first user according to the to-be-processed allocation information, allocate corresponding reward resources to the target blockchain node.
9. The blockchain-based resource allocation method according to claim 1 or 7, further includes: Receive a query request for a reserved allocation contract submitted by a business party; Determine the to-be-processed allocation information of at least one user included in the reserved allocation contract; Determine whether the business party is included in the allocation participants in the to-be-processed allocation information of a second user, where the second user is one of the at least one user; If not, return the reserved allocation time in the to-be-processed allocation information of the second user to respond to the query request; If so, return the to-be-processed allocation information of the second user to respond to the query request.
10. A blockchain-based resource allocation system, where there are a reserved allocation contract and an allocation master contract in the blockchain, including: A client and at least one blockchain node; The client is configured to query a reserved allocation contract stored in a target blockchain node, and when it is determined that the reserved allocation time corresponding to the to-be-processed allocation information in the reserved allocation contract is reached, send a resource allocation request to the target blockchain node, where the target blockchain node is one of the at least one blockchain node; The target blockchain node is configured to receive the resource allocation request, invoke the reserved allocation contract based on the first contract address carried in the resource allocation request, execute the invocation logic declared in the reserved allocation contract, invoke the allocation master contract according to a pre-stored second contract address, execute the allocation logic declared in the allocation master contract, obtain and perform the resource allocation operation of a target user according to the to-be-processed allocation information.
11. The blockchain-based resource allocation system according to claim 10, wherein the target blockchain node is further configured to: Execute the query sub-logic declared in the allocation master contract, query a corresponding reserved allocation contract according to a pre-stored first contract address, and obtain the to-be-processed allocation information included in the reserved allocation contract; Execute the allocation sub-logic declared in the allocation master contract, and perform the resource allocation operation of the target user according to the to-be-processed allocation information.
12. A blockchain-based resource allocation device, in which there are a reservation allocation contract and an allocation master contract in the blockchain, and it is applied to a blockchain node, including: A query module, configured to call the allocation master contract based on the received resource allocation request, execute the query logic declared in the allocation master contract, and query the corresponding reservation allocation contract according to the contract query address pre-stored in the allocation master contract; A determination module, configured to determine whether the reservation allocation contract contains the to-be-processed allocation information of the target user according to the user identifier of the target user carried in the resource allocation request; If the operation result of the confirmation module is yes, then run the execution module; The execution module is configured to obtain the to-be-processed allocation information, check whether there is any expired to-be-processed allocation information, and if so, execute the allocation logic declared in the allocation master contract, and perform the resource allocation operation of the target user according to the to-be-processed allocation information.
13. A computing device, including: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to implement the steps of the blockchain-based resource allocation method according to any one of claims 1 to 9 when executing the computer-executable instructions.
14. A computer-readable storage medium, which stores computer instructions, and when the instructions are executed by a processor, the steps of the blockchain-based resource allocation method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Right and interest processing method and device based on block chain
CN113435943A
KR20200079877A