FPGA Cryptocurrency Miner - Department of Electrical and ... › ece › files ›...

Post on 08-Jun-2020

6 views 0 download

Transcript of FPGA Cryptocurrency Miner - Department of Electrical and ... › ece › files ›...

BackgroundAt its current rate, the Bitcoin networkalone, according to some of the most recentestimates, uses over 70 terawatt hours(TWh) of electricity per year – that’s enoughenergy to power over 6 million houses in theU.S. [1]. Hundreds of cryptocurrencies likeBitcoin use computationally intensivealgorithms – called hashing algorithms – togenerate and validate their transactionhistories, called their blockchains. CostlyApplication Specific Integrated Circuits, orASICs, reign supreme in industry when itcomes to sheer hashing performance.

ProblemCan anything be done about the high power

use of cryptocurrency networks?What happens if a fixed ASIC is not feasible for

a currency’s hashing algorithm??With the rampant expansion of crypto overthe past half-decade, and the high cost, hightime of development, and low wideimplementation of high-power ASIC minersacross currencies, there exists a need toimplement a low power, moderate efficiencyminer to outperform high-end GraphicsProcessor Units (GPUs) in times of ASICabsence.

Objectives Create an FPGA-based

cryptocurrency miner that is: Modular for ease of changing

currencies/high-level hashing algorithms. SHA-256 is an excellent, widely used algorithm.

Low power in order to be cost-feasible and scalable.

Superior to GPUs in order to reign supreme in performance when ASIC implementation is not feasible.

The SHA-256 AlgorithmWell documented and widely adopted - Federal Information Processing Standard (FIPS) 180-4 [2]Modular in nature - Lends itself to FPGA ImplementationFixed - Same SHA-256 block could be used in a variety of currencies

At a Glance See FIPS 180-4 Standard in [2]

• SHA-256 performs a series of computationally intensive operations to hash a message (usually the transaction history to be appended to the block chain)

• 3 Main Stages – Preprocessing, Message Scheduling, and Message Compression

• Preprocessing splits the message into exactly N 512 bit blocks (pad the final block with zeros) and setting the “Initial Hash Value”, also called the Initialization Vector, to a fixed value.

• Message Scheduling creates sixty four 32 bit message-dependent words by shifting, rotating and performing logical operations on message registers.

• Message Compression performs the actual hashing operation, where logical and register reassignment operations on eight 32 bit hash value registers iteratively (for 64 rounds!) compress the message schedule into a final 256 bit hash value of the original message.

Figure 1 – Block Diagram of MCF

Niko Carbonell [EE], Martin Martinez [EE], Michael Morton [EE], Zach Peterson [EE]Niko.Carbonell@UTDallas.edu, mem150330@UTDallas.edu, Michael.Morton@UTDallas.edu, zsp140030@UTDallas.edu

Erik Jonsson School of Engineering & Computer ScienceThe University of Texas at Dallas

A modular power-efficient approach to crypto-mining using the SHA-256 Hashing Algorithm

Faculty Advisor:Dr. Dinesh BhatiaUTDesign I: Summer 2018

FPGA Cryptocurrency Miner

Metrics and EthicsPerformance Metrics: Since this project aims to outperform top-tier GPUs (such as GTX 1080 TI) with less power consumption, and hash rates vary currency to currency, our only metric is to outperform or keep pace with the industry leading GPUs in terms of hashes per Watt (h/W) for our chosen currency.Ethics Statement: We did not infringe on any copyright in the making of this project, and cited all sources where others’ work was referenced.

Sources[1] “Bitcoin Energy Consumption Index.” Digiconomist, digiconomist.net/bitcoin-energy-consumption. Accessed 18 July 2018[2] FIPS 180-4, released 08/2015. Latest released version located at https://csrc.nist.gov/media/publications[3] Naik, Rahul P. “Optimising the SHA256 Hashing Algorithm for Faster and More Efficient Bitcoin Mining.” Department of Computer Science, UCL. Published 2 September 2013

Sample Cryptocurrency: Bitcoin and SHA-256

Figure 2 – High level implementation of the SHA-256 algorithm in Bitcoin [3]

At a High Level [3]

• Bitcoin block header relatively constant – only changes per block are nonce incrementation (potentially 232 attempts per block)

• Hash Merkle Root (assumed constant here) represents transactions to validate

FPGA Implementation - SDII

Figure 3 – High level block diagram of an FPGA cryptocurrency miner to be built in SDII

Bitcoin Version

Previous Block’s Accepted Hash

Current Hash Merkle Root

Time (since 1970)

Target Difficulty

Nonce

SHA-256First 512 Bits

SHA-256

Initial Hash Value Always Constant

Hash Output

Last 128 Bits SHA-256Hash Output Hash Accepted by Network?Final Hash Output

No

12.5 Bitcoin RewardYes

Increment Nonce