The security and privacy of electronic healthcare records (EHRs) remain a critical issue for both healthcare services consumers and providers. Breaching a healthcare system causes the disclosure of sensitive health data. This data is usually saved into centralized databases, which creates vulnerabilities and gives rise to cyber attacks. This research focuses on enhancing the security and privacy of EHRs by using blockchain technology. This paper proposes a new architecture that takes advantage of decentralized databases to avoid centralized storage issues. The decentralized used database for storing patient electronic health records is the OrbitDB with Interplanetary File System (IPFS). Besides, we have deployed a blockchain network built on Hyperledger fabric by using Hyperledger composer to save hashes of stored data and control access when retrieving it. The proposed Blockchain-based architecture is designed to contribute to the healthcare management systems’ robustness and to avoid recorded security limitations in commonly used systems for smart healthcare. Performance evaluation results issued from Hyperledger Caliper and comparative analysis have proved the robustness and superiority of the proposed system in terms of security and privacy requirements, key features of blockchain-based healthcare systems, and performance metrics including various throughput and latency.