[Paper Review] An empirical analysis of smart contracts: platforms, applications, and design patterns
This paper presents an empirical analysis of smart contracts on Bitcoin and Ethereum, examining platform differences, application domains, and prevalent design patterns. By analyzing 834 Ethereum contracts, it identifies financial applications as dominant (69% using fork-check, 50% using token/math patterns), reveals widespread use of authorization and time constraints in wallets, and highlights the role of oracles in gaming contracts, offering insights for domain-specific smart contract language design.
Smart contracts are computer programs that can be consistently executed by a network of mutually distrusting nodes, without the arbitration of a trusted authority. Because of their resilience to tampering, smart contracts are appealing in many scenarios, especially in those which require transfers of money to respect certain agreed rules (like in financial services and in games). Over the last few years many platforms for smart contracts have been proposed, and some of them have been actually implemented and used. We study how the notion of smart contract is interpreted in some of these platforms. Focussing on the two most widespread ones, Bitcoin and Ethereum, we quantify the usage of smart contracts in relation to their application domain. We also analyse the most common programming patterns in Ethereum, where the source code of smart contracts is available.
Motivation & Objective
- To understand how smart contracts are implemented and used across different blockchain platforms, particularly Bitcoin and Ethereum.
- To categorize smart contract applications by domain and quantify their prevalence on Ethereum.
- To identify and analyze common programming design patterns in Ethereum smart contracts.
- To correlate design patterns with application domains to inform the design of domain-specific smart contract languages.
- To provide empirical insights for improving security analysis and tooling for smart contracts.
Proposed method
- Collected and analyzed 834 Ethereum smart contract source codes from public repositories.
- Categorized contracts into application domains (e.g., finance, gaming, notary, wallets) based on functionality and use case.
- Identified and classified recurring design patterns (e.g., authorization, time constraint, oracle, fork check) through static code analysis.
- Measured the frequency of each design pattern across different application domains.
- Compared platform-level differences between Bitcoin and Ethereum, focusing on smart contract expressiveness and usage.
- Used statistical analysis to correlate pattern usage with application categories, such as financial or gaming contracts.
Experimental results
Research questions
- RQ1What are the most common application domains for smart contracts on Ethereum?
- RQ2Which design patterns are most frequently used in Ethereum smart contracts, and how do they vary across application domains?
- RQ3How do the design patterns in smart contracts relate to specific functional requirements (e.g., security, timing, randomness)?
- RQ4To what extent do financial smart contracts rely on specific patterns like token, math, or fork check?
- RQ5How do wallet and gaming contracts differ in their use of design patterns such as authorization or oracles?
Key findings
- Financial applications account for 69% of contracts using the fork check pattern and 50% using token and math patterns, indicating strong financial use cases.
- 69% of contracts using the fork check pattern are financial, reflecting the need to verify branching logic before fund transfers.
- 25% of gaming contracts use the oracle pattern, and 74% of oracle uses in games are for random number generation, suggesting reliance on external randomness sources.
- 100% of wallet contracts implement both authorization and termination patterns, with 94% using time constraints, highlighting security and lifecycle management priorities.
- 47% of gaming contracts generate random numbers without oracles, indicating alternative local randomness techniques are commonly used.
- Only 29% of financial contracts use any of the identified design patterns, suggesting many perform simple operations without complex logic.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.