This application relates to the field of
blockchain security technology and discloses a method and
system for analyzing user behavior in
smart contract interactions based on network dynamics. The method first parses the
smart contract program, constructing a heterogeneous graph containing multiple contracts. Next, the edge weights of the heterogeneous graph are dynamically reconstructed to distinguish key interaction paths from internal computational
noise. Then, based on the reconstructed edge weights, cross-node
message passing and
feature aggregation are performed on the graph to generate updated node features. Finally, based on the updated node features, local node importance analysis and global graph
structure analysis are performed and fused to determine whether the
smart contract interaction behavior constitutes a malicious
attack pattern. This invention effectively solves the problems of semantic silos,
noise interference, and information
dilution in cross-contract scenarios through dynamic weight reconstruction and dual-
channel analysis, significantly improving the detection accuracy and robustness against complex cross-contract attacks.