A smart home access control system and method based on blockchain technology

By adopting blockchain technology in smart home systems, using IPFS and Hash-SHchain to store data hash values, combining PoW and PoS consensus mechanisms, and optimizing the symmetric key structure, the data sharing and security issues in smart home access control systems are solved, achieving efficient access control and data privacy protection.

CN118713825BActive Publication Date: 2025-12-26SHANGHAI UNIVERSITY OF ELECTRIC POWER
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410860477.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2025-12-26
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

In existing smart home access control systems, personal information stored on centralized servers is vulnerable to hacking, and access data between different organizations cannot be shared or interacted with, posing security and data sharing issues.

Method used

The smart home access control system, based on blockchain technology, uses IPFS to store encrypted hash values ​​as data indexes, Hash-SHchain to store data hash values, and maintains the consortium blockchain through consensus nodes. It combines PoW and PoS consensus mechanisms, optimizes the symmetric key structure, and uses smart contracts for access control.

Benefits of technology

It achieves secure and efficient data privacy protection and access control management, avoids economic issues between visitors and home administrators, improves system security and data sharing capabilities, and reduces communication overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713825B_ABST
    Figure CN118713825B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of intelligent home access control system and method based on blockchain technology, the present application will Hash-SHchain be combined with IPFS, data is stored in IPFS system, and it is indexed using hash value in Hash-SHchain;It also uses the consensus mechanism of PoW and PoS combination, in this mechanism, home administrator is scored according to the service provided by visitor, the comprehensive score result of visitor is used as PoS equity, the difficulty of PoW is determined by the equity of PoS, can prevent node is continuously selected as participating node. Further optimize the symmetric key for encrypting data, wherein the administrator uses multiple access personal keys to generate the final encryption key. Compared with the prior art access control method, the present application can ensure that all data cannot be tampered with or denied, prevent unauthorized access to devices by visitors, and avoid leakage of access personal keys.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of access control, in particular to an intelligent home access control system and method based on blockchain technology. BACKGROUND

[0002] Intelligent home access control technology refers to a series of technical means for controlling and managing access in an intelligent home system using modern technology and equipment. These technologies usually involve identity verification, permission management, data encryption, remote control, etc., aiming to improve the security, convenience and intelligence level of the intelligent home system.

[0003] Specifically, intelligent home access control technology includes but is not limited to the following aspects:

[0004] Identity verification technology: identity verification through password, biometric identification (such as fingerprint, facial recognition), smart card, etc. This method is simple and easy to implement, but there is a risk of password guessing by others.

[0005] Permission management technology: permission management technology is to manage and distribute access control to intelligent home devices according to user identity and needs, such as control permissions of family members to different devices. This method has high flexibility and great convenience. However, there are single point of failure and adverse consequences of misoperation.

[0006] Data encryption technology: data encryption technology is a key means to ensure data transmission and storage security. This method has the advantages of integrity and confidentiality, and improves the security of the system, but there are problems of key leakage and key management.

[0007] Remote control: remote control technology allows users to remotely manage and control home devices through the Internet. This method has the advantages of energy saving and environmental protection, and improves the personalization of home experience, but also has certain security risks and privacy problems. SUMMARY

[0008] The purpose of the present application is to overcome the defects of the above-mentioned traditional access control method and system, i.e. personal information stored in a centralized server is vulnerable to hacker attacks or misuse, and access data between different agencies cannot be shared and interacted, and to provide an intelligent home access control system and method based on blockchain technology.

[0009] The purpose of the present application can be achieved by the following technical solutions:

[0010] As a first aspect of the present application, an intelligent home access control system based on blockchain technology is provided, which comprises:

[0011] IPFS: used to store the ciphertext hash pair data, the hash value as the index of the corresponding ciphertext;

[0012] Hash-SHchain: a consortium blockchain composed of all families and companies, maintained by consensus nodes, used to store data hash values, the stored hash values are used as indexes to map to the corresponding data in IPFS;

[0013] Internet of Things device: communicates with the smart home family administrator and interacts with the visitor through the smart home family administrator;

[0014] Visitor: provides services for the smart home, can query data from Hash-SHchain, and view access permissions through smart contract;

[0015] User: user types include:

[0016] Ordinary user: a user who generates data using Internet of Things devices in the smart home;

[0017] Family administrator: encrypts communication data and generates hash data for uploading to IPFS and Hash-SHchain.

[0018] As a preferred technical solution, the data stored in the IPFS includes:

[0019]

