Giter Club home page Giter Club logo

a-novel-vulnerability-scanner-for-ethereum-smart-contracts-using-transformer-neural-network's Introduction

A Novel Vulnerability Scanner for Ethereum Smart Contracts Using Transformer Neural Network

This is a research project that aims to develop a vulnerability scanner for Ethereum smart contracts using transformer neural network. The project is developed by Emre Balci as a part of his master's thesis at the [Department of Computer Engineering], Bahcesehir University. Paper will be added here soon.

Introduction

Smart contracts are self-executing contracts that run on the Ethereum blockchain. They are used to automate business processes and execute transactions in a decentralized and trustless manner. However, smart contracts are susceptible to security vulnerabilities that can be exploited by attackers to steal funds or disrupt the operation of the contract.

To address this problem, the research proposes a novel vulnerability scanner for Ethereum smart contracts using transformer neural network. The scanner analyzes the source codes of the smart contract and uses a transformer neural network to detect accuracy.

Installation

To use the vulnerability scanner, you need to install the following dependencies:

  • Python 3.7 or higher
  • TensorFlow 2.4.1 or higher
  • Truffle 5.3.2 or higher
  • Solidity 0.7.6 or higher

Usage

To use the vulnerability scanner, you need to follow these steps:

  1. SmartContractApi.zip: This project is an upgraded version of https://github.com/hoss-green/Etherscan.Net utilizing fetch and save operations of smart contracts.
  2. Thesis.py: This file contains operations of MAIAN analysis execeution for each smart contract file previously fetched using Smart Contract API Project.
  3. MAIAN.py: It is a version of the existing MAIAN file with the addition of saving smart contract analysis results to Excel.
  4. MAIANResults.csv: Excel file where analysis results in MAIAN Py are exported.
  5. Opcode.py: In this file, source code of smart contracts are converted opcode then exported to excel.
  6. Evm.mapping.xlsx: Excel file with opcode equivalents of source codes.
  7. Opcode.xlsx: An excel file in which the hashes of the obtained smart contracts and the source codes of these smart contracts converted to opcode are matched.

The following command can be used to run the scanner:

Aspose Words 77abfd83-1e66-44a3-b29e-745b488bb823 001

To enhance our project and improve the security analysis of smart contracts, we have added the following two new artificial intelligence models:

  1. LSTM.py: This file is developed using a Long Short-Term Memory (LSTM) based model for analyzing smart contracts. The LSTM model helps us better understand the functionality of smart contracts and detect security vulnerabilities.

  2. Transformer.py: This file performs smart contract analysis using a Transformer-based model that includes advanced features such as attention mechanisms and multi-head attention. This model allows us to analyze large and complex smart contracts faster and more accurately.

Both of these models have contributed to enhancing our analysis of smart contract security, resulting in improved accuracy and processing speed.

Results

The vulnerability scanner has been tested on several smart contracts and has successfully detected vulnerabilities such as reentrancy, integer overflow, and unhandled exceptions. The results of the experiments are presented in Emre Balci's master's thesis.

Contributions

Contributions to the vulnerability scanner are welcome. If you find a bug or want to suggest an improvement, please open an issue on this GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

a-novel-vulnerability-scanner-for-ethereum-smart-contracts-using-transformer-neural-network's People

Contributors

emrbalc avatar

Stargazers

Tracy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.