Author

Topic: What happens if 2 miners mine the same block at the same time? (Read 269 times)

legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Guys, hash collision is not impossible.

Take example these 2 images. They have the same MD5 hash:

(253DD04E87492E4FC3471DE5E776BC3D)

https://drive.google.com/open?id=1DdJPc0uShVfueYydBO0-WSoDr0Qzhf3F
https://drive.google.com/open?id=1HSUHhLRBLoyHYT72GZWaB_E6PQ1uWTcD

MD5 is broken and it's trivial to construct files with the same hash by slightly changing a small amount of data appended to both files. Same happened with SHA-1, except it would still require a big chunk of processing power, unlike with MD5 which can be attacked in that way even on old CPU. But, MD5 still has pretty much full preimage resistance, meaning if you hash some data, the attacker would only be able to brute force it to try to find a message that hashes to the same hash value. This means that even with MD5 hash collisions effectively cannot be encountered accidentally.

Until there are known practical attacks against SHA-256, hash collisions are out of the question.

Yeah because SHA256 has 11579208923731619542357098500869e+77 different combinations. So big number...
legendary
Activity: 3024
Merit: 2148
Guys, hash collision is not impossible.

Take example these 2 images. They have the same MD5 hash:

(253DD04E87492E4FC3471DE5E776BC3D)

https://drive.google.com/open?id=1DdJPc0uShVfueYydBO0-WSoDr0Qzhf3F
https://drive.google.com/open?id=1HSUHhLRBLoyHYT72GZWaB_E6PQ1uWTcD

MD5 is broken and it's trivial to construct files with the same hash by slightly changing a small amount of data appended to both files. Same happened with SHA-1, except it would still require a big chunk of processing power, unlike with MD5 which can be attacked in that way even on old CPU. But, MD5 still has pretty much full preimage resistance, meaning if you hash some data, the attacker would only be able to brute force it to try to find a message that hashes to the same hash value. This means that even with MD5 hash collisions effectively cannot be encountered accidentally.

Until there are known practical attacks against SHA-256, hash collisions are out of the question.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Guys, hash collision is not impossible.

Take example these 2 images. They have the same MD5 hash:

(253DD04E87492E4FC3471DE5E776BC3D)
Nobody said that it's impossible, it's just very very low.
However, your example used MD5 hash algorithm that only has 2^128 possible outputs and collisions were already discovered.
In comparison, Bitcoin uses SHA-256 which has a lot larger output size of 2^256 and currently no recorded collision.

Not even one yet? Omg... I wonder what will happen when we will see the first collision. It could happen with 2 same bitcoin addresses right?
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
Guys, hash collision is not impossible.

Take example these 2 images. They have the same MD5 hash:
Nobody said that it's impossible, it's just very very low.
However, your example used MD5 hash algorithm that only has 2^128 possible outputs, prone to collision attacks and collisions were already discovered.
In comparison, Bitcoin uses SHA-256 which has a lot larger output size of 2^256, no easy attack vector [specially SHA-256d (double) used by Bitcoin's POW] and currently no recorded collision.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Guys, hash collision is not impossible.

Take example these 2 images. They have the same MD5 hash:

(253DD04E87492E4FC3471DE5E776BC3D)

https://drive.google.com/open?id=1DdJPc0uShVfueYydBO0-WSoDr0Qzhf3F
https://drive.google.com/open?id=1HSUHhLRBLoyHYT72GZWaB_E6PQ1uWTcD
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
Imagine they have the same hash and the same block header's information. What happens then? Do they spread it to the network and whoever is luckier wins?
If that happened, then the network wont bother since it's the same block  Roll Eyes

Two miners can't have the same hash of their constructed block header unless they also have the same coinbase transaction (the "block reward") or it's a SHA-256 collision.
Why? The coinbase transaction will also be used together with the TXs to make the 'hashMerkleRoot' that's in the block header;
SHA-256 has a very-very-very huge number of possible outputs, two different inputs will only have the same hash if they are exactly the same or there's a collision.

-edit- Noticed that it's the same answer as hatshepsut93's, removed and added something else.

What you wan't to know is when two different blocks were mined at the same time, then there will be a fork that could create a temporary alternate chain.
If you already got 'Mastering Bitcoin', re-read page 200-204.
donator
Activity: 4760
Merit: 4323
Leading Crypto Sports Betting & Casino Platform
What would really blow your mind is what happens if 2 miners mine the same block at different times and separate miners each try to build on the new solved blocks.
legendary
Activity: 3024
Merit: 2148
Imagine they have the same hash and the same block header's information. What happens then? Do they spread it to the network and whoever is luckier wins?

They will only have the same hash if either coinbase transactions are the same, or there is somehow a hash collision (the Universe will end sooner than that one happens). So, if coinbase transactions and all the other information is the same and the hash is the same, than it's the same block, it will propagate through the network like normal, there won't be any conflict. But it will never happen on practice, because too many things need to coincide - two independent miners will have to include the same transactions and make the same timestamp up to the smallest unit, and for some reason include the same coinbase transaction, and also find the same nonce - it's just impossible. But if you imagine it happening, it would be like two nodes on the network simultaneously broadcasting the same new block - the network doesn't care about such circumstances, it only cares that the blocks are valid.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Okay thank you for that, but just you to know, google isn't the best "query solverer" when we talk about bitcoin. I mean, its results don't always fit my question. That's why I don't google "What happens if 2 miners mine the same block at the same time?", but I should have done it this time.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Whatever the title says.

I know that if 1 person tries to double spend his bitcoins he will fail because of the memory pool. (This is what will happen:)




But what if 2 people mine the same block at the same time? SAME SAME time.
Imagine they have the same hash and the same block header's information. What happens then? Do they spread it to the network and whoever is luckier wins?
Jump to: