Data sharing method, system, electronic device and storage medium

By building a trust alliance blockchain and virtual slave chain in the Internet of Things, combined with a federated learning model, the problem of data exposure during data sharing is solved, data security sharing is realized, and the requirements of the data security law are met.

CN112434313BActive Publication Date: 2024-12-10BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011256399.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-11
Publication Date
2024-12-10
Estimated Expiration
2040-11-11

AI Technical Summary

Technical Problem

The existing data sharing method exposes data while realizing data sharing, resulting in loss of data ownership and privacy leakage, making it difficult to meet the requirements of the Data Security Law.

Method used

By building a trust alliance blockchain, establishing virtual slave chain and federated learning models, realizing data sharing without directly transmitting data, and using blockchain and federated learning technology to ensure data security.

Benefits of technology

It realizes data sharing without exposing data, ensures data security and privacy protection, and meets the requirements of the Data Security Law.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112434313B_ABST
    Figure CN112434313B_ABST
Patent Text Reader

Abstract

This specification provides a data sharing method, including: building a trust alliance blockchain according to the application scenario of the Internet of Things and the geographical location of the device; wherein the trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node; a virtual slave chain is established on the trust alliance blockchain; the leader node in each subdomain of the trust alliance blockchain respectively designates a node in its own subdomain as a federated learning node of the subdomain, and assigns a virtual identity to the federated learning node of the subdomain, and joins the virtual slave chain; and each of the federated learning nodes uses the data generated in its own subdomain to perform joint training of a neural network model, establish the same federated learning model, and complete data sharing between each subdomain. This specification also provides a data sharing system, an electronic device, and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of data processing technology, and in particular, to a data sharing method, system, electronic device, and storage medium. Background Art

[0002] With the rapid development of various new distributed technologies, the concept of the Internet of Things has entered the public's field of vision. It connects devices scattered in different geographical locations and application scenarios through the Internet through sensor nodes, realizes data sharing and exchange, realizes the collaborative work of IoT devices, and improves the performance and resource utilization of distributed systems. With the increase of IoT devices and application scenarios, the IoT has proposed the concept of "domains". The collaborative work of IoT devices is achieved through data sharing between domains. How to achieve secure data sharing in different domains has also become a hot topic in network security research.

[0003] Traditional data sharing is done by encrypting data to avoid information leakage. There are two main sharing methods. One is that the two parties sharing data directly exchange data through ciphertext; the other is to encrypt the data and place it in a centralized place, and the data demander requests the data and decrypts it for use. However, the above data sharing methods will also completely expose the data while completing data sharing. The data owner loses control of the data, and the private data is also leaked during the sharing process. In addition, with the introduction of data security bills such as the Data Security Law and the General Data Protection Regulation, the private data of IoT users is no longer allowed to be shared directly. However, the efficient operation of the IoT requires the analysis of a large amount of data to support it. Therefore, a solution that does not expose data and can complete data sharing is needed. Summary of the invention

[0004] In view of this, one or more embodiments of this specification propose a data sharing method, which can achieve data sharing without exposing the data, thereby ensuring data security.

[0005] The data sharing method described in the embodiments of this specification includes: building a trust alliance blockchain according to the Internet of Things application scenario and the geographical location of the device; wherein the trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node; a virtual slave chain is established on the trust alliance blockchain; the leader node in each subdomain of the trust alliance blockchain respectively designates a node in its own subdomain as a federated learning node of the subdomain, and assigns a virtual identity to the federated learning node of the subdomain, and joins the virtual slave chain; and each of the federated learning nodes respectively uses the data generated in its own subdomain to jointly train the neural network model, establish the same federated learning model, and complete data sharing between the subdomains.

[0006] In an embodiment of the present specification, the construction of a trust alliance blockchain according to an IoT application scenario and a device's geographic location includes: according to the IoT application scenario and the device's geographic location, setting at least one subdomain, a public key infrastructure PKI component of each subdomain, and a main PKI component; the PKI certificate server of each subdomain issues certificates for all nodes in its own subdomain, selects a hash function according to the size of the certificate, generates a hash value of each node certificate, and stores the hash values ​​of all node certificates generated by itself in the first block of its own subdomain, to build a slave chain corresponding to the subdomain; the nodes in each subdomain elect a leader node, and determine a leader node for each subdomain; the main PKI component issues certificates for each subdomain, selects a hash function according to the size of the certificate, generates a hash value of each subdomain certificate, and stores the hash value of each subdomain certificate in the first block of the main domain blockchain, to build the main chain; and the leader node of each subdomain updates the resource directory of the domain to the main chain for cross-domain interactive resource query.

