generated from opentensor/bittensor-subnet-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
163 lines (114 loc) · 5.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD)
DOCKER_COMPOSE := BRANCH_NAME=$(BRANCH_NAME) docker compose
LOCAL_ENDPOINT = ws://127.0.0.1:9945
LOCALNET = chain_endpoint $(LOCAL_ENDPOINT)
DEVNET_ENDPOINT = ws://54.205.45.3:9945
DEVNET = chain_endpoint $(DEVNET_ENDPOINT)
INCENTIVIZED_TESTNET_ENDPOINT = ws://100.28.51.29:9945
INCENTIVIZED_TESTNET = chain_endpoint $(INCENTIVIZED_TESTNET_ENDPOINT)
TESTNET = network test
NETUID = 1 # devnet
# NETUID = 165 # testnet
########################################################################
##### SELECT YOUR ENV #####
########################################################################
# SUBTENSOR_ENVIRONMENT = $(LOCALNET)
SUBTENSOR_ENVIRONMENT = $(INCENTIVIZED_TESTNET)
# SUBTENSOR_ENVIRONMENT = $(DEVNET)
# SUBTENSOR_ENVIRONMENT = $(TESTNET)
########################################################################
##### USEFUL COMMANDS #####
########################################################################
## Wallet funding
fund-owner-wallet:
btcli wallet faucet --wallet.name owner --subtensor.$(SUBTENSOR_ENVIRONMENT)
fund-validator-wallet:
btcli wallet faucet --wallet.name validator --subtensor.$(SUBTENSOR_ENVIRONMENT)
fund-miner-wallet:
btcli wallet faucet --wallet.name miner --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Subnet creation
create-subnet:
btcli subnet create --wallet.name owner --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Subnet and wallet info
list-wallets:
btcli wallet list
overview-all:
btcli wallet overview --all --subtensor.$(SUBTENSOR_ENVIRONMENT)
balance-all:
btcli wallet balance --all --subtensor.$(SUBTENSOR_ENVIRONMENT)
list-subnets:
btcli subnets list --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Validator setup
stake-validator:
btcli stake add --wallet.name validator --wallet.hotkey default --subtensor.$(SUBTENSOR_ENVIRONMENT)
register-validator:
btcli subnet register --wallet.name validator --wallet.hotkey default --subtensor.$(SUBTENSOR_ENVIRONMENT)
register-validator-root:
btcli root register --wallet.name validator --wallet.hotkey default --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Register miner + Key Registration Validation
register-miner:
btcli subnet register --wallet.name miner --wallet.hotkey default --subtensor.$(SUBTENSOR_ENVIRONMENT)
validate-key-registration:
btcli subnet list --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Setup weights
boost-root:
btcli root boost --netuid $(NETUID) --increase 1 --wallet.name validator --wallet.hotkey default --subtensor.$(SUBTENSOR_ENVIRONMENT)
set-weights:
btcli root weights --subtensor.$(SUBTENSOR_ENVIRONMENT)
## Run miner and validator
run-miner:
watchfiles "python neurons/miner.py --blacklist.force_validator_permit --netuid $(NETUID) --subtensor.$(SUBTENSOR_ENVIRONMENT) --wallet.name miner --wallet.hotkey default --axon.port 8091 --neuron.debug --logging.debug" .
run-validator:
watchfiles "python neurons/validator.py --netuid $(NETUID) --subtensor.$(SUBTENSOR_ENVIRONMENT) --wallet.name validator --wallet.hotkey default --axon.port 8092 --neuron.debug --logging.debug" .
## Docker commands
docker-build:
docker build -f Dockerfile.masa -t masa-subtensor .
docker-run:
docker run -d --name masa-subtensor -p 30333:30333 -p 9933:9933 -p 9944:9944 -p 9945:9945 -p 9946:9946 masa-subtensor
docker-run-remote:
docker run -d --name masa-subtensor -p 30333:30333 -p 9933:9933 -p 9944:9944 -p 9945:9945 -p 9946:9946 ghcr.io/masa-finance/subtensor:arm-latest
########################################################################
##### VALIDATOR API #####
########################################################################
test-profile:
curl -X GET "http://localhost:8000/data/twitter/brendanplayford" -H "Authorization: Bearer 1234"
########################################################################
########################################################################
## Helpful commands (generally don't run well on their own with Makefiles)
## because each line in recipe runs on its own shell invocation
activate-environment:
conda activate bittensor
bittensor-path-export:
export PYTHONPATH=$(BITTENSOR_PATH)
########################################################################
## Subtensor repo related commands (not needed here)
build-binary:
cargo build --release --features pow-faucet
run-localnet:
BUILD_BINARY=0 ./scripts/localnet.sh
## Hyperparameters and metagraph
hyperparameters:
btcli subnets hyperparameters --subtensor.$(SUBTENSOR_ENVIRONMENT) --netuid $(NETUID)
metagraph:
btcli subnets metagraph --subtensor.$(SUBTENSOR_ENVIRONMENT) --netuid $(NETUID)
########################################################################
##### DOCKER COMPOSE COMMANDS #####
########################################################################
.PHONY: up down build logs
pull:
$(DOCKER_COMPOSE) pull
up:
$(DOCKER_COMPOSE) up -d --pull always
down:
$(DOCKER_COMPOSE) down
build:
$(DOCKER_COMPOSE) build
logs:
$(DOCKER_COMPOSE) logs -f
# You can keep your existing docker commands or replace them with these:
docker-build:
$(DOCKER_COMPOSE) build
docker-up:
$(DOCKER_COMPOSE) up -d --pull always
docker-down:
$(DOCKER_COMPOSE) down