Bitcoin Forum

Other => Beginners & Help => Topic started by: piotr_n on July 07, 2011, 07:08:00 PM



Title: Difficulty - I don't get it
Post by: piotr_n on July 07, 2011, 07:08:00 PM
Can anyone please explain me?

So I read that every new block should appear after 10 minutes from the previous one.
And this is enforced by the difficulty.
So the difficulty is recalculated every few blocks , adjusting itself to the current hashing speed of the network, trying to reach 10min/block in the perfect case, which never happens...

Is this right?

Because if so it would imply that you cannot really predict an actual date when a specific block number would appear in the network.
Or can you?


Title: Re: Difficulty - I don't get it
Post by: BitcoinHoarder on July 07, 2011, 07:11:06 PM
The network adjusts every 2016 blocks, that is coded in the p2p algorithms.

You can't predict exactly when a block will be solved.  I can't even predict exactly when the next block will be solved.  But we know how fast, approximately, the network is operating so we get pretty close.

See https://en.bitcoin.it/wiki/Difficulty


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 07, 2011, 07:17:05 PM
but i wonder about a long term effect.
if they say that the last block that gives the actual mining incentive will be introduced in the year 2136 or something - how accurate is such statement?

is the difficulty calculated to compensate the inherited error, or is it only to match the next 2016 blocks so they would be all 10min long from now on?


Title: Re: Difficulty - I don't get it
Post by: ANSYSiC on July 07, 2011, 07:32:45 PM
theese 6 blocks/hour are in average, so you can say that the last block is found ~2033 (i dont know)


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:05:58 PM
One would think that on the bitcoin forum this kind of questions would rather get answered... :)
I'm not sure if the protocol allows to re-ask, but I would really appreciate anyone explaining this difficulty stuff to me.
So, should I keep asking until I get answered (or banned)? Or maybe re-asking wont help anyway, because the only way to know this is to look into the source code? :)


Title: Re: Difficulty - I don't get it
Post by: supersonic3974 on July 08, 2011, 07:08:36 PM
What hasn't been answered by the previous posts??


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:09:33 PM
is the difficulty calculated to compensate the inherited error, or is it only to match the next 2016 blocks so they would be all 10min long from now on?


Title: Re: Difficulty - I don't get it
Post by: MoonShadow on July 08, 2011, 07:18:53 PM
is the difficulty calculated to compensate the inherited error, or is it only to match the next 2016 blocks so they would be all 10min long from now on?

No, difficulty does not attempt to compensate for the inherited error.  So assuming that difficulty continues to go up, and never down, average block creation over the lifetime of Bitcoin will be something slightly faster than every ten minutes.  Thus it is possible that the entire production curve for bitcoins will be compressed slightly, and the blocks wherein the block reward will come earlier than projected.  However, there will still be exactly the same amount of bitcoins issued as is projected.


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:20:31 PM
Thank you. That's exactly what I needed to know.


Title: Re: Difficulty - I don't get it
Post by: mjsa on July 08, 2011, 07:26:41 PM
The difficulty is used to control the Bitcoin economy, and inflation in a way?


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:33:25 PM
I guess in a way it also controls an inflation, but only in a short term, since the total number of bitcoins is limited at the end, anyway.

But the difficulty, and the way it changes serves many purposes.
The most important one is I guess to decentralize the power of one PC, over the entire network.
So there is this difficulty that makes it difficult to screw over the others :)


Title: Re: Difficulty - I don't get it
Post by: RodeoX on July 08, 2011, 07:36:54 PM
The difficulty is used to control the Bitcoin economy, and inflation in a way?
Not really to control inflation. It has tended to lead to deflation, but the main reasons and advantages are to feed a steady, secure supply into the economy. It takes a lot of computer power to create a bitcoin. That means cost.  Mining provides an incentive to use energy to produce BTC. Difficulty makes it hard to overproduce. The more people trying with better machines, the harder it gets. Difficulty has to be adjusted because the hash power of all computers on the network is always changing.  


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:41:44 PM
But also there is a problem that if anyone would manage to take over more than a half of the network's hashing speed - then he would basically take over the network.
Right?
So the difficulty is also to protect against that, not only to make it more expensive to mine bitcoins? Though, I have to admit that these two things are pretty much related :)


Title: Re: Difficulty - I don't get it
Post by: MoonShadow on July 08, 2011, 07:50:57 PM
But also there is a problem that if anyone would manage to take over more than a half of the network's hashing speed - then he would basically take over the network.
Right?
So the difficulty is also to protect against that, not only to make it more expensive to mine bitcoins? Though, I have to admit that these two things are pretty much related :)

No, an attacker with 50% of the hashing would not be able to take over the network.  Such an attacker would be able to prevent transactions from being processed, and potentially double-spend coins that he recently possessed; but would still be unable to do anything to anyone's coins that he had never actually owned.  The 50% mark just makes an attack possible, it doesn't make it easy.


