Skip to content

Design for Precog Subnet. Intended to provide an arena to express market knowledge and accelerate the dissemination of hidden information relevant to asset prices.

License

Notifications You must be signed in to change notification settings

coinmetrics/precog

Repository files navigation

CoinMetrics Precog Subnet

Testnet UID: 256
Mainnet UID: 55

Status

Activity

Compatibility
Social

Introduction

The Precog Subnet will serve as an arena to identify the analysts with the best strategies and information to anticipate Bitcoin price movements, and recruit them to share their insight with the broader community. By leveraging Bittensor’s subnet structure multiple perspectives can compete with the collective goal of filtering out noise in price signals. The open ecosystem creates a mechanism for people with unique knowledge to benefit themselves in exchange for sharing their specialties with the public


Design Decisions

The initial focus is on Bitcoin as it is the most well-established and arguably most decentralized crypto currency. Bitcoin has an abundance of high-resolution data, while still retaining enough volatility to make price prediction a valuable challenge.

We decided to focus on high-frequency predictions (every 5 minutes) with short resolution times (every hour) because we believe this leverages the unique capabilities of Bittensor to do something that traditional derivatives markets cannot do. While options and futures allow markets to express sentiments around asset price, they are unable to do so in a continuously and with such a short settlement time.

The incentive mechanism was specifically designed to reward precise statements of the future price level, as well as the most likely band the price will trade in. Compared to mechanisms with less precise “long” or “short” predictions, and pre-determined strike price intervals, we believe the metrics we query are closer to what traders and analysts truly want: the most likely price in the future with frequent updates.


Compute Requirements

Validator Miner
8gb RAM 8gb RAM
2 vCPUs 2 vCPUs

Prerequisites

Before beginning, ensure you have:

  1. Python Installation

    • Python version 3.9, 3.10, or 3.11 installed
    • We recommend using pyenv for Python version management
  2. Bittensor Knowledge

  3. Poetry

    • Basic understanding of Poetry for dependency management
    • See the Poetry Documentation for installation and usage
  4. System Requirements

    • NodeJS and NPM (for PM2 installation)
    • Basic understanding of command-line interfaces

Installation

First, install PM2:

sudo apt update
sudo apt install nodejs npm
sudo npm install pm2@latest -g

Verify installation:

pm2 --version

Clone the repository:

git clone https://github.com/coinmetrics/precog.git
cd precog

Create and source a python virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install the requirements with poetry:

pip install poetry
poetry install

Configuration

.env Files

Copy the example .env files and edit all desired values. If you are running a validator, you will only need to copy the .env.validator file. If you are running a miner, you will only need to copy the .env.miner file:

.env.validator

cp .env.validator.example .env.validator

Edit .env.validator with your desired values.

# Network Configuration
# Options: localnet, testnet, finney
NETWORK=testnet

# Wallet Configuration
COLDKEY=your_validator_coldkey
VALIDATOR_HOTKEY=your_validator_hotkey

# Node Configuration
VALIDATOR_NAME=validator
VALIDATOR_PORT=8091

# Logging
# Options: info, debug, trace
LOGGING_LEVEL=debug

.env.miner

cp .env.miner.example .env.miner

Edit .env.miner with your desired values.

# Options: localnet, testnet, finney
NETWORK=testnet

# Wallet Configuration
COLDKEY=your_miner_coldkey
MINER_HOTKEY=your_miner_hotkey

# Node Configuration
MINER_NAME=miner
# This port must be open to accept incoming TCP connections.
MINER_PORT=8092

# Miner Settings
TIMEOUT=16
VPERMIT_TAO_LIMIT=2

#Adjust this function if you would like to specify a custom forward function
FORWARD_FUNCTION=base_miner

# Logging
# Options: info, debug, trace
LOGGING_LEVEL=debug

Deployment

Registering a Hotkey

Once you have configured your .env files as per the instructions above, you can register a miner with make register ENV_FILE=.env.miner or register a validator with make register ENV_FILE=.env.validator.

Running a Miner

Base miner:

  1. Run the command:
    make miner ENV_FILE=.env.miner
    

Custom miner:

  1. Write a custom forward function stored in precog/miners/your_file.py
    • miner.py searches for a function called forward contained within your provided file --forward_function your_file
    • This function should handle how the miner responds to requests from the validator
    • Within the forward function, synapse.predictions and synapse.interval should be set.
    • See base_miner.py for an example
  2. Add a command to Makefile.
    • copy the miner command and rename it (e.g. miner_custom) in Makefile
    • replace the --forward_function base_miner with --forward_function your_file
  3. Run the Command:
    make miner_custom ENV_FILE=.env.custom
    

Running a Validator

make validator ENV_FILE=.env.validator

Incentive Mechanism

Read the Incentive mechanism whitepaper for an in-depth explanation of the mechanism.

Briefly, miners are rewarded based on two factors:

  1. A point estimate for the price of BTC in USD one hour from prediction time
  2. An interval estimate (the minimum and maximum price of BTC over the next hour based on a 1s frequency)

For more information, feel free to investigate reward.py or base_miner.py


Roadmap

Our goal is to continuously improve the subnet and tune it to the goals and interests that will engage the community. We have considered additions in the form of additional asset coverage, such as extending price analysis to TAO tokens. Extensions can also mean incentive mechanisms to calculate new types of metrics such as anticipating volatility, transaction volumes, or the cost of different types of transfers. Our greatest strength is our deep and professional data library, used by many of the largest financial institutions in crypto. We expect these resources will allow the subnet scope to adapt quickly when conditions are right.

We hope to, on one hand, leverage our existing products and coverage to make generating new insights as frictionless as possible for Miners. While on the other hand, we also hope to integrate new data streams into our catalog that only the Bittensor ecosystem can generate. Our aim is for these novel outputs to ultimately bring new participants to Bittensor from the broader crypto community, as we serve metrics and analysis that can't be obtained anywhere else.

About

Design for Precog Subnet. Intended to provide an arena to express market knowledge and accelerate the dissemination of hidden information relevant to asset prices.

Resources

License

Stars

Watchers

Forks

Packages

No packages published