Bitcoin Forum
May 05, 2024, 01:57:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Same block hash  (Read 961 times)
coinspoolco (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile
April 03, 2014, 04:29:07 PM
 #1

Hello everyone,

Do you know what happens if two blocks get the same hashes ? I know it has a very small chance, but I would like to know if it can affect the integrity of blockchain or someting.
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1093


View Profile
April 03, 2014, 04:46:32 PM
 #2

I think it's a fundamental assumption that no collision may occur. I don't think the code has prepared for this. The chain will fork if the transaction inputs and outputs in the two blocks are not identical.

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
coinspoolco (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile
April 03, 2014, 04:58:57 PM
 #3

Well I think we should prepare for this. At this time its not an urging issue, as the hashrate is growing, and there are plenty of space to increase the diff, but once hashrate is not increasing, or we get a very high diff, the chance of getting the same hash is getting bigger.
jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1093


View Profile
April 03, 2014, 05:04:44 PM
 #4

Well I think we should prepare for this. At this time its not an urging issue, as the hashrate is growing, and there are plenty of space to increase the diff, but once hashrate is not increasing, or we get a very high diff, the chance of getting the same hash is getting bigger.

Even if you use up all energy of our sun, you won't be able to find a collision by chance

The only possible scenario is when SHA256 is completely broken

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 03, 2014, 05:09:32 PM
 #5

Well I think we should prepare for this. At this time its not an urging issue, as the hashrate is growing, and there are plenty of space to increase the diff, but once hashrate is not increasing, or we get a very high diff, the chance of getting the same hash is getting bigger.
getting bigger, but still miniscule. <insert picture explaining how big 2^256 is>

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
April 03, 2014, 07:29:43 PM
 #6

Why would it matter if two blocks have the same hash?  Is there something that I'm not aware of in the protocol that depends on blocks having a unique hash?
mustyoshi
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250



View Profile
April 03, 2014, 07:42:00 PM
 #7

Why would it matter if two blocks have the same hash?  Is there something that I'm not aware of in the protocol that depends on blocks having a unique hash?

Isn't the block database indexed by blockhash?

The chain could still function if it was traversed linearly as then the previous block would also be relevant.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
April 03, 2014, 07:49:29 PM
 #8

Why would it matter if two blocks have the same hash?  Is there something that I'm not aware of in the protocol that depends on blocks having a unique hash?
Isn't the block database indexed by blockhash?

The chain could still function if it was traversed linearly as then the previous block would also be relevant.

So, we're saying even if there were a risk of block hash collision, it would be an implementation problem in the Bitcoin Core database, and not a protocol problem, right?

Transactions refer to previous outputs by previous transaction hash and output index, there is no reference to block hash.  The block chain is stored linearly in files, so the order of the blocks (and of the transactions) would be unaffected.
TMorita
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
April 03, 2014, 10:28:34 PM
 #9

The odds of the two blocks hashing to the same value is about 2^256 which is about 1.15 * 10^77.

In case you don't understand scientific notation, the chance is about 1 in 115000000000000000000000000000000000000000000000000000000000000000000000000000.

The odds of being killed by a meteorite is about 1 in 250,000

http://www.wired.com/2013/02/asteroid-odds/

Odds of death by lighting are about 1 in 10,000,000.

http://www.theblaze.com/stories/2013/02/15/how-likely-are-you-to-die-from-gun-violence-this-interesting-chart-puts-it-in-perspective/

You would be better off planning for these two events.
These events are much more likely to occur.

Toshi
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
April 03, 2014, 10:51:57 PM
 #10

The odds of the two blocks hashing to the same value is about 2^256 which is about 1.15 * 10^77.

In case you don't understand scientific notation, the chance is about 1 in 115000000000000000000000000000000000000000000000000000000000000000000000000000.

The odds of being killed by a meteorite is about 1 in 250,000

http://www.wired.com/2013/02/asteroid-odds/

Odds of death by lighting are about 1 in 10,000,000.

http://www.theblaze.com/stories/2013/02/15/how-likely-are-you-to-die-from-gun-violence-this-interesting-chart-puts-it-in-perspective/

You would be better off planning for these two events.
These events are much more likely to occur.

Toshi

Given the current difficulty, I think the first 64 bits or so of block hashes are all zeros. As difficulty increases, the number of effective bits in the valid hash are reduced. Therefore, the odds (assuming difficulty doesn't increase beyond the effective difficulty of the current block) that any valid future block will have the same hash as the current block is about 2192, not 2256.  The birthday paradox increases the likelihood that there will be two blocks that match each other (rather than a block that matches a specific block).

Of course, even 2192 is a ridiculously large number.

So, we are discussing something that most of us agree isn't going to happen. Even if the OP can't wrap their mind around just how unlikely it is, I'm not yet convinced that a duplicate block hash would be a serious problem anyhow.  So not only are we discussing something that isn't going to happen, it might not even be a problem if it was possible.
coinspoolco (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile
April 04, 2014, 01:35:37 AM
Last edit: April 04, 2014, 02:28:35 PM by coinspoolco
 #11

Yeah ofcourse it has a very small chance by now, we are around diff 0x0000000000000000 8d7c776de8f52815420ca164e661e062c8590ca248c8d4ec which makes it about 16^48, but the hashrate is increasing, so the diff does. Every difficulty doubling halves this number. The difficulty doubled every 2month so far, which will probably slow down at a time, but if it keeps the tendence after 20months it will be just 16^38 which is still a large number, but way less then what it is now.

But after all, I was just curious what happens if we get the same hash number, how does the protocol and how does the current wallet implementation react ?

Edit : laanwj answered it : The first thing AcceptBlock() does is check for duplicate block hashes and reject the block in that case. The blockchain will not fork, it will just not be accepted.
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!