Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: nookiegirl on April 25, 2013, 01:12:39 PM



Title: New block exactly every 10min? how?
Post by: nookiegirl on April 25, 2013, 01:12:39 PM
Hi everybody,

I am trying to get deeper into the understanding of bitcoins, but there are still a few things unclear.

So If we all mine bitcoins, then what we do is just to find a hash, that matches a specific criteria.
If this hash is found, then a new block is found and (currently) rewarded with 25 BTC.

But how can this happen exactly every 10 min? How can this be timed so accurately?

If I compare this with password bruteforcing, I have no estimate about the time, I will find a correct hash?


Title: Re: New block exactly every 10min? how?
Post by: drawingthesun on April 25, 2013, 01:24:50 PM
Hi everybody,

I am trying to get deeper into the understanding of bitcoins, but there are still a few things unclear.

So If we all mine bitcoins, then what we do is just to find a hash, that matches a specific criteria.
If this hash is found, then a new block is found and (currently) rewarded with 25 BTC.

But how can this happen exactly every 10 min? How can this be timed so accurately?

If I compare this with password bruteforcing, I have no estimate about the time, I will find a correct hash?

Its a average of 10 minutes, if you look at blocks found some are slower and some are faster.

The network adjusts after a set amount of time to make the average 10 minutes. If more power is added and the average block time shortens, the network adjusts to make it harder. (This also works the other way around)


Title: Re: New block exactly every 10min? how?
Post by: saddambitcoin on April 25, 2013, 01:29:43 PM
the network adjusts its difficulty according to the overall hashrate to reach these targets

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


Title: Re: New block exactly every 10min? how?
Post by: BenTuras on April 25, 2013, 01:36:39 PM
This is done by adjusting the difficulty factor. And to explain this in a few words:

1. Imagine doing a difficult calculation(double sha256) on 16 64-bits values
2. One of these 64-bits values is incremented until the answer is found
3. Each iteration of the difficult calculation leads to 8 new 64 bits values of more or less random value.
4. Of these 8 new 64 bits values, one value must be of value 0x0000 0000 0000 0000 0000 ..... xxxx xxxx, or less. (The difficulty factor)
5. The number of leading zeroes is adjusted so that on average this difficult calculation leads to a correct value every 10 minutes.

The difficulty factor is adjusted every 2160 blocks, in such a way that finding the correct answer of those last 2160 blocks would have taken 2160*10 minutes.

Does this makes sense ?


Title: Re: New block exactly every 10min? how?
Post by: nookiegirl on April 25, 2013, 01:41:20 PM
So the smaller the difficulty, the more zero's?

