PrettiSmart: Visual Interpretation of Smart Contracts via Simulation
Xiaolin Wen1
Tai D. Nguyen2
Yong Wang1
Lun Zhang3
Jun Sun2
2
Smart Contract
Traditional Contract
Sellers
Buyers
Contract
Third Parties
Execution
Smart Contract
Blockchain
Sellers
Buyers
Execution
3
Why do we need to visually interpret it?
The source code is available!
Highest Profit!
Zero Risk!
Scam Impossible!
Code is too complex!
No Existing Transactions!
Investors
4
Smart Contract
Source Code
Ethereum Blockchain
Smart Contract
Function Calls (Money Transfers)
Send Money (Internal Transactions)
Change State Variables
Change Balances
5
PrettiSmart
Possible Function Calls
What we do?
Owner
Multiple Users
Cryptocurrency Flows
Balance Changes
-100
F1
-20
F1
-80
F2
+200
F0
State Variable Changes
Variable #
Smart Contract
Investors
6
PrettiSmart
Input
Output
7
PrettiSmart
8
Simulation Overview
provides a visual summary for each simulation, involving the net balances over time and the involved functions
9
Function Summary
shows the statistics of the calls of each function in a simulation.
10
Function Call Details
Function Calls
Money Flows
Net Balance
demonstrates the detailed behaviors of the smart contract after each function call
11
State Variable Changes
Increase
Decrease
shows how the state variables are changing after each function call.
12
Evaluation
Case 1: Interpreting a Gambling Contract
Case 2: Identifying a Fraudulent Smart Contract
13
Evaluation
Case 1: Interpreting a Gambling Contract
14
Evaluation
Case 1: Interpreting a Gambling Contract
15
Evaluation
Case 1: Interpreting a Gambling Contract
16
Evaluation
Case 1: Interpreting a Gambling Contract
17
Evaluation
Case 1: Interpreting a Gambling Contract
F0: enter (send money to contract)
F1: pickWinner (send money to one user)
18
Evaluation
Case 1: Interpreting a Gambling Contract
19
Evaluation
User Interviews with 12 cryptocurrency investors
PrettiSmart is effective and useful for investors to analyze the smart contract’s functionality.
20
Take-away Message
PrettiSmart: Visual Interpretation of Smart Contracts via Simulation
Xiaolin Wen1
Tai D. Nguyen2
Yong Wang1
Lun Zhang3
Jun Sun2
Paper Link
Contact Me!
Code Will Tell: Visual Identification of Ponzi Schemes on Ethereum
PonziLens+: Visualizing Bytecode Actions for Smart Ponzi Scheme Identification
PrettiSmart: Visual Interpretation of Smart Contracts via Simulation
22
Evaluation
Case 1: Interpreting a Gambling Contract
23
Evaluation
Case 2: Identifying a Fraudulent Smart Contract
24
Evaluation
Case 2: Identifying a Fraudulent Smart Contract
F0: buyMessage
25
Evaluation
Case 2: Identifying a Fraudulent Smart Contract
F1: ownerWithdraw
26