Skip to main content

Mechanistic model for the Filecoin Economy

Project description

Filecoin Mechanistic Twin

Mechanistic model for the Filecoin Economy. You can use this model to forecast all the components underlying Filecoin's circulating supply (i.e., minting, vesting, locking and burning), based on a set of parameters that encode storage provider behavior. The model uses the following assumptions:

  • Forecasting is done daily. This means that each forecasting step corresponds to a day and the forecasted metrics correspond to the value we expect to see at the end of that day.
  • The model uses the current sector states (i.e. known schedule expirations) and it estimates future onboardings and future renewals.
  • The daily power onboarded is provided as a tunable parameter.
  • The sector renewal rates are provided as a tunable parameter.
  • Sector duration is a constant provided as a tunable parameter.
  • Filecoin Plus sectors have the same renewal rates and sector durations as other sectors.
  • The model uses the current pledge metrics (i.e. known scheduled expiration in pledge) to measure known active sectors, and it estimates pledge metrics coming from future onboardings and renewals using the same assumptions as the ones used to model storage power.
  • The model ignores storage deal collateral when computing the total locked FIL.

To learn more about how the model is designed, check the specifications linked at the end of this readme.

Prerequisites

numpy>=1.23.1
pandas>=1.4.3
requests>=2.28.1
matplotlib>=3.5.2
seaborn>=0.11.2

Installing

This package is available on PyPI and thus can be directly installed with pip:

pip install mechaFIL

Alternatively, this package can be installed from source by cloning this repository and installing it manually with the command:

python setup.py install

Usage

There is a high-level function that can be used to run a forecast/simulation of circulating supply and its components. First you need to import the relevant packages:

import mechafil
import datetime

Now, you need to define some parameters:

# Starting date for the simulation
start_date = datetime.date(2021, 3, 15)
# Current date
current_date = datetime.date(2022, 11, 1) 
# Number of days to run the simulation (after current_rate)
forecast_length = 365
# Renewal rate of all sectors (percentage of raw-byte that will renew)
renewal_rate= 0.6
# Raw-byte power (in PiB) that is onboarded every day
rb_onboard_power = 12.0
# Percentage of raw-byte power onboarded that contains FIL+ deals
fil_plus_rate = 0.098
# Sector duration of newly onboarding sectors
duration = 360
# Method of computing QAP
qap_method = 'tunable'

A few important notes regarding the inputs:

  • Due to data availability, the start date cannot be earlier than 2021-03-15.
  • The current date needs to be at least 2 days after the start date.
  • The parameters renewal_rate, rb_onboard_power and fil_plus_rate can be a single number or a vector of numbers. If they are a number, the model assumes that number as a constant throughout the simulation. If a vector is provided, then the vector needs to have the same size as the simulation length. The vector option gives the user the most flexibility since they can apply different constants throughout the simulation.
  • The optional parameter qap_method determines how network QAP will be computed. Two approaches are provided in the library, which we term basic and tunable. Setting this value to tunable will enable QAP to be computed with tunable sector duration multipliers, but note that this is an approximation. The other method is basic which does not support sector duration multipliers. See here for more details.

Now, you can call the simulation function and collect the data in a DataFrame:

cil_df = mechafil.run_simple_sim(start_date,
    current_date,
    forecast_length,
    renewal_rate,
    rb_onboard_power,
    fil_plus_rate,
    duration,
    qap_method='tunable')

cil_df.head()

You can also run part of the simulation separately. To see more examples, check the available notebooks.

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mechaFIL-1.5.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

mechaFIL-1.5-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file mechaFIL-1.5.tar.gz.

File metadata

  • Download URL: mechaFIL-1.5.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mechaFIL-1.5.tar.gz
Algorithm Hash digest
SHA256 a9a7aa3b806acd514df42ced68d32e571d50021c9bed323fde26beaeb112a30e
MD5 dcd3f4b6602a8b575895fbf6aa3952be
BLAKE2b-256 577798e016a04c25cacad0f01acae43533bfaae8e87c68422a5755ba1983b505

See more details on using hashes here.

File details

Details for the file mechaFIL-1.5-py3-none-any.whl.

File metadata

  • Download URL: mechaFIL-1.5-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mechaFIL-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c16ac31d594a21a357642e7fe2b3c81b29f4f5ea245f0c3fa3ff79bd0634f1d9
MD5 bd69ee3038b5c827b6eb94c410715d2f
BLAKE2b-256 6aae502153285da4ef1abaa061e1f237b3cfd09cd1e711da21bd4eb7173883c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page