Trap Contract Detection in Blockchain with Improved Transformer
Abstract
Smart contracts are tailored software services that provide consistency and autonomy. The emergence of blockchain has powerfully facilitated the development of smart contracts but also brought dramatic challenges to their security and trustwor-thiness. Plenty of malicious traps are hidden in smart contracts, causing irreversible damage and obstructing the progress of this technology. Although researchers have gradually emphasized the identification of trap contracts, existing approaches suffer from a few concerns, viz., the shortage of an efficient detection model, the unbalanced categories of trap contracts, and the absence of a high-quality dataset with multi-trap contracts. In this paper, we propose an architecture called TrapFormer to intelligently detect trap contracts in the blockchain solely by leveraging the opcodes of smart contracts. We introduce a densely connected transformer that can segmentally extract opcode features and thus distinguish any potential traps. Furthermore, we implement an adaptive data augmentation method to alleviate the category imbalance of trap contracts. To demonstrate the feasibility of the proposed solution, we construct a multi-trap contract dataset from Ethereum. The experimental results reveal that the proposed solution can achieve superior performance for practical use.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.