Visualizing Bitcoin Mining On Real Fpga Hardware!

Made by Dave

About the project

This is an FPGA-based Bitcoin miner for educational purposes.

Project info





Digilent, Xilinx

Estimated time:

2 weeks


31st January 2018

Items used in this project

Hardware components

PmodOLEDrgb x 1
Nexys 4 DDR FPGA x 1

Software app and online services

Xilinx Vivado


Cryptocurrencies are getting more and more of a big deal nowadays.

But very few people really understand how everything works on the technical side.

Almost every cryptocurrency involves so-called 'mining' as an essential part, which in reality means hashing a specific set of data as quickly as possible, then checking how much leading zeroes the hash contains and then changing the base data a tiny bit ('nonce') and hashing that again. This is repeated until a specific number of leading zeros are achieved. 

We could go more in detail, but this is essentially what happens when you 'mine' e.g. Bitcoin.

As Bitcoin / BTC is the largest and most well - known cryptocurrency, I focused on its hashing algorithm which is called SHA256.

Hashing algorithms can be executed on any processor, but involve a lot of subsequent instruction and computation cycles, making them pretty slow at this task. 

So, to be faster than the competition and to earn the 'block reward', you'll want to build a chip that is made specifically to execute the chosen algorithm as fast as possible. This is what's called an 'ASIC' (e.g. ASIC miners).

The issue here is that an ASIC - whie being faster than a reconfigurable FPGA chip - is fixed, only specific for the application it's made for and it is extremely expensive to manufacture. Also, it doesn't offer much insight after being produced and bought by a consumer.

My vision was to create a hardware design (that could be used to produce an ASIC) that's made to run on an FPGA, which means the SHA256 algorithm is not going to be ran on a CPU, but instead on an array of logic blocks that can afterwards be reconfigured differently for an other project, for example, while still being much faster than most regular processors.

First, I created a design using Bluespec Verilog / BSV and then re-created it in System Verilog, which I just like a little bit more.

Also, my System Verilog project includes an interface to a screen so you can see the computed hashes in real-time and - as far as I know being the first open source implementation of a Bitcoin miner in hardware - can be modified, improved and hacked around with by anyone interested!


This is not the final code yet. The algorithm is fully functional and able to verify blocks by hashing their 80-byte header as specified in the Bitcoin protocol. Next step is to either add a USB controller, so the PC supplies the data to be hashed, or have the hardware logic itself modify the nonce, re-hash and check for leading zeroes itself.


Leave your feedback...