Table of Contents
Fetching ...

PrettiSmart: Visual Interpretation of Smart Contracts via Simulation

Xiaolin Wen, Tai D. Nguyen, Lun Zhang, Jun Sun, Yong Wang

TL;DR

PrettiSmart addresses the challenge that investors struggle to understand smart contracts from source code alone by introducing a simulation-driven visualization approach. A fuzzing-based simulator generates multi-user function-call sequences and captures state changes and cryptocurrency flows, which are then visualized through two modules: a barcode-based Simulation Overview and an augmented Simulation Detail view showing function calls, flows, and state updates. Two case studies and 12 investor interviews demonstrate that the approach improves interpretability and usability for both technically skilled and non-programmer investors. The work suggests future extensions to support multi-token scenarios, realistic user behavior modeling, and mobile access, thereby broadening the practical impact of smart-contract interpretation tools.

Abstract

Smart contracts are the fundamental components of blockchain technology. They are programs to determine cryptocurrency transactions, and are irreversible once deployed, making it crucial for cryptocurrency investors to understand the cryptocurrency transaction behaviors of smart contracts comprehensively. However, it is a challenging (if not impossible) task for investors, as they do not necessarily have a programming background to check the complex source code. Even for investors with certain programming skills, inferring all the potential behaviors from the code alone is still difficult, since the actual behaviors can be different when different investors are involved. To address this challenge, we propose PrettiSmart, a novel visualization approach via execution simulation to achieve intuitive and reliable visual interpretation of smart contracts. Specifically, we develop a simulator to comprehensively capture most of the possible real-world smart contract behaviors, involving multiple investors and various smart contract functions. Then, we present PrettiSmart to intuitively visualize the simulation results of a smart contract, which consists of two modules: The Simulation Overview Module is a barcode-based design, providing a visual summary for each simulation, and the Simulation Detail Module is an augmented sequential design to display the cryptocurrency transaction details in each simulation, such as function call sequences, cryptocurrency flows, and state variable changes. It can allow investors to intuitively inspect and understand how a smart contract will work. We evaluate PrettiSmart through two case studies and in-depth user interviews with 12 investors. The results demonstrate the effectiveness and usability of PrettiSmart in facilitating an easy interpretation of smart contracts.

PrettiSmart: Visual Interpretation of Smart Contracts via Simulation

TL;DR

PrettiSmart addresses the challenge that investors struggle to understand smart contracts from source code alone by introducing a simulation-driven visualization approach. A fuzzing-based simulator generates multi-user function-call sequences and captures state changes and cryptocurrency flows, which are then visualized through two modules: a barcode-based Simulation Overview and an augmented Simulation Detail view showing function calls, flows, and state updates. Two case studies and 12 investor interviews demonstrate that the approach improves interpretability and usability for both technically skilled and non-programmer investors. The work suggests future extensions to support multi-token scenarios, realistic user behavior modeling, and mobile access, thereby broadening the practical impact of smart-contract interpretation tools.

Abstract

Smart contracts are the fundamental components of blockchain technology. They are programs to determine cryptocurrency transactions, and are irreversible once deployed, making it crucial for cryptocurrency investors to understand the cryptocurrency transaction behaviors of smart contracts comprehensively. However, it is a challenging (if not impossible) task for investors, as they do not necessarily have a programming background to check the complex source code. Even for investors with certain programming skills, inferring all the potential behaviors from the code alone is still difficult, since the actual behaviors can be different when different investors are involved. To address this challenge, we propose PrettiSmart, a novel visualization approach via execution simulation to achieve intuitive and reliable visual interpretation of smart contracts. Specifically, we develop a simulator to comprehensively capture most of the possible real-world smart contract behaviors, involving multiple investors and various smart contract functions. Then, we present PrettiSmart to intuitively visualize the simulation results of a smart contract, which consists of two modules: The Simulation Overview Module is a barcode-based design, providing a visual summary for each simulation, and the Simulation Detail Module is an augmented sequential design to display the cryptocurrency transaction details in each simulation, such as function call sequences, cryptocurrency flows, and state variable changes. It can allow investors to intuitively inspect and understand how a smart contract will work. We evaluate PrettiSmart through two case studies and in-depth user interviews with 12 investors. The results demonstrate the effectiveness and usability of PrettiSmart in facilitating an easy interpretation of smart contracts.

Paper Structure

This paper contains 26 sections, 6 figures.

Figures (6)

  • Figure 1: Critical concept illustrations: (A) presents an example of the smart contract source code in Solidity, which can be deployed on the Ethereum blockchain (B). Users make a function call via its ABIto execute the contract (A1). If this function call changes the Ethereum state, a transaction will be created to record it on the blockchain.
  • Figure 2: The simulator framework (A) consists of four steps: source code parsing, fuzzing configuration, function call parsing, and operation parsing. (B) shows the collected data for the visualizations.
  • Figure 3: The visual designs of PrettiSmart. The Simulation Overview Module (A) shows a visual summary of each simulation. The Simulation Detail Module includes: Function Summary (B) to overview each function, Function Call Details (C) to show the function call distribution (C1), cryptocurrency flow (C2), and net balance changes (C3), and State Variable Changes (D) to show the variables changed in each function call.
  • Figure 4: With PrettiSmart, an investor has identified a smart contract as a fair gambling game. (A) shows the overview of simulations from our simulator, where the patterns in (A1) and (A2) help the investor understand the gains and losses of each address. (B) helps analyze the function summaries (B1), the reasons for turning losses into wins (B2), and the repetitive patterns in cryptocurrency flow (B3) and state variable changes (B4). The user checked the two involved functions in (C) and (D) by hovering over the function summaries.
  • Figure 5: With PrettiSmart, an investor identified a fraudulent smart contract. (A) shows that all simulated addresses lost their cryptocurrencies and the contract had an increasing balance. By observing the Simulation Detail Module (B), the investor found an abnormal chain-like cryptocurrency flow (B2) and a repetitive state change pattern (B3). After checking the function call details of F0 (C and D4) and comparing the state change pattern of F0 and F1 (D1-D3), the investor confirmed that this smart contract is a fraudulent contract.
  • ...and 1 more figures