Security and Privacy Preserving Schemes in Smart Homes Using Blockchain