Preprint

Stablecoin Defense Test Catches Most Simulated Attacks, With False Alarms

An arXiv preprint reports high recall and millisecond screening in simulated tests, but lower precision leaves live-chain performance untested.

A proposed defense for DeFi stablecoins detected nearly all of the simulated malicious transactions in testing, but its warnings were less precise. The detector's average recall, meaning the share of malicious examples it found, was 97.70%, while precision, the share of its alerts that matched malicious examples, was 60.66%. Overall accuracy was 96.61%. In plain terms, the test shows a trade-off: the model found most simulated attacks, but not every alert pointed to a malicious transaction.

The findings come from an arXiv preprint dated 26 August 2026. The study asks whether its defense mechanisms can mitigate representative stablecoin smart-contract attacks and whether its Bi-LSTM detector can identify malicious transactions with low inference latency. The evaluation used constructed contract scenarios and simulated transaction data, so these results do not by themselves establish performance on live blockchain traffic.

A defense built in stages

The proposed architecture spans the security lifecycle. It calls for screening before deployment, interception during execution and post-incident response. In practical terms, the design places security checks before contracts are deployed, monitoring while transactions are being handled and controls after an incident.

To test the contract side, the evaluation constructed three representative attack scenarios. Each vulnerable implementation was tested before and after defense integration under the same attack conditions. The reported outcomes marked reentrancy and flash-loan governance as prevented, while oracle manipulation was marked mitigated. The results should therefore be read as outcomes from constructed test cases.

How the detector was tested

The detector dataset contained 100,000 simulated transactions: 95,000 normal and 5,000 malicious. The researchers used an 80:20 split for training and testing and repeated the evaluation over 10 experimental rounds. Because the malicious class was much smaller, training used a cost-sensitive loss, which makes some mistakes more expensive than others. A malicious sample received a misclassification penalty approximately 19 times that assigned to a normal sample, and the Adam optimizer used a learning rate of 0.005.

The model used two bidirectional layers with a hidden dimension of 16. Its sigmoid output represented the risk that a transaction sequence was anomalous on a scale from 0 to 1. At the mempool stage, where pending transactions are screened, the risk-interception threshold was set at 85% to reduce false positives from legitimate high-frequency arbitrage.

Fast detection, uneven warning quality

On the detector's main scores, average accuracy was 96.61% and recall was 97.70%. Precision, however, averaged 60.66%. Precision asks how often a warning is correct, so the numbers mean the model found most malicious examples in the simulated test while a substantial share of its alerts were false positives. The authors linked the lower precision to the imbalance in the data and to legitimate high-frequency DeFi behavior that can resemble an attack.

The reported inference time was also short within the test setup. Processing a single transaction feature sequence took between 1.5 and 2.8 milliseconds. That figure excludes network-transmission overhead, so it measures model processing rather than the full end-to-end time needed to receive a transaction, make a decision and act on it.

What the results leave unanswered

The paper's limitations narrow the reach of the findings. The detector was evaluated on simulated transaction data, and the contract experiments relied on constructed vulnerable and defended implementations. The displayed performance report listed F1-score as an evaluation metric, but its result columns showed accuracy, recall and precision only, with no F1 value.

Taken together, the reported evidence is confined to the proposed design's selected contract scenarios and simulated detector dataset. Two attack categories were marked prevented and one was marked mitigated, while the detector combined high recall with lower precision. The results support further testing, but they do not yet establish how the system would perform on live blockchain traffic.

Paper data and sources

Original title: Defending the Peg: Real-Time Dynamic Protection and Anomaly Detection in DeFi Stablecoins
Authors: Hengxing Zeng, Shipeng Ye, Xiaoqi Li
Journal/Repository: arXiv
Status: Preprint, not yet peer-reviewed
First online: 2026-08-26
DOI: Not available
Original paper · Full text

Versions and corrections

  1. Published automatically after legal-source, freshness, evidence, and independent-verification gates passed.