Skip to content

Commit

Permalink
Merge pull request #40 from coinmetrics/staging
Browse files Browse the repository at this point in the history
Master Release v0.3.0
  • Loading branch information
peterc-yuma authored Jan 7, 2025
2 parents 390266e + cccc492 commit b7cc7b6
Showing 14 changed files with 778 additions and 662 deletions.
20 changes: 20 additions & 0 deletions .env.miner.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Network Configuration
NETWORK=localnet # Options: localnet, testnet, finney

# Wallet Configuration
COLDKEY=miner
MINER_HOTKEY=default

# Node Configuration
MINER_NAME=miner
MINER_PORT=8092
AXON_IP=127.0.0.1
AXON_EXTERNAL_IP=127.0.0.1

# Miner Settings
TIMEOUT=16
VPERMIT_TAO_LIMIT=2
FORWARD_FUNCTION=base_miner

# Logging
LOGGING_LEVEL=info # Options: info, debug, trace
15 changes: 15 additions & 0 deletions .env.validator.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Network Configuration
NETWORK=testnet # Options: localnet, testnet, finney

# Wallet Configuration
COLDKEY=validator
VALIDATOR_HOTKEY=default

# Node Configuration
VALIDATOR_NAME=validator
VALIDATOR_PORT=8091
AXON_IP=127.0.0.1
AXON_EXTERNAL_IP=127.0.0.1

# Logging
LOGGING_LEVEL=info # Options: info, debug, trace
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -121,13 +121,14 @@ celerybeat.pid
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.env*
!.env.*.example

# Spyder project settings
.spyderproject
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ repos:
language: system
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
args: ['--maxkb=500']
args: ['--maxkb=500000']
- id: check-ast
name: check python ast
description: simply checks whether the files parse as valid python.
83 changes: 34 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,69 +1,54 @@
################################################################################
# User Parameters #
################################################################################
coldkey = default
validator_hotkey = validator
miner_hotkey = miner
netuid = $(testnet_netuid)
network = $(testnet)
ENV_FILE ?= .env

include $(ENV_FILE)
export

################################################################################
# Network Parameters #
################################################################################
finney = wss://entrypoint-finney.opentensor.ai:443
testnet = wss://test.finney.opentensor.ai:443
locanet = ws://127.0.0.1:9944
localnet = ws://127.0.0.1:9945

testnet_netuid = 256
localnet_netuid = 1
logging_level = info # options= ['info', 'debug', 'trace']


################################################################################
# Commands #
################################################################################
ifeq ($(NETWORK),localnet)
netuid = 1
else ifeq ($(NETWORK),testnet)
netuid = 256
else ifeq ($(NETWORK),finney)
#netuid = 64
$(error Finney network not supported yet)
endif

metagraph:
btcli subnet metagraph --netuid $(netuid) --subtensor.chain_endpoint $(network)
btcli subnet metagraph --netuid $(netuid) --subtensor.chain_endpoint $($(NETWORK))

register:
{ \
read -p 'Wallet name?: ' wallet_name ;\
read -p 'Hotkey?: ' hotkey_name ;\
btcli subnet register --netuid $(netuid) --wallet.name "$$wallet_name" --wallet.hotkey "$$hotkey_name" --subtensor.chain_endpoint $(network) ;\
btcli subnet register --netuid $(netuid) --wallet.name "$$wallet_name" --wallet.hotkey "$$hotkey_name" --subtensor.chain_endpoint $($(NETWORK)) ;\
}

validator:
python start_validator.py \
--neuron.name validator \
--wallet.name $(coldkey) \
--wallet.hotkey $(validator_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 8091 \
--neuron.name $(VALIDATOR_NAME) \
--wallet.name $(COLDKEY) \
--wallet.hotkey $(VALIDATOR_HOTKEY) \
--subtensor.chain_endpoint $($(NETWORK)) \
--axon.port $(VALIDATOR_PORT) \
--axon.ip $(AXON_IP) \
--axon.external_ip $(AXON_EXTERNAL_IP) \
--netuid $(netuid) \
--logging.level $(logging_level)
--logging.level $(LOGGING_LEVEL)

miner:
python start_miner.py \
--neuron.name miner \
--wallet.name $(coldkey) \
--wallet.hotkey $(miner_hotkey) \
--subtensor.chain_endpoint $(network) \
--axon.port 8092 \
--netuid $(netuid) \
--logging.level $(logging_level) \
--timeout 16 \
--vpermit_tao_limit 2 \
--forward_function base_miner

custom_miner:
python start_miner.py \
--neuron.name custom_miner \
--wallet.name $(coldkey) \
--wallet.hotkey miner2 \
--subtensor.chain_endpoint $(network) \
--axon.port 8093 \
--neuron.name $(MINER_NAME) \
--wallet.name $(COLDKEY) \
--wallet.hotkey $(MINER_HOTKEY) \
--subtensor.chain_endpoint $($(NETWORK)) \
--axon.port $(MINER_PORT) \
--axon.ip $(AXON_IP) \
--axon.external_ip $(AXON_EXTERNAL_IP) \
--netuid $(netuid) \
--logging.level $(logging_level) \
--timeout 16 \
--forward_function custom_function
--logging.level $(LOGGING_LEVEL) \
--timeout $(TIMEOUT) \
--vpermit_tao_limit $(VPERMIT_TAO_LIMIT) \
--forward_function $(FORWARD_FUNCTION)
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ cd precog

Create and source a python virtual environment:
```
python3 -m venv
python3 -m venv .venv
source .venv/bin/activate
```

@@ -71,7 +71,7 @@ poetry install
## Configuration

### Makefile
Start by editing the Makefile with you wallet and network information:
Start by editing the Makefile with your wallet and network information:
```
################################################################################
# User Parameters #
@@ -83,6 +83,21 @@ netuid = $(testnet_netuid)
network = $(testnet)
```

### .env Files
Copy the example `.env` files and edit all desired values:

#### .env.validator
```
cp .env.validator.example .env.validator
```
Edit `.env.validator` with your desired values.

#### .env.miner
```
cp .env.miner.example .env.miner
```
Edit `.env.miner` with your desired values.

### Wandb
Wandb integration is planned for mainnet launch and does not currently work.

@@ -93,7 +108,7 @@ Wandb integration is planned for mainnet launch and does not currently work.
Base miner:
1. Run the command:
```
make miner
make miner ENV_FILE=.env.miner
```
Custom miner:
@@ -107,18 +122,18 @@ Custom miner:
- replace the `--forward_function base_miner` with `--forward_function your_file`
3. Run the Command:
```
make miner_custom
make miner_custom ENV_FILE=.env.custom
```
### Running a Validator
```
make validator
make validator ENV_FILE=.env.validator
```
## Incentive Mechanism
Incentive mechanism whitepaper coming soon.
Read the [Incentive mechanism whitepaper](https://github.com/coinmetrics/precog/tree/master/docs/precog_Incentive_mechanism.pdf) 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
6 changes: 6 additions & 0 deletions docs/Release Notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

0.3.0
-----
Released on January 7th 2025
- Update to bittensor v8.5.1
- Implement CR3

0.2.0
-----
Released on December 20th 2024
Binary file added docs/precog_Incentive_mechanism.pdf
Binary file not shown.
Loading

0 comments on commit b7cc7b6

Please sign in to comment.