[0020] In the formula, and represent the data stored in the IPFS, each category is a ciphertext hash pair, where the hash value is considered as the index of the corresponding ciphertext; D i is the data generated by the Internet of Things device, A i is the service data provided by the visitor; and are the hash values of the data generated by the Internet of Things device and the service data provided by the visitor, respectively; represent the data ciphertext generated by the device during operation and the visitor analysis data ciphertext, respectively; Enc k () represents a symmetric encryption algorithm using key k.

[0021] As a preferred technical solution, the internal structure of the block in the Hash-SHchain is as follows:

[0022] The block header contains Index, preHash, merkleRoot, time, nonce, and the block body contains six specific transactions, which are divided into and two types, and the transaction content is as follows:

[0023]

[0024] in,

[0025]

[0026] In the formula, The digital signature of the home administrator representing the transaction, htxl i The identifier representing transaction i, For the administrator's identity information, For visitor identity information, ts i Let be the timestamp at time i. Data hashes generated for IoT devices For visitor V j Rating identifier;

[0027]

[0028] in,

[0029]

[0030] In the formula, This represents the hash value of the service data provided by the visitor. A digital signature representing a visitor, PEnc pk () indicates an asymmetric encryption algorithm using the public key pk; using service data A i Digital envelopes and visitor V j Digital envelopes For service data A i Implement dual privacy measures.

[0031] As a preferred technical solution, the home administrator scores the service information generated by visitors, and can revoke the visitor's access permission if misconduct or error messages occur; furthermore, the home administrator can dynamically add or revoke visitor access permissions, as detailed below:

[0032] The home administrator sets the visitor V by calling the initAccList function. j Initialization includes: Visitor V who owns the address j Device d can be used to view the readability of the OP status; the time range of access; the on / off status of device d; and the function switching mode of device d.

[0033] When the family administrator successfully sets up visitor V j When granting access permissions, call the getAccess function to obtain permission information;

[0034] The home administrator dynamically adds and revokes the access control permission of the visitor V j by respectively calling the addAList and deleteAList functions.

[0035] As a second aspect of the present application, a smart home access control method based on a blockchain technology is provided, which adopts the smart home access control system based on a blockchain technology as described above, and the specific access steps are as follows:

[0036] The home administrator, the visitor, and the Internet of Things device are initialized to generate a symmetric key k a , which is encrypted by the home administrator to the device Internet of Things data; each visitor generates a communication key k j with the home administrator, each home smart device (HSD) generates an independent and unique identity

[0037] After the Internet of Things device generates the data, the home administrator calculates the data ciphertext and the data hash value generated by the Internet of Things device and uploads them to the IPFS; the data hash value generated by the Internet of Things device is stored on the Hash-SHchain through the consensus node;

[0038] The home administrator replies to the message M i according to the access request Req i of the visitor:

[0039] When the visitor receives the reply message M i from the home administrator, the visitor checks whether the permission is empty, and if the content of the permission is not empty, the visitor has the right to access the data of the smart home;

[0040] The visitor V j starts to search the relevant index on the Hash-SHchain and finds the corresponding data in the IPFS, decrypts, analyzes, and processes it, and then sends it out:

[0041]

[0042] After the home administrator receives the service data identifier , the home administrator retrieves the service data A i from the IPFS and scores the visitor according to the provided service;

[0043] If the home administrator is satisfied with the service of the visitor, the visitor will get a positive evaluation, and vice versa; the home administrator uploads the score to the consensus node network.​

[0044] As a preferred technical solution, the method adopts an optimized symmetric key structure, specifically as follows:

[0045] Each visitor owns a symmetric key k j For each device, the home administrator generates a random key and aggregates it with the symmetric key set {k j |1≤j≤n} to create an encryption key K i :

[0046]

[0047] The home administrator sends the encryption key set to each visitor V j :

[0048]

[0049] After the encryption key set begins to decrypt, K i is calculated using the following formula:

[0050]

[0051] In the formula, PEnc pk () represents an asymmetric encryption algorithm using public key pk, k l represents the encryption key of visitor l, and K i represents the data encryption key calculated comprehensively.

[0052] As a preferred technical solution, when the visitor and the home administrator first meet, the home administrator verifies the access rights of the visitor:

[0053] When the home administrator receives a connection request Req j from the visitor V i , the home administrator queries the reputation of the visitor V j from Hash-SHchain;

[0054] If the requirements of the home administrator are not met, the connection will be refused;

[0055] Otherwise, the home administrator will continue to check the local ACL table, and if the visitor exists in the ACL table The visitor will be able to access the data; otherwise, the connection request will be refused.

[0056] As a preferred technical solution, the reputation calculation is specifically as follows:

[0057] If the visitor V jThe service meets the needs of the family administrator, who will give a positive score, otherwise, a negative score;

[0058] The family administrator will access the visitor V j The service data A i is aggregated into a set, and the credibility of a certain piece of service data is defined as:

[0059]

[0060] In the formula, α and β are two preset parameters that control the minimum lower limit and the change rate of the credibility of the service data A i respectively.

[0061] The family administrator obtains the credibility set R i of the service data A q ={r1, r2, …, r q};

[0062] The aggregated credibility of the visitor V j is calculated using the Bayes theorem formula:

[0063]

[0064] In the formula, P(V) is the prior probability of the visitor, is the complementary content of the visitor, P(r j / V) = r j , P(V / R) belongs to [0,1];

[0065] When P(V / R) exceeds a preset threshold, the family administrator will generate a positive score for the visitor; otherwise, a negative score.

[0066] As a preferred technical solution, the consensus node uses weighted aggregation to calculate the offset of the collected family administrator scores:

[0067]

[0068] In the formula, is the score offset of the visitor V according to the family administrator A, belongs to [0,1], a and b are the number of positive scores and negative scores, and G(.) is used to control the sensitivity of negative scores.

[0069] The consensus node adds the score offset to the Hash-SHchain.

[0070] As a preferred technical solution, the consensus node adopts a consensus mechanism combining PoW and PoS:

[0071] The sum of the absolute values of the offsets is used as the PoS rights, and the threshold in PoW is determined by the PoS rights, and the selection of the participating nodes is carried out by constantly changing the random number, and only when the calculation result is lower than the predetermined threshold, the node will be selected as the participating node:

[0072]

[0073] In the formula, The threshold of node i ; And Present a positive correlation; The offset set of the current node i F max is Upper limit; Composed of a series of binary, determine the speed of generating blocks; N y The number of consecutive 0s in front of N x The total number of bits of the hash value;

[0074] After the participating nodes are selected, all consensus nodes verify the nonce; when the blockchain begins to fork, the consensus nodes select one of the forks to calculate the block and add it to the Hash-SHchain; the longest fork chain of the blockchain will become the main chain, and the blocks on the other forks will be discarded and returned to the transaction pool of each node, and will be re-added to the Hash-SHchain in the later stage, and all consensus nodes maintain the same blockchain.

[0075] Compared with the prior art, the present application has the following beneficial effects:

[0076] 1) The present application designs a Hash-SHchain to store the hash values of data. In order to protect data privacy, the present application uses an encrypted digital envelope to store specific messages. The Hash-SHchain is also combined with IPFS to store data in the IPFS system and index it using hash values in the Hash-SHchain. This not only allows visitors to quickly query the corresponding data based on the hash index in the block, but also ensures that all data cannot be tampered with or denied. It can avoid economic problems between visitors and family administrators.

[0077] 2) The present application adopts a consensus mechanism combining PoW and PoS. In this mechanism, the family administrator scores according to the services provided by the visitor. The comprehensive score result of the visitor is used as the PoS rights. The difficulty of PoW is determined by the rights of PoS, which can prevent the node from being selected continuously.

[0078] 3) The present application further optimizes the symmetric key used for encrypting data, wherein the home administrator uses the personal key of multiple visitors to generate the final encryption key, which can avoid the leakage of the personal key of the visitor.

[0079] 4) The present application uses a smart contract to write an access control method. Deploying a smart contract with an authorization function can prevent unauthorized access to the device by visitors. Compared with a local storage access control list, this method does not occupy any local storage space and saves communication overhead. BRIEF DESCRIPTION OF DRAWINGS

[0080] Figure 1 A system model of a blockchain-based smart home access control method is provided for the first embodiment of the present application.

[0081] Figure 2 A detailed flowchart of a blockchain-based smart home access control method is provided for the first embodiment of the present application.

[0082] Figure 3 The internal structure of a block in a blockchain-based smart home access control system is provided for the first embodiment of the present application.

[0083] Figure 4 The generation process of a block in a blockchain-based smart home access control system is provided for the first embodiment of the present application. DETAILED DESCRIPTION

[0084] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. The present embodiment is implemented on the premise of the technical solution of the present application, and gives a detailed implementation and specific operation process, but the protection scope of the present application is not limited to the following embodiments.

[0085] Embodiment 1

[0086] The present application provides a blockchain-based smart home access control system to solve the problems of sharing and interactive operation of access control data, key security, etc. It includes: designing a blockchain Hash-SHchain to store the hash value of the data, and using a consensus mechanism combining PoW and PoS, and finally writing an access control method by a smart contract, and optimizing the symmetric key used for encrypting data.

