Author

Topic: How could a miner know he is in the best block chain (Read 966 times)

hero member
Activity: 854
Merit: 1009
JAYCE DESIGNS - http://bit.ly/1tmgIwK
Alright, let me explain difficulty.

Mining involves finding hashes that match the parameters. The difficulty specifies that the final hash is invalid unless the value of your hash is lower than a certain value.

For example, this is difficulty 1: 0x00000000FFFF
And this is around difficulty 16,000: 0x00000000000404CB

A hash value 0x00000000A123..........  would be valid for difficulty 1 and not valid for difficulty 16,000.

So, I could manufacture blocks at a lower difficulty, but it would make my chain shorter, and i could manufacture blocks at a higher difficulty but it would proportionally increase time spent making each block.

Ok i kinda get it now, everything is cryptographically guaranteed, not just a parameter in a database.

No wonder its called cryptocurrency. It is really fascinating how bitcoin works behind the scenes, these crypto operations surely was designed by geniuses.
legendary
Activity: 1358
Merit: 1000
if ur using the latest client u should be on the right fork but i guessing u want to check to make sure
legendary
Activity: 1120
Merit: 1038
No, longest chain is only a way to explain it in a simple manner. Highest total difficulty is what is used.
A chain with blocks [A,B,C,D,E] is longer than chain [A,B,P,Q,R,S] if the difficulty of C+D+E > difficulty of P+Q+R+S even though there are more blocks in the latter.

There are potential attacks on the blockchain wherein an attacker can create a chain where difficulty would be lower than actual chain difficulty, allowing them to create blocks faster. In order to prevent this attack, the 'longer' chain is decided by sum of difficulty and not total length.

A chain with a million blocks of difficulty 1 is shorter than a chain with two blocks with a difficulty of 600,000


Interesting, I though time stamp in block solves this, as million blocks of difficulty 1 could not be created as there is not enought time to create million blocks, all ten minutes apart. What is the attack vector if just longest chain is selected as best, I mean how you fool the time stamps to have today million valid blocks of difficulty 1 when clearly not enought time for million blocks since late 2009 all ten minutes apart...

Bitcoin does not limit you to 1 block every 10 minutes though. Check out blockchain.info's list of recent blocks, and I'm sure you'll see some blocks under 5 minutes apart.

legendary
Activity: 1120
Merit: 1038

No, longest chain is only a way to explain it in a simple manner. Highest total difficulty is what is used.
A chain with blocks [A,B,C,D,E] is longer than chain [A,B,P,Q,R,S] if the difficulty of C+D+E > difficulty of P+Q+R+S even though there are more blocks in the latter.

There are potential attacks on the blockchain wherein an attacker can create a chain where difficulty would be lower than actual chain difficulty, allowing them to create blocks faster. In order to prevent this attack, the 'longer' chain is decided by sum of difficulty and not total length.

A chain with a million blocks of difficulty 1 is shorter than a chain with two blocks with a difficulty of 600,000

And can't that be faked? For example by introducing fake blocks with fake difficulty settings.

How does the miners know that the blocks they get are authentic?

Alright, let me explain difficulty.

Mining involves finding hashes that match the parameters. The difficulty specifies that the final hash is invalid unless the value of your hash is lower than a certain value.

For example, this is difficulty 1: 0x00000000FFFF
And this is around difficulty 16,000: 0x00000000000404CB

A hash value 0x00000000A123..........  would be valid for difficulty 1 and not valid for difficulty 16,000.

So, I could manufacture blocks at a lower difficulty, but it would make my chain shorter, and i could manufacture blocks at a higher difficulty but it would proportionally increase time spent making each block.
sr. member
Activity: 294
Merit: 250
No, longest chain is only a way to explain it in a simple manner. Highest total difficulty is what is used.
A chain with blocks [A,B,C,D,E] is longer than chain [A,B,P,Q,R,S] if the difficulty of C+D+E > difficulty of P+Q+R+S even though there are more blocks in the latter.

There are potential attacks on the blockchain wherein an attacker can create a chain where difficulty would be lower than actual chain difficulty, allowing them to create blocks faster. In order to prevent this attack, the 'longer' chain is decided by sum of difficulty and not total length.

A chain with a million blocks of difficulty 1 is shorter than a chain with two blocks with a difficulty of 600,000


