A simulation model of Polygon 2.0 to study validator incentives and ecosystem security. It forked from ethereum-economic-model and has been constructed using the open-source Python library radCAD, which is an enhancement of cadCAD.
- Clone or download the Git repository:
git clone https://github.com/0xPolygon/polygon2.0-economic-model.git
or using GitHub Desktop - Set up your development environment using one of the following three options:
This option guides you through setting up a cross-platform, beginner-friendly (yet more than capable enough for the advanced user) development environment using Anaconda to install Python 3 and Jupyter. There is also a video that accompanies this option and walks through all the steps: Model Quick-Start Guide
- Download Anaconda
- Use Anaconda to install Python 3
- Set up a virtual environment from within Anaconda
- Install Jupyter Notebook within the virtual environment
- Launch Jupyter Notebook and open the environment_setup.ipynb notebook in the root of the project repo
- Follow and execute all notebook cells to install and check your Python dependencies
This option guides you through how to set up a custom development environment using Python 3 and Jupyter.
Please note the following prerequisites before getting started:
- Python: tested with versions 3.7, 3.8, 3.9
- NodeJS might be needed if using Plotly with Jupyter Lab (Plotly works out the box when using the Anaconda/Conda package manager with Jupyter Lab or Jupyter Notebook)
First, set up a Python 3 virtualenv development environment (or use the equivalent Anaconda step):
# Create a virtual environment using Python 3 venv module
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
Make sure to activate the virtual environment before each of the following steps.
Secondly, install the Python 3 dependencies using Pip, from the requirements.txt file within your new virtual environment:
# Install Python 3 dependencies inside virtual environment
pip install -r requirements.txt
To create a new Jupyter Kernel specifically for this environment, execute the following command:
python3 -m ipykernel install --user --name python-pol-model --display-name "Python (Polygon Economic Model)"
You'll then be able to select the kernel with display name Python (Polygon Economic Model)
to use for your notebook from within Jupyter.
To start Jupyter Notebook or Lab (see notes about issues with using Plotly with Jupyter Lab):
jupyter notebook
# Or:
jupyter lab
For more advanced Unix/macOS users, a Makefile is also included for convenience that simply executes all the setup steps. For example, to setup your environment and start Jupyter Lab:
# Setup environment
make setup
# Start Jupyter Lab
make start-lab
Alternatively, you can set up your development environment using the pre-built Docker image with all the dependencies you need: CADLabs Jupyter Lab Environment
To install and use Plotly with Jupyter Lab, you might need NodeJS installed to build Node dependencies, unless you're using the Anaconda/Conda package manager to manage your environment. Alternatively, use Jupyter Notebook which works out the box with Plotly.
See https://plotly.com/python/getting-started/
You might need to install the following "lab extension":
jupyter labextension install jupyterlab-plotly@4.14.3
If you receive the following error and you use Anaconda, try: conda install -c anaconda pywin32
DLL load failed while importing win32api: The specified procedure could not be found.
The experiments/notebooks/Polygon_analysis directory contains the most recent released cryptoeconomics simulation results. Specifically, Polygon2.0 Economics v0.1presents a comprehensive analysis of the primary validator economics in the current model iteration. The simulation specs in this notebook is aligned with the POL whitepaper, ensuring that the simulation specifications are consistent with the official documentation. The notebook shows
- $POL token price trajectory
- Three chains adoption rate scenarios
- Validator yields over time per scenario
- Validator profit break down analysis in both yields and dollars.