[0007] In an embodiment of the present specification, establishing a virtual slave chain on the trust alliance blockchain includes: the main PKI component issues at least one certificate as a certificate corresponding to the virtual slave chain node; selecting a hash function according to the size of the certificate to generate a hash value of each virtual slave chain node certificate; and storing the hash value of each virtual slave chain node certificate in the first block of the virtual blockchain to construct the virtual slave chain.

[0008] In an embodiment of the present specification, the allocating a virtual identity to the federated learning node of the subdomain includes: issuing a certificate corresponding to a virtual slave chain node and its corresponding hash value to the federated learning node of the subdomain.

[0009] In an embodiment of the present specification, each of the federated learning nodes uses the data generated in its own subdomain to perform joint training of the neural network model, including: each of the federated learning nodes elects a leader node to determine the federated learning leader node; the federated learning leader node generates a public key and a private key, and sends the generated public key to other federated learning nodes; each federated learning node uses local data to train the neural network model to obtain the federated learning model corresponding to each subdomain, and encrypts the model parameters of each federated learning model with the public key and uploads them to the federated learning leader node; the federated learning leader node receives the model parameters of each federated learning model uploaded by each federated learning node, averages them and decrypts them with a private key to obtain the averaged model parameters, and sends the decrypted model parameters to other federated learning nodes; and each federated learning node updates the parameters of its own federated learning model according to the above-mentioned averaged model parameters, and then returns to the step of each of the above-mentioned federated learning nodes using local data to train the neural network model, and iterates the above process until the loss functions of all federated learning models converge.

[0010] In an embodiment of the present specification, the leader node election of each of the federated learning nodes includes: each federated learning node sends an election request with a timestamp t1 to other nodes respectively; wherein the timestamp t1 is the time of sending the election request; when each federated learning node receives an election request from other federated learning nodes, it determines the timestamp t2 of receiving the election request and calculates the transmission duration t3 of the election request; each federated learning node records the information of the federated learning node that sends the election request and the transmission duration t3 of the above-mentioned election request in a form; after receiving the election requests from all other federated learning nodes, each federated learning node broadcasts the form recorded by itself to other nodes in the entire domain; and after other nodes receive the form, according to the records in the form, they add up the transmission duration t3 corresponding to the same federated learning node, and use the federated learning node with the smallest sum as the federated learning leader node.

[0011] In an embodiment of the present specification, the method further includes: the federated learning leader node collects fields of the data set on each federated learning node, determines the fields for federated learning and their order based on the fields, generates an alignment result of the data set, and sends the alignment result of the above data set to other federated learning nodes; wherein, each federated learning node uses local data to train the neural network model, including: each federated learning node uses local data to train the neural network model based on the alignment result.

[0012] Corresponding to the above data sharing method, the embodiment of this specification also provides a data sharing system, including: a trust alliance blockchain and a virtual slave chain; wherein,

[0013] The trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node;

[0014] The leader node in each subdomain designates a node in its own subdomain as a federated learning node of the subdomain, and allocates a virtual identity to the federated learning node of the subdomain to join the virtual slave chain; and

[0015] Each of the federated learning nodes uses the data generated in its own subdomain to jointly train the neural network model, establishes the same federated learning model, and completes data sharing among the subdomains.

[0016] One or more embodiments of the present specification also provide an electronic device, which may include: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data sharing method when executing the program.

[0017] One or more embodiments of the present specification also provide a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the above-mentioned data sharing method.

[0018] In the above data sharing method, each subdomain adds its federated learning node to the established virtual slave chain, and through joint training, the above federated learning nodes jointly train a federated learning model. This federated learning model is equivalent to a machine learning model trained under the condition of sharing all the data of each subdomain. The use of this federated learning model in the application of each subdomain is equivalent to using all the data of each subdomain, thereby achieving the effect of data sharing. In addition, in the above process, the subdomains do not actually share data, so the exposure or leakage of data is completely avoided, thereby ensuring the security of data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only one or more embodiments of the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 The implementation process of the data sharing method described in some embodiments of this specification is shown;

[0021] Figure 2The process of building a trust alliance blockchain described in some embodiments of this specification is shown;

[0022] Figure 3 A schematic diagram showing the structure of a trust alliance blockchain described in some embodiments of this specification is shown;

[0023] Figure 4 A schematic diagram of the structure of a trust alliance blockchain including a virtual slave chain described in some embodiments of this specification is shown;

[0024] Figure 5 The specific implementation method flow of the joint training described in some embodiments of this specification is shown;

[0025] Figure 6 The method flow for all federated learning nodes to elect a leader as described in some embodiments of this specification is shown;

