Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: No_2 on July 28, 2014, 09:34:18 AM



Title: Bitcoin External Dependencies and Block Generation Time
Post by: No_2 on July 28, 2014, 09:34:18 AM
Am I correct in thinking that the Bitcoin difficulty adjustment algorithm which dictates the target hash's difficulty value for blocks, where difficulty is adjusted every 2016 blocks, purely adjusts itself based on the current hashing power on the network?

Am I also therefore correct in guessing it does this so as to avoid having to use any external dependencies and thus any potentially centralised resources which could also be an attack vector such as referring to an external time server?


Title: Re: Bitcoin External Dependencies and Block Generation Time
Post by: kjj on July 28, 2014, 12:07:54 PM
We still depend on external timekeeping, but in a distributed way.


Title: Re: Bitcoin External Dependencies and Block Generation Time
Post by: DeathAndTaxes on July 28, 2014, 02:11:59 PM
Am I correct in thinking that the Bitcoin difficulty adjustment algorithm which dictates the target hash's difficulty value for blocks, where difficulty is adjusted every 2016 blocks, purely adjusts itself based on the current hashing power on the network?

Am I also therefore correct in guessing it does this so as to avoid having to use any external dependencies and thus any potentially centralised resources which could also be an attack vector such as referring to an external time server?

You can't adjust difficulty based on blocks alone.   Ok 2016 blocks have been completed does difficulty go up or down?  You need a second factor and that factor is time.  So Bitcoin is dependent on real world timekeeping however Bitcoin does a few things to minimize the influence of time on the security of the network.


Title: Re: Bitcoin External Dependencies and Block Generation Time
Post by: azeteki on July 28, 2014, 08:08:54 PM
The aim of the blockchain is to provide ordering of transactions. Transactions are ordered based on height, rather than block timestamp. In a sense the block height _is_ the timestamp of a transaction. It just doesn't have a regular interval.

With a ~10 minute time interval between blocks, blockchain state can be synchronized globally in an effective manner.

If the interval fell very low (i.e. if there were never any diff adjustments), nodes would likely begin to fall out of sync and blocks would be orphaned often, wasting hashpower. Too high, and transactions are included too slowly.

Difficulty adjustment attempts to fix this. It doesn't have to be exactly perfect as long as we remain within sensible bounds. And it can be enforced on a local level (each node rejecting blocks that abuse timestamps too much).


Title: Re: Bitcoin External Dependencies and Block Generation Time
Post by: No_2 on July 29, 2014, 10:22:13 AM
You can't adjust difficulty based on blocks alone.   Ok 2016 blocks have been completed does difficulty go up or down?  You need a second factor and that factor is time.  So Bitcoin is dependent on real world timekeeping however Bitcoin does a few things to minimize the influence of time on the security of the network.

Thanks for this. I thought that second factor was that the network could see the total hashrate being applied to it.

Where can I find out more info on the time stamping process?


Title: Re: Bitcoin External Dependencies and Block Generation Time
Post by: DannyHamilton on July 29, 2014, 01:52:36 PM
Where can I find out more info on the time stamping process?

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

Quote
Each block contains a Unix time (http://en.wikipedia.org/wiki/Unix_time) timestamp. In addition to serving as a source of variation for the block hash (https://en.bitcoin.it/wiki/Block_hashing_algorithm), there are also validity checks, that make it more difficult for an adversary to manipulate the block chain.

A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours. "Network-adjusted time" is the median of the timestamps returned by all nodes connected to you.

Whenever a node connects to another node, it gets a UTC timestamp from it, and stores its offset from node-local UTC. The network-adjusted time is then the node-local UTC plus the median offset from all connected nodes. Network time is never adjusted more than 70 minutes from local system time, however.

Bitcoin uses an unsigned integer for the timestamp