| With the development of Internet of Things technology,smart homes have entered a new era of interconnected and common devices,and the demand of smart homes data sharing has increased along with it.Due to the scattered network topology and limited resources of smart home devices,the process of data transmission and sharing of smart home devices faces huge challenges.On the one hand,most of the smart home data-sharing platforms are centralized,which are vulnerable to malicious attacks and have security issues such as a single point of failure.On the other hand,traditional policies of data access control in smart homes are decided by third-party service providers,making it difficult for data owners to formulate according to their wishes.The risk of leakage of user privacy data increases.Therefore,how to achieve secure and reliable distributed data sharing while effectively protecting user privacy has become a major challenge for smart homes.To solve the problem of data sharing in smart homes,in this dissertation,a data-sharing model based on sharding blockchain and smart contracts is designed from two perspectives: the construction of a data-sharing platform and the privacy protection of data in the sharing process,This model provides a new solution for secure and efficient data sharing in smart homes.The main research contents of this dissertation are as follows:(1)A method of building a secure data-sharing platform based on a sharding blockchain is designed for problems such as centralized and the single point of failure in smart homes data-sharing platforms.Specifically,a reputation-based sharding blockchain system is proposed as a platform for the secure and efficient sharing of smart home data.Firstly,a reputation-based random sharding scheme is designed in this dissertation,with unpredictable sharding results and effective protection against malicious attacks.Secondly,a Proof-of-Work consensus mechanism is improved.The difficulty of consensus is related to the reputation value of the node,reducing the computing consumption of high-reputation nodes to adapt to resource-constrained smart home devices.In addition,an incentive mechanism that considers both the reward and punishment is designed to constrain the behavior of nodes to ensure the security and efficiency of the sharding blockchain.The reward distribution formula is designed to encourage nodes to make positive contributions to obtain more rewards.Security analysis shows that the proposed data-sharing platform based on the sharding blockchain can effectively resist common malicious attacks.The experimental results show that the solution has efficient data processing and sharing capabilities,provides higher security while consuming fewer resources,and meets the demand of secure and efficient sharing of smart homes data.(2)To address the problems of coarse-grained access control and high storage pressure of shared data in smart homes,a smart contract-based access control strategy for shared data is designed in this dissertation.Firstly,the shared data is encrypted by using ciphertext policy attribute-based encryption(CP-ABE)and RSA hybrid encryption algorithms to guarantee the data owner’s control over the data.Secondly,a smart contract is designed and built to complete the automatic verification of access rights,which enables the whole process of access to be recorded and traceable.At the same time,the data storage method that combines on-chain and off-chain is adopted to relieve the storage burden of the blockchain.Specifically,the Inter Planetary File System(IPFS)is introduced to store the ciphertext information of home data,and only the index of IPFS is uploaded to the blockchain.Security analysis verifies the effectiveness of the proposed access control strategy.Experimental results show that the scheme achieves fine-grained access control of shared data,protects the privacy of home data,and provides distributed and traceable secure storage of data.Moreover,smart contracts achieve high security with less Gas consumption. |