Title: Re: Difficulty - I don't get it
Post by: TiagoTiago on July 08, 2011, 07:55:51 PM
The difficulty is like saying you need to get less than N when rolling a gazillion sided dice to be acknowledged as having cracked a block; people can get lots of dices and roll them at the same time to increase their chances of getting a small enough number, if people start using too many dices, the threshold is changed so that even with all the additional dices everyone together still only get a number bellow the threshold around 6 times per hour on average, same thing if people  start using less dices, but in the opposite direction.


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 07:58:08 PM
But also there is a problem that if anyone would manage to take over more than a half of the network's hashing speed - then he would basically take over the network.
Right?
So the difficulty is also to protect against that, not only to make it more expensive to mine bitcoins? Though, I have to admit that these two things are pretty much related :)

No, an attacker with 50% of the hashing would not be able to take over the network.  Such an attacker would be able to prevent transactions from being processed, and potentially double-spend coins that he recently possessed; but would still be unable to do anything to anyone's coins that he had never actually owned.  The 50% mark just makes an attack possible, it doesn't make it easy.
Sorry, I don't mean to spread any panic or something.
Of course he cannot get money that people had generated before.
But if he can prevent transactions and take all the freshly generated coins to himself - isn't it technically taking over the network?


Title: Re: Difficulty - I don't get it
Post by: MoonShadow on July 08, 2011, 08:05:47 PM

But if he can prevent transactions and take all the freshly generated coins to himself - isn't it technically taking over the network?


Anyone who has such hashing power has to choose between assaulting the network and participating honestly within it.  If said person has 51% of the hashing power, and participates honestly, he can capture 51% of the newly generated coins.  He could choose to reject every transaction, and simply publish empty blocks, but this isn't an attack on the network, really.  It does no harm, since transactions can still be expected to be processed by the miners who capture the other 49% of blocks.  However, such a person could choose to prevent all transactions, but to do this he has to turn his miners to the task of reversing all of the blocks that are created by other miners, so he would still only be able to capture about the same number of blocks over the same time period.  The effective hash rate of the network would be cut in half, but only if the attacker is successful at reversing all honest blocks before another honest block could be built upon it.  The odds of this continuing for any extended period of time is remote with only 51%.


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 08:14:01 PM

But if he can prevent transactions and take all the freshly generated coins to himself - isn't it technically taking over the network?


Anyone who has such hashing power has to choose between assaulting the network and participating honestly within it.  If said person has 51% of the hashing power, and participates honestly, he can capture 51% of the newly generated coins.  He could choose to reject every transaction, and simply publish empty blocks, but this isn't an attack on the network, really.  It does no harm, since transactions can still be expected to be processed by the miners who capture the other 49% of blocks.  However, such a person could choose to prevent all transactions, but to do this he has to turn his miners to the task of reversing all of the blocks that are created by other miners, so he would still only be able to capture about the same number of blocks over the same time period.  The effective hash rate of the network would be cut in half, but only if the attacker is successful at reversing all honest blocks before another honest block could be built upon it.  The odds of this continuing for any extended period of time is remote with only 51%.
I know it is unlikely.
But you say that he can deny to publish all the transactions.
What I think would be more dangerous is if he defines a filter that accepts some transactions, but not others.
It could turn into corporations ruling over what can and what cannot be sent through.
So it's more likely to happen :)


Title: Re: Difficulty - I don't get it
Post by: MoonShadow on July 08, 2011, 08:19:43 PM

What I think would be more dangerous is if he defines a filter that accepts some transactions, but not others. This would give him much more power than stopping all the transactions - so it's more likely to happen :)

Yes, but miner defined filters are part of the protocol.  It's expected that, in the future, some miners will simply choose to reject fee-less transactions, as an example.  Future bitcoin-banks could choose to ignore transactions, free or not, that are not issued by clients of other banks that they have reciproprocity agreements with.  Wal-mart could ignore transactions intended for Target, and vice versa, if they can identify them.  None of this would cause harm to the Bitcoin network at large, and is not an attack. The worst thing that can happen to such a transaction is that it's in limbo until such time that a miner that doesn't discriminate processes a block.


Title: Re: Difficulty - I don't get it
Post by: piotr_n on July 08, 2011, 08:23:14 PM
Yeah, even then, it's only a mater of time until my transaction gets mined by an honest miner :)
The guy who invented it is really a genius - Edison is nothing next to him :)


Title: Re: Difficulty - I don't get it
Post by: MoonShadow on July 08, 2011, 08:38:44 PM

The guy who invented it is really a genius - Edison is nothing next to him :)

If Satoshi is, in fact, a single individual, then he is a polymath.  The breath of professional grade knowledge required to produce this, and the rather sudden manner in which it just sprung onto the Interent in 2009, leads me to assume that Satoshi isn't likely to be a single person, IMHO, any more so than LulSec would be.


Title: Re: Difficulty - I don't get it
Post by: dtmcnamara on July 11, 2011, 05:11:15 AM
Yeah, even then, it's only a mater of time until my transaction gets mined by an honest miner :)
The guy who invented it is really a genius - Edison is nothing next to him :)

i wouldnt go that far...but thats just my 2cents