Digital twins are increasingly used in smart grids for real-time monitoring and analysis, but they introduce new cybersecurity concerns, especially regarding data integrity and false data injection attacks. In this paper, we design defenses against two feasible data-integrity attacks - false data injection and data tampering - in a smart grid digital twin to promote the use of a hybrid defense combining machine learning-based anomaly identification and blockchain. We build a high-fidelity smart grid twin by extending its accuracy through residual learning models that validate simulation output with real lab data. An unsupervised One-Class Support Vector Machine (OCSVM) is trained to detect anomalous injection or tampering attempts in real-time, while all identified anomalies are logged by a Hyperledger Fabric permissioned blockchain to maintain tamper-proof data integrity. The enhanced twin achieves virtual-equivalence to physical readings and substantially higher accuracy over basic simulations (up to 56% reduced prediction error). Under attack, OCSVM detects > 95% of malicious data points with negligible false alarms. Simultaneously, blockchain- based logging injects an immutable, consensus-verified audit trail for every identified anomaly that defeats attackers from covering their tracks. The results demonstrate that through the combination of an accurate, data-upgraded twin with simultaneous smart anomaly identification and blockchain-based auditing, the resiliency and trustworthiness of digital twin applications to power grids can be substantially enhanced.
Smart grid, Digital twin, Blockchain, Machine learning