Bitcoin Forum
June 14, 2024, 07:59:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How could a miner know he is in the best block chain  (Read 949 times)
ebyccc (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
May 19, 2016, 01:54:34 AM
 #1

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)?
jambola2
Legendary
*
Offline Offline

Activity: 1120
Merit: 1038


View Profile
May 19, 2016, 12:44:28 PM
 #2

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.


No longer active on bitcointalk, however, you can still reach me via PMs if needed.
wintermeasures
Sr. Member
****
Offline Offline

Activity: 322
Merit: 250



View Profile
May 19, 2016, 04:49:01 PM
 #3

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.
RealBitcoin
Hero Member
*****
Offline Offline

Activity: 854
Merit: 1009


JAYCE DESIGNS - http://bit.ly/1tmgIwK


View Profile
May 19, 2016, 04:50:46 PM
 #4

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.

jacobmayes94
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250



View Profile
May 19, 2016, 04:56:05 PM
 #5

I thought bitcoind already did that by default.

Jacob
jambola2
Legendary
*
Offline Offline

Activity: 1120
Merit: 1038


View Profile
May 19, 2016, 07:38:23 PM
 #6

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

No longer active on bitcointalk, however, you can still reach me via PMs if needed.
RealBitcoin
Hero Member
*****
Offline Offline

Activity: 854
Merit: 1009


JAYCE DESIGNS - http://bit.ly/1tmgIwK


View Profile
May 19, 2016, 08:54:56 PM
 #7


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?

Cuidler
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250


View Profile
May 19, 2016, 09:20:06 PM
Last edit: May 19, 2016, 09:31:30 PM by Cuidler
 #8

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...

.Liqui Exchange.Trade and earn 24% / year on BTC, LTC, ETH
....Brand NEW..........................................Payouts every 24h. Learn more at official thread
jambola2
Legendary
*
Offline Offline

Activity: 1120
Merit: 1038


View Profile
May 22, 2016, 08:20:38 AM
 #9


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.

No longer active on bitcointalk, however, you can still reach me via PMs if needed.
jambola2
Legendary
*
Offline Offline

Activity: 1120
Merit: 1038


View Profile
May 22, 2016, 08:26:08 AM
 #10

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.


No longer active on bitcointalk, however, you can still reach me via PMs if needed.
Bitcoinpro
Legendary
*
Offline Offline

Activity: 1344
Merit: 1000



View Profile
May 22, 2016, 10:56:48 AM
 #11

if ur using the latest client u should be on the right fork but i guessing u want to check to make sure

WWW.FACEBOOK.COM

CRYPTOCURRENCY CENTRAL BANK

LTC: LP7bcFENVL9vdmUVea1M6FMyjSmUfsMVYf
RealBitcoin
Hero Member
*****
Offline Offline

Activity: 854
Merit: 1009


JAYCE DESIGNS - http://bit.ly/1tmgIwK


View Profile
May 22, 2016, 02:00:34 PM
 #12

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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!