Interesting, I though time stamp in block solves this, as million blocks of difficulty 1 could not be created as there is not enought time to create million blocks, all ten minutes apart. What is the attack vector if just longest chain is selected as best, I mean how you fool the time stamps to have today million valid blocks of difficulty 1 when clearly not enought time for million blocks since late 2009 all ten minutes apart...
hero member
Activity: 854
Merit: 1009
JAYCE DESIGNS - http://bit.ly/1tmgIwK

No, longest chain is only a way to explain it in a simple manner. Highest total difficulty is what is used.
A chain with blocks [A,B,C,D,E] is longer than chain [A,B,P,Q,R,S] if the difficulty of C+D+E > difficulty of P+Q+R+S even though there are more blocks in the latter.

There are potential attacks on the blockchain wherein an attacker can create a chain where difficulty would be lower than actual chain difficulty, allowing them to create blocks faster. In order to prevent this attack, the 'longer' chain is decided by sum of difficulty and not total length.

A chain with a million blocks of difficulty 1 is shorter than a chain with two blocks with a difficulty of 600,000

And can't that be faked? For example by introducing fake blocks with fake difficulty settings.

How does the miners know that the blocks they get are authentic?
legendary
Activity: 1120
Merit: 1038
sorry friend, can u explain to us with more simple word? i cant understand u mean, sorry im newbie here  Huh Huh Huh
thank you.

The original poster asked for a somewhat complicated answer itself. In short, what I basically said was that in order to check which chain is the best, the getheaders function can be used. You give another user your blockchain, and they tell you which blocks they think you are missing. You compare their blocks to your blocks, and then find out which has a higher sum of difficulty.

Plus its also the longest chain right? I remember there was a new fix where the longest chain with the highest difficulty is selected as the original.

No, longest chain is only a way to explain it in a simple manner. Highest total difficulty is what is used.
A chain with blocks [A,B,C,D,E] is longer than chain [A,B,P,Q,R,S] if the difficulty of C+D+E > difficulty of P+Q+R+S even though there are more blocks in the latter.

There are potential attacks on the blockchain wherein an attacker can create a chain where difficulty would be lower than actual chain difficulty, allowing them to create blocks faster. In order to prevent this attack, the 'longer' chain is decided by sum of difficulty and not total length.

A chain with a million blocks of difficulty 1 is shorter than a chain with two blocks with a difficulty of 600,000
sr. member
Activity: 364
Merit: 250
I thought bitcoind already did that by default.

Jacob
hero member
Activity: 854
Merit: 1009
JAYCE DESIGNS - http://bit.ly/1tmgIwK
Let the letters represent hashes.

Other persons chain: [a b c d e f g h i j k]
Your chain: [a b c d e f l m n o p]

You send a getheader with your chain:
Response: [g h i j k]
Does not match [l m n o p]

Compare total difficulty of [g h i j k] and [l m n o p]. Stay with whichever chain has a higher total difficulty.



Plus its also the longest chain right? I remember there was a new fix where the longest chain with the highest difficulty is selected as the original.
sr. member
Activity: 322
Merit: 250
Let the letters represent hashes.

Other persons chain: [a b c d e f g h i j k]
Your chain: [a b c d e f l m n o p]

You send a getheader with your chain:
Response: [g h i j k]
Does not match [l m n o p]

Compare total difficulty of [g h i j k] and [l m n o p]. Stay with whichever chain has a higher total difficulty.



sorry friend, can u explain to us with more simple word? i cant understand u mean, sorry im newbie here  Huh Huh Huh
thank you.
legendary
Activity: 1120
Merit: 1038
Let the letters represent hashes.

Other persons chain: [a b c d e f g h i j k]
Your chain: [a b c d e f l m n o p]

You send a getheader with your chain:
Response: [g h i j k]
Does not match [l m n o p]

Compare total difficulty of [g h i j k] and [l m n o p]. Stay with whichever chain has a higher total difficulty.

newbie
Activity: 6
Merit: 0
I have finished reading the bitcoin developer guide but still confused. Like you are a head first miner, and received a block inventory (broadcasted by its inventor), then you would reply a getheader to the peer, and he would response a sequence of headers. What if you find that sequence cannot match your own block chain, and judge whether the peer  or yourself is wrong (by which i mean not on the longest chain)?
Jump to: