IoT technology is rapidly growing in all fields of modern industries. Billions of IoT devices contribute to facilitating life in various contexts. A centralized system can hardly handle the extensive volume of IoT networks. Blockchain technology provides an immutable decentralized platform for communication in IoT applications. However, blockchain does not provide a solution for the confidentiality of data, which can be vital in many IoT applications. To this end, in this paper, we define the security concerns of data sharing in the IoT application. On that basis, we propose a secure data-sharing framework based on blockchain. In this framework, broadcast encryption is used to provide confidentiality of data with minimum data overhead. Moreover, with homomorphic encryption, the proposed framework enables secure data queries without leaking any information about the data. In the security analysis of the proposed framework, we have formally proved that this framework meets the security requirements. Moreover, the proposed framework is evaluated in the teleconsultation use case. The evaluation results show the proposed framework’s strength in providing a secure and robust framework for data-sharing in the context of e-health.KeywordsIoTBlockchainSecureBroadcast encryptionHomomorphic encryption