Skip to content

Blockchain Turns to AI Solution for Improving Smart Contract Security

'Lightning Cat' is a new solution to identify vulnerabilities in smart contracts using deep learning models. Can AI strengthen one of blockchain's weaknesses?

Lightning cat smart contract AI checke

As a technology touting "security" as one of its intrinsic characteristics, it might be hard to grasp how blockchain-based protocols lost $3.8 billion to security attacks in 2022 alone.

By design, distributed ledger technologies (DLT) provide features for user protection such as the immutability of the code and the transparency of operations. However, the same features can work against it if potential attack vectors are not properly considered by the developers.

Detecting vulnerabilities in the code becomes crucial to prevent security breaches that might cause financial losses or system breakdowns. Yet, doing so comes with a cost that not all are ready to bear. David Schwed, COO of DeFi code auditing firm Halbron, suggests that “a big protocol should have 10 to 15 people on the security team, each with a specific area of expertise," but with apps looking to maximize profit and customers looking to maximize yield, investment in security is the root cause of many hacks happening in the still poorly-regulated crypto market.

Even when decentralized apps do take all the necessary precautions, attacks can still happen. Existing security tools can only detect forms of exploit that have occurred before, but with new hacking techniques appearing every day, their databases quickly become incomplete.

However, deep learning models don't require predefined detection rules and can analyse results during the training process, making them way more efficient in detecting vulnerabilities in smart contracts.

Titled "Deep learning-based solution for smart contract vulnerabilities detection," the study introducing 'Lightning Cat' has optimized three deep learning models, CodeBERT, LSTM, and CNN, to create an "effective data preprocessing method that captures the semantic features of smart contract vulnerabilities."

The optimization of the deep learning model CodeBERT proved to be the most successful, having achieved a recall rate in detecting potential code flaws of 93.55%. This is 11.85% higher than Slither, a top Solidity and Vyper audit tool, and any other AI and non-AI mechanisms studied.

The intersection of distributed ledger technologies (DLT) with artificial intelligence is perceived as something like a medieval royal wedding. Blockchain improves AI issues of security, technical complexity, and privacy, while AI helps blockchain deal with scalability, efficiency, and security issues.

If it proves as successful as during the testing phase, 'Lightning Cat' will be a first-generation prince in this upcoming tech kingdom.