CN112968923B - Block chain task scheduling method and miner node - Google Patents

Block chain task scheduling method and miner node Download PDF

Info

Publication number
CN112968923B
CN112968923B CN202110080581.4A CN202110080581A CN112968923B CN 112968923 B CN112968923 B CN 112968923B CN 202110080581 A CN202110080581 A CN 202110080581A CN 112968923 B CN112968923 B CN 112968923B
Authority
CN
China
Prior art keywords
target block
node
block
address
worker node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110080581.4A
Other languages
Chinese (zh)
Other versions
CN112968923A (en
Inventor
杨高赟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Guangpu Internet Technology Co ltd
Original Assignee
Shenzhen Guangpu Internet Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Guangpu Internet Technology Co ltd filed Critical Shenzhen Guangpu Internet Technology Co ltd
Priority to CN202110080581.4A priority Critical patent/CN112968923B/en
Publication of CN112968923A publication Critical patent/CN112968923A/en
Application granted granted Critical
Publication of CN112968923B publication Critical patent/CN112968923B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a block chain task scheduling method and a miner node, which are used for improving the efficiency of block allocation. The method comprises the following steps: obtaining a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block; analyzing the block number to obtain a first IP address; determining a first worker node according to the first IP address; judging whether the first worker node meets the preset condition for processing the target block or not; if yes, the target block is distributed to the first worker node for processing.

Description

Block chain task scheduling method and miner node
Technical Field
The embodiment of the application relates to the technical field of blockchain, in particular to a blockchain task scheduling method and a miner node.
Background
The interplanetary File System (IPFS, interPlanetary File System) is a network transport protocol that aims to create persistent and distributed storage and sharing files. The advent of IPFS provides a solution to reduce the maintenance costs of data. And blockchain entries such as filecoin, filecash and filestar, etc. based on IPFS are generated. In the block chain project based on the IPFS, a scheme that a miner node and a plurality of worker nodes are matched to form an ore mining cluster is generally adopted to provide data storage service for a demander.
In the prior art, when a minuter node acquires a block from a task queue, it is often required to acquire task conditions of all the worker nodes associated with the minuter node, then screen out the worker nodes meeting the conditions, and then allocate the worker nodes to any one of the worker nodes meeting the conditions according to a certain rule, for example, randomly, or allocate the worker nodes with the least number of tasks to be executed in the worker nodes meeting the conditions, or allocate tasks according to other modes, and the like.
However, the process from acquiring a block to completing the allocation by the miner node is too cumbersome and the efficiency of allocating the block is low.
Disclosure of Invention
The embodiment of the application provides a block chain task scheduling method and a miner node, which can simplify the process of the miner node for distributing blocks and improve the efficiency of distributing the blocks.
The first aspect of the embodiment of the application provides a block chain task scheduling method, which is applied to a miner node and comprises the following steps:
obtaining a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets the preset condition for processing the target block or not;
if yes, the target block is distributed to the first worker node for processing.
Optionally, the determining whether the first worker node meets the preset condition for processing the target block includes:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold;
if yes, determining that the first worker node meets the preset condition for processing the target block.
Optionally, after the determining whether the number of tasks to be completed of the first worker node is less than the task number threshold, the method further includes:
if not, acquiring all worker nodes with the task number to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and distributing the target block to the second worker node for processing.
Optionally, after one of the preselected worker nodes is randomly selected as a second worker node, before the target block is allocated to the second worker node for processing, the method further includes:
changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
Optionally, after the target block is allocated to the second worker node for processing, the method further includes:
and when receiving a phase change notification corresponding to the target block sent by the second worker node, updating the phase bit of the block number.
Optionally, before the obtaining the block number of the target block from the task queue, the method further includes:
generating a block number of the target block according to a preset naming rule;
and adding the block number into a task queue.
Optionally, the generating the block number of the target block according to the preset naming rule includes:
acquiring the IP address of the worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
and generating a block number of the target block according to the IP address and the unique identification of the target block.
A second aspect of an embodiment of the present application provides a miner node, including:
the system comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring a block number of a target block from a task queue, the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
the analyzing unit is used for analyzing the block number to obtain a first IP address;
the determining unit is used for determining a first worker node according to the first IP address;
the judging unit is used for judging whether the first worker node meets the preset condition for processing the target block or not;
and the first allocation unit is used for allocating the target block to the first worker node for processing when the judgment unit determines that the first worker node meets the preset condition for processing the target block.
Optionally, the judging unit is specifically configured to:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold;
if yes, determining that the first worker node meets the preset condition for processing the target block.
Optionally, the miner node further includes a second allocation unit, where the second allocation unit is configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, acquiring all worker nodes with the number of tasks to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and distributing the target block to the second worker node for processing.
Optionally, the second allocation unit is specifically configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, acquiring all worker nodes with the number of tasks to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
And distributing the target block to the second worker node for processing.
Optionally, the miner node further includes a second updating unit, where the second updating unit is specifically configured to:
and when receiving a phase change notification corresponding to the target block sent by the second worker node, updating the phase bit of the block number.
Optionally, the miner node further includes a naming unit, where the naming unit is configured to:
generating a block number of the target block according to a preset naming rule;
and adding the block number into a task queue.
Optionally, the naming unit is specifically configured to:
acquiring the IP address of the worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
generating a block number of the target block according to the IP address and the unique identifier of the target block;
and adding the block number into a task queue.
A third aspect of an embodiment of the present application provides a miner node, including:
the device comprises a processor, a memory, an input/output unit and a bus;
the processor is connected with the memory, the input/output unit and the bus;
the processor specifically performs the following operations:
obtaining a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets the preset condition for processing the target block or not;
if yes, the target block is distributed to the first worker node for processing.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, on which a program is stored, which when executed on a computer, causes the computer to perform a method as in the first aspect and any one of the possible implementation manners of the first aspect.
From the above technical solutions, the embodiments of the present application have the following advantages:
in this embodiment, after obtaining a target block from a task queue, a miner node first analyzes a block number of the target block, thereby obtaining a first internet protocol (IP, internet Protocol) address carried in the target block, then determines a first worker node according to the first IP address, and if the first worker node meets a preset condition for processing the target block, directly distributes the target block to the first worker node for processing. According to the embodiment of the invention, the block number is improved, the IP address of the worker node associated with the minuter node is added while the uniqueness of the block number is considered, so that when the minuter node distributes tasks for the target block, the target block is directly distributed to the first worker node for processing as long as the first worker node corresponding to the first IP address carried in the block number of the target block is determined to meet the preset condition of processing the target block, the process of distributing the block is simplified, and the efficiency of distributing the block is improved.
Drawings
FIG. 1 is a flow chart of one embodiment of a method for blockchain task scheduling provided in embodiments of the present application;
FIG. 2 is a flowchart illustrating another embodiment of a method for blockchain task scheduling according to the embodiments of the present application;
FIG. 3 is a schematic structural diagram of one embodiment of a miner node provided in an embodiment of the disclosure;
FIG. 4 is a schematic structural diagram of another embodiment of a miner node according to an embodiment of the disclosure;
fig. 5 is a schematic structural diagram of another embodiment of a miner node according to an embodiment of the disclosure.
Detailed Description
The embodiment of the application provides a block chain task scheduling method and a miner node, which are used for simplifying the process of the miner node for distributing blocks and improving the efficiency of distributing the blocks.
The method for block chain task scheduling in the embodiment of the present application is described in detail below.
Referring to fig. 1, an embodiment of a method for block chain task scheduling in the embodiments of the present application includes:
101. the miner node obtains the block number of the target block from the task queue;
in an ore excavation cluster formed by a miner node and a plurality of worker nodes, the miner node can acquire the block number of the target block from the task queue, the block number comprises an identification bit, an address bit and a stage bit, and the identification bit stores the unique identification of the target block so as to ensure the uniqueness of the block number; the address bits hold an internet protocol, IP, address of a worker node associated with the minuter node; the phase bit stores phase information of the target block, which indicates the execution phase of the target block.
It should be noted that, the IP address stored in the address bit only needs to ensure that the unique worker node can be determined, and may be a complete IP address, or may only include a part of the IP address, such as a tail, which is not limited herein.
102. The minur node analyzes the block number to obtain a first IP address;
because the address bits of the block number store the internet protocol IP address of the worker node associated with the miner node, the miner node may obtain the first IP address by resolving the block number according to the address bits.
103. The minuter node determines a first worker node according to the first IP address;
the first IP address is an IP address of a certain worker node in the mining cluster and has uniqueness, so that the minuter node can determine the first worker node corresponding to the first IP address in the mining cluster according to the first IP address.
104. The minuter node judges whether the first worker node meets the preset condition for processing the target block, if yes, step 105 is executed;
after determining the first worker node, the minuter node may determine the first worker node, and if the first worker node meets a preset condition for processing the target block, step 105 may be executed.
105. And the minuter node distributes the target block to the first worker node for processing.
When the first worker node meets the preset condition for processing the target block, the minuter node can directly distribute the target block to the first worker node, and the first worker node processes the target block.
In this embodiment of the present application, after a miner node obtains a target block from a task queue, the miner node first analyzes a block number of the target block, so as to obtain a first IP address carried in the target block, then determines a first worker node according to the first IP address, and if the first worker node meets a preset condition for processing the target block, directly allocates the target block to the first worker node for processing. According to the embodiment of the invention, the block number is improved, the IP address of the worker node associated with the minuter node is added while the uniqueness of the block number is considered, so that when the minuter node distributes tasks for the target block, the target block is directly distributed to the first worker node for processing as long as the first worker node corresponding to the first IP address carried in the block number of the target block is determined to meet the preset condition of processing the target block, the process of distributing the block is simplified, and the efficiency of distributing the block is improved.
Referring to fig. 2, another embodiment of a method for block chain task scheduling in the embodiments of the present application includes:
201. the minuter node obtains the IP address of the worker node with the highest weight according to the historical task allocation record;
in practical application, the weight of each worker node under the minuter node can be dynamically calculated according to the historical task allocation record, namely the previous block allocation record, wherein the weight refers to the limitation of the allocated blocks, the minuter node can compare the weight of each worker node after calculating the weight of each worker node, then the worker node with the highest weight is determined, and then the IP address of the worker node is acquired.
It should be noted that, the miner node may calculate the weight of the worker node according to the most recent part of the historical task allocation records, for example, the most recent 100 block task allocation; the weight of the worker node may also be calculated according to all the historical task records, which is not limited herein.
In this embodiment, the rule of the weight of the worker node may be that the higher the number of times the historical task allocation record is allocated to the block, the higher the weight is, for example, the historical task allocation record is 100 times, the A worker node in the mining cluster is allocated to 9 times of block tasks, the B worker node is allocated to 7 times of block tasks, the C worker node is allocated to 22 times of block tasks, and the weight of the three worker nodes is that the C worker node > A worker node > B worker node; other principles are also possible, and are not limited in this regard.
202. The minur node generates a unique identifier of a target block according to the unique identifier of the last block of the target block;
the minuter node may generate the unique identifier of the target block according to the unique identifier of the last block of the target block, for example, the unique identifier of the last block of the target block is 10783672, and the rule generated by the unique identifier is increment of 1 each time, so that the minuter node may obtain the unique identifier 10783673 of the target block, and similarly, may obtain the unique identifier 10783674 of the next block of the target block.
203. The minur node generates a block number of the target block according to the IP address and the unique identifier of the target block;
the minuter node can generate the block number of the target block according to the acquired IP address of the worker node with the highest weight and the unique identifier of the target block, and it should be noted that the values of the stage bits of the newly generated block number are all default values.
204. The miner node adds the block number into a task queue;
after generating the block number of the target block, the miner node may add the block number to the task queue.
205. The miner node obtains the block number of the target block from the task queue;
206. the minur node analyzes the block number to obtain a first IP address;
207. the minuter node determines a first worker node according to the first IP address;
in this embodiment, steps 205 to 207 are similar to steps 101 to 103 in the previous embodiment, and are not repeated here.
208. The miner node judges whether the number of tasks to be completed of the first worker node is smaller than a task number threshold, if yes, step 209 is executed; if not, go to step 212.
The minuter node can judge whether to distribute the target task to the first worker node according to the number of tasks to be completed of the first worker node. If the number of tasks to be completed of the first worker node is smaller than the task number threshold, it is indicated that the first worker node meets the preset condition of the processing target block, and the minuter node can execute step 209; otherwise, the miner node performs step 212.
209. The minuter node determines that the first worker node meets the preset condition for processing the target block;
when the number of tasks to be completed of the first worker node is smaller than the task number threshold, the minuter node can determine that the first worker node meets the preset condition of the processing target block.
210. The minuter node distributes the target block to the first worker node for processing;
in this embodiment, step 210 is similar to step 105 in the previous embodiment, and will not be described here again.
211. When the minuter node receives a phase change notification corresponding to the target block sent by the first worker node, updating a phase bit of the block number;
after the minuter node distributes the target block to the first worker node, if the first worker node finishes the corresponding task of the target block, a phase change notification is sent to the minuter node, and after the minuter node receives the phase change notification sent by the first worker node, the phase bit in the block number of the target block can be updated.
In this embodiment, when the phase information of the target block changes, the miner node may receive the phase change notification sent by the first worker node, and then update the phase bit in the block number correspondingly.
In this embodiment, when the phase of the target block changes, the minur node may update the phase bit in the block number of the target block, track the phase of the target block, and obtain the phase of the target block that is abnormal through the phase bit in the block number if the target block is abnormal.
212. The minuter nodes acquire all worker nodes with the task number to be completed lower than the task number threshold as preselected worker nodes;
when the minuter node determines that the first worker node does not meet the preset condition of the processing target block, the worker node with the number of tasks to be completed lower than the task number threshold value can be screened out from the mining cluster to serve as a preselected worker node of the processing target block.
213. The minuter node randomly selects one from the preselected worker nodes to serve as a second worker node;
after the minuter node acquires the preselected worker node, a second worker node serving as a processing target block can be randomly selected from the preselected worker nodes.
214. The minuter node changes the address bit of the block number into a second IP address;
after the minuter node determines the second worker node, the address bits in the block number of the target block may be changed to a second IP address, where the second IP address bits are the IP address of the second worker node.
215. The minuter node distributes the target block to the second worker node for processing;
after the minuter node changes the address bits in the block number, the target block may be allocated to the second worker node, and the first worker node processes the target block.
In this embodiment, when the first worker node does not meet the preset condition, the minuter node may dynamically allocate the target block to the second worker node in the mining cluster, where the second worker node meets the preset condition, so as to improve robustness.
In this embodiment, before the target block is allocated to the second worker node, the minuter node changes the address bit in the block number of the target block into the second IP address corresponding to the second worker node, so that the minuter node can track the worker node that is processing the target block by querying the IP address corresponding to the address bit in the block number, without querying the log file, thereby improving efficiency.
216. And when the minuter node receives a phase change notification corresponding to the target block sent by the second worker node, updating the phase bit of the block number.
After the minuter node distributes the target block to the second worker node, if the second worker node processes the corresponding task of the target block, a phase change notification is sent to the minuter node, and after the minuter node receives the phase change notification sent by the second worker node, the phase bit in the block number of the target block can be updated.
The method for scheduling the block chain task in the embodiment of the application is described in detail, and the minuter node in the embodiment of the application is described in detail.
Referring to fig. 3, an embodiment of a miner node in an embodiment of the application includes:
an obtaining unit 301, configured to obtain, from a task queue, a block number of a target block, where the block number includes an identification bit, an address bit, and a phase bit, where the identification bit stores a unique identification of the target block, the address bit stores an internet protocol IP address of a worker node associated with the minuter node, and the phase bit stores phase information of the target block;
the parsing unit 302 is configured to parse the block number to obtain a first IP address;
a determining unit 303, configured to determine a first worker node according to the first IP address;
a judging unit 304, configured to judge whether the first worker node meets a preset condition of the processing target block;
the first allocation unit 305 is configured to allocate the target block to the first worker node for processing when the determining unit 304 determines that the first worker node meets a preset condition for processing the target block.
In this embodiment, after the obtaining unit 301 obtains the target block from the task queue, the analyzing unit 302 first analyzes the block number of the target block, so as to obtain the first IP address carried in the target block, then the determining unit 303 determines the first worker node according to the first IP address, and if the first worker node meets the preset condition for processing the target block, the first distributing unit 305 directly distributes the target block to the first worker node for processing. According to the embodiment of the invention, the block number is improved, and the IP address of the worker node associated with the minuter node is added while the uniqueness of the block number is considered, so that when the minuter node distributes tasks for the target block, as long as the judging unit 304 determines that the first worker node corresponding to the first IP address carried in the block number of the target block meets the preset condition for processing the target block, the first distributing unit 305 can directly distribute the target block to the first worker node for processing, and therefore, the process of distributing the block is simplified, and the efficiency of distributing the block is improved.
Referring to fig. 4, another embodiment of a miner node in an embodiment of the present application includes:
an obtaining unit 301, configured to obtain, from a task queue, a block number of a target block, where the block number includes an identification bit, an address bit, and a phase bit, where the identification bit stores a unique identification of the target block, the address bit stores an internet protocol IP address of a worker node associated with the minuter node, and the phase bit stores phase information of the target block;
the parsing unit 302 is configured to parse the block number to obtain a first IP address;
a determining unit 303, configured to determine a first worker node according to the first IP address;
a judging unit 304, configured to judge whether the first worker node meets a preset condition of the processing target block;
the first allocation unit 305 is configured to allocate the target block to the first worker node for processing when the determining unit 304 determines that the first worker node meets a preset condition for processing the target block.
In this embodiment, the judging unit is specifically configured to:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold;
if yes, determining that the first worker node meets the preset condition of the processing target block.
In this embodiment, the miner node may further include a first updating unit 406, a second allocation unit 407, a second updating unit 408, and a naming unit 409.
The first updating unit 406 is specifically configured to:
when a phase change notification corresponding to the target block sent by the first worker node is received, the phase bit of the block number is updated.
The second distributing unit 407 is specifically configured to:
when the judging unit 404 determines that the first worker node does not meet the preset condition of the processing target block, acquiring all worker nodes with the number of tasks to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node;
and distributing the target block to a second worker node for processing.
The second updating unit 408 specifically is configured to:
and when receiving a phase change notification corresponding to the target block sent by the second worker node, updating the phase bit of the block number.
Naming unit 409 is specifically used for:
acquiring the IP address of the worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of the target block according to the unique identifier of the last block of the target block;
generating a block number of the target block according to the IP address and the unique identification of the target block;
and adding the block number into a task queue.
In this embodiment, the functions of the units correspond to the steps in the embodiment shown in fig. 2, and are not described herein.
Referring to fig. 5, another embodiment of a miner node in an embodiment of the present application includes:
a processor 501, a memory 502, an input/output unit 503, and a bus 504;
the processor 501 is connected to the memory 502, the input/output unit 503, and the bus 504;
the processor 501 specifically performs the following operations:
the method comprises the steps that a block number of a target block is obtained from a task queue, the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets the preset condition of the processing target block or not;
if yes, the target block is distributed to the first worker node for processing.
In this embodiment, the functions of the processor 501 correspond to the steps in the embodiments shown in fig. 1 to 2, and are not described herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, random access memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (8)

1. A method for scheduling a blockchain task, applied to a miner node, comprising:
obtaining a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold;
if yes, the target block is distributed to the first worker node for processing.
2. The method of claim 1, wherein after the determining whether the number of tasks to be completed for the first worker node is less than a task number threshold, the method further comprises:
if not, acquiring all worker nodes with the task number to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and distributing the target block to the second worker node for processing.
3. The method of claim 2, wherein after randomly selecting one of the preselected worker nodes as a second worker node, the method further comprises, before assigning the target block to the second worker node for processing:
changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
4. The method of claim 2, wherein after the assigning the target block to the second worker node for processing, the method further comprises:
and when receiving a phase change notification corresponding to the target block sent by the second worker node, updating the phase bit of the block number.
5. The method according to any one of claims 1 to 4, wherein prior to the obtaining the block number of the target block from the task queue, the method further comprises:
generating a block number of the target block according to a preset naming rule;
and adding the block number into a task queue.
6. The method of claim 5, wherein generating the block number of the target block according to the preset naming convention comprises:
according to the historical task allocation records, the IP address of the worker node with the highest weight is obtained, the weight represents the limitation of the allocation blocks, and the highest weight represents the highest number of times of allocation of the historical task allocation records to the blocks;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
and generating a block number of the target block according to the IP address and the unique identification of the target block.
7. A miner node, comprising:
the system comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring a block number of a target block from a task queue, the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
the analyzing unit is used for analyzing the block number to obtain a first IP address;
the determining unit is used for determining a first worker node according to the first IP address;
the judging unit is used for judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value;
and the first allocation unit is used for allocating the target block to the first worker node for processing when the judging unit determines that the number of tasks to be completed of the first worker node is smaller than a task number threshold value.
8. The miner node of claim 7, further comprising a second allocation unit, the second allocation unit being specifically configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, acquiring all worker nodes with the number of tasks to be completed lower than the task number threshold as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and distributing the target block to the second worker node for processing.
CN202110080581.4A 2021-01-21 2021-01-21 Block chain task scheduling method and miner node Active CN112968923B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110080581.4A CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110080581.4A CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Publications (2)

Publication Number Publication Date
CN112968923A CN112968923A (en) 2021-06-15
CN112968923B true CN112968923B (en) 2023-05-05

Family

ID=76271487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110080581.4A Active CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Country Status (1)

Country Link
CN (1) CN112968923B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109076344A (en) * 2016-05-03 2018-12-21 诺基亚美国公司 Affairs using the protection of block chain for Internet resources distribution
CN109951482A (en) * 2019-03-19 2019-06-28 全链通有限公司 User terminal and its block chain domain name analytic method
CN110233802A (en) * 2019-05-14 2019-09-13 天津大学 A method of the block chain framework of the building more side chains of one main chain
CN110531924A (en) * 2019-05-31 2019-12-03 杭州复杂美科技有限公司 For extending the method and apparatus, storage medium and system of block chain memory capacity
WO2020143196A1 (en) * 2019-01-11 2020-07-16 平安科技(深圳)有限公司 Communication method and device between blockchain nodes, storage medium and electronic apparatus
WO2020215247A1 (en) * 2019-04-24 2020-10-29 Nokia Technologies Oy Method and apparatus for supporting blockchain-based data storage in vehicular network

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11196573B2 (en) * 2017-03-06 2021-12-07 Nokia Technologies Oy Secure de-centralized domain name system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109076344A (en) * 2016-05-03 2018-12-21 诺基亚美国公司 Affairs using the protection of block chain for Internet resources distribution
WO2020143196A1 (en) * 2019-01-11 2020-07-16 平安科技(深圳)有限公司 Communication method and device between blockchain nodes, storage medium and electronic apparatus
CN109951482A (en) * 2019-03-19 2019-06-28 全链通有限公司 User terminal and its block chain domain name analytic method
WO2020215247A1 (en) * 2019-04-24 2020-10-29 Nokia Technologies Oy Method and apparatus for supporting blockchain-based data storage in vehicular network
CN110233802A (en) * 2019-05-14 2019-09-13 天津大学 A method of the block chain framework of the building more side chains of one main chain
CN110531924A (en) * 2019-05-31 2019-12-03 杭州复杂美科技有限公司 For extending the method and apparatus, storage medium and system of block chain memory capacity

Also Published As

Publication number Publication date
CN112968923A (en) 2021-06-15

Similar Documents

Publication Publication Date Title
CN108632374B (en) Software gray level release method and device
US20220272242A1 (en) Cluster resource management in distributed computing systems
CN108052615B (en) Access request processing method, device, medium and electronic equipment
CN110351375B (en) Data processing method and device, computer device and readable storage medium
CN104243405A (en) Request processing method, device and system
CN109416646B (en) Optimization method for container allocation and processing equipment
CN102724105B (en) A kind of load-balancing method and device
CN103139255A (en) Method for allocating resource identification and identification section
CN112333289A (en) Reverse proxy access method, device, electronic equipment and storage medium
CN113256291A (en) Method and device for creating account and distributing transaction in blockchain system
CN112769943A (en) Service processing method and device
CN102831000B (en) The method and system of system upgrade
CN114500462A (en) Virtual private cloud network address allocation method and device, electronic equipment and medium
CN107277188B (en) Method, client, server and service system for determining IP address attribution information
CN112968923B (en) Block chain task scheduling method and miner node
CN110798507B (en) Method and system for DHCP address allocation memory
CN104717280A (en) Data synchronism marking method and device
JP6582628B2 (en) Process allocation method, process allocation apparatus, and process allocation program
CN109857805B (en) Block chain based data storage method, related equipment and storage medium
US11086689B2 (en) Method for automatically and dynamically assigning the responsibility for tasks to the available computing components in a highly distributed data-processing system
CN109842665B (en) Task processing method and device for task allocation server
CN111935100B (en) Flowspec rule issuing method, device, equipment and medium
CN112019630B (en) Load balancing method and device
CN112527496A (en) Sequence number distribution service system, sequence number distribution method, server and storage medium
CN112954084B (en) Edge computing processing method, network function example and edge service management and control center

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210831

Address after: 518000 1303a, satellite building, No. 61, Gaoxin South ninth Road, high tech Zone community, Yuehai street, Nanshan District, Shenzhen, Guangdong

Applicant after: Shenzhen Guangpu Internet Technology Co.,Ltd.

Address before: A01, 11th floor, Jinyuan business building, Haigang District, Qinhuangdao City, Hebei Province 066000

Applicant before: Hebei fengzhichao Internet Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant