Today, the confidentiality and security of patient medical records is of great importance. A database where patient records are kept should not fall into the hands of malicious persons. In addition to keeping medical records confidential and secure, their sharing among various entities such as individuals or institutions must be auditable and controllable. This study proposes a method that enables the storage, access, and sharing of medical data without risking security vulnerability. In the proposed method, data are stored on the cloud, whereas data access information and hash values are stored on a blockchain. The three consensus mechanisms (Proof ofWork (PoW), Proof of Stake (PoS), and Proof of Authority (PoA).) for the proposed scheme are implemented and compared with studies in the literature in terms of security analysis.The performance analysis of the proposed method showed that the Proof of Work gives the best result in terms of block size, while the Proof of Stake gives the best results in terms of block creation time and memory usage. The security analysis showed that the proposed method has many security features and is strong against attacks.