Bitcoin mining set difficulty
The target can be derived from it via a predefined formula. For example, if the packed target in the block is 0x1bcb, the hexadecimal target is. Note that the 0xcb value is a signed value in this format. The largest legal value for this field is 0x7fffff. To make a larger value you must shift it down one full byte. Also 0x is the smallest positive valid value. The highest possible target difficulty 1 is defined as 0x1d00ffff, which gives us a hex target of.
It should be noted that pooled mining often uses non-truncated targets, which puts "pool difficulty 1" at. Here's a fast way to calculate bitcoin difficulty. It uses a modified Taylor series for the logarithm you can see tutorials on flipcode and wikipedia and relies on logs to transform the difficulty calculation:.
To see the math to go from the normal difficulty calculations which require large big ints bigger than the space in any normal integer to the calculation above, here's some python:. Current difficulty , as output by Bitcoin's getDifficulty. There is no minimum target. The maximum difficulty is roughly: The difficulty is adjusted every blocks based on the time it took to find the previous blocks.
At the desired rate of one block each 10 minutes, blocks would take exactly two weeks to find. If the previous blocks took more than two weeks to find, the difficulty is reduced. If they took less than two weeks, the difficulty is increased.
The change in difficulty is in proportion to the amount of time over or under two weeks the previous blocks took to find.
Sep - As of 19th December , many difficulty charts, including the one above, seem to be displaying outdated data. We've posted a video explaining the cause of this here. Looking at the Blockchain chart above for the past 2 years, it definitely looks exponential; e. But the figures for the past 3 years don't do that, they vary significantly. In it took around 11 months for the difficulty to double, in early around 6 months, in late around 8 months and then in between months.
Rather than doubling at a consistent interval, it seems to vary based on factors like available hardware and public interest. What we're suggesting is that the rate Bitcoin difficulty is increasing is not fixed, and can be anticipated. Right now, in December , Bitcoin is very popular, with thousands of new investors and miners every day - so significant difficulty increases are to be expected. Many new people are interested in bitcoin mining, allowing hardware manufacturers to sell miners in larger quantities, causing more total hashpower to be available - driving Bitcoin difficulty up.
The key relationship here is that the amount of new hardware becoming available is strongly linked to the demand for it.
A risk is that if the people making these miners produce too many, the difficulty will rise so fast that Bitcoin mining profitability goes down massively. This occurred for Dash when the Antminer D3 came out. There are also scenarios that can cause Bitcoin's difficulty to decrease. August is a good example of this, where a lot of miners moved their hashpower to mine Bitcoin Cash as it was more profitable at the time. This decreased hashpower mining Bitcoin, causing Bitcoin's difficulty to decrease for 2 weeks.
If you stay up-to-date with these types of scenarios and mine the more profitable coins Bitcoin Cash in this scenario , you can get extra coins for 2 weeks and sell them immediately for a great return on investment or just HODL them! Another argument suggesting Bitcoin mining will remain profitable long-term is to look at it from the perspective of large mining operations.
If you were a miner running a large setup, and Bitcoin mining was to no longer be profitable, then you'd likely start mining something else that was. If there were no profitable coins for a long period of time, you'd likely have very high operating costs and be forced to shut down your operation eventually. For a smaller miner running just a few Antminers or some cloud mining, this would be less of an issue.
So in theory as long as Bitcoin stays popular and its price continues to increase, if you can get cheap electricity Bitcoin mining should always stay profitable. This last argument in particular is very speculative, so be aware that for a worst-case scenario if Bitcoin's price was to fall for a long-period of time, even if you had cheap electricity, there's a risk that mining it would no longer be profitable.
In June , the reward for Bitcoin mining will half. This could cause big issues in the long-term as it essentially makes it half as profitable overnight. So if miners are only making a small profit prior to this, they'll then be running at a loss just after it.
At this point open-ended contracts on sites like Genesis Mining will likely no longer be profitable although they might not even last that long.