Hashrate

From BitcoinWiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search
Hashrate Bitcoin network h/s

Hashrate (Hash per second, h/s) is an SI-derived unit representing the number of double SHA-256 computations performed in one second in the bitcoin network for cryptocurrency mining. Hashrate is also called as hashing power. It is usually symbolized as h/s (with an appropriate SI prefix).

What is hashing power or hash rate?[edit]

The hash rate is the primary measure of a Bitcoin miner's performance. In 2014, a miner's performance was generally measured in Ghash/s, or billions of hashes per second.

The hash/second unit is also part of a common measure of a Bitcoin miner's electric efficiency in the term watts /Ghash/s, denoted as W/Ghash/s. As 1 watt is equal to 1 joule/s, this measure can also be expressed as J/Ghash, or joules per 1 billion hashes.

Bitcoin network hash rate[edit]

Bitcoin network hashrate chart

The hash/s is also used in calculations of the Bitcoin network's overall hash rate. Because each miner or mining pool only relays a solved block to the network, the overall hash rate of the network is calculated based on the time between blocks. While not an accurate measure of network hash rate at any given instance in time, measurements over longer periods can be considered indicative and similar calculations are used in Bitcoin's difficulty adjustment.

In January 2015, the network hash rate was around 300 Phash/s, or 300 quadrillion hashes per second.

If you compare a bitcoin mining device to one that is designed to mine, for example, Ethereum, you will notice a very large apparent difference in hash rates. This is because there are many different algorithms that cryptocurrencies use. They all require different amounts of memory and computing power in order to be mined. To put it simply, bitcoin and its SHA256 algorithm is considered by today standards to be relatively easy to compute. As a result, a mining device that is still relevant today would need to produce hashes in the terahash range and up.

If we were to compare this to Ethereum, you’ll find that most modern Ethereum mining devices (typically GPU’s) operate in the megahash range.

At first glance, you may think that the bitcoin mining device is significantly more powerful or more productive. While it’s true that it produces more hashes (of the SHA256 variety), this is because bitcoin hashes are easier to produce computationally. As a consequence, the network difficulty is significantly higher for bitcoin. To make things even more confusing, some cryptocurrencies intentionally chose algorithms that can only be mined using a basic CPU. As a result, mining devices for this network that can produce hundreds of hashes per second are considered to be high and very competitive.

So what does all this mean? Basically, it means that looking at the hash rate alone doesn’t necessarily tell you the effectiveness of the miner. You also need to understand the network difficulty, and what the norm is for most mining devices for that particular cryptocurrency.

How can I calculate how many hashes I generate per second?[edit]

Your problem breaks down nicely into 3 separate tasks [1]

  • Sharing a single count variable across threads
  • Benchmarking thread completion time
  • Calculating hashes p/sec
  • Sharing a single count variable across threads

Hash rate calculator[edit]

Now that we know that not all hashes are the same we need to know how to calculate the estimated profitability of a miner based on its hash rate. For this, will need to use a mining profitability calculators, they are available in the Internet.

public static class GlobalCounter

 {
   public static int Value { get; private set; }
   public static void Increment()
   {
       Value = GetNextValue(Value);
   }
   private static int GetNextValue(int curValue)
   {
       return Interlocked.Increment(ref curValue);
   }
   public static void Reset()
   {
       Value = 0;
   }
 }

Before you spin off the threads call GlobalCounter.Reset and then in each thread (after each successful hash) you would call GlobalCounter.Increment - using Interlocked.X performs atomic operations of Value in a thread-safe manner, it's also much faster than lock.

Benchmarking thread completion time

var sw = Stopwatch.StartNew();
Parallel.ForEach(someCollection, someValue =>
 {
   // generate hash
   GlobalCounter.Increment();
 });
 sw.Stop();
Parallel.ForEach will block until all threads have finished

Calculating hashes per second

...
sw.Stop();
var hashesPerSecond = GlobalCounter.Value / sw.Elapsed.Seconds;

How is the hash rate measured?[edit]

Hash rate is a unit measured in hashes per second or h/s and here are some usual denominations used to refer it.

Hash rate denominations:

  • 1 kH/s is 1,000 (one thousand) hashes per second;
  • 1 MH/s is 1,000,000 (one million) hashes per second;
  • 1 GH/s is 1,000,000,000 (one billion) hashes per second;
  • 1 TH/s is 1,000,000,000,000 (one trillion) hashes per second;
  • 1 PH/s is 1,000,000,000,000,000 (one quadrillion) hashes per second;
  • 1 EH/s is 1,000,000,000,000,000,000 (one quintillion) hashes per second.

Common Hash rate Conversions:

  • 1 MH/s = 1,000 kH/s;
  • 1 GH/s = 1,000 MH/s = 1,000,000 kH/s;
  • 1 TH/s = 1,000 GH/s = 1,000,000 MH/s = 1,000,000,000 kH/s.

See Also on BitcoinWiki[edit]

Sources[edit]

http://bitcoin.it/
https://www.codesd.com