Bitcoin & Litecoin Proxy Mining on Mac OS X

Bitcoin

When it comes to mining Bitcoins and Litecoins there are two major protocols involved: the older Getwork protocol and the newer Stratum protocol. At this point the Stratum protocol has all-but-replaced the Getwork protocol. All major mining pools and mining software support Stratum and Getwork is deprecated.

This is usually not a problem, however some older mining utilities (for example the Litecoin CPU miner) do not have Stratum support. And some pools, such as Slush’s Bitcoin pool or WeMineLTC, have limited-to-no support for Getwork. This is where a very nice Python utility called the Stratum Mining Proxy can help.

You can use the Stratum Mining Proxy on any computer to connect to your desired Bitcoin or Litecoin pool. Then you can connect your mining software to the IP address of the computer the proxy mining software is running on. All of the Getwork network requests from the mining software will be reshaped into the Stratum protocol and then forwarded on to the mining pool.

Installing the Xcode Command Line Tools

In order to install the mining proxy you’ll need a set of command line utilities for compiling software. You have two options:

  1. Install Xcode for free from the App Store and then use Xcode to install the Command Line Tools package
  2. Install only the Command Line Tools package from an unofficial (non-Apple) source

If you would rather play it safe and stick to as many trusted sources as possible, or if you plan to make use of the Xcode IDE, go with the first option. If you’d rather save some disk space and don’t mind using a widely used – if unofficial – source, go with option two.

Option 1: Install Xcode and Command Line Tools

To get started using this option you will need to install the Xcode. Xcode is a free download from the Apple App Store.

Xcode on App Store

Next you’ll use Xcode to install the Command Line Tools. Launch Xcode and then click the Xcode>Preferences menu item. Click the Downloads tab and then click Install next to Command Line Tools.

Xcode Downloads

If the text next to Xcode Command Line Tools says Installed, carry on to the next step.

Option 2: Install just the Command Line Tools

If you would like to install only the GCC Command Line Tools you can download the package for your version of OS X here.

Standalone GCC Installer

Simply run the setup package after downloading and step through the installer.

Downloading the Mining Proxy

The original Stratum Mining Proxy project was created by Slush, who also runs one of the more popular mining pools and is very involved in the Bitcoin community and development, from proposing the concept of pooled mining to proposing the Stratum protocol.

However his original project is for Bitcoin miners and pools only. In order to support both Bitcoin and Litecoin mining you’ll want to refer to this fork which includes support for the scrypt algorithm used by Litecoin. You can either download the latest source as a zip file or use Git to clone the repository.

Installing Scrypt (Litecoin) Support

If you downloaded a zip file of the mining proxy source rather than using Git to clone the repository, extract the zip file contents by double-clicking.

Next, open Terminal.app from the Applications folder or using Spotlight. Use the cd command to navigate to the mining proxy source. For instance, if you downloaded the source as a zip file:

cd ~/Downloads/stratum-mining-proxy-master

Next, change directory to the Litecoin scrypt module:

cd litecoin_scrypt

Finally, install the scrypt module for Litecoin support:

sudo python setup.py install

Installing the Stratum Mining Proxy

Now, in the Terminal app window change the working directory back up to the root of the mining proxy source:

cd ..

And finally install the mining proxy:

sudo python setup.py install

Install Mining Proxy

Using the Mining Proxy

Once the mining proxy is installed, using it is fairly straight forward. Normally your Bitcoin or Litecoin miner connects to a host and port with a specific username and password. For instance:

minerd -o http://pool-host:pool-port -u pool-username -p pool-password -t thread-count

With the mining proxy you’ll want to first run the proxy itself, connecting to the pool’s host and port:

mining_proxy.py -nm -o pool-host -p pool-port

If you are mining Litecoins, use the -pa parameter:

mining_proxy.py -nm -pa scrypt -o pool-host -p pool-port

Mining Proxy Output

Then run your miner, but specify your computer’s IP address and the port number reported by the mining proxy output:

minerd -o http://your-ip:port-from-output -u pool-username -p pool-password -t thread-count

Mining Proxy Output - Clients

Other Benefits

There are a couple of other benefits of the Stratum Mining Proxy that are worth noting:

  1. The mining proxy supports both Getwork and Stratum clients. This means you can use the proxy to consolidate network traffic regardless of the mining protocol.
  2. Using the mining proxy gives you a simple way to get a heads-up view of which machines are alive and which are submitting accepted work by referring to the Terminal output.

Resources

To learn more about mining Bitcoins and Litecoins on OS X, see my previous blog posts:

Bitcoin Mining – Part 1
Bitcoin Mining – Part 2
Bitcoin Mining – Part 3
Litecoin Mining – Part 1
Litecoin Mining – Part 2

Advertisements

One thought on “Bitcoin & Litecoin Proxy Mining on Mac OS X

  1. Pingback: Litecoin Mining on Mac OS X – CPU Mining | blog.nwoolls.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s