Skip to main content

Test Collateral in Test Network

This page is for owner and miner who want to test collateral contract in Bittensor test network.

1. Deploying a Collateral Contract (Owner only).

You can skip this if you're a miner only.

Step 1: Install Foundry.

curl -L https://foundry.paradigm.xyz | bash  
source /home/ubuntu/.bashrc # Or start a new terminal session
foundryup
forge --version

Step 2: Clone celium-collateral-contract GitHub repo.

git clone https://github.com/Datura-ai/celium-collateral-contracts.git

Step 3: Install project dependencies.

pdm install

Step 4: Install node dependencies.

npm install

Step 5: Deposit some TAO to the SS58 address that corresponds to your ETH address.

Step 5.1. Get SS58 Address from your ETH address.

export OWNER_ETH_ADDRESS="<replace-with-your-eth-address>"
export PYTHONPATH=celium_collateral_contracts
pdm run python -c "from address_conversion import h160_to_ss58; print(h160_to_ss58('$OWNER_ETH_ADDRESS'))"

Step 5.2. Get SS58 address from the above commands and transfer TAO to that address.

btcli w transfer --dest="ss58-address-from-above-commands"

Step 6: Build and Deploy a contract.

bash build.sh
rm -rf deployments.json
export RPC_URL="https://test.finney.opentensor.ai"
export PRIVATE_KEY="<replace-with-your-eth-private-key>"
export MIN_COLLATERAL_INCREASE=1000000000000000
export DENY_TIMEOUT=3600
export NET_UID=1
bash deploy.sh

2. Deploying a Miner and Deposit Collaterals

We assume you have a EVM-compatible wallet and have balance to deposit in TAO network. Check out 4.1. Prepare an EVM-Compatible Wallet

Step 1: Clone a GitHub repo.

git clone https://github.com/Datura-ai/compute-subnet.git
cd compute-subnet/neurons/miners
cp .env.template .env

Step 2: Update .env file properly.

  • COLLATERAL_CONTRACT_ADDRESS: Need to be collateral contract address which is deployed on test network. Don't set it for main network since we provide collateral contract address of main network.
  • BITTENSOR_NETUID: 37
  • BITTENSOR_NETWORK: test
  • Set other env files - BITTENSOR_WALLET_NAME, BITTENSOR_WALLET_HOTKEY_NAME, EXTERNAL_IP_ADDRESS, INTERNAL_PORT

Step 3: Run a docker container with dev docker images.

docker compose -f docker-compose.app.dev.yml up -d

Step 4: Add executors and deposits for your executors. While adding your executors, use our validator hotkey in test network: 5GZ9Sq7XEzUHVwY9ibnzFvRvXR2touSqLLje75pgrgAbJQXG.

Command list for setting up executors can be found here