- What is Bitcoin Mining Difficulty
- What is Bitcoin Mining Difficulty?
- The Computationally-Difficult Problem
- The Bitcoin Network Difficulty Metric
- The Block Reward
- Difficulty
- Contents
- What is «difficulty»?
- How often does the network difficulty change?
- What is the formula for difficulty?
- How is difficulty stored in blocks?
- How is difficulty calculated? What is the difference between bdiff and pdiff?
- What is the current difficulty?
- What is the maximum difficulty?
- Can the network difficulty go down?
- What is the minimum difficulty?
- What network hash rate results in a given difficulty?
- How soon might I expect to generate a block?
- Difficulty in Mining
- Contents
- Bitcoin mining difficulty [ edit ]
- Storing cryptocurrency difficulty in blocks [ edit ]
- Maximum, current and minimum difficulty [ edit ]
- Difficulty changes [ edit ]
- What is the current difficulty? [ edit ]
- What is the maximum difficulty? [ edit ]
- Can the network difficulty go down? [ edit ]
- What is the minimum BTC difficulty? [ edit ]
- What network hash rate results in a given difficulty? [ edit ]
- How soon might I expect to generate a block? [ edit ]
- Сложность майнинга Биткоина (Bitcoin Mining Difficulty): обзор, как узнать и рассчитать, графики сложности, влиянение на курс
- Текущая сложность и графики
- Что такое сложность майнинга Биткоина
- Для чего нужна сложность
- Как изменяется сложность
- Какие факторы влияют на сложность
- Как рассчитывается сложность
- Как связаны сложность, цена на биткоин и выгодность майнинга
- Вывод
What is Bitcoin Mining Difficulty
What is Bitcoin Mining Difficulty?
The Computationally-Difficult Problem
Bitcoin mining a block is difficult because the SHA-256 hash of a block’s header must be lower than or equal to the target in order for the block to be accepted by the network.
This problem can be simplified for explanation purposes: The hash of a block must start with a certain number of zeros. The probability of calculating a hash that starts with many zeros is very low, therefore many attempts must be made. In order to generate a new hash each round, a nonce is incremented. This is based on the hashcash function.
The Bitcoin Network Difficulty Metric
The Bitcoin network difficulty is the measure of how difficult it is to find a new block compared to the easiest it can ever be. It is recalculated every 2016 blocks to a value such that the previous 2016 blocks would have been generated in exactly two weeks had everyone been mining at this difficulty. This will yield, on average, one block every ten minutes.
As more miners join, the rate of block creation will go up. As the rate of block generation goes up, the difficulty rises to compensate which will push the rate of block creation back down. Any blocks released by malicious miners that do not meet the required difficulty target will simply be rejected by everyone on the network and thus will be worthless.
The Block Reward
When a block is discovered, the discoverer may award themselves a certain number of bitcoins, which is agreed-upon by everyone in the network. Currently this bounty is 25 bitcoins; this value will halve every 210,000 blocks. See Controlled Currency Supply.
Additionally, the miner is awarded the fees paid by users sending transactions. The fee is an incentive for the miner to include the transaction in their block. In the future, as the number of new bitcoins miners are allowed to create in each block dwindles, the fees will make up a much more important percentage of mining income.
Источник
Difficulty
Contents
What is «difficulty»?
Difficulty is a measure of how difficult it is to find a hash below a given target.
The Bitcoin network has a global block difficulty. Valid blocks must have a hash below this target. Mining pools also have a pool-specific share difficulty setting a lower limit for shares.
How often does the network difficulty change?
What is the formula for difficulty?
difficulty = difficulty_1_target / current_target
(target is a 256 bit number)
difficulty_1_target can be different for various ways to measure difficulty. Traditionally, it represents a hash where the leading 32 bits are zero and the rest are one (this is known as «pool difficulty» or «pdiff»). The Bitcoin protocol represents targets as a custom floating point type with limited precision; as a result, Bitcoin clients often approximate difficulty based on this (this is known as «bdiff»).
How is difficulty stored in blocks?
Each block stores a packed representation (called «Bits») for its actual hexadecimal target. The target can be derived from it via a predefined formula. For example, if the packed target in the block is 0x1b0404cb (stored in little-endian order: cb 04 04 1b ), the hexadecimal target is
Note that this packed format contains a sign bit in the 24th bit, and for example the negation of the above target would be 0x1b8404cb in packed format. Since targets are never negative in practice, however, this means the largest legal value for the lower 24 bits is 0x7fffff. Additionally, 0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent.
How is difficulty calculated? What is the difference between bdiff and pdiff?
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
So the difficulty at 0x1b0404cb is therefore:
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:
What is the current difficulty?
Current difficulty, as output by Bitcoin’s getDifficulty.
What is the maximum difficulty?
There is no minimum target. The maximum difficulty is roughly: maximum_target / 1 (since 0 would result in infinity), which is a ridiculously huge number (about 2^224).
The actual maximum difficulty is when current_target=0, but we would not be able to calculate the difficulty if that happened. (fortunately it never will, so we’re ok.)
Can the network difficulty go down?
Yes it can. See discussion in target.
What is the minimum difficulty?
The minimum difficulty, when the target is at the maximum allowed value, is 1.
What network hash rate results in a given difficulty?
The difficulty is adjusted every 2016 blocks based on the time it took to find the previous 2016 blocks. At the desired rate of one block each 10 minutes, 2016 blocks would take exactly two weeks to find. If the previous 2016 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 2016 blocks took to find.
To find a block, the hash must be less than the target. The hash is effectively a random number between 0 and 2**256-1. The offset for difficulty 1 is
and for difficulty D is
The expected number of hashes we need to calculate to find a block with difficulty D is therefore
The difficulty is set such that the previous 2016 blocks would have been found at the rate of one every 10 minutes, so we were calculating (D * 2**48 / 0xffff) hashes in 600 seconds. That means the hash rate of the network was
over the previous 2016 blocks. Can be further simplified to
without much loss of accuracy.
At difficulty 1, that is around 7 Mhashes per second.
At the time of writing, the difficulty is 22012.4941572, which means that over the previous set of 2016 blocks found the average network hash rate was
How soon might I expect to generate a block?
The average time to find a block can be approximated by calculating:
where difficulty is the current difficulty, hashrate is the number of hashes your miner calculates per second, and time is the average in seconds between the blocks you find.
For example, using Python we calculate the average time to generate a block using a 1Ghash/s mining rig when the difficulty is 20000:
and find that it takes just under 24 hours on average.
Источник
Difficulty in Mining
Enjoyed the article? Share:
Difficulty is a value used to show how hard is it to find a hash that will be lower than target defined by system.
The Bitcoin network has a global block difficulty. Valid blocks must have a hash below this target. Mining pools also have a pool-specific share difficulty setting a lower limit for shares.
Contents
Bitcoin mining difficulty [ edit ]
In Bitcoin network there’s global difficulty set for all blocks. For block to be considered legitimate it has to have hash value lower than set target.
Difficulty changes every 2016 blocks. This is calculated using following formula:
where target is a 256-bit number.
Difficulty_1_target can take various values. Traditionally it’s a hash function first 32 bits of which are equal to 0 while all the rest are 1 (it is also called pdiff or pool difficulty). Bitcoin protocol provides target as a type with floating point and limited accuracy. Different Bitcoin clients often determine cryptocurrency difficulty based on this data.
Storing cryptocurrency difficulty in blocks [ edit ]
Every block contains a packed version (called «Bits») of hexadecimal target.
Using following formula target can be obtained from any block. For example if a target packed in a block appears as 0x1b0404cb its hexadecimal version will look as following:
Maximum value for this field is 0x7fffff while minimum is 0x008000.
Maximum possible target (with difficulty equal to 1) is defined as 0x1d00ffff which appears as following in hexadecimal numeration:
Next is an easy way of difficulty calculation. It uses an altered version of Taylor series to logarithm and relies on logs to transform difficulty calculation.
Maximum, current and minimum difficulty [ edit ]
Current difficulty can be found out by using Bitcoin command line ‘getDifficulty’.
Due to target function not having minimum value maximum difficulty can be calculated only approximately as following: maximum_target / 1 (as 0 would lead the equation to being infinitely big) which is an inconcievable number (
Minimum difficulty is just equal to 1.
Difficulty changes [ edit ]
Difficulty is changed every 2016 blocks based on the time it took to discover 2016 previous blocks. If a block is found every 10 minutes (as it was intended initially for even emission) finding 2016 blocks will take exactly 2 weeks. If previous 2016 blocks were found in more than two weeks the cryptocurrency mining difficulty will be lowered, and if they were mined faster then that it will be raised. The more (or less) time was spent on finding the previous 2016 blocks the more will difficulty be lowered (raised).
To mine a block hash has to be lower than targer (proof-of-work). Hash is a random number between 0 and 2*256-1.
Difficulty is set as if we found previous 2016 blocks at the speed of one block per 10 minutes
Average time of finding a single block can be calculated using this formula: time = difficulty * 2**32 / hashrate where ‘difficulty’ is the current cryptocurrency difficulty level of BTC difficulty network and ‘hashrate’ is the amount of hashes a miner finds per second.
What is the current difficulty? [ edit ]
Current difficulty online, as output by Bitcoin’s getDifficulty.
What is the maximum difficulty? [ edit ]
There is no minimum target. The maximum difficulty is roughly: maximum_target / 1 (since 0 would result in infinity), which is a ridiculously huge number (about 2^224). [This is not correct, target can be zero, but most hash functions produce all zeroes at such a low frequency it’s practically impossible, not actually impossible]
The actual maximum difficulty is when current_target=0, but we would not be able to calculate the difficulty if that happened. (fortunately it never will, so we’re ok.)
Can the network difficulty go down? [ edit ]
What is the minimum BTC difficulty? [ edit ]
The minimum difficulty, when the target is at the maximum allowed value, is 1.
What network hash rate results in a given difficulty? [ edit ]
The difficulty is adjusted every 2016 blocks based on the time it took to find the previous 2016 blocks. At the desired rate of one block each 10 minutes, 2016 blocks would take exactly two weeks to find. If the previous 2016 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 2016 blocks took to find.
To find a block, the hash must be less than the target. The hash is effectively a random number between 0 and 2**256-1. The offset for difficulty 1 is
and for difficulty D is
The expected number of hashes we need to calculate to find a block with difficulty D is therefore
The difficulty is set such that the previous 2016 blocks would have been found at the rate of one every 10 minutes, so we were calculating (D * 2**48 / 0xffff) hashes in 600 seconds. That means the hash rate of the network was
over the previous 2016 blocks. Can be further simplified to
without much loss of accuracy.
At difficulty 1, that is around 7 Mhashes per second.
At the time of writing, the difficulty is 22012.4941572, which means that over the previous set of 2016 blocks found the average network hash rate was
How soon might I expect to generate a block? [ edit ]
The average time to find a block can be approximated by calculating:
where difficulty is the current difficulty, hashrate is the number of hashes your miner calculates per second, and time is the average in seconds between the blocks you find.
For example, using Python we calculate the average time to generate a block using a 1Ghash/s mining rig when the difficulty is 20000:
and find that it takes just under 24 hours on average.
Источник
Сложность майнинга Биткоина (Bitcoin Mining Difficulty): обзор, как узнать и рассчитать, графики сложности, влиянение на курс
Сложность майнинга Биткоина – это показатель, отображающий, насколько трудно в текущий момент конкурировать за добычу блоков в сети. Чем меньше машин подключено к сети, тем сложность ниже, и наоборот.
Динамика роста сложности (на 1 сентября 2019 года средний показатель Bitcoin Difficulty равен 10,771,996,663,680.01428571):
график сложности майнинга биткоина с 2009 по сентябрь 2019
график сложности майнинга за 2017-2019
Текущая сложность и графики
Уровни сложности постоянно меняются. Приведем несколько актуальных способов узнать, на каком уровне параметр находится в текущий момент:
- https://www.blockchain.com/ru/charts/difficulty . График сложности майнинга Биткоина за всё время существования блокчейн сети (можно выбрать период).
- https://www.coinwarz.com/difficulty-charts/bitcoin-difficulty-chart . График и таблица со средними значениями по дням. Представлена статистика изменения величины Bitcoin Difficulty за день; 30, 60 и 90 дней.
- http://bitcoin.sipa.be/ — Несколько графиков, отображающих текущую и прогнозируемую сложность BTC-сети.
- https://bitcoinwisdom.com/bitcoin/difficulty — информация о хэшрейте и сложности Биткоина, сравнительные графики.
- https://diff.cryptothis.com/ — еще один подробный и наглядный сайт, обновляющий информацию в реальном времени.
- В консоле Биткоин кошелька Bitcoin Core ввести команды getdifficulty или getmininginfo:
Нюанс: чтобы узнать актуальную величину таким способом блокчейн сети должен быть загружен полность (синхронизирован 100%).
Что такое сложность майнинга Биткоина
Количество вычислительной мощности в сети способно со временем существенно изменяться – в момент добычи самого первого BTC Сатоши Накамото это был всего лишь один компьютер или ноутбук. А сегодня криптовалютным майнингом занимаются целые фермы промышленных масштабов.
Bitcoin-сеть использует глобальную сложность добычи блоков. Правильные блоки должны иметь хэш ниже определенной цели. Также различные пулы для майнинга сами устанавливают нижний предел трудности.
Формула, по которой рассчитывается показатель :
difficulty = difficulty_1_target / current_target
- current_target – всегда число 256bit
- difficulty_1_target – в классическом понимании число, в котором ведущие 32 bit = 0, а остальные 1. Параметр также называется сложностью пула и может немного различаться в зависимости от способа измерения difficulty.
Протокол Bitcoin использует пользовательский тип числа с ограниченной точностью и плавающей запятой. По этой причине майнеры часто приближаются к основанной на этом сложности, для этого есть понятие – bdiff.
Для чего нужна сложность
Программное обеспечение должно автоматически делать поиска хэша более или менее трудным для майнеров – это нужно для обеспечения стабильности генерации новых блоков. Благодаря корректировкам, система остается устойчивой: сколько бы устройств ни было в блокчейн сети, расчеты все равно будут занимать около 10 минут.
Сложность добычи криптовалюты – очень важный показатель, который должен учитывать любой новичок. Чем больше в сети майнеров и новых блоков, тем менее прибыльной становится монета. Поэтому майнеры, пришедшие в индустрию первыми, смогли получить ощутимую прибыль в короткие сроки. Но и те, кто приходит позднее, должны быть уверены, что добыча принесет им дополнительный доход.
Как изменяется сложность
Сложность майнинга внутри сети Bitcoin способна бесконечно увеличиваться до того момента, пока не будет добыта самая последняя монета. В то же время может повышаться и скорость увеличения сложности. На сегодняшний день уровень сложности добычи монет в сети Bitcoin поднялся до такого уровня, что выработка каждой новой монеты занимает массу времени и для этого требуется очень мощное оборудование. Для многих майнеров это критический фактор: не все имеют возможность приобрести такую дорогую технику или апгрейдить старую.
Также в теории сложность может уменьшаться, если система видит, что блоки стали добываться слишком быстро. На практике такое почти никогда не случается – с 2015 года такая ситуация сложилась только пять раз. Имеется устойчивая тенденция к повышению сложности.
Какие факторы влияют на сложность
На показатель сложности майнинга Bitcoin оказывают влияние три основных фактора:
- Количество людей и, соответственно, устройств, задействованных в сети
- Наличие глобальной сложности блока, которая зависит от нахождения допустимого хэша ниже определенного уровня.
- Скорость добычи, устанавливаемая непосредственно майнинг-пулом.
Последний параметр различается для каждого отдельного пула и каждой криптовалюты.
Как рассчитывается сложность
Трудность добычи блоков начинается со значения 1 и не может опуститься ниже этого значения. Затем сеть сравнивает временные метки формирования каждого блока, чтобы узнать сколько времени потребовалось на их формирование.
Если мы хотим узнать, сколько времени заняло создание 2016 блоков, присвоим этому параметру переменную Т. Нам нужно, чтобы 2016 блоков создавались две недели, поэтому, если Т равно иному значению, что умножаем сложность на (2 недели / Т). Например, если добыча нужного количества блоков заняла всего 10 дней, то значит сложность слишком низкая, ее нужно увеличить на 40%.
Сложность майнинга Биткоина повышаться или снижаться исходя из того, потребовалось ли меньше или больше четырнадцати дней, чтобы сгенерировать 2016 блоков. Как правило, в случае падения хешрейта сети показатель тоже уменьшается.
Можно приблизительно предугадать следующее изменение, основываясь на времени нахождения последних блоков. Однако осуществлять долгосрочные прогнозы никто не может, хотя есть попытки делать это с помощью аппаратных достижений – закона Мура, анализа направления курса и др.
Как связаны сложность, цена на биткоин и выгодность майнинга
Доходность майнинга зависит от множества факторов, в том числе от сложности и халвинга (периодического уменьшения награды). Майнер, которому удалось создать новый блок в сети, получает награду в виде криптовалюты. Считается, что 10 минут достаточно, чтобы оборудование участников сети проверило все содержащиеся в блоке транзакции.
Вознаграждение получает майнер, который нашел блок последним, поэтому участники объединяются в пулы – у группы шанс это сделать намного выше.
На данный момент каждые 10 минут в мире добывают 12,5 Биткоинов, а в 2020 это число сократится до 6,25 BTC. Параллельно с этим популярность криптовалюты все время растет, в майнинг-пулы приходит все больше людей. И получаемые 12,5 монет делятся на сотни тысяч человек; доход каждого отдельно взятого майнера уменьшается. Соответственно, майнерам приходится постоянно увеличивать мощности своего оборудования, чтобы хоть что-то заработать. Но делать это постоянно сложно.
Остается только следить за графиками изменения сложности и принимать во внимание, что число подключенных к сети майнеров всегда будет в положительную или отрицательную сторону влиять на прибыльность процесса.
Теперь немного о том, как сложность майнинга связана с ростом или падением курса криптовалюты.
Аналитики из DataLight в мае 2019 года увидели абсолютно четкую взаимосвязь между сложностью добычи BTC и изменениями курса. В этом году 3 раза была ситуация, когда резкое повышение цены шло сразу за повышением трудности майнинга. Если рассматривать общегодовые изменения, то в январе цена монеты возросла в два раза, а сложность – на треть.
Три основных предположения, откуда берется корреляция :
- Сложность и хэшрейт растут вместе с ценой, потому что все большее количество майнеров пытается получить награду.
- Наоборот, цена следует за сложностью и хэшрейтом.
- Взаимосвязь между показателями обуславливается степенным законом. Если отследить это соотношение, что можно разработать формулу для расчета курса BTC.
Какая теория верна, можно только гадать, но многие майнеры и инвесторы уже решили обращать внимание на данный факт, чтобы принимать верные решения.
Вывод
Изменения сложности майнинга тесно связаны с технологическим фактором. Майнеров интересует выпуск на рынок нового высокопроизводительного оборудования, также они пытаются максимально занизить затраты на электричество – найти бесплатные розетки или расположить ферму в регионах с низкой стоимостью электроэнергии. Не теряет актуальности и облачный майнинг.
До тех пор, пока кто-то будет заниматься майнингом, сложность будет расти. От этого рентабельность процесса снизится, домашний майнинг изживет себя как явление, заинтересованные уйдут на биржи или на добычу альткоинов. А майнинг Биткоина останется на откуп масштабным корпорациям, у которых достаточно средств и физического пространства для установки сотен единиц оборудования.
Источник