[0026] Figure 7 The implementation process of a specific example of the data sharing method described in some embodiments of this specification is shown;

[0027] Figure 8 The updating process of the federated learning model described in some embodiments of this specification is shown; and

[0028] Fig. 9 A schematic diagram of the internal structure of an electronic device described in some embodiments of this specification is shown. DETAILED DESCRIPTION

[0029] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0030] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of this specification should be understood by people with ordinary skills in the field to which this disclosure belongs. The "first", "second" and similar words used in one or more embodiments of this specification do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0031] In order to solve the problem of data exposure or leakage in existing data sharing methods, one or more embodiments of this specification provide a data sharing method, which can realize data sharing in the Internet of Things without exposing the data, thereby ensuring data security.

[0032] Generally speaking, for the problem of secure data sharing in the Internet of Things, it is first necessary to ensure that the Internet of Things environment is safe and reliable. Blockchain can effectively resist external network attacks, such as false identity attacks, anonymous attacks, etc., through technologies such as certificate authentication and signature algorithms, and use blockchain technology to achieve a safe and reliable Internet of Things environment. In addition, in a multi-domain blockchain, each blockchain slave chain has privacy information of the domain in which it is located. In order to avoid the leakage of these privacy information in cross-domain interactions, the embodiments of this specification introduce a virtual slave chain for cross-domain interaction that does not contain any entity on the basis of the blockchain. In response to the problem of privacy data exposure in the cross-domain interaction process, the embodiments of this specification use federated learning to establish a machine learning model, and perform data interaction by sharing the machine learning model. Since the interaction of the machine learning model obtained by federated learning replaces the direct data interaction, the data in the entire interaction process is not directly transmitted between the two parties, avoiding the problem of data exposure.

[0033] Based on this, the embodiments of this specification divide the IoT data sharing process into three main processes and implement them step by step: first, build a trust alliance blockchain platform device based on the virtual slave chain to ensure the secure supply of the IoT network layer architecture; then, establish a blockchain cross-domain interaction channel supported by federated learning to achieve an inter-domain communication environment without data entity interaction; finally, rely on the federated learning nodes in each region to complete data sharing in the cross-domain interaction channel of the blockchain platform.

[0034] The data sharing method described in the embodiments of this specification will be described in detail below with reference to the accompanying drawings.

[0035] Figure 1 The implementation process of the data sharing method described in some embodiments of this specification is shown. Figure 1 As shown, the method may include:

[0036] In step 102: a trust alliance blockchain is established according to the IoT application scenario and the geographical location of the device.

[0037] In some embodiments of this specification, the construction process of the above-mentioned trust alliance blockchain can refer to Figure 2 , which may specifically include the following steps:

[0038] In step 202, at least one subdomain, a Public Key Infrastructure (PKI) component of each subdomain, and a main PKI component are set according to the IoT application scenario and the geographical location of the device.

[0039] In the embodiments of this specification, the above subdomains may specifically refer to heterogeneous communication domains, such as communication domains of operators, Internet of Vehicles, etc. Specifically, it may be an IBC domain of Identity-Based Cryptography (IBC). In the IBC domain, a PKI certificate is used as the identifier of each IBC domain.

[0040] In step 204, the PKI certificate server of each subdomain issues certificates to all nodes in its own subdomain respectively, and selects a hash function according to the size of the certificate to generate a hash value of each node certificate respectively.

[0041] In step 206, each subdomain stores the hash values ​​of all node certificates generated by itself into the first block of its own subdomain to build a subdomain network.

[0042] In step 208, the nodes in each subdomain conduct a leader node election, and a leader node is determined for each subdomain.

[0043] In step 210, the main PKI component issues a certificate for each subdomain, and selects a hash function according to the size of the certificate to generate a hash value for each subdomain certificate.

[0044] In step 212, the hash value of each subdomain certificate is stored in the first block of the main domain blockchain to build the main chain.

[0045] In step 214, the leader node of each sub-domain updates the resource directory of the domain to the main chain for cross-domain interactive resource query.

[0046] Through the above process, a trust alliance blockchain can be established, thereby realizing the construction of a blockchain-based data security sharing platform device. Figure 3 The schematic diagram of the structure of the trust alliance blockchain constructed by the above method described in the embodiment of this specification is shown. Figure 3 As shown, the above-mentioned trust alliance blockchain includes a main chain and at least one slave chain, wherein each slave chain corresponds to a subdomain.

[0047] In step 104, based on the above-mentioned trust alliance blockchain, a virtual slave chain is established to provide a cross-domain data sharing environment.

