Approximate Bitcoin Mining

Approximate Bitcoin Mining

Approximate Bitcoin Mining Matthew Vilim Henry Duwe Rakesh Kumar University of Illinois at University of Illinois at University of Illinois at Urbana-Champaign Urbana-Champaign Urbana-Champaign [email protected] [email protected] [email protected] ABSTRACT Bitcoin resolves this problem and guarantees consensus of Bitcoin is the most popular cryptocurrency today. A bedrock ownership by maintaining a public ledger (Section 2.1) of all of the Bitcoin framework is mining, a computation intensive transactions, called the blockchain [11]. New transactions process that is used to verify Bitcoin transactions for profit. are grouped together and are checked against the existing We observe that mining is inherently error tolerant due to its history to ensure all new transactions are valid. embarrassingly parallel and probabilistic nature. We exploit Bitcoin's authenticity is assured by those who contribute this inherent tolerance to inaccuracy by proposing approxi- computation power to its network (known as miners) to ver- mate mining circuits that trade off reliability with area and ify and append transactions to a public ledger. Miners' will- delay. These circuits can then be operated at Better Than ingness to lend their computation power to the network, typ- Worst-Case (BTWC) to enable further gains. Our results ically in the form of ASICs dedicated to mining, in exchange show that approximation has the potential to increase min- for reward (profit) is critical to the security and survival of ing profits by 30%. Bitcoin. In this paper, we observe that Bitcoin mining is a suitable candidate for approximate computing. As we demonstrate, CCS Concepts Bitcoin mining is intrinsically resilient to errors; its parallel •Hardware ! Fault tolerance; nature minimizes the propagation of errors incurred while searching for a solution, and Bitcoin's distributed verifica- tion system detects and invalidates any potentially erroneous Keywords solutions. As such, a Bitcoin mining ASIC can be built out Bitcoin; SHA-256; Approximate Computing; Error-Tolerance of approximate circuits that trade off circuits' reliability for reduced delay and area; an appropriate approximate circuit 1. INTRODUCTION will maximize profit even when producing results that are not guaranteed to be correct. The Bitcoin cryptocurrency provides a decentralized and We propose two forms of approximation. Functional ap- distributed method of verifying monetary transactions be- proximation is performed by replacing circuits with approx- tween trustless parties1. Although cryptocurrencies had been imate versions to reduce area or delay. The reclaimed tim- proposed previously, Bitcoin was the first to provide a truly ing slack may then be used to raise frequency and increase trustless solution. Unlike a traditional monetary system throughput. Operational approximation is performed by re- which is issued and backed by a single entity, Bitcoin requires ducing guard bands and running the circuit with negative no central administrator nor trust between participants. timing slack (i.e. at an even higher frequency), allowing occa- Traditionally, the difficulty in creating a distributed cur- sional timing failures and Better Than Worst-Case (BTWC) rency is the need for a scheme to prevent double spending. operation. Our results show a 30% increase in mining profit One party might simultaneously broadcast two transactions, from these approximation techniques. sending the same coins to two separate parties on the net- work; but without a central server to arbitrate both transac- tions and decide which is valid, disagreement arises over the 2. BITCOIN MINING true history and ownership of a given coin. Created in 2008, 2.1 Overview 1At the time of this writing, Bitcoin's market capitalization is $5.5 billion USD. To maintain the validity of transactions in the Bitcoin network, there must be an incentive to contribute to verify- ing transactions within the blockchain. Bitcoin provides this Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed incentive by rewarding miners who contribute with new bit- for profit or commercial advantage and that copies bear this notice and the full cita- coins for every block created. Without miners, new transac- tion on the first page. Copyrights for components of this work owned by others than tions cannot be added to the public ledger, and Bitcoin will ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or re- publish, to post on servers or to redistribute to lists, requires prior specific permission not function. The mining process is summarized in Figure 1. and/or a fee. Request permissions from [email protected]. Mining consists of searching for a cryptographic nonce value DAC ’16, June 05-09, 2016, Austin, TX, USA within a block such that the hash of the block falls within a c 2016 ACM. ISBN 978-1-4503-4236-0/16/06. $15.00 certain range. The network scales the range to maintain an DOI: http://dx.doi.org/10.1145/2897937.2897988 average rate of one new block every ten minutes. • Σ0(x) ≡ x o 2 ⊕ x o 13 ⊕ x o 22 Figure 1: Mining Process Block Diagram • Σ (x) ≡ x 6 ⊕ x 11 ⊕ x 25 block header 1 o o o • σ (x) ≡ x 7 ⊕ x 18 ⊕ x 3 nonce 0 o o • σ1(x) ≡ x o 17 ⊕ x o 19 ⊕ x 10 H(0) SHA-256 SHA-256 threshold Algorithm 2 SHA-256 1: function SHA-256(M) digest SHA-256 comparator 2: for i from 0 to N − 1 do 3: for j from 0 to 15 do (i) solution? 4: Wj = Mj 5: end for 6: for j from 16 to 63 do As a result, miners naturally compete against each other 7: Wj = σ1(Wj−2) + Wj−7 + σ0(Wj−15) + Wj−16 to gain a higher fraction of the network's hash rate in or- 8: end for der to maximize reward. In a race to capture the network's rewards, miners have developed increasingly sophisticated 9: for j from 0 to 63 do solutions, culminating in the development of Bitcoin ASIC 10: t0 h + Σ1(e) + Ch(e; f; g) + Kj + Wj accelerators [13]. A miner's revenue is determined by the 11: t1 Σ0(a) + Maj(a; b; c) accelerator's hash rate (GHash=s); operating costs are de- 12: h g; g f; f e; e d + t1 termined by its energy efficiency (GHash=J). 13: d c; c b; b a; a t1 + t2 The mining algorithm is shown in Algorithm 1. In short, (i) (i−1) (i) (i−1) mining is a search for the nonce value that results in a double 14: H0 H0 + a; H1 H1 + b SHA-256 hash digest (Algorithm 2) value less than a given (i) (i−1) (i) (i−1) 15: H2 H2 + c; H3 H3 + d threshold. The nonce is a 32-bit field within a 1024-bit block 16: H(i) H(i−1) + e; H(i) H(i−1) + f header. In order to verify transactions at a steady rate, 4 4 5 5 17: H(i) H(i−1) + g; H(i) H(i−1) + h this threshold varies over time as a function of difficulty 6 6 7 7 18: end for D(t). Difficulty is adjusted by the network regularly such 19: end for that a solution is expected to be found approximately every 20: return H(N−1) 10 minutes, regardless of the network's collective hash rate. 21: end function By their very nature, hash functions are designed to be non-invertible, so mining is performed by brute force, guess- ing nonce values and comparing the hash output. This task is perfectly parallel as multiple hashes may be computed at 2.2 Related Work once. It follows that one's probability of finding a solution Although some work has been done to improve the per- is proportional to one's hash rate. The first miner to find a formance of SHA-256 ASICs in context of other applica- valid nonce broadcasts the value on the network for verifica- tions [6] [10], no published research, to the best of our knowl- tion and is rewarded with newly minted digital (bit)coins. edge, attempts to optimize ASICs for Bitcoin mining. The most closely related work is by Courtois et al. [5] who ex- Algorithm 1 Mining Process plore mining optimizations from an algorithmic perspective. 1: nonce 0 Their central observation is that the first half of the block 2: while nonce < 232 do header (shown in gray in Figure 1) does not change across 3: threshold ((216 − 1) 208)=D(t) nonce iterations, so its hash may be precomputed. Since 32 4: digest SHA-256(SHA-256(header)) this precomputation cost is amortized across 2 nonce iter- 5: if digest < threshold then ations, it halves the cost of the first SHA-256 round (shown 6: return nonce within the dashed line in Figure 1). Our paper is the first 7: else work to explore hardware optimizations, specifically approx- 8: nonce nonce + 1 imation-based optimizations theorized by [8], unique to Bit- 2 9: end if coin mining . 10: end while 2.3 Baseline Hardware Algorithm 2 presents a basic description of SHA-256. For 2.3.1 Implementation details on message padding, initial hash values H(0), and For our studies, we selected as baseline the SHA-256 ASIC constants Kj , see [12]. design outlined by Dadda et al. [6]. A summary of SHA-256 • The message M is divided into N 512-bit blocks is provided in Algorithm 2. The hashing core in this design is M (0);M (1);:::;M (N−1). Each of these blocks is fur- implemented as two parallel pipelines, the Compressor (Line ther subdivided into 16 32-bit words M (i);M (i);:::;M (i).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us