Mesos Bitcoin Miner
A Mesos framework that mines Bitcoin.
To run this framework, you need to have a Bitcoin daemon (
bitcoind) and a Mesos cluster running.
There are many ways to install
bitcoind; you should be able to easily find instructions online for your platform. For OS X, I usually just build it from source.
In order for the Mesos cluster to talk to your
bitcoind, you will need to configure your
bitcoind to enable RPC. The location of the bitcoind config file is platform-specific, but for OS X it's at:
If the file doesn't exist, go ahead and create it. You will need to set three fields:
rpcallowip. Here is how my config file looks like:
rpcuser=bitcoinrpc rpcpassword=BEBSruNHg14Tmz4D6X8qCjA22RCuoniDxovRCvPvGqS1 rpcallowip=0.0.0.0/0
rpcpassword can be arbitrary strings.
Note that for the purpose of the demo, I've set
rpcallowip to the entire IP space. This is highly insecure. In practice, you will most definitely want to set it to only allow for some specific IPs.
Once the config file is in place, run bitcoind in server mode:
bitcoind will now start downloading the blockchain. The framework will not work until the entire blockchain has been downloaded. Note that the blockchain is huge, so you might need to wait a while. To check how many blocks you have downloaded so far:
To set up a real Mesos cluster, refer to the official documentation.
Importantly, you need to make sure that you start your Mesos slaves with the Docker containerizer enabled, since we make use of Docker images in our framework. If you start the Mesos slaves manually, you can just set the environment variable
docker. Otherwise, you might need to modify the config files under
In the end, you should obtain the IP address and port where the Mesos master is running on. They are needed to run the framework.
You need to have Go installed. Then in this directory:
go get github.com/tools/godep # only if you don't have godep installed already godep go build scheduler.go
Now you should have a binary called
scheduler inside the directory.
./scheduler -master="<address of mesos master>" -bitcoind_address="<address of your bitcoin daemon>" <your bitcoin RPC username> <your bitcoin RPC password>
For example, in my local setup, I run:
./scheduler -master="172.31.1.11:5050" -bitcoind_address="172.31.2.1" bitcoinrpc BEBSruNHg14Tmz4D6X8qCjA22RCuoniDxovRCvPvGqS1
Note that the
bitcoindAddress is the IP address of your
bitcoind from the perspective of the Mesos cluster.
With the rise of GPUs and ASICs, mining Bitcoin using raw CPUs has been unprofitable for the past few years. Therefore, this project is probably only useful for time travellers from 2011 or before. Although now that I think about it, Mesos didn't even exist before 2011, so even time travellers wouldn't be able to use it. Sorry guys.