Smart contracts are pivotal for implementing various functions due to their interactivity with external data. However, this interactivity also presents challenges in terms of security and reliability. There is a lack of statistical and quantitative research on the interaction between smart contracts and external data. To fill this gap, we thoroughly examine 10,500 actual smart contracts to select 9,356 valid samples, excluding those that are outdated or have compilation errors. Utilizing code parsing techniques, the study transformed contract code into Abstract Syntax Trees (ASTs) and extracted keywords related to external data dependency through code analysis. By comparing the ASTs with the keyword list, we conduct a quantitative analysis of the number and proportion of contracts involving external data interaction. Furthermore, we collect over 3,600 security audit reports and manually filter 249 (approximately 9%) reports related to external data interaction, categorizing the external data dependency in these contracts. We also explore the relationship between the complexity of smart contracts and their dependence on external data.
翻译:智能合约因其与外部数据的交互能力,在实现多样化功能方面发挥着关键作用。然而,这种交互性也带来了安全性与可靠性方面的挑战。目前,关于智能合约与外部数据交互的统计与量化研究尚显不足。为填补这一空白,本研究深入考察了10,500份实际智能合约,筛选出9,356份有效样本,排除了过时或存在编译错误的合约。通过运用代码解析技术,研究将合约代码转化为抽象语法树(AST),并借助代码分析提取了与外部数据依赖相关的关键词。通过将AST与关键词列表进行比对,我们对涉及外部数据交互的合约数量及比例进行了量化分析。此外,我们收集了超过3,600份安全审计报告,并人工筛选出其中249份(约占总数的9%)与外部数据交互相关的报告,对这些合约中的外部数据依赖类型进行了分类。研究还进一步探讨了智能合约的复杂程度与其对外部数据依赖性之间的关系。