deep_gas_oracle icon indicating copy to clipboard operation
deep_gas_oracle copied to clipboard

Unofficial implementation of the paper: "Step on the Gas? A Better Approach for Recommending the Ethereum Gas Price"

Stargazers Issues MIT License


Ethereum Deep Gas Price 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)!

Table of Contents
  1. About The Project
    • Built With
  2. Getting Started
    • Prerequisites
    • Installation
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

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:

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

Some predictions over the 3 hours:

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

DEEP GAS ORACLE :

GETH (my implementation):

As a comparison, here is the paper original 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"

License

Distributed under the MIT License. See LICENSE for more information.