[0087] The system model is shown in Figure 1 The system model of the present application consists of the following components: IPFS, IoT device, visitor, home administrator and Hash-SHchain. Please note that the service provider is referred to as a visitor in the rest of the present application, and the symbols involved and their corresponding meanings are shown in Table 1.

[0088] Table 1 Symbolic representation of the meaning

[0089]

[0090] IPFS: IPFS is a system designed specifically for storing data addresses. It uses multiple virtual servers hosted by third parties instead of dedicated servers. Users can access IPFS data anytime, anywhere. In this invention, the management and maintenance of the IPFS system are the responsibility of the smart home service provider alliance (such as a residential community). The data stored in IPFS is divided into two categories:

[0091]

[0092] It is worth noting that each category is a ciphertext hash pair, where the hash value is considered as the index of the corresponding ciphertext. i is the data generated by the Internet of Things device i, A i is the service data provided by the visitor i. and represent the data stored in the IPFS system.

[0093] Internet of Things devices: In the smart home architecture of this invention, all Internet of Things devices only communicate with the smart home family administrator. Through the smart home family administrator, it is convenient to interact with visitors for data exchange. In addition, the computing and storage capabilities of the IoT smart devices discussed in this invention are limited, so blockchain needs to be used to store transaction hash data.

[0094] Hash-SHchain: In this invention, Hash-SHchain is a consortium blockchain composed of all families and companies. All members must abide by the rules agreed upon by the consortium. Consensus nodes near the smart home jointly maintain the consortium blockchain. Hash-SHchain is specifically designed to store data hash values, which are used and represent. The two hash values stored in Hash-SHchain are used as indexes to map to the corresponding data in IPFS.

[0095] Visitors: In this invention, multiple visitors provide services, denoted by V j The main task of the visitor is to provide services for the smart home, including collecting home data, tracking, analyzing, and sending service data A i to the family administrator during this period. During this period, the family administrator will rate the visitor's V j service. Once the visitor's rating is below the threshold set by the family administrator, the family administrator has the right to replace the visitor V j In addition, the visitor V jData can also be queried from Hash-SHchain, and access permission can be viewed through smart contract.

[0096] User: In smart home, user types are divided into the following two roles:

[0097] Ordinary user: Ordinary user refers to some people who generate data in smart home using Internet of Things devices. Each family can have one or more users.

[0098] Home administrator: In the context of smart home, we think that the smart gateway is the home administrator. The home administrator encrypts the communication data and generates hash data uploaded to IPFS and blockchain, thereby ensuring the privacy of smart home data. In addition, the home administrator generates a unique identity for each HSD and a unique identity for each visitor V j Service data A generated i is scored. If there is bad behavior or an error message, the permission can be revoked.

[0099] As shown in Figure 2 , the key roles are home administrator and visitor. According to their main functions, the process includes data uploading and data access, and detailed elaboration is made.

[0100] As another embodiment of the present application, the present application also provides a smart home access control method based on blockchain technology using the above-mentioned system, and the specific step flow is as follows:

[0101] 1) Data uploading

[0102] Initialization process: Before the Internet of Things devices are integrated into the smart home, the home administrator, the visitor and all devices must go through the initialization process. This process generates a symmetric key k a used by the home administrator for device data encryption. In addition, each visitor generates a communication key k j with the home administrator, and each HSD generates an independent and unique identity

[0103] Data uploading process: After the Internet of Things devices generate data, the home administrator calculates and and uploads them to IPFS. In order to realize efficient search, our system stores on Hash-SHchain through consensus nodes, which accelerates the speed of retrieving the corresponding ciphertext.

[0104] Access control: When the visitor and the home administrator first contact, the home administrator uses two methods to verify the access permission of the visitor. The details are as follows:

[0105] Verification method: When the family administrator receives a message from visitor V j Connection request Req i At that time, the family administrator queries visitor V from the Hash-SHchain. j The reputation value. If the home administrator's requirements are not met, the connection will be refused. Otherwise, the home administrator will continue to check the local ACL table, as shown in Table 2. If the visitor exists in the ACL... Visitors will be able to access the data. Otherwise, the connection request will be rejected. ACLs include the specific smart device's time (access time), OP (read / write), Switch (0 for open, 1 for closed), and FunAdjust (0 for standard startup, 1 for upgrade functionality).

[0106] Table 2 ACL Table

[0107]

[0108] Symmetric key transmission: Home administrator verifies visitor V j After granting access, the visitor will send an encrypted symmetric key to the home administrator:

[0109]

