This project aims to predict the block reward of a blockchain network using historical data and machine learning techniques.
The project consists of two main components: server.js
and BlockReward.ipynb
. The server.js
file is responsible for fetching data from an API, exporting it to a CSV file, and running a server to provide the data. The BlockReward.ipynb
notebook uses the exported CSV data to train a machine learning model and predict future block rewards.
- Clone the repository.
- Install the project dependencies by running the command
npm install
.
- Start the server by running
npm start
. This will fetch the data, export it to a CSV file, and start the server. - Open the
BlockReward.ipynb
notebook in an environment like Jupyter Notebook or Google Colab. - Ensure that the
block_data.csv
file generated by the server is in the same directory as the notebook. - Run the notebook cells to load the data, train the model, and predict block rewards.
The data used in this project is obtained from the Ethereum blockchain through the Etherscan API. It includes the timestamp (in seconds) and the corresponding block reward in Ether. The server.js
script fetches the data for a range of block numbers and exports it to a CSV file named block_data.csv
.
The BlockReward.ipynb
notebook visualizes the historical data, trains a random forest regressor model, and predicts future block rewards based on a given timestamp. The predictions are displayed on a scatter plot along with the actual data points.
The project relies on the following dependencies:
- axios: ^1.4.0
- csv-writer: ^1.6.0
- dotenv: ^16.3.1
- ethers: ^5.0.0
- express: ^4.18.2
Make sure to install these dependencies before running the project.
Contributions to this project are welcome. Feel free to submit bug reports, feature requests, or pull requests to the repository.