- Install dependencies
yarn install
-
Copy
secrets.example.tstosecrets.tsand insert private keys for the accounts that have adequate balance for deploying and calling the smart contracts. -
Setup network:
npx hardhat run src/network-setup.ts
- Build contracts:
npx hardhat compile
- Deploy a contract (example):
npx hardhat run src/deploy.ts
-
Run the local BitTensor chain and wait until it builds and starts producing blocks
-
Send some testnet currency to your accounts in secrets.ts file:
npx hardhat run src/fill_accounts.ts
- Run tests
npx hardhat test
yarn installnpx hardhat compile- Launch a local network with ./scripts/localnet.sh
- Do preliminary setup 4.1
npx hardhat run src/fill_accounts.ts
npx hardhat run src/network-setup.ts
4.2 Set your subnetOwnerHotkey in src/deploy-subnet-manager.ts Important: It will become a neuron on the subnet with uid 0, so it is important to have the private key for it.
- Run the deploy script. It will deploy the contract and perform self-diagnostics.
npx hardhat run src/deploy-subnet-manager.ts
- Register validators
- Set netuid in src/register-validators.ts
- Fund validator coldkeys (Bob and Charlie for testing). Then execute
npx hardhat run src/register-validators.ts
- Set registrator and developer hotkeys in smart contract
- Set contract address in setup-keys.ts
- Set public keys for validaotrs in setup-keys.ts and run
npx hardhat run src/setup-keys.ts
- Wait until subnet owner emissions accumulate on the contract address and call distributeRewards in the contract
- The deploy script outputs the contract mirror address like this:
SS58 Mirror address of this contract: 5GBDecCfCQHfuaf16Gb9V13qwFiKJLGnfmoPm3EG2E2zj89x
This address will be the subnet owner coldkey. The subnet owner hotkey is set in step 4 (It is Dave for testing: 5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL) The hotkey can be monitored for subnet owner stake (which will be transferred by the distributeRewards method).
In order to distribute rewards:
- Fill the contract address in distribute-rewards.ts and run
npx hardhat run src/distribute-rewards.ts
- Setting hyperparameters (developer only)
- Run
npx hardhat run src/set-hyperparameters.ts
- Verify Kappa using Polkadot AppsUI
- Change blockTime in deploy-subnet-manager.ts script
- Set subnet identity parameter in deploy-subnet-manager.ts script