deep_gas_oracle

This is an unofficial implementation of the paper: Step on the Gas? A Better Approach for Recommending the Ethereum Gas Price (by Sam M. Werner, Paul J. Pritz, Daniel Perez)!

This is a price gas recommender for the Ethereum network. The network is trained to
predict the next Sth prices (with a resampling over 5 minutes periods). As the minimum
gas price is very noisy, the idea is to predict the prices on the next minutes/hours.
From thoses predictions the algorithm will return a recommended price,
taking into account the slope of the predictions.

Few plots from this repository:

Note: We try to forecast the minimum eth gas price over the next 3 hours.

The loss of the GRU model:

loss

Model first timestamp predictions (5min) on the test range:

predictions_5min

Some predictions over the 3 hours:

pred_3h_1

pred_3h_2

Results of the simulation between the block 8965759 and the block 8995344:

DEEP GAS ORACLE :

results_deep_gas_oracle

GETH (my implementation):

results_geth

As a comparison, here is the paper original results:

paper_results

Note: I just tried a few different hyper-parameters but didn't have time to tune them yet.
My results are not as good as the paper but close to it.

Built With

  • Python
  • Pytorch
  • Pandas & Numpy
  • Notebooks for visualisations

Getting Started

Follow the notebooks.

Prerequisites

This run on python 3, you can find the requirements in : requirements.txt

Note: you need to have pip installed

Datasets

To download the raw datasets, you need a google api key to use the BigQuery
service to be able to fetch historical eth blocks information.
Once you have the key, place the json file in the credentials/ folder.

For the eth price, you can download it here
on Kaggle.

You should put the ETH price csv file in the datasets/ folder.

Installation

1 - Clone this repo

2 - Install the package with pip:

pip install .

Usage

You can run the notebooks to:

  • 01 -> Explore the data and preprocess it
  • 02 -> Modelise the minimum gas prices (5min avg) with a GRU neural-network
  • 03 -> Evaluate the recommendation made by the deep oracle VS "Geth strategy"

GitHub