If so, what if the difficulty is so low (has so many zero's up front), that there are only 2 digits left on the right and you could only create 0xFF more calculations?


Title: Re: New block exactly every 10min? how?
Post by: Peter Lambert on April 25, 2013, 01:54:57 PM
Hi everybody,

I am trying to get deeper into the understanding of bitcoins, but there are still a few things unclear.

So If we all mine bitcoins, then what we do is just to find a hash, that matches a specific criteria.
If this hash is found, then a new block is found and (currently) rewarded with 25 BTC.

But how can this happen exactly every 10 min? How can this be timed so accurately?

If I compare this with password bruteforcing, I have no estimate about the time, I will find a correct hash?

It does not happen exactly every 10 minutes, as was said above if you look at the actual block times they vary by quite a bit. Sometimes you get two blocks within a minute, and sometimes it takes over an hour to get a block, but the average is 10 minutes.

Think of it like if you roll dice, if you roll a 6 sided die once a second you would expect to get a 1 about every 6 seconds. But sometimes you would roll a 1 two times in a row, and sometimes you would roll a bunch of other numbers, but on average the 1 would come up about every 6 seconds.

If more people start mining bitcoins then the blocks will start coming faster. Like in my die rolling example, if you start rolling two dice then you will get a 1 twice as often. But what happens is the bitcoin protocol adjusts the difficulty every so often (about every two weeks, but actually there is a set number of blocks which it recalculates at). So in our dice example, after rolling two dice for a while you get changed to 12 sided dice, so then the rate of finding 1's goes back to where it was before.

The difference between this and brute forcing a password is that there are more possible answers for this (any number less than difficulty, as opposed to just one right answer). You could make an estimation of the time it takes to do a brute force, but since you are just looking for one answer the probable time is less meaningful, people usually state the time needed to try all possible passwords. So if your brute force can run through all possible passwords in 10 days, the average time to find the password would be 5 days, but you might find it in the fist day or you might find it in the last day.


Title: Re: New block exactly every 10min? how?
Post by: TierNolan on April 25, 2013, 01:55:41 PM
If so, what if the difficulty is so low (has so many zero's up front), that there are only 2 digits left on the right and you could only create 0xFF more calculations?

You mean so high.  You mean that you need 248 out of the 256 bits to be zero?  That requires 2^248 attempts on average.

On the other side, there is a minimum allowed difficulty.  You always have to do at least 2^32 (on average) to get a block.


Title: Re: New block exactly every 10min? how?
Post by: drawingthesun on April 25, 2013, 02:35:16 PM
To ask something I don't know, is there a max to the difficulty? Could we run out of space for leading zeros?


Title: Re: New block exactly every 10min? how?
Post by: CIYAM on April 25, 2013, 02:37:26 PM
To ask something I don't know, is there a max to the difficulty? Could we run out of space for leading zeros?

In short no - to understand this better you need to try and fathom exactly how big 2^256 is (there are other topics about it if you are keen to search).


Title: Re: New block exactly every 10min? how?
Post by: DannyHamilton on April 25, 2013, 03:13:16 PM
Quote
If we built a Dyson sphere around the sun and captured all its energy for 32 years, without any loss, we could power a computer to count up to 2192. Of course, it wouldn’t have the energy left over to perform any useful calculations with this computer. But that’s just one star, and a measly one at that. A typical supernova releases something like 1051 ergs. If all of this energy could be channelled into a single orgy of computation, a 219-bit counter could be cycled through all of its states. These numbers have nothing to do with the technology of the devices; they are the maximums that thermodynamics will allow.

- Bruce Shneier

In other words, it really isn't likely that we will ever run into a situation where a 256 bit difficulty will become "too easy".

It could happen if a weakness is discovered in the future in the SHA-256 algorithm, but if that happens it is very likely that bitcoin will switch to a different proof-of-work algorithm.


Title: Re: New block exactly every 10min? how?
Post by: drawingthesun on April 25, 2013, 03:16:41 PM
To ask something I don't know, is there a max to the difficulty? Could we run out of space for leading zeros?

In short no - to understand this better you need to try and fathom exactly how big 2^256 is (there are other topics about it if you are keen to search).


Thanks!

So we would run out after this many zeros: http://www.wolframalpha.com/input/?i=2%5E256 (http://www.wolframalpha.com/input/?i=2%5E256)

How many zeros are we up to right now?


Title: Re: New block exactly every 10min? how?
Post by: CIYAM on April 25, 2013, 03:18:18 PM
How many zeros are we up to right now?

http://blockchain.info/block-index/378457/00000000000001aea0dbcf76505cba633639210ddbcaca13dbac43869e09327d

Check the "hash" on the top right (or just in the URL itself) - as you can see - there is a lot of room left. :)


Title: Re: New block exactly every 10min? how?
Post by: kjj on April 25, 2013, 03:41:37 PM
Quote
If we built a Dyson sphere around the sun and captured all its energy for 32 years, without any loss, we could power a computer to count up to 2192. Of course, it wouldn’t have the energy left over to perform any useful calculations with this computer. But that’s just one star, and a measly one at that. A typical supernova releases something like 1051 ergs. If all of this energy could be channelled into a single orgy of computation, a 219-bit counter could be cycled through all of its states. These numbers have nothing to do with the technology of the devices; they are the maximums that thermodynamics will allow.

- Bruce Shneier

In other words, it really isn't likely that we will ever run into a situation where a 256 bit difficulty will become "too easy".

It could happen if a weakness is discovered in the future in the SHA-256 algorithm, but if that happens it is very likely that bitcoin will switch to a different proof-of-work algorithm.

Heh.  When pasting things with superscripts, it is very helpful to fix them.  Counting to 2192 is trivial.  Counting to 2192 is not.


Title: Re: New block exactly every 10min? how?
Post by: DannyHamilton on April 25, 2013, 03:50:35 PM
Quote
If we built a Dyson sphere around the sun and captured all its energy for 32 years, without any loss, we could power a computer to count up to 2192. Of course, it wouldn’t have the energy left over to perform any useful calculations with this computer. But that’s just one star, and a measly one at that. A typical supernova releases something like 1051 ergs. If all of this energy could be channelled into a single orgy of computation, a 219-bit counter could be cycled through all of its states. These numbers have nothing to do with the technology of the devices; they are the maximums that thermodynamics will allow.

- Bruce Shneier

In other words, it really isn't likely that we will ever run into a situation where a 256 bit difficulty will become "too easy".

It could happen if a weakness is discovered in the future in the SHA-256 algorithm, but if that happens it is very likely that bitcoin will switch to a different proof-of-work algorithm.

Heh.  When pasting things with superscripts, it is very helpful to fix them.  Counting to 2192 is trivial.  Counting to 2192 is not.

Oops.  Thanks.  I've got to be more careful about that.  ;D

Fixed.