[0048] In the embodiment of the present specification, in the above step 104, the above trust alliance blockchain uses the main PKI component therein to build a virtual blockchain, and this virtual blockchain is jointly managed by the leader nodes of all subdomains to build a trust alliance blockchain network containing virtual slave chains.

[0049] Specifically, the above-mentioned main PKI component will issue at least one certificate as the certificate corresponding to the virtual slave chain node; then, a hash function is selected according to the size of the certificate to generate the hash value of each virtual slave chain node certificate; finally, the hash value of each virtual slave chain node certificate is stored in the first block of the virtual blockchain.

[0050] Figure 4 The schematic diagram of the structure of the trust alliance blockchain network containing the virtual slave chain constructed by the above method described in the embodiment of this specification is shown. Figure 4 As shown, the above-mentioned trust alliance blockchain containing virtual slave chains includes, in addition to a main chain and at least one slave chain, a virtual slave chain, wherein, in addition to the above-mentioned virtual slave chain, each slave chain corresponds to a subdomain.

[0051] In step 106, the leader node of each subdomain designates a node in the domain as the federated learning node of the subdomain, allocates a virtual identity to the federated learning node of the subdomain, and joins the virtual slave chain.

[0052] In an embodiment of the present specification, the above-mentioned allocation of a virtual identity to the federated learning node of the subdomain may specifically include: issuing a certificate corresponding to a virtual slave chain node and its corresponding hash value to the federated learning node of the subdomain. Thus, each federated learning node will have a dual identity: one identity is a node in the original subdomain where it is located, and the other is a node on the virtual slave chain.

[0053] In step 108, each of the federated learning nodes uses the data generated in its own subdomain to jointly train the neural network model and establish the same federated learning model to complete data sharing among the subdomains.

[0054] In the embodiments of this specification, Figure 5 The specific implementation process of the above joint training is shown. Figure 5 As shown, the above joint training can be implemented through the following steps:

[0055] In step 502, all the above-mentioned federated learning nodes conduct a leader node election to determine the federated learning leader node.

[0056] In the embodiments of this specification, Figure 6 The figure shows the process of leader election for all the above federated learning nodes. Figure 6 As shown, the above election process may include the following steps:

[0057] In step 602, each of the above-mentioned federated learning nodes sends an election request with a timestamp t1 to other nodes, wherein the timestamp t1 is the time when the election request is sent.

[0058] In step 604, when each of the above-mentioned federated learning nodes receives an election request from other federated learning nodes, it determines the timestamp t2 of receiving the election request and calculates the transmission duration t3 of the election request, where t3=t2-t1. Subsequently, each federated learning node will record the information of the federated learning node that sends the election request and the transmission duration t3 of the above-mentioned election request in a form.

[0059] In step 606, after receiving the election requests from all other federated learning nodes, each federated learning node broadcasts its own record list to other nodes in the entire domain.

[0060] In step 608, after receiving the form, other nodes add up the transmission time t3 corresponding to the same federated learning node according to the records in the form, and use the federated learning node with the smallest sum as the above-mentioned federated learning leader node.

[0061] Furthermore, in the above step 608, the second smallest federated learning node may be used as the above federated learning leader backup node.

[0062] In step 504, the federated learning leader node generates a public key and a private key, and sends the generated public key to other federated learning nodes.

[0063] In an embodiment of the present specification, the above-mentioned federated learning leader node may use a homomorphic encryption algorithm (Paillier) to generate the above-mentioned public key and private key.

[0064] Specifically, the secret key can be generated through the following process:

[0065] First, randomly select two large prime numbers p and q that satisfy ,in, Representative request and The greatest common divisor of .

[0066] Secondly, calculate and .

[0067] Again, pick random integers ( ), so that the condition Divisibility The order of can be satisfied, that is, .in, Representative request and The least common multiple of .

[0068] Finally, determine the public key , the private key is .

[0069] After the above public key and private key are determined, the public key can be used to encrypt data, and the private key can be used to decrypt data.

[0070] Specifically, assuming the plaintext is , choose a random number Then, for the above plain text The ciphertext obtained after encryption It can be expressed by the following expression: .

[0071] In addition, for the ciphertext It can be decrypted by the following expression to get the plaintext : .

[0072] In this step, the above-mentioned federated learning leader node distributes the public key to the federated learning nodes of other subdomains, so that the federated learning phase of other subdomains can use the received public key to encrypt the data that needs to be exchanged during the training process.

[0073] In step 506, each federated learning node uses local data to train the neural network model to obtain a federated learning model corresponding to each subdomain, and encrypts the model parameters of each federated learning model using the above public key and uploads them to the federated learning leader node.

[0074] Specifically, in the embodiments of the present specification, the above-mentioned neural network model may be a convolutional neural network model (CNN), a deep neural network (DNN) or any other neural network model.

