How to Set Up a Mosaic Miner on Windows Using WSL

Today I’ll walk you through setting up a Mosaic Miner on Windows using the Windows Subsystem for Linux (WSL). Let’s dive right in!

May 21, 2024 - 16:20
Oct 15, 2024 - 07:47
 65
How to Set Up a Mosaic Miner on Windows Using WSL
Set Up a Mosaic Miner on Windows : COMAI

Step-by-Step Guide to Installing and Running a Mosaic Miner

1. Open the GitHub Guide

The easiest way to follow along with this tutorial is by opening our GitHub guide (link in the description). It contains all the necessary commands and steps, ensuring a smooth setup process.

2. Set Up WSL and Install Ubuntu

Start by opening PowerShell with administrative rights. From here, we’ll:

  • Set the default version of WSL to version 2
  • Update WSL
  • Install Ubuntu

Once completed, set your username and password. When Ubuntu opens, exit the terminal and relaunch it from the Start menu shortcut for proper initialization.

3. Update the System and Ensure Compatibility

Use the commands from our GitHub guide to quickly update your operating system. It’s essential to ensure that WSL and CUDA work together seamlessly. Simply copy and paste the commands one at a time, following the prompts.

4. Install the CUDA Toolkit

After adding the necessary repositories and updating the package list, proceed to install the CUDA toolkit. Keep in mind that this installation may take some time, so be patient.

5. Installing Docker

Next up is Docker. Before proceeding, uninstall any conflicting Docker versions that might already be on your system. Then, follow these steps:

  • Add the official Docker GPG key
  • Install the necessary certificates
  • Add the Docker repository to your sources list
  • Update the package list and install Docker

Once installed, make sure your user is added to the Docker group. Verify the installation by running the docker hello-world command.

6. Setting Up the NVIDIA Container Toolkit

Now, let’s configure the repository and install the NVIDIA container toolkit. Afterward, install the remaining dependencies and update your system’s PATH. This ensures everything runs smoothly. Be sure to add any necessary lines to your .bashrc file.

7. Restart the Shell

After installing Poetry (and other dependencies), restart your shell to make sure all settings take effect. Then, test if Common X is working properly by listing all the modules. Since Mosaic operates on subnet 14, use the --netuid 14 flag to list the modules on that subnet.

8. Creating a Key for Your Miner

Next, create a new key for your computer. You can either generate a new key or regenerate one using a seed phrase. In this tutorial, we’ll create a new one by typing commonx keys create followed by the name of your key.

9. Cloning the Mosaic Repository

Clone the Mosaic repository and navigate to the Mosaic subnet folder. Then, enter the Poetry shell by typing poetry shell and run poetry install to install all the necessary dependencies.

10. Preparing Your Miner

Now, prepare the commands to register your miner. Open Notepad, paste the command, and make necessary changes such as:

  • Module name
  • Key
  • Public IP
  • Port number

Once updated, copy the command and paste it into Ubuntu. If you haven’t registered a module yet, select yes when prompted.

11. Testing the Miner

To test if your miner is running properly, prepare the host value to allow all validators to send requests. Use the address 0.0.0.0 and the port number you registered. Copy the command into Ubuntu and let the miner run.

Your miner should now be operational! You’ll see requests start to come in.

12. Setting Up Docker for Mosaic Miner

Although your miner is up and running, you can take it one step further by setting it up in Docker. The Mosaic team has made this process very easy. Here’s how:

  • Press Ctrl+C to stop the miner
  • Clear the screen
  • Restart the Docker service (if you haven’t rebooted after the installation)

Use Notepad to prepare the necessary Docker commands. Update the key name, host, and port, then copy and paste the command into Ubuntu.

13. Viewing and Following Docker Logs

To check the logs of your miner, find the container ID by typing docker ps -a. Copy the ID, then type docker logs to view the latest logs. For continuous output, use the docker logs --follow command to tail the logs in real time.

14. Enabling Auto-Upgrade for Docker Containers

You can enable auto-upgrade to automatically check for the latest Mosaic Docker image, pull it, and restart your containers with the new image. This option is located at the bottom of our GitHub guide.


Conclusion

Congratulations! You’ve successfully set up your very own Common AI Miner on the Mosaic subnet using Windows and WSL. You’re now ready to receive validator requests and run a fully functional miner.

If you found this guide helpful, don’t forget to hit the like button and subscribe for more tutorials. Until next time, keep learning and exploring!



Source : @Eden.