[0110] therefore, It was the home administrator who used sk a Encryption k j ciphertext Extracting the symmetric key k j In V j After being authorized, the home administrator uses the symmetric key k j To encrypt and generate the corresponding hash

[0111] Optimize the symmetric key structure: In fact, using a symmetric key k a Encrypting data increases space overhead. To reduce this overhead, an optimized symmetric key structure is proposed. We assume there are n potential visitors providing services to the smart home. Visitors and smart devices are represented by {V}. j |1≤j≤n},{D i |1≤i≤m} means that each visitor has a symmetric key k. j For each device, the home administrator generates a random key. and combine it with the symmetric key set {k j Aggregates |1≤j≤n} to create an encryption key K i As shown below:

[0112]

[0113] After that, the home administrator sends the encryption key set to each visitor V j As follows:

[0114]

[0115] After they start decryption, the data encryption key K is calculated using the following formula: i .

[0116]

[0117] This method can prevent collusion attacks between other visitors, effectively ensuring the security of data.

[0118] Data access

[0119] After the above steps, the home administrator will reply to the access request Req i of the visitor with a message M i :

[0120]

[0121] Where,

[0122]

[0123] In the formula, Time refers to the length of the access, σ ac is the digital signature of the home administrator on the reply message.

[0124] When the visitor receives the reply message M i from the home administrator, the visitor will check whether their rights right are empty. If the content of right is not empty, the visitor has the right to access the data of the smart home.

[0125] The visitor V j starts searching for the relevant index on Hash-SHchain and finds the corresponding data in IPFS, decrypts, analyzes and processes it, and then sends it out through the following formula:

[0126]

[0127] After receiving the service data identifier , the home administrator retrieves the service data A iThe data is collected and users are rated based on the services provided. If the home administrator is satisfied with the service, the visitor receives a positive rating, and vice versa. Finally, the home administrator uploads the ratings to the consensus network for node selection.

[0128] The specific implementation of the smart home access control scheme based on blockchain technology proposed in this invention includes the following: the internal structure of the block; the specific implementation method of access control; and finally, the calculation of the visitor's reputation based on the visitor's service performance.

[0129] Internal structure of the block

[0130] The block header contains: (Index, preHash, MerkleRoot, time, nonce). For example... Figure 3 As shown, the block contains six specific transactions, divided into... and Two types. The transaction details are as follows:

[0131]

[0132] in,

[0133]

[0134] In the formula, A digital signature representing the home administrator of the transaction.

[0135]

[0136] in,

[0137]

