Skip to content

AlessandroPaparella/BR-transaction-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Back runable transaction classifier made-with-python PRs Welcome

A classifier for back-runable ethereum transactions made with neural network.

1. About

I created this classifier during a competition on the recognition of ethereum transactions subject to back-running (more information on this can be found in the useful links). Also does not include code for the regression problem as no significant results were found and the model could not learn with the available data

This repository shows only the best performing model that the author has been able to obtain, and is the result of several tests and tuning steps of the model.

2. Requirements

  • Google account
  • 10gb+ of gdrive space
  • Colab TPU runtime

3. Description

Looking at the application domain and the type of data, after several tests I realized that it would be more appropriate to use a RNN (particularly useful in time series), in particular the LSTM architecture has proved more performant.

Architecture

Neural Network architecture

3.1 Dataset exploration

The training dataset is first pre-processed by eliminating irrelevant columns and splitting it into validation and training files with percentages of 0.1 and 0.9 respectively, this operation can be done locally and is very important for optimizing the use of Google Colab resources, especially if you make use of the free version you risk exhausting the resources (the dataset is very heavy and takes a long time to be transformed into tensors).

The most interesting part of the dataset is represented by the column "txTrace" which contains the stack of calls made in the transaction, this recursive structure is explored through DFS in order to transform the dataset into a 3d tensor [samples x time x features] suitable for RNNs, where the time dimension is the sequence of calls and the features are the attributes of individual calls.

4 Usage

  1. git clone https://github.com/AlessandroPaparella/BR-transaction-classifier.git
  2. Move train.csv and test.py in the repo directory
  3. Run preprocessing.py
  4. For training purpose upload training.csv and validation.csv in your gdrive root
  5. For testing purpose upload weights (available with release) on your gdrive root
  6. Run the respective google colab notebook

5. Useful links