How to Set Up a Mosaic Miner on Windows Using WSL

In this guide, we'll walk through setting up a Mosaic Miner on Windows using the Windows Subsystem for Linux (WSL). This step-by-step tutorial will guide you through installing the necessary tools, configuring your system, and setting up your very own Mosaic miner. Let's get started!

May 24, 2024 - 16:26
Oct 15, 2024 - 07:44
 58
How to Set Up a Mosaic Miner on Windows Using WSL
Windows Using WSL in COMAI

1. Setting Up Windows Subsystem for Linux (WSL)

To follow along with this tutorial, I highly recommend opening our GitHub guide (link in the description) for easy reference. Now, let’s set up WSL:

  • Open PowerShell with admin rights.
  • Set the default version of WSL, update it, and install WSL version 2.
  • Once that's done, you can install Ubuntu and set up your username and password.

Once Ubuntu is ready, exit it and start it again from the Start menu to ensure it runs properly.


2. Install the CUDA Toolkit

To ensure that WSL and CUDA work smoothly together, follow the instructions below:

  • Add the necessary repository and update the package list.
  • Install the CUDA toolkit (note that this might take a while).

With CUDA installed, you're now ready to move on to Docker.


3. Install Docker on Ubuntu

Before installing Docker, uninstall any conflicting versions:

  • Add the official Docker GPG key and install the required certificates.
  • Add the Docker repository to your apt sources, update the package list, and install Docker.

Make sure to add the user to the Docker group. To verify that Docker is installed correctly, run docker hello-world.


4. Install NVIDIA Container Toolkit

Now, let’s install the NVIDIA container toolkit to support your GPU:

  • Configure the repository (you can use experimental packages if preferred).
  • Update the package list and install the NVIDIA container toolkit.

5. Set Up Dependencies and CommonX

Before proceeding, install dependencies, update the path, and modify your bashrc file if necessary. Afterward, restart your shell and ensure CommonX is functioning correctly.

Test it by listing all modules on subnet 14 using the following command: --netuid 14.


6. Creating a Key for Your Miner

Now, create a key for your miner or regenerate one from an existing seed phrase:

  • Type commonx keys create and name your key (e.g., “mykey”).

For extra caution, retrieve the seed phrase by typing:
commonx keys show --show-private.


7. Clone the Mosaic Repository

Clone the Mosaic repo and enter the Poetry shell:

  • Type poetry shell followed by poetry install to install dependencies.

Check the public IP of your miner and save it.


8. Register Your Miner

Open Notepad and prepare the necessary command by:

  • Changing the module name, key, IP address, and port number.

Paste it into Ubuntu, and if you’re registering your module, ensure to answer "yes" to register it. Don't forget the burn fee, which fluctuates based on network usage.


9. Testing the Miner

To ensure your miner works properly:

  • Modify your host value to 0.0.0.0 to allow all validators to send requests to your miner.
  • Copy and paste the prepared command into Ubuntu and run it.

Once you see requests coming in, your Mosaic miner is officially up and running!


10. Setting Up Docker

The Mosaic team has made it easy to set up Docker:

  • After stopping the miner (Ctrl+C), restart the Docker service.
  • Update the key name, host, and port in Notepad, then paste it into Ubuntu.

To check logs, first find the container ID (docker ps -a), then use docker logs to check the latest output. If you want to see live logs, use docker logs --follow .


11. Enable Auto-Upgrade

Finally, enable auto-upgrade to periodically check for the latest Mosaic Docker image, restart containers, and keep everything up to date. You can find this option at the bottom of the GitHub guide.


Conclusion

Congratulations! You’ve successfully set up your very own Common AI Miner on the Mosaic subnet. Now your miner is ready to handle requests from validators across the globe. Great job!

If you enjoyed this guide and found it helpful, please don’t forget to hit the like button. It helps us a lot. Until next time, keep learning and exploring!

 
Source : @Eden.