[0138] use (A i (digital envelopes) and (V j (Digital envelope) for A i Implement dual privacy measures. It is the visitor's digital signature.

[0139] Smart Contracts

[0140] According to the security requirements of smart home systems, the solution of this invention should include an access control method and a revocation mechanism. j Access permissions are configured to prevent data leaks. The permission structure for smart devices in IoT is shown in Algorithm 1.

[0141] Algorithm 1

[0142]

[0143]

[0144] In addition, the access rights of the visitor can be dynamically added or revoked using Algorithm 2 according to the needs of the family administrator. The family administrator first needs to set the V j 's initialization by calling the initAccList function. The V j with the address can view the OP state readable r (read), Time represents the time range of access, Switch represents the on state of the device d, and FunAdjust represents the function transformation mode of the device d. When the family administrator successfully sets the access rights of the V j , the V j can call the getAccess function to obtain the right information. The family administrator can also call the addAList and deleteAList functions respectively to dynamically add and revoke the V j access control rights.

[0145] Algorithm 2

[0146]

[0147]

[0148] Reputation calculation

[0149] The reputation calculation of the present application has two steps, namely reputation calculation and consensus mechanism. As shown in Figure 4 , the flow of block generation is shown.

[0150] Reputation calculation: If the service of the V j meets the needs of the family administrator, the family administrator will give a positive score. Otherwise, a negative score. First, the family administrator aggregates the service data A i of the V j into a set {D1, D2,..., D q ,...}. The instability of network frequency is one of the reasons for the occurrence of abnormal data. Therefore, the credibility of a certain A i can be defined as:

[0151]

[0152] where α and β are two preset parameters, respectively controlling the minimum lower limit and the change rate of the service data A i credibility. Through the above formula, the family administrator can obtain the credible set R i of the A q data = {r1, r2,..., r q}.

[0153] The Bayesian formula is used to calculate the aggregated credibility of the visitor V j .

[0154]

[0155] P(V) is the prior probability of the visitor, is the complementary content of the visitor, P(r j / V) = r j , P(V / R) belongs to [0, 1], as long as P(V / R) exceeds the preset threshold, the family administrator will generate a positive score for the visitor. Otherwise, a negative score is generated. The higher the score represents the reputation of the visitor.

[0156] In the process of collecting scores, the consensus nodes may have conflicting scores for the same visitor, for example, positive scores account for the majority and negative scores account for the minority. The score is calculated by using a weighted aggregation to calculate the offset. The offset of the score is positively correlated with the positive score of the response data. The content of the offset of the score is calculated as follows:

[0157]

[0158] is the score offset of the visitor V according to the family administrator A, belongs to [0, 1], a and b are the number of positive scores and negative scores, and G(.) is used to control the sensitivity of negative scores. If the malicious node cannot control the majority of the family administrator, the score of the visitor by the family administrator will be more fair and reliable. The weighted aggregation method is used to make the score offset more reliable. Finally, the consensus node tries to add the score offset to the Hash-SHchain.

[0159] Consensus mechanism

[0160] In the PoW consensus mechanism, the selection of participating nodes is completed by constantly changing the random number. Only when the calculation result is lower than the predetermined threshold, the node will be selected as the participating node. It should be noted that the node with stronger calculation ability is more likely to be selected as the participating node. On the basis of PoW, the invention adopts a consensus mechanism combining PoW and PoS. The invention uses the sum of the absolute value of the offset as the PoS rights, and the threshold in PoW is determined by the PoS rights. The greater the rights, the lower the difficulty of PoW, and the easier the node is to calculate nonce, and finally be selected as the participating node. The participating node is selected according to the following method:

[0161]

[0162] In the formula, is node i 's threshold. Only the node satisfying the first formula can be selected as a participating node. and present a positive correlation. is the offset set of the current node i . In order to prevent the node i with large offset from being continuously selected as a participating node, F max is the upper limit of . consists of a series of binary, determines the speed of block generation. N y is the number of consecutive 0s in the front end, N x is the total number of bits of the hash value. The difficulty of PoW is determined by the rights of PoS, which can prevent the node from being continuously selected as a participating node.

[0163] After the participating node is selected, all consensus nodes verify nonce, at which time the node may receive at least two blocks. When the blockchain begins to fork, the consensus node will select one of the forks to calculate the block and add it to the Hash-SHchain. The longest fork chain of the blockchain will become the main chain, and the blocks on the other forks will be discarded and returned to the transaction pool of the respective node, and will be re-joined in the Hash-SHchain later. All consensus nodes jointly maintain the same blockchain, ensuring data consistency.

[0164] Embodiment 2

[0165] As one of the embodiments of the present application, in order to verify the effect of the blockchain-based smart home access control system and method of the present application, scientific demonstration is carried out through economic benefit calculation and simulation / contrast experiment. Referring to Table 3:

[0166] Table 3 Time cost of each algorithm

[0167] Function Minimum time Maximum time Average time Deployment 16.302 20.10 18.184 initAccList 8.741 12.483 11.572 getAccess 0.947 2.548 1.827 addAList 10.717 14.532 12.167 deleteAList 9.314 18.164 13.231

[0168] In this embodiment, a simple smart contract is deployed to allow authorized access by visitors; algorithm 1 and algorithm 2 are implemented on Remix using the Solidity language; the functions of initAccList, getAccess, addAList and deleteAList in the smart contract are tested using Web3j; and 1000 times of javascript and shell scripts are run to obtain the approximate time cost of each algorithm.

[0169] As shown in Table 3, getAccess is a view-type function. It does not consume any gas value and only prolongs the transmission time. These results show that the time cost can be reduced to milliseconds if the generation time of the blockchain is reduced. When the maximum time is reached, it indicates that the deployment process takes longer than usual. This can cause the deployment to fail or extend the deployment time. The occurrence of the minimum and maximum times depends on various factors, including network status and processing power. However, these issues can be addressed by adjusting parameters and optimizing the program.

[0170] The length of each parameter of the block header is set, as shown in Table 4. Using the above design in our scheme, we choose the SHA-256 algorithm to calculate the hash, use the 128-bit AES symmetric encryption algorithm, and combine the 1024-bit RSA digital signature. Based on such a design, the length of the important parameters in the block is presented in Table 4.

[0171] Table 4 Length of each parameter in each block

[0172]

[0173] And The size of each block occupies 224 and 388 bytes, respectively. After considering the merkle tree structure, we can get that 1M bytes of blocks can be composed of 2849 or 331 blocks. If one block is generated per minute, the throughput can reach 47 or 5 per second.

[0174] The method of the present invention improves the efficiency of the entire system by introducing an efficient blockchain protocol and algorithm optimization. The method of the present invention optimizes the access control process, reduces user waiting time, and improves system response speed. The score improvement in system stability of the method of the present invention can be attributed to a stronger network architecture and fault recovery mechanism. The improvement in user satisfaction reflects a more convenient user interface and faster service response. The method of the present invention significantly improves the security of the system, including enhanced data encryption and improved user verification process.

[0175] The above detailed description of the preferred embodiments of the present invention. It should be understood that those skilled in the art can make many modifications and changes without creative labor based on the concept of the present invention. Therefore, any technical solution that can be obtained by logical analysis, reasoning or limited experiment based on the existing technology according to the concept of the present invention shall be within the protection scope determined by the claims.

Claims

1. A blockchain technology-based smart home access control system, characterized by, The system comprises: IPFS: for storing ciphertext hash pairs of data, and the hash value is used as an index of the corresponding ciphertext; Hash-SHchain: a consortium blockchain composed of all families and companies, which is jointly maintained by consensus nodes through consensus nodes, and is used to store data hash values, and the stored hash values are used as indexes to map to the corresponding data in the IPFS; Internet of Things device: communicates with the smart home family administrator and interacts with the visitor through the smart home family administrator; Visitor: provides services for the smart home, can query data from the Hash-SHchain, and view access permissions through a smart contract; User: user types include: Ordinary user: a user who generates data using an Internet of Things device in a smart home; Family administrator: encrypts communication data and generates hash data for uploading to the IPFS and Hash-SHchain; When the visitor and the family administrator first meet, the family administrator verifies the access permissions of the visitor: When the home administrator receives a visitor Connection request At that time, the family administrator queries the visitor from the Hash-SHchain. reputation; If the visitor does not have a reputation that satisfies the requirements of the home administrator, the connection is refused; Otherwise, the home administrator will continue to check the local ACL table, if there is the visitor in the ACL table , the visitor will be able to access the data; otherwise, the connection request is rejected; The reputation calculation is as follows: The home administrator will access the service data of the visitor Aggregated into a set, the credibility of a certain piece of service data is defined as: In the formula, and are two preset parameters respectively controlling the minimum lower limit and the change rate of the credibility of the service data of the service data Home administrator acquires service data of the trusted set and computes the aggregate trust of the visitor using the Bayes theorem formula: wherein, is the prior probability of the visitor, is the complementary content of the visitor, , , belongs to [0, 1]; When When the pre-set threshold is exceeded, the home administrator generates a positive score for the visitor; otherwise, a negative score is generated. 2.The smart home access control system based on blockchain technology of claim 1, wherein, The data stored in the IPFS includes: In the formula, and Data stored in IPFS, each category is a ciphertext hash pair, and the hash value is regarded as the index of the corresponding ciphertext; Data generated by the Internet of Things device, Service data provided by the visitor; and Data generated by the Internet of Things device and service data hash value provided by the visitor, respectively; , Data ciphertext generated by the device during operation and visitor analysis data ciphertext, respectively; Indicates that the key k Symmetric encryption algorithm. 3.The smart home access control system based on blockchain technology of claim 1, wherein, The internal structure of the block in the Hash-SHchain is as follows: The block header includes Index, preHash, merkleRoot, time, nonce, and the block body includes six specific transactions, which are divided into and two types, and the transaction content is as follows: wherein, wherein, a digital signature of a family manager representing the transaction, a transaction i identifier, identity information of the manager, identity information of the visitor, a timestamp at i time, a data hash value generated by the Internet of Things device, a rating identifier of the visitor ; wherein, In the formula, represents the service data hash value provided by the visitor, represents the digital signature of the visitor, represents the public key pk The asymmetric encryption algorithm for encryption; adopt the digital envelope of service data and the digital envelope of the visitor and the digital envelope of the visitor Double privacy processing is performed on the service data and the digital envelope of the visitor . 4.The smart home access control system based on blockchain technology of claim 1, wherein, The family administrator scores the service information generated by the visitor, and if there is bad behavior or an error message, the access permissions of the visitor can be revoked; and the family administrator can dynamically add or revoke the access permissions of the visitor, as follows: The home administrator sets the visitors by calling the initAccList function Initialization includes: visitors with addresses Using the device d The readable of OP status; the time range of access; the open state of the device d and the functional transformation mode of the device d ; When the home administrator successfully sets the access rights of the visitor , the getAccess function is called to obtain the right information; The home administrator dynamically adds and revokes access control rights of the visitor by calling the addAList and deleteAList functions, respectively. The home administrator dynamically adds and revokes access control rights of the visitor by calling the addAList and deleteAList functions, respectively. 5.A smart home access control method based on a blockchain technology, characterized in that, The method uses the smart home access control system based on blockchain technology according to any one of claims 1-4, and the specific access steps are as follows: Home administrator, visitors and IoT devices are initialized, yielding symmetric keys , device IoT data is encrypted by the home administrator; each visitor generates a communication key with the home administrator , each home smart device (HSD) generates an independent and unique identity ; The IoT device generates data, and the home administrator computes the data ciphertext and the hash value of the data generated by the IoT device and uploads them to the IPFS; Hashing data generated by IoT devices through consensus nodes stored on the Hash-SHchain; Home administrator according to access request of visitor Reply message : When the visitor receives the reply message from the family administrator The visitor checks whether the permission is empty, and if the content of the permission is not empty, the visitor has the right to access the data of the smart home. Visitor Start searching for the relevant index on the Hash-SHchain and find the corresponding data in the IPFS, decrypt, analyze and process it, and then send it out: The home administrator receives the service data identifier The service data is then retrieved from the IPFS and rates the visitor according to the service provided; If the family administrator is satisfied with the service of the visitor, the visitor will receive a positive evaluation, and vice versa; The family administrator uploads the score to the consensus node network. 6.The smart home access control method based on blockchain technology of claim 5, wherein, The method uses an optimized symmetric key structure, as follows: Each visitor possesses a symmetric key For each device, the home administrator generates a random key and aggregates it with the symmetric key set to create an encryption key : The home administrator sends the set of encryption keys to each visitor : After the set of encryption keys begins decryption, the following formula is used to calculate : In the formula: represents an asymmetric encryption algorithm using a public key pk, represents a guest encryption key, represents a data encryption key integrated with the calculation. 7.The smart home access control method based on blockchain technology of claim 5, wherein, When the visitor and the family administrator first meet, the family administrator verifies the access permissions of the visitor: When the home administrator receives a visitor Connection request At that time, the family administrator queries the visitor from the Hash-SHchain. reputation; If the requirements of the family administrator are not met, the connection will be refused; Otherwise, the home administrator will continue to check the local ACL table, and if the visitor is found in the ACL table... If the request is granted, the visitor will be able to access the data; otherwise, the connection request will be rejected. 8.The smart home access control method based on blockchain technology of claim 7, wherein, The reputation calculation is as follows: If the visitor s service meets the needs of the home administrator, the home administrator will give a positive score, otherwise, a negative score; The home administrator will access the service data of the visitor Aggregated into a set, the credibility of a certain piece of service data is defined as: In the formula, and are two preset parameters respectively controlling the minimum lower limit and the change rate of the credibility of the service data . Home administrator gets service data of trusted set Using the Bayes' theorem formula to calculate the aggregated credibility of visitors : wherein, is the prior probability of the visitor, is the complementary content of the visitor, , , belongs to [0, 1]; When When the pre-set threshold is exceeded, the home administrator generates a positive score for the visitor; otherwise, a negative score is generated. 9.The smart home access control method based on blockchain technology of claim 8, wherein, The consensus node calculates the offset of the collected family administrator scores using weighted aggregation: wherein is according to the home administrator A to the visitor V a score offset, belongs to [0, 1], a and b is the number of positive and negative scores, sensitivity for controlling negative scores; The consensus node adds the offset of the score to the Hash-SHchain. 10.The smart home access control method based on blockchain technology of claim 9, wherein, The consensus node uses a consensus mechanism combining PoW and PoS: The sum of the absolute values of the offset is used as the PoS rights, and the threshold in PoW is determined by the PoS rights, and the selection of the participating nodes is performed by constantly changing the random number, and only when the calculation result is lower than the predetermined threshold, the node will be selected as the participating node: In the formula, is a threshold value; and present a positive correlation; is the current offset set; is an upper limit; consists of a series of binaries, which determines the speed of the generated block; is the number of consecutive 0s in the front end, is the total number of bits of the hash value; After the participating node is selected, all consensus nodes verify the nonce; when the blockchain starts to fork, the consensus node selects one of the forks for block calculation and adds it to the Hash-SHchain; the longest fork chain of the blockchain will become the main chain, and the blocks on the other forks will be discarded and returned to the transaction pool of the respective nodes, and will be re-added to the Hash-SHchain in the later stage, and all consensus nodes jointly maintain the same blockchain.

Citation Information

Patent Citations

  • Smart contract based access control method and system for Internet of Things

    CN109617896A

  • Intelligent building management method and system, storage medium and electronic equipment

    CN113139884A