SolcTrans: Towards machine translation of Solidity smart contract source code

06/11/2021
by   Chaochen Shi, et al.
0

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.

READ FULL TEXT
research
05/31/2021

A Bytecode-based Approach for Smart Contract Classification

With the development of blockchain technologies, the number of smart con...
research
05/08/2023

Capturing Smart Contract Design with DCR Graphs

Smart contracts manage blockchain assets. While smart contracts embody b...
research
03/01/2022

Practical Mitigation of Smart Contract Bugs

In spite of their popularity, developing secure smart contracts remains ...
research
03/12/2021

A Multi-Modal Transformer-based Code Summarization Approach for Smart Contracts

Code comment has been an important part of computer programs, greatly fa...
research
11/27/2022

Who is Gambling? Finding Cryptocurrency Gamblers Using Multi-modal Retrieval Methods

With the popularity of cryptocurrencies and the remarkable development o...
research
12/21/2021

Chat2Code: Towards conversational concrete syntax for model specification and code generation, the case of smart contracts

The revolutionary potential of automatic code generation tools based on ...
research
11/28/2021

Semantic Code Search for Smart Contracts

Semantic code search technology allows searching for existing code snipp...

Please sign up or login with your details

Forgot password? Click here to reset