[0075] In addition, in some other embodiments of the present specification, before training the neural network model, the following steps may be further included:

[0076] In step 505, the federated learning leader node collects the fields of the data sets on each federated learning node, determines the fields for federated learning and their order based on the fields, generates an alignment result of the data set, and sends the alignment result of the data set to other federated learning nodes.

[0077] In this way, each federated learning node can determine which data fields in its own data set and the order of these data fields to use to train its own federated learning model according to the alignment result of the received data set. That is, in this case, in this step 506, each federated learning node will extract the data of the corresponding field from the local data set based on the alignment result of the above data set, and then use the extracted data to train the neural network model.

[0078] It should be noted that, in the embodiments of this specification, each of the above-mentioned federated learning nodes may further collect and store data sets generated by other nodes in its subdomain in addition to storing the data sets generated by itself.

[0079] In step 508, the federated learning leader node receives the model parameters of the respective federated learning models uploaded by each federated learning node, averages them, decrypts them using the private key, obtains the averaged model parameters, and sends the averaged model parameters to each federated learning node.

[0080] In step 510, each federated learning node updates the parameters of its own federated learning model according to the averaged model parameters, then returns to step 506, and iterates the above process until the loss functions of all federated learning models converge.

[0081] Through the above Figure 5 The process shown completes the entire joint training process. The federated learning model obtained through the above training process establishes a blockchain cross-domain interaction channel supported by federated learning on the above trust alliance blockchain, and the interaction channel is a secure shared channel without data entity interaction.

[0082] After the joint training is completed and the model parameters of the above-mentioned federated learning model are obtained, the federated learning nodes on each subdomain can distribute the model parameters of the above-mentioned federated learning model to other nodes within its subdomain through its own slave chain, so that all nodes can share the above-mentioned federated learning model. In other subsequent applications, each node can directly use the above-mentioned federated learning model to perform various data classification or prediction operations, thereby realizing the functions of various IoT applications.

[0083] It can be seen from the above data sharing method that in the embodiments of this specification, each subdomain adds the federated learning node on it to the established virtual slave chain, and through joint training, the above federated learning nodes jointly train a federated learning model. This federated learning model is equivalent to a machine learning model trained under the condition of sharing all the data of each subdomain. Each subdomain uses this federated learning model in its other applications, which is equivalent to using all the data of each subdomain, thereby achieving the effect of data sharing. Moreover, in the above process, the subdomains do not really share data, so the exposure or leakage of data is completely avoided, thereby ensuring the security of the data.

[0084] The following will describe in detail a specific example of the data sharing method described in the embodiments of this specification in conjunction with the accompanying drawings. The application scenario of this example is the Internet of Things between brain-computer interface devices in smart medical care. The purpose of this embodiment is to integrate a variety of EEG raw data collection scenarios, so as to establish a high-precision, wide-range, multi-scenario mapping model of brain wave physiological signals to human brain intention behavior. To achieve this goal, it is necessary to collect raw EEG physiological signal data in different application scenario domains and conduct reliable cross-domain interactions. However, the collected raw EEG signal data is the user's personal privacy and needs to be effectively protected. Therefore, the embodiments provided in this specification will construct a trust alliance blockchain platform architecture based on virtual sub-chains, and establish a blockchain cross-domain interaction channel supported by federated learning to enhance the reliability of cross-domain interactions of data in each region on the platform. Specifically, the mapping model results are only transmitted between different domains to achieve the purpose of protecting the original training data.

[0085] In the embodiments provided in this specification, unless otherwise specified, the PKI components all adopt basic settings and can be obtained through free open source channels. Unless otherwise specified, the content of each blockchain certificate can be randomly set, and its data format is an array with an indefinite length.

[0086] Figure 7 A specific example of the data sharing method described in the embodiments of this specification is shown.

[0087] In step 702, according to different brain-computer interface raw data collection scenarios, three IBC domains are divided into medical institutions, research institutes, and universities.

[0088] For the convenience of description, the three domains are named as domain A, domain B, and domain C in the following text. In addition, in the embodiment provided by the present invention, the number of sub-devices in the three IBC domains is 3, 4, and 3 respectively. For each IBC domain, a corresponding domain PKI component is set; for the entire trust alliance blockchain platform, a main PKI component is set.

[0089] In step 704, for each IBC domain, its subdomain PKI certificate server issues certificates to all devices in the IBC domain.

[0090] In an embodiment provided by the present invention, the certificate content is shown in Table 1 below.

[0091]

[0092] Table 1

[0093] In step 706, the hash value of the certificate is generated using the python.hash() function, as shown in Table 2 below in one embodiment provided by the present invention.

