coinspoolco (OP)
Newbie
Offline
Activity: 47
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 04:29:07 PM |
|
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.
|
|
|
|
jl2012
Legendary
Offline
Activity: 1792
Merit: 1111
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 04:46:32 PM |
|
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
Activity: 47
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 04:58:57 PM |
|
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
Activity: 1792
Merit: 1111
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 05:04:44 PM |
|
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
Activity: 2058
Merit: 1434
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 05:09:32 PM |
|
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>
|
|
|
|
DannyHamilton
Legendary
Offline
Activity: 3472
Merit: 4790
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 07:29:43 PM |
|
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
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 07:42:00 PM |
|
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
Activity: 3472
Merit: 4790
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 07:49:29 PM |
|
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.
|
|
|
|
|
DannyHamilton
Legendary
Offline
Activity: 3472
Merit: 4790
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 03, 2014, 10:51:57 PM |
|
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 2 192, not 2 256. 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 2 192 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
Activity: 47
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
April 04, 2014, 01:35:37 AM Last edit: April 04, 2014, 02:28:35 PM by coinspoolco |
|
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.
|
|
|
|
|