Task allocation method and device and storage medium
By using random number seeds to determine target indices for task allocation in blockchain networks, the problem of computing power monopoly in proof-of-work and proof-of-stake scenarios is solved, achieving fair task allocation and improved network security.
Patent Information
- Application Number
- CN202510838421.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-10-31
AI Technical Summary
In blockchain's proof-of-work and proof-of-stake scenarios, the concentration of computing power or stake can lead to a de facto monopoly of transaction records by a single node, threatening network security.
By obtaining the node information and random number seed of the candidate nodes, the target index is determined using the random number seed, and tasks are assigned according to the mapping relationship, ensuring that the selection of candidate nodes is equally random and avoiding the monopoly of computing power or rights.
This achieves a fair allocation of tasks, avoids monopolies caused by an excessively high proportion of computing power or equity in a single node, and improves the security of the blockchain network.
Smart Images

Figure CN120872518A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and more specifically, to a task allocation method, apparatus, and storage medium. Background Technology
[0002] In related technologies, in the traditional blockchain Proof-of-Work scenario, nodes obtain the right to record transactions based on their own capabilities; in the Proof-of-Stake scenario, the probability of a node obtaining the right to record transactions is determined by the number of tokens it holds and the duration of that holding (i.e., stake). With the increasing concentration of computing power, computing power monopolies may occur in Proof-of-Work and Proof-of-Stake scenarios. If a single node's computing power / stake exceeds 50%, it can effectively monopolize the transaction records in the blockchain, thus posing a potential threat to network security. Therefore, how to rationally allocate tasks to nodes remains a technical problem to be solved. Summary of the Invention
[0003] In view of this, this application proposes a task allocation method, apparatus and storage medium, which aims to reasonably allocate tasks to nodes.
[0004] In a first aspect, this application proposes a task allocation method, comprising: a task allocation device acquiring node information and a random number seed for each candidate node in a first candidate node list; the node information including: a mapping relationship between the identification information of the candidate node and the index of the candidate node; the task allocation device determining a target index based on the random number seed of each candidate node; the task allocation device determining a target candidate node based on the target index and the mapping relationship; and the task allocation device allocating a target task to the target candidate node.
[0005] Optionally, the candidate nodes in the first candidate node list are filtered to obtain the second candidate node list; the target index is determined according to the random number seed of each valid candidate node in the second candidate node list; each valid candidate node in the second candidate node list is obtained by filtering the candidate nodes in the first candidate node list.
[0006] Optionally, the system receives a random number encryption seed sent by each candidate node; the random number encryption seed is obtained by each candidate node through encryption calculation of the random number seed; based on the random number encryption seed sent by each candidate node, each candidate node in the first candidate node list is verified to determine the valid candidate nodes in the first candidate node list; the random number encryption seed sent by each candidate node includes the encryption result of the random number seed of the valid candidate node; and a second candidate node list is generated based on the valid candidate nodes in the first candidate node list.
[0007] Optionally, a hash calculation is performed on the random number seed of each valid candidate node in the second candidate node list to obtain a first hash result; the first hash result is divided by the total number of candidate nodes in the second candidate node list to determine the target remainder of the quotient of the first hash result and the total number of candidate nodes; the target remainder is used as the target index.
[0008] Optionally, the following steps are taken: receiving the processing result of the target task sent by the target candidate node; sending the processing result to the task publishing node; the task publishing node is used to publish the target task; determining the target incentive corresponding to the target candidate node based on the task satisfaction sent by the task publishing node and the integrity level of the target candidate node; the task satisfaction is positively correlated with the target incentive, and the integrity level is positively correlated with the target incentive; and sending the target incentive to the target candidate node.
[0009] Optionally, the number of processing times required to determine the processing result of the target task is obtained from the target candidate node; the shortest task processing time is determined based on the ratio of the number of processing times to the preset computing power; the preset computing power is used to characterize the maximum computing power value allowed for the candidate node; the target time interval between the release time of the target task and the release time of the first task is obtained; the first task is the task closest to the release time of the target task; if the shortest task processing time is less than the target time interval, the processing result is sent to the task release node.
[0010] Optionally, if no task processing result is received from the target candidate node within a preset time period, the integrity level of the target candidate node is lowered; a prompt message is sent to the target candidate node; the prompt message is used to remind the target candidate node to process the target task.
[0011] Optionally, the target task is retrieved from the local task table and broadcast to the node set of the blockchain; response results are received from multiple nodes in the node set; based on the response results, a first candidate node list is determined from the multiple nodes; the response results of the candidate nodes in the first candidate node list are used to characterize the candidate nodes' participation in the competition for the target task.
[0012] Secondly, this application proposes a task allocation device, comprising: a processing unit; the processing unit being configured to obtain node information and a random number seed for each candidate node in a first candidate node list; the node information including: a mapping relationship between the identification information of the candidate node and the index of the candidate node; the processing unit being configured to determine a target index based on the random number seed of each candidate node; the processing unit being configured to determine a target candidate node based on the target index and the mapping relationship; and the processing unit being configured to allocate a target task to the target candidate node.
[0013] Optionally, a processing unit is used to filter the candidate nodes in the first candidate node list to obtain a second candidate node list; a processing unit is used to determine the target index according to the random number seed of each valid candidate node in the second candidate node list; each valid candidate node in the second candidate node list is obtained by filtering the candidate nodes in the first candidate node list.
[0014] Optionally, a communication unit is used to receive a random number encryption seed sent by each candidate node; the random number encryption seed is obtained by each candidate node through encryption calculation of the random number seed; a processing unit is used to verify each candidate node in the first candidate node list based on the random number encryption seed sent by each candidate node, and determine the valid candidate nodes in the first candidate node list; the random number encryption seed sent by each candidate node includes the encryption result of the random number seed of the valid candidate node; the processing unit is used to generate a second candidate node list based on the valid candidate nodes in the first candidate node list.
[0015] Optionally, a processing unit is used to perform a hash calculation on the random number seed of each valid candidate node in the second candidate node list to obtain a first hash result; a processing unit is used to divide the first hash result by the total number of candidate nodes in the second candidate node list to determine the target remainder of the division between the first hash result and the total number of candidate nodes; and a processing unit is used to use the target remainder as the target index.
[0016] Optionally, a communication unit is used to receive the processing result of the target task sent by the target candidate node; a processing unit is used to send the processing result to the task publishing node; the task publishing node is used to publish the target task; the target incentive corresponding to the target candidate node is determined based on the task satisfaction sent by the task publishing node and the integrity level of the target candidate node; the task satisfaction is positively correlated with the target incentive, and the integrity level is positively correlated with the target incentive; the communication unit is used to send the target incentive to the target candidate node.
[0017] Optionally, a processing unit is used to obtain the number of times the target candidate node determines the processing result of the target task; a processing unit is used to determine the shortest task processing time based on the ratio of the number of processing times to the preset computing power; the preset computing power is used to characterize the maximum computing power value allowed for the candidate node; obtain the target time interval between the release time of the target task and the release time of the first task; the first task is the task closest to the release time of the target task; the processing unit is used to send the processing result to the task release node if the shortest task processing time is less than the target time interval.
[0018] Optionally, a processing unit is used to lower the integrity level of the target candidate node if no task processing result is received from the target candidate node within a preset time period; a communication unit is used to send a prompt message to the target candidate node; the prompt message is used to remind the target candidate node to process the target task.
[0019] Optionally, a processing unit is used to retrieve and broadcast the target task from the local task table to the node set of the blockchain; a communication unit is used to receive response results sent by multiple nodes in the node set; and a processing unit is used to determine a first candidate node list from multiple nodes based on the response results; the response results of the candidate nodes in the first candidate node list are used to characterize the candidate nodes' participation in the competition for the target task.
[0020] Thirdly, a task allocation device is provided, including a memory and a processor; the memory is used to store computer execution instructions, and the processor is connected to the memory via a bus; when the task allocation device is running, the processor executes the computer execution instructions stored in the memory, so that the task allocation device performs the task allocation method of the first aspect.
[0021] The task allocation device can be a network device or a component of a network device, such as a chip system within the network device. This chip system supports the network device in implementing the functions involved in the first aspect and any of its possible implementations, such as acquiring, determining, and transmitting data and / or information involved in the aforementioned task allocation method. The chip system includes chips, but may also include other discrete devices or circuit structures.
[0022] Fourthly, a computer-readable storage medium is provided, comprising computer-executable instructions that, when executed on a computer, cause the computer to perform the task allocation method of the first aspect.
[0023] Fifthly, a computer program product is also provided, which includes computer instructions that, when executed on a task allocation device, cause the task allocation device to perform the task allocation method as described in the first aspect above.
[0024] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of the task allocation device, or it may be packaged separately from the processor of the task allocation device; this application does not limit this.
[0025] The descriptions of the second, third, fourth, and fifth aspects of this application can be referenced to the detailed description of the first aspect.
[0026] In the embodiments of this application, the names of the aforementioned task allocation devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. For example, the receiving unit may also be called a receiving module, receiver, etc. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of this application and its equivalents.
[0027] In this embodiment, the task allocation device obtains the node information and random number seed of each candidate node in the first candidate node list. Considering that the random number seed of each candidate node is randomly obtained, the target index can be randomly obtained based on the random number seed of each candidate node. Since the node information includes the mapping relationship between the candidate node's identification information and the candidate node's index, the task allocation device can determine the target candidate node based on the target index and the mapping relationship. Since the target index is randomly obtained by the task allocation device, the probability of each candidate node in the first candidate node list being selected as the target candidate node is the same, thus achieving fair allocation of the target task to the target candidate node. Since the target candidate node is randomly selected with equal probability, this application can avoid the problem of computing power monopoly that may occur in the Proof-of-Work and Proof-of-Stake scenarios in the prior art, where the computing power / stake ratio of a single node exceeds 50%, effectively monopolizing the transaction records in the blockchain. Attached Figure Description
[0028] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0029] Figure 1 This application provides a schematic diagram of the architecture of a task allocation system.
[0030] Figure 2 This is a schematic diagram of the structure of a task allocation device provided in an embodiment of this application;
[0031] Figure 3 A flowchart illustrating a task allocation method provided in an embodiment of this application;
[0032] Figure 4 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0033] Figure 5 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0034] Figure 6A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0035] Figure 7 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0036] Figure 8 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0037] Figure 9 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0038] Figure 10 A flowchart illustrating another task allocation method provided in an embodiment of this application;
[0039] Figure 11 This is a schematic diagram of another task allocation device provided in an embodiment of this application. Detailed Implementation
[0040] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0041] In this article, the character " / " generally indicates that the objects before and after it are in an "or" relationship. For example, A / B can be understood as A or B.
[0042] The terms "first" and "second" in this application's specification are used to distinguish different objects, not to describe a specific order of objects. For example, "first edge service node" and "second edge service node" are used to distinguish different edge service nodes, not to describe a characteristic order of edge service nodes.
[0043] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0044] Furthermore, in the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "exemplarily" or "for example" is intended to present concepts in a concrete manner.
[0045] In related technologies, in the traditional blockchain Proof-of-Work scenario, nodes obtain the right to record transactions based on their own capabilities; in the Proof-of-Stake scenario, the probability of a node obtaining the right to record transactions is determined by the number of tokens it holds and the duration of that holding (i.e., stake). With the increasing concentration of computing power, computing power monopolies may occur in Proof-of-Work and Proof-of-Stake scenarios. If a single node's computing power / stake exceeds 50%, it can effectively monopolize the transaction records in the blockchain, thus posing a potential threat to network security. Therefore, how to rationally allocate tasks to nodes remains a technical problem to be solved.
[0046] In this embodiment, the task allocation device obtains the node information and random number seed of each candidate node in the first candidate node list. Considering that the random number seed of each candidate node is randomly obtained, the target index can be randomly obtained based on the random number seed of each candidate node. Since the node information includes the mapping relationship between the candidate node's identification information and the candidate node's index, the task allocation device can determine the target candidate node based on the target index and the mapping relationship. Since the target index is randomly obtained by the task allocation device, the probability of each candidate node in the first candidate node list being selected as the target candidate node is the same, thus achieving fair allocation of the target task to the target candidate node. Since the target candidate node is randomly selected with equal probability, this application can avoid the problem of computing power monopoly that may occur in the Proof-of-Work and Proof-of-Stake scenarios in the prior art, where the computing power / stake ratio of a single node exceeds 50%, effectively monopolizing the transaction records in the blockchain.
[0047] For example, such as Figure 1 As shown, Figure 1 This is a schematic diagram of the architecture of a task allocation system provided in an embodiment of this application. The task allocation system includes: a task allocation device 101 and an acquisition device 102.
[0048] The acquisition device 102 is used to acquire the node information and random number seed of each candidate node in the first candidate node list. The node information includes: the mapping relationship between the identification information of the candidate node and the index of the candidate node.
[0049] The task allocation device 101 is used to obtain the node information and random number seed of each candidate node in the first candidate node list through the acquisition device 102. The task allocation device 101 determines the target index according to the random number seed of each candidate node; the task allocation device 101 determines the target candidate node according to the target index and the mapping relationship; the task allocation device 101 allocates the target task to the target candidate node.
[0050] Optionally, the physical device of the acquisition device 102 is a terminal, and the physical device of the task allocation device 101 is a server.
[0051] Optionally, the aforementioned terminal may be a device that provides voice and / or data connectivity to a user, a handheld device with wireless connectivity, or other processing device connected to a wireless modem. The wireless terminal may communicate with one or more core networks via a radio access network (RAN). The wireless terminal may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, or a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device that exchanges voice and / or data with the radio access network, such as a mobile phone, tablet computer, laptop computer, netbook, or personal digital assistant (PDA).
[0052] Optionally, the server mentioned above can be one of the servers in a server cluster (composed of multiple servers), a chip in the server, a system-on-a-chip in the server, or a virtual machine (VM) deployed on a physical machine. This application embodiment does not limit this.
[0053] This application provides a task allocation device for executing the task allocation system provided in this application. Figure 2 This is a schematic diagram of a task allocation device provided in an embodiment of this application. Figure 2 As shown, the task allocation device 200 includes at least one processor 201, a communication line 202, and at least one communication interface 204, and may also include a memory 203. The processor 201, memory 203, and communication interface 204 can be connected via the communication line 202.
[0054] The processor 201 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).
[0055] Communication line 202 may include a path for transmitting information between the aforementioned components.
[0056] The communication interface 204 is used to communicate with other devices or communication networks and can use any transceiver-like device, such as Ethernet, radio access network (RAN), WLAN, etc.
[0057] The memory 203 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of including or storing desired program code having the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0058] In one possible design, the memory 203 can exist independently of the processor 201, meaning the memory 203 can be an external memory of the processor 201. In this case, the memory 203 can be connected to the processor 201 via the communication line 202 to store execution instructions or application code, and its execution is controlled by the processor 201 to implement the task allocation method provided in the following embodiments of this application. In another possible design, the memory 203 can also be integrated with the processor 201, meaning the memory 203 can be an internal memory of the processor 201. For example, the memory 203 can be a cache, which can be used to temporarily store some data and instruction information.
[0059] As one possible implementation, processor 201 may include one or more CPUs, for example Figure 2 CPU0 and CPU1 in the example. Alternatively, the task allocation device 200 may include multiple processors, such as CPU0 and CPU1. Figure 2 The processors 201 and 207 are included. Alternatively, the task allocation device 200 may also include an output device 205 and an input device 206.
[0060] The following, in conjunction with the appendix Figure 3 This application provides a detailed description of a task allocation method according to its embodiments, such as... Figure 3 As shown, the task allocation method includes S301-S304.
[0061] S301, The task allocation device obtains the node information and random number seed of each candidate node in the first candidate node list.
[0062] The node information includes: the mapping relationship between the candidate node's identifier information and the candidate node's index.
[0063] Optionally, the node information may also include: the identification information of the candidate node and the index of the candidate node.
[0064] Optionally, the index of a candidate node can be a unique number of the candidate node in the first candidate node list.
[0065] It's important to explain that candidate nodes send a certain amount of tokens to an irreversible "black hole address" to prove their actual investment in the network and prevent a single entity from creating a large number of fake identities. After receiving and successfully verifying the burning transaction, the blockchain assigns a unique registration identifier to the candidate node and records it on the chain, linking it to the burning operation. Only then does the candidate node qualify to participate in processing tasks.
[0066] Understandably, once a candidate node is qualified to participate in the task, a random number seed is generated.
[0067] Instantaneous, the random number seed is Seed i .
[0068] S302, The task allocation device determines the target index based on the random number seed of each candidate node.
[0069] In one possible implementation, the task allocation device performs a calculation on the random number seed of each candidate node to obtain the calculation result; and determines the target index based on the calculation result and a preset algorithm.
[0070] S303, The task allocation device determines the target candidate node based on the target index and mapping relationship.
[0071] In one possible implementation, the task allocation device obtains the target index, uses the target index as the target number of the candidate node in the first candidate node list, and determines the target candidate node corresponding to the target number based on the target number.
[0072] It should be explained that each candidate node in the first candidate node list has a unique number.
[0073] Optionally, the set of indices in the first candidate node list is a series of consecutive positive integers.
[0074] S304. The task allocation device allocates the target task to the target candidate node.
[0075] In one possible implementation, the task allocation device sends the parameters corresponding to the target task to the target candidate node.
[0076] The above solution brings at least the following beneficial effects: In this embodiment, the task allocation device obtains the node information and random number seed of each candidate node in the first candidate node list. Considering that the random number seed of each candidate node is randomly obtained, the target index can be randomly obtained based on the random number seed of each candidate node. Since the node information includes the mapping relationship between the candidate node's identification information and the candidate node's index, the task allocation device can determine the target candidate node based on the target index and the mapping relationship. Since the target index is randomly obtained by the task allocation device, the probability of each candidate node in the first candidate node list being selected as the target candidate node is the same, thus achieving fair allocation of the target task to the target candidate node. Since the target candidate node is randomly selected with equal probability, this application can avoid the problem of computing power monopoly that may occur in the Proof-of-Work and Proof-of-Stake scenarios in the prior art, where the computing power / stake ratio of a single node exceeds 50%, effectively monopolizing the transaction records in the blockchain.
[0077] In one possible implementation, combining Figure 3,like Figure 4 As shown, the process by which the task allocation device determines the target index based on the random number seed of each candidate node in S302 can be specifically implemented through the following S401-S402.
[0078] S401, The task allocation device filters the candidate nodes in the first candidate node list to obtain the second candidate node list.
[0079] In one possible implementation, the task allocation device sends request signaling to candidate nodes in the first candidate node list and determines the activation status of the candidate nodes based on the received request response information. Based on the activation status of the candidate nodes, inactive candidate nodes are selected from the first candidate node list; inactive candidate nodes are then removed from the first candidate node list to obtain a second candidate node list.
[0080] Understandably, the task allocation device updates the first candidate node list to obtain the second candidate node list.
[0081] S402, The task allocation device determines the target index based on the random number seed of each valid candidate node in the second candidate node list.
[0082] Each valid candidate node in the second candidate node list is obtained by filtering the candidate nodes in the first candidate node list.
[0083] In one possible implementation, the task allocation device performs relevant calculations based on the random number seed of each valid candidate node in the second candidate node list and the number of valid candidate nodes to determine the target index.
[0084] The above solution brings at least the following beneficial effects: In this embodiment of the application, the task allocation device filters the candidate nodes in the first candidate node list to obtain a second candidate node list, so that the filtered candidate nodes can be used to determine the target index.
[0085] In one possible implementation, combining Figure 4 ,like Figure 5 As shown, in S401, the process by which the task allocation device filters the candidate nodes in the first candidate node list to obtain the second candidate node list can be specifically implemented through the following S501-S503.
[0086] S501, The task allocation device receives the random number encryption seed sent by each candidate node.
[0087] The random number encryption seed is obtained by each candidate node through encrypted calculation of the random number seed.
[0088] In one possible implementation, the task allocation device receives a random number encrypted seed sent by each candidate node via a smart contract on the blockchain.
[0089] It needs to be explained that the candidate node encrypts or hashes the random number seed to obtain a random number encryption seed, submits the random number encryption seed to the blockchain, and adds the submitted random number encryption seed to the blockchain's smart contract.
[0090] For example, the random number encryption seed is EndSeed. i .
[0091] S502, the task allocation device verifies each candidate node in the first candidate node list based on the random number encryption seed sent by each candidate node, and determines the valid candidate node in the first candidate node list.
[0092] The random number encryption seed sent by each candidate node includes the encryption result of the random number seed of the valid candidate nodes.
[0093] In one possible implementation, the random number encryption seed sent by each candidate node is decrypted to obtain a decryption seed set; if the first candidate node in the first candidate node list belongs to the decryption seed set, then the first candidate node is a valid candidate node; if the first candidate node in the first candidate node list does not belong to the decryption seed set, then the first candidate node is an invalid candidate node.
[0094] S503, The task allocation device generates a second candidate node list based on the valid candidate nodes in the first candidate node list.
[0095] In one possible implementation, the task allocation device deletes invalid candidate nodes from the first candidate node list to obtain a second candidate node list.
[0096] The above scheme brings at least the following beneficial effects: In this embodiment of the application, the task allocation device verifies each candidate node in the first candidate node list based on the random number encryption seed sent by each candidate node, determines the valid candidate node in the first candidate node list, and can authenticate the identity of the candidate node in the first candidate node list to avoid abnormal candidate nodes from participating in the processing of the target task.
[0097] In one possible implementation, combining Figure 4 ,like Figure 6 As shown, in S402, the process by which the task allocation device determines the target index based on the random number seed of each valid candidate node in the second candidate node list can be specifically implemented through the following S601-603.
[0098] S601, The task allocation device performs a hash calculation on the random number seed of each valid candidate node in the second candidate node list to obtain the first hash result.
[0099] In one possible implementation, the first hash result satisfies the following formula: P = (Hash(Seed1||Seed2||…||Seed)) k In this context, P is the first hash result, Seed1 is the random number seed for the first valid candidate node, || represents the join operation, and Seed... k is the random number seed for the k-th valid candidate node, where k is a positive integer greater than 1.
[0100] S602, the task allocation device divides the first hash result and the total number of candidate nodes in the second candidate node list to determine the target remainder of the division between the first hash result and the total number of candidate nodes.
[0101] In one possible implementation, the target remainder satisfies the following formula:
[0102] Rand=(Hash(Seed1||Seed2||…||Seed k mod length(CandList);
[0103] Where Rand is the target remainder, and length(CandList) is the total number of candidate nodes in the second candidate node list.
[0104] S603, The task allocation device uses the target remainder as the target index.
[0105] Optionally, the task allocation device broadcasts the target valid candidate nodes to the entire blockchain.
[0106] The above scheme brings at least the following beneficial effects: In this embodiment, the task allocation device divides the first hash result by the total number of valid candidate nodes in the second candidate node list, determines the target remainder of the division between the first hash result and the total number of candidate nodes, and uses the target remainder as the target index. Since the first hash result is obtained randomly, the target remainder of the division between the first hash result and the total number of candidate nodes is also random. Furthermore, since the remainder between the dividend and the divisor is a relatively small number, this ensures that even when the total number of candidate nodes is small, the target index can still be obtained accurately.
[0107] In one possible implementation, combining Figure 3 ,like Figure 7As shown, in S304, after the task allocation device assigns the target task to the target candidate node, the task allocation device sends the target stimulus to the target candidate node. The process of the task allocation device sending the target stimulus to the target candidate node can be specifically implemented through the following S701-S704.
[0108] S701, The task allocation device receives the processing results of the target task sent by the target candidate node.
[0109] Optionally, the result of the target task can be a calculation result, a comparison and selection result, or the answer to the question; we do not limit this.
[0110] S702, the task allocation device sends the processing results to the task publishing node.
[0111] The task publishing node is used to publish target tasks.
[0112] It should be explained that the task publishing node determines task satisfaction based on the accuracy of the received processing results, the matching degree between the processing results and the target task, and the time spent processing the target task.
[0113] S703, the task allocation device determines the target incentive corresponding to the target candidate node based on the task satisfaction level sent by the task issuing node and the integrity level of the target candidate node.
[0114] Among them, task satisfaction is positively correlated with goal incentives, and integrity level is positively correlated with goal incentives.
[0115] In one possible implementation, the task allocation device determines the initial incentive corresponding to the target task based on the target task, and determines the target incentive corresponding to the target candidate node based on the product of the initial incentive, the integrity level of the target candidate node, and the task satisfaction.
[0116] Optionally, the task publishing node user publishes the target task to the blockchain, and the task allocation device obtains the target task from the blockchain.
[0117] It's important to explain that the task-issuing node sends a certain amount of tokens to an irreversible "black hole address" to prove the actual cost of its investment in the network, preventing a single entity from creating a large number of fake identities (i.e., a Sybil attack). After receiving and successfully verifying the burning transaction, the blockchain assigns a unique registration identifier to the task-issuing node and records it on the chain, associating it with the burning operation. Only then does the task-issuing node qualify to apply for task issuance.
[0118] S704, The task allocation device sends target stimuli to the target candidate nodes.
[0119] In one possible implementation, the task allocation device invokes the blockchain's smart contract to send target incentives to the target candidate nodes based on their address information.
[0120] It should be explained that when a task publishing node publishes a target task to the blockchain, it sends the corresponding incentive to the smart contract.
[0121] The above solution brings at least the following beneficial effects: In this embodiment, the task allocation device determines the target incentive corresponding to the target candidate node based on the task satisfaction of the task issued by the task issuing node and the integrity level of the target candidate node. This not only takes into account the satisfaction of the task issuing node with the processing result of the target task, but also takes into account the integrity of the target candidate node, so as to reasonably allocate the target incentive to the target candidate node.
[0122] In one possible implementation, combining Figure 7 ,like Figure 8 As shown, in S702, the process of the task allocation device sending the processing result to the task publishing node can be specifically implemented through the following S801-S804.
[0123] S801, The number of times the task allocation device obtains the target candidate node to determine the processing result of the target task.
[0124] In one possible implementation, the task allocation device obtains the number of times the target candidate node determines the processing result of the target task from the blockchain.
[0125] It should be explained that a Nonce field is retained in the block header, which can represent the number of attempts made by the candidate node to find a hash that satisfies the difficulty target task.
[0126] S802, The task allocation device determines the shortest task processing time based on the ratio of the number of processing times to the preset computing power.
[0127] The preset computing power is used to characterize the maximum computing power value that candidate nodes are allowed to use.
[0128] It should be explained that the task allocation device prevents candidate nodes from consuming too much energy and forming a computing power monopoly by increasing computing power without limit.
[0129] S803, The task allocation device obtains the target time interval between the release time of the target task and the release time of the first task.
[0130] The first task is the task closest to the release time of the target task.
[0131] Optionally, the first task is a task that occurs before the target task is released.
[0132] It should be explained that the blockchain will only issue the next task after the current task is completed.
[0133] For example, the first task is released at 9:00, the target task is released at 11:00, and the target time interval is 2 hours.
[0134] S804. If the shortest task processing time is less than the target time interval, the task allocation device will send the processing result to the task issuing node.
[0135] Optionally, if the shortest task processing time is less than the target time interval, the task allocation device will send the processing result back to the target candidate node.
[0136] It should be explained that if the shortest task processing time is less than the time it takes for other candidate nodes to process the first task, it can be determined that the target candidate node has used computing power resources higher than the maximum computing power value or that the target candidate node has engaged in improper operation. In this case, the task allocation device will reject the processing result of the target task sent by the target candidate node.
[0137] Understandably, when a target candidate node is rejected due to excessive computing power, it needs to reduce its computing power or adjust its task processing strategy to ensure that its task processing behavior complies with the collectively agreed energy consumption standards, thus balancing network security and energy conservation goals.
[0138] The above solution brings at least the following beneficial effects: In this embodiment of the application, by limiting the computing power value of the target candidate node, it can be ensured that its own task processing behavior complies with the collectively agreed energy consumption standard, taking into account both network security and energy saving goals.
[0139] In one possible implementation, combining Figure 3 ,like Figure 9 As shown, after the task allocation device assigns the target task to the target candidate node in S304, the task allocation device reminds the target candidate node to process the target task. The process of the task allocation device reminding the target candidate node to process the target task can be specifically implemented through the following S901-902.
[0140] S901. If no task processing result is received from the target candidate node within a preset time period, the task allocation device lowers the integrity level of the target candidate node.
[0141] Optionally, when the task allocation device retrieves the target task from the smart contract of the blockchain, it retrieves the preset time period corresponding to the target task.
[0142] It should be noted that the preset time period is shorter than the time period required by the task release node.
[0143] S902, The task allocation device sends a prompt message to the target candidate node.
[0144] The prompt message is used to remind the target candidate node to process the target task.
[0145] The above solution brings at least the following beneficial effects: In this embodiment, if no task processing result is received from the target candidate node within a preset time period, the task allocation device lowers the integrity level of the target candidate node, thereby monitoring the target candidate node's execution of the target task. Through the integrity level mechanism, the initiative of candidate nodes in processing tasks is increased, thereby improving the efficiency of task processing.
[0146] In one possible implementation, combining Figure 3 ,like Figure 10 As shown, before the task allocation device obtains the node information and random number seed of each candidate node in the first candidate node list in S301, the task allocation device determines the first candidate node list. The process of the task allocation device determining the first candidate node list can be specifically implemented through the following S1001-1003.
[0147] S1001, The task allocation device retrieves the target task from the local task table and broadcasts it to the node set of the blockchain.
[0148] In one possible implementation, the task allocation device obtains the target task information from the local task table and broadcasts the task information to the set of nodes in the blockchain.
[0149] The target task information includes: the type of target task, the time requirement of the target task, and the estimated incentive of the target task.
[0150] It should be explained that the local task table is stored in a smart contract on the blockchain.
[0151] S1002, The task allocation device receives response results sent by multiple nodes in the node set.
[0152] Optionally, the response results may include the address information and identification information of the candidate nodes.
[0153] S1003. Based on the response results, the task allocation device determines the first candidate node list from multiple nodes.
[0154] The response results of the candidate nodes in the first candidate node list are used to characterize the candidate nodes' participation in the competitive target task.
[0155] The above solution brings at least the following beneficial effects: In this embodiment of the application, the task allocation device determines a first candidate node list from multiple nodes based on the response results, which can fully consider the willingness of candidate nodes to process the target task, avoid candidate nodes that do not have the willingness to process the target task from participating in the processing of the target task, and improve the rationality of task allocation.
[0156] This application embodiment can divide the task allocation device into functional modules or functional units according to the above method example. For example, each function can be divided into a separate functional module or functional unit, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or in software functional modules or functional units. The module or unit division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0157] For example, such as Figure 11 The diagram shown is a possible structural schematic of a task allocation device according to an embodiment of this application. The task allocation device includes a processing unit 1101 and a communication unit 1102.
[0158] Processing unit 1101 is used to obtain the node information and random number seed of each candidate node in the first candidate node list; the node information includes: the mapping relationship between the identification information of the candidate node and the index of the candidate node; processing unit 1101 is used to determine the target index according to the random number seed of each candidate node; processing unit 1101 is used to determine the target candidate node according to the target index and the mapping relationship; processing unit 1101 is used to assign the target task to the target candidate node.
[0159] Optionally, the processing unit 1101 is used to filter the candidate nodes in the first candidate node list to obtain a second candidate node list; the processing unit 1101 is used to determine the target index according to the random number seed of each valid candidate node in the second candidate node list; each valid candidate node in the second candidate node list is obtained by filtering the candidate nodes in the first candidate node list.
[0160] Optionally, the communication unit 1102 is used to receive random number encryption seeds sent by multiple candidate nodes; the random number encryption seeds are obtained by the multiple candidate nodes encrypting the random number seeds; the processing unit 1101 is used to verify each candidate node in the first candidate node list based on the random number encryption seeds sent by the multiple candidate nodes, and determine the valid candidate nodes in the first candidate node list; the random number encryption seeds sent by the multiple candidate nodes include the encryption results of the random number seeds of the valid candidate nodes; the processing unit 1101 is used to generate a second candidate node list based on the valid candidate nodes in the first candidate node list.
[0161] Optionally, the processing unit 1101 is used to perform hash calculation on the random number seed of each valid candidate node in the second candidate node list to obtain a first hash result; the processing unit 1101 is used to divide the first hash result and the total number of candidate nodes in the second candidate node list to determine the target remainder of the division between the first hash result and the total number of candidate nodes; the processing unit 1101 is used to use the target remainder as the target index.
[0162] Optionally, the communication unit 1102 is used to receive the processing result of the target task sent by the target candidate node; the processing unit 1101 is used to send the processing result to the task publishing node; the task publishing node is used to publish the target task; the target incentive corresponding to the target candidate node is determined based on the task satisfaction sent by the task publishing node and the integrity level of the target candidate node; the task satisfaction is positively correlated with the target incentive, and the integrity level is positively correlated with the target incentive; the communication unit 1102 is used to send the target incentive to the target candidate node.
[0163] Optionally, the processing unit 1101 is used to obtain the number of times the target candidate node determines the processing result of the target task; the processing unit 1101 is used to determine the shortest task processing time based on the ratio of the number of processing times to the preset computing power; the preset computing power is used to characterize the maximum computing power value allowed for the candidate node; obtain the target time interval between the release time of the target task and the release time of the first task; the first task is the task closest to the release time of the target task; the processing unit 1101 is used to send the processing result to the task release node if the shortest task processing time is less than the target time interval.
[0164] Optionally, the processing unit 1101 is used to lower the integrity level of the target candidate node if the task processing result sent by the target candidate node is not received within a preset time period; the communication unit 1102 is used to send a prompt message to the target candidate node; the prompt message is used to remind the target candidate node to process the target task.
[0165] Optionally, the processing unit 1101 is used to obtain and broadcast the target task from the local task table to the node set of the blockchain; the communication unit 1102 is used to receive the response results sent by multiple nodes in the node set; the processing unit 1101 is used to determine a first candidate node list from multiple nodes based on the response results; the response results of the candidate nodes in the first candidate node list are used to characterize the candidate nodes participating in the competition for the target task.
[0166] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run computer programs or instructions to implement the task allocation method in the above method embodiments.
[0167] Embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the task allocation method described in the above method embodiments.
[0168] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In embodiments of the present invention, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0169] Since the apparatus, device, computer-readable storage medium, and computer program product in the embodiments of the present invention can be applied to the above methods, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0170] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A task allocation method, characterized in that, include: Obtain the node information and random number seed for each candidate node in the first candidate node list; The node information includes: the mapping relationship between the identification information of the candidate node and the index of the candidate node; The target index is determined based on the random number seed of each candidate node; Based on the target index and the mapping relationship, the target candidate node is determined; The target task is assigned to the target candidate node.
2. The method according to claim 1, characterized in that, The step of determining the target index based on the random number seed of each candidate node includes: The candidate nodes in the first candidate node list are filtered to obtain the second candidate node list; The target index is determined based on the random number seed of each valid candidate node in the second candidate node list; each valid candidate node in the second candidate node list is obtained by filtering the candidate nodes in the first candidate node list.
3. The method according to claim 1, characterized in that, The process of filtering candidate nodes in the first candidate node list to obtain a second candidate node list includes: Receive a random number encryption seed sent by each candidate node; the random number encryption seed is obtained by each candidate node through encrypted calculation of the random number seed; Each candidate node in the first candidate node list is verified based on the random number encryption seed sent by each candidate node to determine the valid candidate node in the first candidate node list; the random number encryption seed sent by each candidate node includes the encryption result of the random number seed of the valid candidate node; Based on the valid candidate nodes in the first candidate node list, a second candidate node list is generated.
4. The method according to claim 2, characterized in that, The step of determining the target index based on the random number seed of each valid candidate node in the second candidate node list includes: The random number seed of each valid candidate node in the second candidate node list is hashed to obtain the first hash result; The first hash result and the total number of candidate nodes in the second candidate node list are divided to determine the target remainder of the division between the first hash result and the total number of candidate nodes. The target remainder is used as the target index.
5. The method according to claim 1, characterized in that, After assigning the target task to the target candidate node, the method further includes: Receive the processing result of the target task sent by the target candidate node; The processing result is sent to the task publishing node; the task publishing node is used to publish the target task. Based on the task satisfaction rate sent by the task issuing node and the integrity level of the target candidate node, the target incentive corresponding to the target candidate node is determined; the task satisfaction rate is positively correlated with the target incentive, and the integrity level is positively correlated with the target incentive. Send target incentives to the target candidate nodes.
6. The method according to claim 5, characterized in that, Sending the processing result to the task publishing node includes: The number of times the target candidate node is obtained to determine the processing result of the target task; The shortest task processing time is determined based on the ratio of the number of processing operations to the preset computing power; the preset computing power is used to characterize the maximum computing power value that candidate nodes are allowed to use. Obtain the target time interval between the release time of the target task and the release time of the first task; the first task is the task closest to the release time of the target task. If the shortest task processing time is less than the target time interval, the processing result is sent to the task publishing node.
7. The method according to claim 1, characterized in that, After assigning the target task to the target candidate node, the method further includes: If no task processing result is received from the target candidate node within a preset time period, the integrity level of the target candidate node will be reduced. A prompt message is sent to the target candidate node; the prompt message is used to remind the target candidate node to process the target task.
8. The method according to any one of claims 1-7, characterized in that, Before obtaining the node information and random number seed of each candidate node in the first candidate node list, the method further includes: The target task is retrieved from the local task table and broadcast to the node set of the blockchain; Receive response results sent by multiple nodes in the node set; Based on the response results, a first candidate node list is determined from the plurality of nodes; the response results of the candidate nodes in the first candidate node list are used to characterize the candidate nodes' participation in the competition for the target task.
9. A task allocation device, characterized in that, The task allocation device includes: a processing unit; The processing unit is used to obtain the node information and random number seed of each candidate node in the first candidate node list; the node information includes: the mapping relationship between the identification information of the candidate node and the index of the candidate node; The processing unit is used to determine the target index based on the random number seed of each candidate node; The processing unit is configured to determine the target candidate node based on the target index and the mapping relationship; The processing unit is used to assign the target task to the target candidate node.
10. A task allocation device, characterized in that, include: A processor and a memory; wherein the memory is used to store computer execution instructions, and when the task allocation device is running, the processor executes the computer execution instructions stored in the memory to cause the task allocation device to perform the task allocation method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed by the task allocation device, cause the computer to perform the task allocation method as described in any one of claims 1-8.