[0094]

[0095] Table 2

[0096] In step 708, for each IBC domain, the hash values ​​of the certificates of all devices in the domain are stored in the first block of the IBC domain to build an IBC domain network.

[0097] In step 710, the sub-domain nodes conduct sub-domain leader node election.

[0098] In one embodiment provided by the present invention, the sub-domain leader node election results are: domain A: device 2; domain B: device 4; domain C: device 1.

[0099] In step 712, for each IBC domain, its primary PKI server issues a certificate for the IBC domain network constructed in step 708, selects a hash function according to the size of the certificate, and generates a hash value of the certificate.

[0100] In one embodiment provided by the present invention, the hash value of the IBC domain network certificate is shown in Table 3 below.

[0101]

[0102] Table 3

[0103] In step 714, the hash value of the IBC domain network certificate is stored in the first block of the main domain blockchain to build the main chain.

[0104] In step 716, the sub-domain leader updates the resource directory of the domain to the main domain ledger for cross-domain interactive resource query.

[0105] In step 718, the trust alliance blockchain network builds a virtual blockchain with the help of the main PKI component. This virtual blockchain is jointly managed by device 2 in domain A, device 4 in domain B, and device 1 in domain C to build a trust alliance blockchain network containing virtual sub-chains.

[0106] In step 720, for each IBC domain, the sub-domain leader is instructed to designate a node within the domain as the federated learning node of the domain.

[0107] In one embodiment provided by the present invention, the designation results of the sub-domain leaders are shown in Table 4 below.

[0108]

[0109] Table 4

[0110] At step 722, for each IBC domain, the subdomain leader applies for a virtual identity for the federated learning node.

[0111] In step 724, within the trust alliance blockchain network, all federated learning nodes jointly conduct a federated learning leader node election. The detailed steps are as follows:

[0112] Each federated learning node sends an election request with a timestamp t1 to other federated learning nodes except itself, where the timestamp records the time when the request was sent.

[0113] In one embodiment provided by the present invention, the content of the election request sent by each federated learning node to other nodes is shown in Table 5 below.

[0114]

[0115] Table 5

[0116] For each federated learning node, when receiving an election request from another federated learning node, the time of receiving the request is recorded as timestamp t2. Let t3 = t2-t1, and record the requesting node information and t3 in the form.

[0117] In an embodiment provided by the present invention, the record forms of domain A, domain B, and domain C are shown in Tables 6, 7, and 8 below, respectively.

[0118]

[0119] Table 6

[0120]

[0121] Table 7

[0122]

[0123] Table 8

[0124] After receiving requests from all election nodes, other nodes broadcast their own recorded forms to all nodes in the domain.

[0125] After receiving the form, the node adds the t3 of the corresponding node in the form and the sum of the sum The smallest node becomes the leader node of federated learning. =12+5=17; Device 4 in domain B =10+2=12; Device 2 in domain C =3+6=9. Therefore, device 2 in domain C is selected as the leader node of federated learning.

[0126] In step 726, device 2 (federated learning leader node) in domain C collects the fields of the data sets to be trained of each federated learning node, performs data transformation and data induction, unifies the fields and their order used by all parties, and generates a data set alignment result.

[0127] In step 728, device 2 (federated learning leader node) in domain C sends the output result of step 13 to other federated learning nodes.

[0128] In step 730, device 2 (federated learning leader node) in domain C generates a public key and a private key using the Paillier algorithm. The specific steps are as follows:

[0129] First, let , , obviously satisfies .

[0130] calculate .

[0131] calculate .

[0132] Then choose a random integer .

[0133] In this case, the public key is determined to be (201793,96335) and the private key is 200880. The following conditions are met:

[0134] After the above public key and private key are determined, the public key can be used to complete encryption, and the private key can be used to complete decryption.

[0135] In step 732, device 3 in domain A, device 4 in domain B, and device 2 in domain C (federated learning nodes in each subdomain) respectively use local data to train the neural network sub-model.

[0136] In step 734, device 2 in domain C (federated learning leader node) distributes the public key (201793,96335) to each subdomain federated learning node to encrypt the data that needs to be exchanged during the training process.

[0137] Specifically, when the plain text is When choosing a random number , we can get the ciphertext :

[0138]

[0139] In step 736, the federated learning nodes of each subdomain aggregate the sub-model parameter ciphertexts encrypted in step 732 to device 2 (the federated learning leader node) in domain C, and calculate the federated average of the sub-model parameter ciphertexts at the leader node. Finally, the calculated federated average is decrypted.

[0140] Specifically, when the ciphertext is When decryption is performed, the plaintext content can be obtained. :

[0141]

[0142] In step 738, device 2 in domain C (federated learning leader node) transmits the decrypted model data back to other federated learning nodes respectively, and each federated learning node updates its own model parameters according to the received model data.

[0143] Iterate steps 732-738 until the model accuracy of each subdomain meets the requirements, thus completing the entire training process.

[0144] In the embodiment of the present invention, the final trained scenario brain wave physiological signal to human brain intention behavior mapping model has been experimentally tested, and the accuracy rates in various application scenarios have reached 87.1%, 86.4%, and 81.2%, respectively. At the same time, it well protects user privacy and improves the security and reliability of interaction.

[0145] Furthermore, since each subdomain will continuously generate new data during the execution of IoT applications, in order to achieve timely data sharing between subdomains, it is necessary to further update the trained federated learning model in a timely manner based on the above data sharing method. The update process of the federated learning model can be as follows: Figure 8 As shown, it may specifically include:

[0146] In step 802, each federated learning node collects the data generated in its own subdomain to form a database of the subdomain.

[0147] In step 804, each federated learning node determines its own subdomain training factor according to the amount of data generated in the domain, determines whether to request training according to the above training factor, and sends a training request to the federated learning leader node when it is determined to request training.

[0148] Specifically, in the embodiments of this specification, the above training factors It can be determined by the following expression: ,in, is the amount of data generated by this domain, is the total amount of data.

[0149] In addition, the request training threshold can be pre-set , and according to the training factor and request training threshold The relationship between determines whether training is requested. For example, when , it is determined to request training. At this time, the federated learning node sends a training request to the federated learning leader node; otherwise, the federated learning node can continue to collect data.

[0150] In step 806, the federated learning leader node receives training requests. When the number of received training requests exceeds a preset request number threshold, the federated learning leader node sends an instruction to start federated learning to all federated learning nodes.

[0151] In step 808, after receiving the above-mentioned instruction to start federated learning, each federated learning node starts to execute the above-mentioned joint training process 506-510 to update its own federated learning model.

[0152] Through the above method, when the newly generated data in each subdomain exceeds a certain condition, joint training can be re-performed to obtain an updated federated learning model, thereby realizing timely sharing of data among subdomains.

[0153] Corresponding to the above data sharing method, the embodiment of this specification also provides a data sharing system. Its internal structure can be as above Figure 4 As shown, it mainly includes: a trust alliance blockchain and a virtual slave chain; wherein the trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node;

[0154] The leader node in each subdomain designates a node in the domain as the federated learning node of the subdomain, and allocates a virtual identity to the federated learning node of the subdomain, and joins the virtual slave chain;

[0155] Each of the federated learning nodes uses the data generated in its own subdomain to jointly train the neural network model and establish the same federated learning model to complete data sharing among the subdomains.

[0156] It should be noted that the method of one or more embodiments of this specification can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of one or more embodiments of this specification, and the multiple devices will interact with each other to complete the above method.

[0157] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0158] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more embodiments of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0159] The apparatus of the above-mentioned embodiment is used to implement the corresponding method in the above-mentioned embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0160] Fig. 9 A more specific electronic device hardware structure diagram provided in the embodiment of this specification may include: a processor 910, a memory 920, an input / output interface 930, a communication interface 940, and a bus 950. The processor 910, the memory 920, the input / output interface 930, and the communication interface 940 are connected to each other through the bus 950 in the device.

[0161] The processor 910 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the data sharing method provided in the embodiments of this specification.

[0162] The memory 920 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 920 may store an operating system and other application programs. When the data sharing method provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 920 and is called and executed by the processor 910.

[0163] The input / output interface 930 is used to connect the input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0164] The communication interface 940 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0165] The bus 950 includes a path that transmits information between components of the device (eg, the processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 ).

[0166] It should be noted that, although the above device only shows the processor 910, the memory 920, the input / output interface 930, the communication interface 940 and the bus 950, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0167] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0168] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. In line with the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present specification as described above, which are not provided in detail for the sake of simplicity.

[0169] In addition, to simplify the description and discussion, and in order not to obscure one or more embodiments of the present specification, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, devices may be shown in the form of block diagrams to avoid obscuring one or more embodiments of the present specification, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which one or more embodiments of the present specification are to be implemented (i.e., these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that one or more embodiments of the present specification may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0170] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the discussed embodiments.

[0171] One or more embodiments of this specification are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification should be included in the scope of protection of this disclosure.

Claims

