This project allows users to easily experiment with and discover the inner workings of mining on a low cost multi-purpose platform. Note that there are currently much faster and more powerful options available for bitcoin mining including FPGA arrays and ASICS. The purpose of the article and project is simply to introduce to the processes and algorithms used for bitcoin mining, not to make money. The knowlege, algorithms and processes can be taken to larger scale platforms if the user wishes to seriously pursue bitcoin mining
Bitcoin mining is part of the process in a bitcoin transaction. The transaction consists of some very hard number crunching. Bitcoin and Bitcoin mining topics go well beyond the scope of this article. Please have a look at the reference links available in the footer for more information regarding these complex topics. I will briefly explain in a very high level manner the process of bitcoin mining and show how and why it directly applies to FPGA’s, particularly the in conjunction with an embedded platform with web access such as the beaglebone or Raspberry Pi.
So what is bitcoin? Bitcoin is an experimental, decentralized digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Bitcoin is designed around the idea of using cryptography to control the creation and transfer of money, rather than relying on central authorities [1]. The more interesting aspects of bitcoin mining are in the details of the intricate protocols and algorithms being used that make up what is quickly being adopted as a new digital currency. Part of the beauty of the bitcoin protocol is that it uses technologies including encryption, hashing, client to client communication, all of which scream out for an FPGA implementation.
Most of the work involved in bitcoin transactions is in the mining. The key part of the transaction is in the verification process that authenticates the bitcoin transaction. The verification process awards effective bitcoin nodes (or "bitcoin miners") with a limited release of bitcoins and the transaction fees (if any). This process requires intense computing power, electricity, and significant investment as it solves hashes through brute-force to verify transactions and add them to the network's transaction log [1]. So part of the fun of mining is getting a reward equivalent to hard cash money! You might have noticed the words brute force and solving hashes. These are two more keywords that are just asking for an FPGA.
The process of bitcoin mining is no minor feat and this is why FPGA’s have been widely adopted for the task. The mining process, or proof-of-work process, involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. Once this hash has been found, the block can be considered as being solved and the transaction can be verified. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash [2]. You can go through the links below to see more details about the processing, but the bottom line is that you are looking for a diamond in the rough. So, get to that number crunching, as the faster you crunch the numbers the sooner you will have a chance to wield that bitcoin cash earned by the work of that handy dandy FPGA.
The reality of solving a “block” or successfully mining the correct hash is becoming harder and harder with the advent of bigger and better processing work horses. The trend has gone from crunching the numbers on high end FPGA’s to now being able buy a custom ASIC which is designed to increase the total number of hashes/sec calculated while reducing the power requirement from that of running PC’s, GPU’s or FPGA’s. But this should not discourage you from getting started with an FPGA, as there are now pools of miner’s which all work together to solve the “block” and then share the loot with all who were working on it. So, even the humble 2.5 Mega hash/sec, as found in this project, can get you in the game. You will have bragging rights of be saying you did it, but it probably won’t ever get you rich.
The bigger motivational factor should be to do it because you can. There is only one place to start in learning to work with FPGA’s and create cool and interesting projects. My vote is to start off with the basics, learn to work with a basic FPGA, learn the algorithms involved that have the potential of making you some digital cash, and most importantly have fun while you’re doing it!
The FPGA LOGi family has support for a bitcoin mining application that will get you up and running with a fully operational bitcoin miner in 10 cubic inches of hardware. The current hardware supported is the LOGi-bone in conjunction with the Beaglebone. You can simply extract and run the packaged application code or open and explore the open source project yourself, learn it, make modifications and then build and run your own custom version. After getting the application running, don’t forget to sit back and think, I just created my own bitcoin mining rig!
This mining project is based upon an existing open source hardware project that was customized and built to work on the LOGi family and Beaglebone. The project was created by Jonathan Piat. The LOGi team looks forward to porting the project to run on the LOGi-Mark1 and allow interfacing the Beaglebone, Raspberry Pi. When you are finished with the bitcoin minig project, don't throw out the board move onto the many other cool projects that the LOGi Family boards are capable of running, such as plug and play machine vision, Quadcopter, autonomous robot and many more. The LOGI team plans to continue working to make these projects as plug and play as possible, as was done with the mining application.
This demo shows how one can build a low power self contained mining platform using a Beaglebone and the Logibone cape. In this demo the Beaglebone executes a python client that Communicates with the mining pool to get share information and submit hashing results. A python class provides the interface to the Logibone to easily get/send information from/to the FPGA. The Logibone cape uses the GPMC interface of the Beaglebone and thus appear in the Beaglebone address space as a set of registers. These register provides information about the hashing status and an interface to write the share and read the result.
To run the demo:
1) Extract the logibone_mining_demo.tar.gz file to the beaglebone
2) Extract the tar.gz file (tar xzf logibone_mining_demo.tar.gz)
3) Go into the logibone_mining_demo folder
4) Add execution mode to the make_demo.sh script (chmod 777 make_demo.sh)
5) If you are running Ubuntu, edit make_demo to uncomment the “apt-get” lines and
comment the “opkg” lines (by default the demo runs on Angstrom)
6) Execute make_demo and follow the instruction (executing the script should take 2
minutes and the cape Led should be blinking)
Note: You will need to configure each mining worker to participate in a bitcoin mining pool You be given worker registration information username and password for each worker that can be used to configure your mining worker. There are many mining pool sites which can be referenced here: http://mining.bitcoin.cz/
LOGi Family overview and documentation
FPGA LOGi family overview Document
Video Overview of FPGA LOGi family and LOGi-Bone
Source Code repository containing the bitcoin miner and other projects:
Jonathan Piat Repository
Current Bitcoin Mining Source package to install and run for LOGi-Bone and Beaglebone:
http://valentfx.com/images/prj/logi/demo/logibone_mining_demo.tar.gz
Other projects coming for the LOGi Family:
FPGA LOGi Guides - Tutorials - Applications
References and further reading:
[1] https://en.bitcoin.it
[2] http://en.wikipedia.org/wiki/Bitcoin
http://www.npr.org/blogs/money/2011/08/24/138673630/what-is-bitcoin
http://codinginmysleep.com/bitcoin-mining-in-plain-english/