Privacy Protection and Performance Enhancement in IoT Applications using Blockchain and Machine Learning Techniques