当前位置: X-MOL 学术arXiv.cs.SE › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
SolcTrans: Towards machine translation of Solidity smart contract source code
arXiv - CS - Software Engineering Pub Date : 2021-06-11 , DOI: arxiv-2106.06458
Chaochen Shi, Yong Xiang, Jiangshan Yu, Keshav Sood, Longxiang Gao

Context: Decentralized applications on blockchain platforms are realized through smart contracts. However, participants who lack programming knowledge often have difficulties reading the smart contract source codes, which leads to potential security risks and barriers to participation. Objective: Our objective is to translate the smart contract source codes into natural language descriptions to help people better understand, operate, and learn smart contracts. Method: This paper proposes an automated translation tool for Solidity smart contracts, termed SolcTrans, based on an abstract syntax tree and formal grammar. We have investigated 3,000 smart contracts and determined the part of speeches of corresponding blockchain terms. Among them, we further filtered out contract snippets without detailed comments and left 811 snippets to evaluate the translation quality of SolcTrans. Results: Experimental results show that even with a small corpus, SolcTrans can achieve similar performance to the state-of-the-art code comments generation models for other programming languages. In addition, SolcTrans has consistent performance when dealing with code snippets with different lengths and gas consumption. Conclusion: SolcTrans can correctly interpret Solidity codes and automatically convert them into comprehensible English text. We will release our tool and dataset for supporting reproduction and further studies in related fields.

中文翻译:

SolcTrans:迈向 Solidity 智能合约源代码的机器翻译

背景:区块链平台上的去中心化应用是通过智能合约实现的。然而,缺乏编程知识的参与者往往难以阅读智能合约源代码,从而导致潜在的安全风险和参与障碍。目标:我们的目标是将智能合约源代码翻译成自然语言描述,帮助人们更好地理解、操作和学习智能合约。方法:本文提出了一种基于抽象语法树和形式语法的 Solidity 智能合约自动翻译工具,称为 SolcTrans。我们调查了 3000 个智能合约,确定了相应区块链术语的词性。他们之中,我们进一步过滤掉没有详细注释的合同片段,留下811个片段来评估SolcTrans的翻译质量。结果:实验结果表明,即使语料库很小,SolcTrans 也可以达到与其他编程语言最先进的代码注释生成模型相似的性能。此外,SolcTrans 在处理不同长度和 gas 消耗的代码片段时具有一致的性能。结论:SolcTrans 可以正确解释 Solidity 代码并自动将其转换为可理解的英文文本。我们将发布我们的工具和数据集,以支持相关领域的复制和进一步研究。SolcTrans 可以实现与其他编程语言最先进的代码注释生成模型类似的性能。此外,SolcTrans 在处理不同长度和 gas 消耗的代码片段时具有一致的性能。结论:SolcTrans 可以正确解释 Solidity 代码并自动将其转换为可理解的英文文本。我们将发布我们的工具和数据集,以支持相关领域的复制和进一步研究。SolcTrans 可以实现与其他编程语言最先进的代码注释生成模型类似的性能。此外,SolcTrans 在处理不同长度和 gas 消耗的代码片段时具有一致的性能。结论:SolcTrans 可以正确解释 Solidity 代码并自动将其转换为可理解的英文文本。我们将发布我们的工具和数据集,以支持相关领域的复制和进一步研究。
更新日期:2021-06-14
down
wechat
bug