Digital healthcare systems play a pivotal role in providing efficient and accessible healthcare services. However, ensuring secure authentication and key agreement mechanisms is essential to protect sensitive patient data and maintain the integrity of the system. The existing methods face limitations in terms of vulnerability to cyber attacks, scalability, and resource utilization. Furthermore, the integration of blockchain technology introduces new complexities that need to be addressed. This research proposes an optimized fuzzy logic approach combined with blockchain technology to address the authentication and key agreement challenges in digital healthcare systems. The proposed solution leverages the flexibility and adaptability of fuzzy logic algorithms to handle uncertainty and imprecision in authentication decisions. By employing fuzzy logic, the system can effectively minimize false positives and false negatives, enhancing the robustness against adversarial attacks. Moreover, the integration of blockchain technology provides a decentralized and tamper-proof infrastructure for securely storing and managing authentication and key agreement data. This ensures transparency and trust in the system, mitigating the risks of unauthorized access and data manipulation. The blockchain-based architecture also enables efficient resource utilization and scalability, allowing the system to handle authentication requests in a timely manner, even in large-scale digital healthcare environments.The proposed method is evaluated by using the NIST Special Database 302 and it shows superior performance compared to existing methods, with minimum False Rejection Rate (FRR), False Acceptance Rate (FAR), and response time. Moreover, the proposed method minimizes communication overhead during the authentication process and resists different cyber attacks including a Replay attack, Man-in-the-middle attack, Denial of Service (DoS) attack, and Impersonation attack. The proposed method achieves excellent performance in terms of security, efficiency, and resistance to various cyber-attacks, making it a promising approach for secure data sharing in P2P cloud environments.