Blockchain consensus method for electronic health network based on dqn algorithm
Patent Information
- Application Number
- CN202210224557.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2042-03-07
AI Technical Summary
但是在该区块链网络的挖掘过程中没有考虑到移动设备端边缘卸载时各个MEC服务器的贡献差异,这会导致MEC服务器在提供大量计算资源的情况下却获得了较低的挖掘资源,从而使得MEC服务器倾向于拒绝WBAN的卸载请求
[0059] Compared with the prior art, the significant advantages of this invention are: 1) the reputation scoring mechanism helps to rationally allocate hash resources in the blockchain network and encourages MEC servers to participate in blockchain consensus; 2) the process of adopting the DQN algorithm-based electronic health network blockchain consensus can realize the system's intelligent and autonomous adjustment of hash resource allocation.
Smart Images

Figure CN116779081B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of blockchain technology, specifically a consensus method for electronic health networks based on the DQN algorithm. Background Technology
[0002] E-Health Networks are a novel Internet of Things (IoT) technology that utilizes WBAN (Web Application Blockchain) technology to monitor user diseases and manage health. In the 5G and 6G era, E-Health Network applications are becoming increasingly complex, and mobile data traffic is exploding. With limited local computing resources on mobile devices, E-Health Networks based on Multi-Access Edge Computing (MEC) have emerged. However, in E-Health Networks, trust among multiple WBAN users, multiple MEC edge servers, and the cloud becomes a critical issue; furthermore, offloading mobile device tasks to edge servers poses a risk of user privacy breaches. Blockchain, which can be viewed as a decentralized public ledger, possesses characteristics such as immutability, multi-party maintenance, traceability, and decentralization, effectively addressing the trust and privacy issues in MEC environments.
[0003] To ensure the fair, transparent, and automated operation of a blockchain network, a consensus mechanism is needed among miners to reach agreement on transaction data, contributions, and rewards. In the eHealth scenario, miners collect transaction information about mobile device offloading tasks from the blockchain network and then execute the consensus process. The blockchain can use Proof-of-Work or Proof-of-Stake for consensus. By leasing hash power, mobile devices can lease the hash power they need, addressing the issue of installing additional mining hardware or mobile devices requiring more computation and storage. However, the mining process in this blockchain network does not consider the differences in contributions from various MEC servers during edge offloading of mobile devices. This can lead to MEC servers providing significant computational resources but receiving relatively low mining resources, causing them to tend to reject WBAN offloading requests. Therefore, it is necessary to explore hash resource allocation so that MEC servers with high computational contributions receive higher rewards. Summary of the Invention
[0004] The purpose of this invention is to provide a blockchain consensus method for electronic health networks based on the DQN algorithm, which rationally allocates hash resources, effectively solves the problems of large state space and large action space for multiple users and multiple MEC edge servers, obtains optimal network service performance, and accelerates mining speed.
[0005] The technical solution to achieve the purpose of this invention is: a blockchain consensus method for electronic health networks based on the DQN algorithm, the method comprising the following steps:
[0006] Step 1: Determine the eHealth network architecture that supports blockchain transactions and calculate the network parameters;
[0007] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0008] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0009] Step 4: Allocate hash resources based on the trained decision network.
[0010] Furthermore, the electronic health network architecture supporting blockchain transactions described in step 1 is divided into three layers: the user layer, the edge layer, and the cloud layer.
[0011] The user layer includes N mobile terminal device wireless body area network (WBAN) users. WBAN is used for wearable sensor devices that collect health data. WBAN users need to register with the blockchain network and use a blockchain account as the unique identifier to join the blockchain network and become legitimate participants. WBAN users can perform task calculations locally or offload some tasks to a multi-access edge computing (MEC) server or a cloud server for execution.
[0012] The edge layer includes macro base stations and M MEC servers. The controller module in the macro base station implements various control functions for the system network, including hash resource allocation strategies. The macro base station is used to monitor the blockchain network, and the MEC server provides real-time computing services for WBAN users, while participating in blockchain consensus and receiving corresponding rewards.
[0013] The cloud layer includes a cloud platform, where macro base stations in the edge layer schedule tasks to cloud servers for task offloading and computation; WBAN users purchase computing resources for data processing tasks through the blockchain, and transactions are executed by smart contracts, referred to as transaction contracts.
[0014] Furthermore, the network parameters in step 1 include reputation score, expected mining reward, and service fee;
[0015] Step 1-1: Based on the total hashing power H of the blockchain network and the hashing power p of the MEC server... m The relative hashing power of MEC server m to the blockchain network is obtained. For MEC server collection;
[0016] Step 1-2, assuming MEC server m propagates slower than other MEC servers, the probability that this block is orphaned by the blockchain network is... Where η = 1 / 600 (sec) is the constant average value, Φ(b) m) represents the propagation time of the block, b m The number of transactions contained in the block mined by miner m;
[0017] Steps 1-3: Based on the calculation results of steps 1-1 and 1-2, obtain the expected mining reward r for the MEC server m. m :
[0018]
[0019] In the formula, R f Rewards for the process of reaching a consensus with the first miner;
[0020] Steps 1-4: After each MEC server m completes its computation task, it obtains a reputation score χ. m This is used to measure the computational contribution of the MEC server in the current time slot, and the calculation formula is:
[0021]
[0022] The entire communication process has several time slots t∈{0,1,2,…T-1}, λ l and λ q As a weighting factor, For WBAN user set; Indicates whether WBAN n will offload the task to the MEC server m. This indicates that the task is unloaded to MEC server m, otherwise it is not unloaded to MEC server; τ n Indicates the expected completion time of the task. Y represents the actual time taken for WBAN n to complete the task after it is offloaded to the MEC server; m The number of CPU cores in MEC server m;
[0023] Steps 1-5: During the uninstallation process, WBAN pays service fees γ to the edge service provider. n,m =μ·q n Where μ represents the price unit for the computing service, and q n This indicates the number of MEC server CPU cycles required for the task.
[0024] Furthermore, the MDP model described in step 2 includes a state space S(t), an action space A(t), and a reward function R(t);
[0025] Step 2-1: Every L time slots, a new round of hash power allocation begins. The macro base station controller collects the connection policies and offloading policies of all WBANs and each MEC server from the previous L time slots, and calculates the reputation score of the MEC server accordingly; the state space is defined as:
[0026]
[0027] This represents the set of WBAN users who choose to offload tasks to the MEC server. For a set of tasks, For a set of connection strategies, For a set of uninstallation strategies;
[0028] Step 2-2, the current action space A(t) is defined as the hash power allocated by the macro base station to the MEC server:
[0029] A(t)={p m (t)|m=1,2,…M}
[0030] p m (t) represents the hash power allocated to MEC server m in the current time slot t;
[0031] Steps 2-3: The goal of the blockchain consensus problem is to maximize the overall revenue of MEC edge servers in the system and efficiently allocate miners' hash resources. Therefore, the reward function can be expressed as:
[0032]
[0033] Where r m The expected mining reward for server m; η m The cost of mining is related to the allocated hash power, and the pricing method varies across different blockchains; γ n,m WBAN user n pays computing fees to MEC server m.
[0034] Furthermore, step 3, the training of the DQN algorithm, includes the following steps.
[0035] Step 3-1: Initialize the DQN network parameters and training parameters, including network parameters θ, θ - , experience replay set D, action selection strategy ε and its reduction δ;
[0036] Step 3-2, Initialize environment parameters: Channel state s t Let t = 0;
[0037] Step 3-3: Select action a using the ε-greedy action selection strategy. i (t), allocate hash power to the MEC server and obtain the corresponding reward r. t And update the next state s t+1 At the same time, a parameter end(t) is set to determine whether the training round has ended. end(t) = 1 indicates that the training has ended, otherwise end(t) = 0.
[0038] Steps 3-4: Each experience (s) is added to the experience replay pool. t ,a t ,r t ,s t+1 Store the data using `end(t)`, and check if the number of stored items has reached the set value. If yes, proceed to the next step; otherwise, return to step 3-3.
[0039] Steps 3-5: Randomly sample K from D at each time step t. t A subset of data is extracted from empirical samples and input into the network for training. The target value Q is then calculated. target :
[0040]
[0041] Steps 3-6: Update the parameter θ using stochastic gradient descent to ensure that the estimated output value continuously approaches the target value Q. target .
[0042] Steps 3-7 involve multiple rounds of training to update network parameters. At the end of each round of training, the average reward is recorded and the process returns to step 3-2 until the average reward of the decision network converges.
[0043] Furthermore, step 4, which involves allocating hash resources based on the trained decision network, specifically involves inputting the current time slot's state into the decision network and outputting an action, i.e., a strategy for allocating hash resources.
[0044] An e-health network blockchain consensus system based on the DQN algorithm, the system comprising:
[0045] The network construction module is used to determine the eHealth network architecture that supports blockchain transactions and to calculate network parameters;
[0046] The model building module is used to establish a blockchain consensus MDP model and determine the state space, action space, and reward function.
[0047] The training module is used to train the blockchain consensus problem using the DQN algorithm, update the network parameters, and output the trained decision network until the reward function converges during the entire operation.
[0048] The allocation module is used to allocate hash resources based on the trained decision network.
[0049] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps:
[0050] Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters.
[0051] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0052] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0053] Step 4: Allocate hash resources based on the trained decision network.
[0054] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:
[0055] Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters.
[0056] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0057] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0058] Step 4: Allocate hash resources based on the trained decision network.
[0059] Compared with the prior art, the significant advantages of this invention are: 1) the reputation scoring mechanism helps to rationally allocate hash resources in the blockchain network and encourages MEC servers to participate in blockchain consensus; 2) the process of adopting the DQN algorithm-based electronic health network blockchain consensus can realize the system's intelligent and autonomous adjustment of hash resource allocation.
[0060] The present invention will now be described in further detail with reference to the accompanying drawings. Attached Figure Description
[0061] Figure 1 This is a flowchart of the electronic health network blockchain consensus method based on the DQN algorithm of this invention.
[0062] Figure 2 This is a diagram of the electronic health network architecture in an embodiment of the present invention.
[0063] Figure 3 This is a graph showing the change in total revenue of the MEC server obtained in this embodiment of the invention. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0065] In one embodiment, combined Figure 1 This paper provides a consensus method for an electronic health network blockchain based on the DQN algorithm, the method comprising the following steps:
[0066] Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters.
[0067] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0068] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0069] Step 4: Allocate hash resources based on the trained decision network.
[0070] Furthermore, in one embodiment, the electronic health network architecture supporting blockchain transactions described in step 1 is divided into three layers: the user layer, the edge layer, and the cloud layer. The user layer consists of N mobile terminal device wireless body area network (WBAN) users, where WBAN is a wearable sensor device used to collect health data. WBAN users need to register with the blockchain network, using a blockchain account as the unique identifier to join the network and become legitimate participants. WBAN users can perform task computation locally or offload some tasks to a multi-access edge computing (MEC) server or a cloud server. The edge layer consists of macro base stations and M MEC servers. The controller module in the macro base station can implement various control functions for the system network, such as hash resource allocation strategies. The macro base station can monitor the blockchain network to prevent malicious behavior. The MEC servers in the network are typically placed near roadside small base stations, giving them some wireless communication capabilities. The MEC servers have sufficient computing resources, including high-frequency CPU cores and large storage capacity, enabling them to provide real-time computing services to WBAN users and participate in blockchain consensus to receive corresponding rewards. Cloud platforms in the cloud layer have greater computing power than MEC servers. Macro base stations in the edge layer schedule tasks to cloud servers for offloading computation. WBAN users can purchase computing resources for data processing tasks through the blockchain, and transactions are executed by smart contracts, known as transaction contracts.
[0071] Furthermore, in one embodiment, the blockchain reputation scoring mechanism, i.e., network parameters in step 1, includes reputation score, expected mining reward, and service fee;
[0072] Step 1-1: Based on the total hashing power H of the blockchain network and the hashing power p of the MEC server... m The relative hashing power of MEC server m to the blockchain network is obtained. For MEC server collection;
[0073] Step 1-2, assuming MEC server m propagates slower than other MEC servers, the probability that this block is orphaned by the blockchain network is... Where η = 1 / 600 (sec) is the constant average value, Φ(b) m ) represents the propagation time of the block, b m The number of transactions contained in the block mined by miner m;
[0074] Steps 1-3: Based on the calculation results of steps 1-1 and 1-2, obtain the expected mining reward r for the MEC server m. m :
[0075]
[0076] In the formula, R f Rewards for the process of reaching a consensus with the first miner;
[0077] Steps 1-4: After each MEC server m completes its computation task, it obtains a reputation score χ. m This is used to measure the computational contribution of the MEC server in the current time slot, and the calculation formula is:
[0078]
[0079] The entire communication process has several time slots t∈{0,1,2,…T-1}, λ l and λ q As a weighting factor, For WBAN user set; Indicates whether WBAN n will offload the task to the MEC server m. This indicates that the task is unloaded to MEC server m, otherwise it is not unloaded to MEC server; τ n Indicates the expected completion time of the task. Y represents the actual time taken for WBAN n to complete the task after it is offloaded to the MEC server; m The number of CPU cores in MEC server m;
[0080] Steps 1-5: During the uninstallation process, WBAN pays service fees γ to the edge service provider. n,m =μ·q n Where μ represents the price unit for the computing service, and q n This indicates the number of MEC server CPU cycles required for the task.
[0081] Furthermore, in one embodiment, the MDP model described in step 2 has a state space S(t), an action space A(t), and a reward function R(t);
[0082] Step 2-1: Every L time slots, a new round of hash power allocation begins. The macro base station controller collects the connection policies and offloading policies of all WBANs and each MEC server from the previous L time slots, and calculates the reputation score of the MEC server accordingly; the state space is defined as:
[0083]
[0084] This represents the set of WBAN users who choose to offload tasks to the MEC server. For a set of tasks, For a set of connection strategies, For a set of uninstallation strategies;
[0085] Step 2-2, the current action space A(t) is defined as the hash power allocated by the macro base station to the MEC server:
[0086] A(t)={p m (t)|m=1,2,…M}
[0087] p m (t) represents the hash power allocated to MEC server m in the current time slot t;
[0088] Steps 2-3: The goal of the blockchain consensus problem is to maximize the overall revenue of MEC edge servers in the system and efficiently allocate miners' hash resources. Therefore, the reward function can be expressed as:
[0089]
[0090] Where r m The expected mining reward for server m; η m The cost of mining is related to the allocated hash power, and the pricing method varies across different blockchains; γ n,m WBAN user n pays computing fees to MEC server m.
[0091] Furthermore, in one embodiment, step 3 of training the DQN algorithm includes the following steps.
[0092] Step 3-1: Initialize the DQN network parameters and training parameters, including network parameters θ, θ - , experience replay set D, action selection strategy ε and its reduction δ;
[0093] Step 3-2, Initialize environment parameters: Channel state s t Let t = 0;
[0094] Step 3-3: Select action a using the ε-greedy action selection strategy. i (t), allocate hash power to the MEC server and obtain the corresponding reward r. t And update the next state s t+1 At the same time, a parameter end(t) is set to determine whether the training round has ended. end(t) = 1 indicates that the training has ended, otherwise end(t) = 0.
[0095] Steps 3-4: Each experience (s) is added to the experience replay pool. t ,a t ,r t ,s t+1 Store the data using `end(t)`, and check if the number of stored items has reached the set value. If yes, proceed to the next step; otherwise, return to step 3-3.
[0096] Steps 3-5: Randomly sample K from D at each time step t. t A subset of data is extracted from empirical samples and input into the network for training. The target value Q is then calculated. target :
[0097]
[0098] Steps 3-6: Update the parameter θ using stochastic gradient descent to ensure that the estimated output value continuously approaches the target value Q. target .
[0099] Steps 3-7 involve multiple rounds of training to update network parameters. At the end of each round of training, the average reward is recorded and the process returns to step 3-2 until the average reward of the decision network converges.
[0100] Furthermore, in one embodiment, step 4, which involves allocating hash resources based on the trained decision network, specifically involves inputting the current time slot's state into the decision network and outputting an action, namely, a strategy for allocating hash resources.
[0101] In one embodiment, an electronic health network blockchain consensus system based on the DQN algorithm is provided, the system comprising:
[0102] The network construction module is used to determine the eHealth network architecture that supports blockchain transactions and to calculate network parameters;
[0103] The model building module is used to establish a blockchain consensus MDP model and determine the state space, action space, and reward function.
[0104] The training module is used to train the blockchain consensus problem using the DQN algorithm, update the network parameters, and output the trained decision network until the reward function converges during the entire operation.
[0105] The allocation module is used to allocate hash resources based on the trained decision network.
[0106] Specific limitations regarding the DQN-based e-health network blockchain consensus system can be found in the above section on the limitations of the DQN-based e-health network blockchain consensus method, and will not be repeated here. Each module in the aforementioned DQN-based e-health network blockchain consensus system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0107] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0108] Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters.
[0109] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0110] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0111] Step 4: Allocate hash resources based on the trained decision network.
[0112] For specific limitations on each step, please refer to the limitations on the DQN-based blockchain consensus method for electronic health networks mentioned above, which will not be repeated here.
[0113] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0114] Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters.
[0115] Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function;
[0116] Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network.
[0117] Step 4: Allocate hash resources based on the trained decision network.
[0118] For specific limitations on each step, please refer to the limitations on the DQN-based blockchain consensus method for electronic health networks mentioned above, which will not be repeated here.
[0119] As a specific example, the invention will be further verified and illustrated in one embodiment.
[0120] First press Figure 2 The architecture establishes an electronic health network, consisting of three layers: the user layer, the edge layer, and the cloud layer. The block size is set to 5–10 Kb, the hash power allocated to MEC servers follows a uniform distribution of 20–100 MHash / s, and the mining price for MEC servers follows a 2×10⁻⁶ pattern. -5 ~10×10 -5 The tokens are uniformly distributed. The hash power of the blockchain network follows a uniform distribution of 1×10⁻⁶. 3 ~1×10 5 GHash / s, miners who solve complex problems and reach consensus receive a reward of R = 30 tokens.
[0121] Based on this network architecture, the controller in the macro base station collects relevant information about all MEC servers participating in WBAN task calculation, and then introduces a reputation mechanism to evaluate the reputation score of each MEC server based on service latency and service quantity.
[0122] After modeling the state space S(t), action space A(t), and reward function R(t) of the blockchain consensus problem in the embodiment according to step 2, the neural network is updated according to step 3, wherein the parameters are set as follows: learning rate α = 0.01, capacity of experience memory pool D = 10000, experience samples K = 64, and training period T = 600.
[0123] During the training phase, the agent interacts with the environment to obtain the current state s. t Select action a tThen obtain the next state s t+1 and rewards t The experience replay pool stores each experience instance. After storing a certain number of instances, at each time step t, 64 experience samples are randomly sampled and input into the neural network for training, minimizing the loss function L. t (θ) Update the current network parameters θ, and then use the gradient descent algorithm for optimization, feeding θ into the target value network θ every N steps. - After a training cycle ends, the average reward is recorded and the next round of calculation begins until the average reward converges.
[0124] Figure 3 This chart compares the total revenue of the MEC server obtained using the DQN learning strategy and the more common random strategy. In the early stages of training, the revenue of the MEC system obtained by the DQN algorithm and the random strategy are basically the same. However, as the training cycle increases, the DQN learning algorithm continuously explores the action space to obtain the current optimal strategy, causing the system revenue to continuously increase until convergence.
[0125] In summary, the method of this invention calculates the reputation score of each MEC server based on service latency and service quantity. In blockchain consensus, it adaptively adjusts the hash power resources within the MEC servers, encouraging them to participate in the blockchain consensus process and jointly maintain the blockchain network. This method can significantly improve network performance and can be widely applied in home healthcare, sports and fitness, battlefield soldier monitoring, and convalescent monitoring.
[0126] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.
Claims
1. A consensus method for an electronic health network blockchain based on the DQN algorithm, characterized in that, The method includes the following steps: Step 1: Determine the electronic health network architecture that supports blockchain transactions and design a blockchain reputation scoring mechanism, i.e., calculate network parameters. Step 2: Establish a blockchain consensus MDP model and determine the state space, action space, and reward function; Step 3: Use the DQN algorithm to train the blockchain consensus problem, update the network parameters, until the reward function converges during the entire operation, and output the trained decision network. Step 4: Allocate hash resources based on the trained decision network; In step 1, the blockchain reputation scoring mechanism, i.e., network parameters, includes reputation score, expected reward, and service fee; Step 1-1, based on the total hashing capacity of the blockchain network And the hash power of the MEC server Obtain the MEC server Relative hashing power of blockchain networks ; Steps 1-2: Configure the MEC server Compared to other MEC servers, the propagation speed is slower, and the probability of the block being orphaned by the blockchain network is [missing information]. ,in The average value is a constant. For the propagation time of the block, For users The number of transactions contained in the mined block; Steps 1-3: Based on the calculation results of steps 1-1 and 1-2, obtain the MEC server. Expected Rewards : In the formula, Rewards for the process of reaching a consensus with the first user; Steps 1-4, each MEC server A reputation score is obtained after completing the calculation task. This is used to measure the computational contribution of the MEC server in the current time slot, and the calculation formula is: Several time slots in the entire communication process , and As a weighting factor; WBAN Should the task be offloaded to the MEC server? ,when This indicates that the task is offloaded to the MEC server. Conversely, it was not uninstalled to the MEC server; Indicates the expected completion time of the task. WBAN The actual time spent completing the task after it is offloaded to the MEC server; MEC server The number of CPU cores; Steps 1-5: During the uninstallation process, WBAN pays service fees to the edge service provider. ,in, This indicates the price unit for the computing service. This indicates the number of MEC server CPU cycles required for the task. Step 2-1, every Each time slot begins a new round of hash power allocation, and the macro base station controller collects data beforehand. The connection and offloading policies of all WBANs with each MEC server in each time slot are used to calculate the reputation score of the MEC server; the state space is defined as: For a set of tasks, For a set of connection strategies, For a set of uninstallation strategies; Step 2-2, Current Action Space Defined as the hash power allocated by the macro base station to the MEC server: Indicates the current time slot Hash power allocated to MEC server m; Steps 2-3: The goal of the blockchain consensus problem is to maximize the overall revenue of MEC edge servers in the system and effectively allocate users' hash resources. Therefore, the reward function can be expressed as: in For server Expected rewards; The cost is related to the allocated hash power, and the pricing method varies across different blockchains; WBAN user n pays computing fees to MEC server m.
2. The electronic health network blockchain consensus method based on the DQN algorithm according to claim 1, characterized in that, The eHealth Network architecture supporting blockchain transactions described in Step 1 is divided into three layers: user layer, edge layer, and cloud layer. The user layer includes A mobile terminal device wireless body area network (WBAN) user, WBAN is used for wearable sensor devices to collect health data; WBAN users need to register with the blockchain network, and use a blockchain account as the unique identifier to join the blockchain network and become a legitimate participant; WBAN users can perform task calculations locally, or they can offload some tasks to a multi-access edge computing (MEC) server or a cloud server for execution. The edge layer includes macro base stations and Each MEC server, in which the controller module of the macro base station implements various control functions for the system network, including hash resource allocation strategies; Macro base stations are used to monitor the blockchain network, while MEC servers provide real-time computing services for WBAN users, participate in blockchain consensus, and receive corresponding rewards. The cloud layer includes the cloud platform, where macro base stations in the edge layer schedule tasks to cloud servers for task offloading and computation; WBAN users purchase computing resources for data processing tasks through the blockchain, and transactions are executed by smart contracts, known as transaction contracts.
3. The electronic health network blockchain consensus method based on the DQN algorithm according to claim 2, characterized in that, Step 3, the DQN algorithm training, includes the following steps: Step 3-1: Initialize the DQN network parameters and training parameters, including network parameters. , Experience replay set D, action selection strategy and its reduction ; Step 3-2, Initialize environmental parameters: Channel state ,make ; Step 3-3, through Action selection strategy: select actions Hash power is allocated to MEC servers, and corresponding rewards are obtained. And update the next status. At the same time, set parameters to determine whether this round of training has ended. , This indicates the training is over; otherwise... ; Steps 3-4: Add each experience to the experience replay pool. Perform storage, determine if the storage quantity has reached the set value. If yes, proceed to the next step; otherwise, return to step 3-3. Steps 3-5, according to each time step , in order to Random sampling A subset of data is extracted from empirical samples and input into the network for training to calculate the target value. : Steps 3-6: Update parameters using stochastic gradient descent. This is to ensure that the estimated output value continuously approaches the target value. ; Steps 3-7 involve multiple rounds of training to update network parameters. At the end of each round of training, the average reward is recorded and the process returns to step 3-2 until the average reward of the decision network converges.
4. The electronic health network blockchain consensus method based on the DQN algorithm according to claim 3, characterized in that, Step 4 describes allocating hash resources based on the trained decision network. Specifically, the current time slot state is input into the decision network, and the output is the action, i.e., the strategy for allocating hash resources.
5. An electronic health network blockchain consensus system based on the DQN algorithm, characterized in that, The system includes: The network construction module is used to determine the eHealth network architecture that supports blockchain transactions and to calculate network parameters; The model building module is used to establish a blockchain consensus MDP model and determine the state space, action space, and reward function. The training module is used to train the blockchain consensus problem using the DQN algorithm, update the network parameters, and output the trained decision network until the reward function converges during the entire operation. The allocation module is used to allocate hash resources based on the trained decision network.
6. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Computing resource allocation and task unloading method for edge computing of super-dense network
CN110798849A
Performance optimization method for Internet of Things scene based on mobile edge computing and blockchain collaborative enabling
CN112261674A
Mobile edge computing task unloading method and device based on transfer learning
CN113504987A