Detection and Analysis of Ethereum Energy Smart Contracts

As blockchain technology advances, so has the deployment of smart contracts on blockchain platforms, making it exceedingly challenging for users to explicitly identify application services. Unlike traditional contracts, smart contracts are not written in a natural language, making it difficult to de...

Full description

Bibliographic Details
Main Authors: Bahareh Lashkari, Petr Musilek
Format: Article
Language:English
Published: MDPI AG 2023-05-01
Series:Applied Sciences
Subjects:
Online Access:https://www.mdpi.com/2076-3417/13/10/6027
_version_ 1797601268633436160
author Bahareh Lashkari
Petr Musilek
author_facet Bahareh Lashkari
Petr Musilek
author_sort Bahareh Lashkari
collection DOAJ
description As blockchain technology advances, so has the deployment of smart contracts on blockchain platforms, making it exceedingly challenging for users to explicitly identify application services. Unlike traditional contracts, smart contracts are not written in a natural language, making it difficult to determine their provenance. Automatic classification of smart contracts offers blockchain users keyword-based contract queries and a streamlined effective management of smart contracts. In addition, the advancement in smart contracts is accompanied by security challenges, which are generally caused by domain-specific security breaches in smart contract implementation. The development of secure and reliable smart contracts can be extremely challenging due to domain-specific vulnerabilities and constraints associated with various business logics. Accordingly, contract classification based on the application domain and the transaction context offers greater insight into the syntactic and semantic properties of that class. However, despite initial attempts at classifying Ethereum smart contracts, there has been no research on the identification of smart contracts deployed in transactive energy systems for energy exchange purposes. In this article, in response to the widely recognized prospects of blockchain-enabled smart contracts towards an economical and transparent energy sector, we propose a methodology for the detection and analysis of energy smart contracts. First, smart contracts are parsed by transforming code elements into vectors that encapsulate the semantic and syntactic characteristics of each term. This generates a corpus of annotated text as a balanced, representative collection of terms in energy contracts. The use of a domain corpus builder as an embedding layer to annotate energy smart contracts in conjunction with machine learning models results in a classification accuracy of 98.34%. Subsequently, a source code analysis scheme is applied to identified energy contracts to uncover patterns in code segment distribution, predominant adoption of certain functions, and recurring contracts across the Ethereum network.
first_indexed 2024-03-11T03:58:46Z
format Article
id doaj.art-88b7706d76dc4413991956d8cc5939f7
institution Directory Open Access Journal
issn 2076-3417
language English
last_indexed 2024-03-11T03:58:46Z
publishDate 2023-05-01
publisher MDPI AG
record_format Article
series Applied Sciences
spelling doaj.art-88b7706d76dc4413991956d8cc5939f72023-11-18T00:19:31ZengMDPI AGApplied Sciences2076-34172023-05-011310602710.3390/app13106027Detection and Analysis of Ethereum Energy Smart ContractsBahareh Lashkari0Petr Musilek1Electrical and Computer Engineering, University of Alberta, Edmonton, AB T6G 1H9, CanadaElectrical and Computer Engineering, University of Alberta, Edmonton, AB T6G 1H9, CanadaAs blockchain technology advances, so has the deployment of smart contracts on blockchain platforms, making it exceedingly challenging for users to explicitly identify application services. Unlike traditional contracts, smart contracts are not written in a natural language, making it difficult to determine their provenance. Automatic classification of smart contracts offers blockchain users keyword-based contract queries and a streamlined effective management of smart contracts. In addition, the advancement in smart contracts is accompanied by security challenges, which are generally caused by domain-specific security breaches in smart contract implementation. The development of secure and reliable smart contracts can be extremely challenging due to domain-specific vulnerabilities and constraints associated with various business logics. Accordingly, contract classification based on the application domain and the transaction context offers greater insight into the syntactic and semantic properties of that class. However, despite initial attempts at classifying Ethereum smart contracts, there has been no research on the identification of smart contracts deployed in transactive energy systems for energy exchange purposes. In this article, in response to the widely recognized prospects of blockchain-enabled smart contracts towards an economical and transparent energy sector, we propose a methodology for the detection and analysis of energy smart contracts. First, smart contracts are parsed by transforming code elements into vectors that encapsulate the semantic and syntactic characteristics of each term. This generates a corpus of annotated text as a balanced, representative collection of terms in energy contracts. The use of a domain corpus builder as an embedding layer to annotate energy smart contracts in conjunction with machine learning models results in a classification accuracy of 98.34%. Subsequently, a source code analysis scheme is applied to identified energy contracts to uncover patterns in code segment distribution, predominant adoption of certain functions, and recurring contracts across the Ethereum network.https://www.mdpi.com/2076-3417/13/10/6027distributed ledgerEthereumsmart contracttransactive energy frameworkmachine learningenergy trading
spellingShingle Bahareh Lashkari
Petr Musilek
Detection and Analysis of Ethereum Energy Smart Contracts
Applied Sciences
distributed ledger
Ethereum
smart contract
transactive energy framework
machine learning
energy trading
title Detection and Analysis of Ethereum Energy Smart Contracts
title_full Detection and Analysis of Ethereum Energy Smart Contracts
title_fullStr Detection and Analysis of Ethereum Energy Smart Contracts
title_full_unstemmed Detection and Analysis of Ethereum Energy Smart Contracts
title_short Detection and Analysis of Ethereum Energy Smart Contracts
title_sort detection and analysis of ethereum energy smart contracts
topic distributed ledger
Ethereum
smart contract
transactive energy framework
machine learning
energy trading
url https://www.mdpi.com/2076-3417/13/10/6027
work_keys_str_mv AT baharehlashkari detectionandanalysisofethereumenergysmartcontracts
AT petrmusilek detectionandanalysisofethereumenergysmartcontracts