1. A data sharing method, comprising: Building a trust alliance blockchain according to the IoT application scenario and the geographical location of the device; wherein the trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node; Establishing a virtual slave chain on the trust alliance blockchain; The leader node in each subdomain of the trust alliance blockchain designates a node in its own subdomain as the federated learning node of the subdomain, and allocates a virtual identity to the federated learning node of the subdomain to join the virtual slave chain; and Each of the federated learning nodes uses the data generated in its own subdomain to jointly train the neural network model, establishes the same federated learning model, and completes data sharing among the subdomains.

2. The method according to claim 1, wherein: The construction of a trust alliance blockchain based on IoT application scenarios and device geographic locations includes: According to the IoT application scenario and the device geographic location, set up at least one subdomain, the public key infrastructure PKI components of each subdomain, and the main PKI component; The PKI certificate server of each subdomain issues certificates for all nodes in its own subdomain, selects a hash function according to the size of the certificate, generates hash values ​​for each node certificate, and stores the hash values ​​of all node certificates generated by itself in the first block of its own subdomain, thus building a slave chain corresponding to the subdomain; The nodes in each subdomain elect a leader node and determine a leader node for each subdomain; The main PKI component issues a certificate for each subdomain, selects a hash function according to the size of the certificate, generates a hash value for each subdomain certificate, and stores the hash value of each subdomain certificate in the first block of the main domain blockchain to construct the main chain; and The leader node of each subdomain updates the resource directory of its own subdomain to the main chain for cross-domain interactive resource query.

3. The method according to claim 2, wherein: The establishment of a virtual slave chain on the trust alliance blockchain includes: The master PKI component issues at least one certificate as a certificate corresponding to the virtual slave chain node; Selecting a hash function according to the size of the certificate to generate hash values ​​of the certificates of each virtual slave chain node; and The hash value of each virtual slave chain node certificate is stored in the first block of the virtual blockchain to construct the virtual slave chain.

4. The method according to claim 3, wherein: The allocating a virtual identity to the federated learning node of the subdomain includes: issuing a certificate corresponding to a virtual slave chain node and its corresponding hash value to the federated learning node of the own subdomain.

5. The method according to claim 1, wherein: Each of the federated learning nodes uses the data generated in its own subdomain to perform joint training of the neural network model, including: Each of the federated learning nodes performs a leader node election to determine a federated learning leader node; The federated learning leader node generates a public key and a private key, and sends the generated public key to other federated learning nodes; Each federated learning node uses local data to train a neural network model to obtain a federated learning model corresponding to each subdomain, and encrypts the model parameters of each federated learning model with the public key and uploads them to the federated learning leader node; The federated learning leader node receives the model parameters of the respective federated learning models uploaded by each federated learning node, averages them and decrypts them using a private key to obtain the averaged model parameters, and sends the averaged model parameters to other federated learning nodes; and Each federated learning node updates the parameters of its own federated learning model according to the averaged model parameters, returns to the step of each federated learning node training the neural network model using local data, and iterates the above process until the loss function of the federated learning model trained by each federated learning node converges.

6. The method according to claim 5, wherein: The leader node election performed by each of the federated learning nodes includes: Each federated learning node sends an election request with a timestamp t1 to other nodes; wherein the timestamp t1 is the time when the election request is sent; When each federated learning node receives an election request from another federated learning node, it determines the timestamp t2 of receiving the election request and calculates the transmission duration t3 of the election request; Each federated learning node records the information of the federated learning node that sent the election request and the transmission time t3 of the election request in the form; After receiving election requests from all other federated learning nodes, each federated learning node broadcasts its own recorded form to other nodes in the entire domain; and After receiving the form, other nodes add up the transmission time t3 corresponding to the same federated learning node according to the records in the form, and use the federated learning node with the smallest sum as the federated learning leader node.

7. The method according to claim 5, wherein: The method further comprises: The federated learning leader node collects fields of data sets on each federated learning node, determines fields for federated learning and their order according to the fields, generates alignment results of the data sets, and sends the alignment results of the data sets to other federated learning nodes; wherein, Each federated learning node uses local data to train the neural network model, including: each federated learning node uses local data to train the neural network model based on the alignment result.

8. A data sharing system, comprising: Trust alliance blockchain and a virtual slave chain; The trust alliance blockchain includes a main chain and at least one slave chain, each slave chain corresponds to a subdomain, and each subdomain includes a leader node; The leader node in each subdomain designates a node in its own subdomain as a federated learning node of the subdomain, and allocates a virtual identity to the federated learning node of the subdomain to join the virtual slave chain; and Each of the federated learning nodes uses the data generated in its own subdomain to jointly train the neural network model, establishes the same federated learning model, and completes data sharing among the subdomains.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data sharing method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium, wherein: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the data sharing method according to any one of claims 1 to 7.