[论文解读] Smart-Corpus: an Organized Repository of Ethereum Smart Contracts Source Code and Metrics
Smart-Corpus 是一个经过筛选、持续更新的以太坊智能合约仓库,聚合了 Solidity 源代码、ABI、字节码,以及内在和外在的软件度量指标。它通过 GraphQL 接口使研究人员能够高效地查询和分析智能合约,通过提供经验证、EtherScan 核查的合约的预计算度量指标,显著减少了静态分析的时间和工作量,目前已索引超过 30,000 个合约,且每天新增约 100 个。
Many empirical software engineering studies show that there is a great need for repositories where source code is acquired, filtered and classified. During the last few years, Ethereum block explorer services have emerged as a popular project to explore and search Ethereum blockchain data such as transactions, addresses, tokens, smart-contracts' source code, prices and other activities taking place on the Ethereum blockchain. Despite the availability of this kind of services, retrieving specific information useful to empirical software engineering studies, such as the study of smart-contracts' software metrics might require many sub-tasks, such as searching specific transactions in a block, parsing files in HTML format and filtering the smart-contracts to remove duplicated code or unused smart-contracts. In this paper we afford this problem creating Smart Corpus', a Corpus of Smart Contracts in an organized reasoned and up to date repository where Solidity source code and other metadata about Ethereum smart contracts can easily and systematically be retrieved. We present the Smart Corpus' design and its initial implementation and we show how the data-set of smart contracts' source code in a variety of programming languages can be queried and processed, get useful information on smart contracts and their software metrics. The Smart Corpus aims to create a smart-contracts' repository where smart contracts data (source code, ABI and byte-code) are freely and immediately available and also classified based on the main software metrics identified in the scientific literature. Smart-contracts source code has been validated by EtherScan and each contract comes with its own associated software metrics as computed by the freely available software PASO. Moreover, Smart Corpus can be easily extended, as the number of new smart-contracts increases day by day.
研究动机与目标
- 解决以太坊智能合约源代码及其相关软件度量缺乏组织化、可访问且结构化仓库的问题。
- 通过提供预验证和预处理的数据,降低区块链研究人员进行静态分析的时间和计算成本。
- 通过提供标准化、持续更新的语料库,支持可复现的智能合约实证软件工程研究。
- 通过图形化界面和 GraphQL 接口,支持高效查询智能合约数据,以满足特定研究需求。
- 对智能合约数据进行分类和增强,包括内在度量(如函数数量、事件数量)和外在度量(如交易次数、余额)
提出的方法
- Smart-Corpus 系统从以太坊区块浏览器获取智能合约数据,主要依赖 EtherScan 进行源代码验证和元数据提取。
- 它提取并存储每个合约的 Solidity 源代码、ABI、字节码及关联元数据,集中化地组织于一个结构化仓库中。
- 使用开源工具 PASO 计算内在度量(如函数数量、事件数量、修饰符数量、可支付函数数量)并存储于每个合约中。
- 外在度量(如交易次数、以太币余额)则从区块链交易数据和合约交互日志中推导得出。
- 系统实现了 GraphQL API,使研究人员能够使用结构化查询检索特定数据子集,实现高效且精准的数据获取。
- 语料库持续更新,每天新增约 100 个合约,确保对以太坊智能合约生态的持续相关性和全面覆盖。
实验结果
研究问题
- RQ1研究人员如何在不手动处理原始区块链数据的情况下,高效地检索和分析以太坊智能合约的源代码及其相关软件度量?
- RQ2从大规模、经验证的语料库中推导出的真实世界智能合约中,最常见的结构模式(如函数数量、修饰符数量)是什么?
- RQ3预计算、经筛选的语料库在多大程度上能减少智能合约研究中静态分析的时间和计算成本?
- RQ4外在属性(如交易量、代币余额)与已部署智能合约的内在代码复杂性之间存在何种相关性?
- RQ5标准化、开放且持续更新的语料库能否支持区块链软件工程中的可复现研究?
主要发现
- Smart-Corpus 语料库目前托管约 30,000 个以太坊智能合约,其源代码、ABI、字节码及关联度量均已存储并经过验证。
- 语料库每日更新,平均每天新增约 100 个合约,确保对以太坊智能合约生态的实时覆盖。
- 内在度量(如函数数量、事件数量、可支付函数存在性)使用 PASO 工具计算,并为每个合约存储。
- 外在度量(如总交易次数、以太币余额)从区块链交易数据中提取,并与每个合约的地址关联。
- GraphQL 接口使研究人员能够检索精确的数据子集(如函数数量超过 20 个的合约),而无需手动过滤或解析原始数据。
- 该系统通过消除研究人员自行下载、验证和计算原始区块链数据度量的需求,实现了高效且可复现的研究。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。