BIP30 and BIP34 interaction (was Re: [BIP Proposal] Buried Deployments) [combined summary]



Individual post summaries: Click here to read the original discussion on the bitcoin-dev mailing list

Published on: 2016-11-18T16:47:09+00:00


Summary:

In a recent discussion on the bitcoin-dev mailing list, concerns were raised about the possibility of transaction hash collisions and their potential impact on the Bitcoin network. While it is unlikely that such collisions will occur due to the strength of SHA256, there is still a small chance that they could happen. BIP30 allows for fully-spent transactions to be duplicated for pruning purposes, but this means that there could be duplicated transaction IDs (txids) in the future. BIP34 aims to enforce block and transaction uniqueness, but does not explicitly reject collisions by consensus. To address this issue, a suggestion is made to draft a new BIP, but it is noted that doing so would make it impossible to guard against chain splits caused by pruning.Peter Todd responds to these concerns, stating that the likelihood of a transaction hash collision is highly unlikely, as SHA256 is currently a secure algorithm with infeasible brute-force attacks against 256-bit keys. He emphasizes that if SHA256 were to become weak, Bitcoin would be fundamentally broken, as miners would be able to generate blocks with collisions in transactions and merkle trees, leading to multiple contradictory transaction histories. Todd cites Bruce Schneier's statement that brute-force attacks against 256-bit keys will remain infeasible until computers are built from something other than matter and occupy something other than space.Eric Voskuil explains in another discussion that banning duplicate transaction hashes outright is not feasible, as it would require spent transaction hashes to be retained forever, contradicting the concept of pruning nodes. Additionally, implementing such a ban would result in a chain split and a hard fork. While BIP34 prevents exact duplicate transactions, different transactions can still have the same hash if their parents are identical. However, as long as the hash function remains secure, future transactions are guaranteed to have unique txids.Tier Nolan adds that as long as there is no hash function break, the rules guarantee that all future transactions will have different txids. However, Eric Voskuil points out that if there is an address collision, someone may lose money, while a tx hash collision handled differently by implementations could lead to a chain split. It is emphasized that nodes cannot dismiss this possibility and must remain vigilant. Nolan explains that the only way for two transactions to have the same txid is if their parents are identical, as txids of parents are included in a transaction. While coinbases used to allow for the possibility of identical transactions, exceptions were made because duplicate outputs were not possible in the database. All new coinbases will have unique hashes, ensuring that all future transactions will have different txids.In regards to BIP30, it is clarified that it prevents duplicate transaction hashes only when a new transaction hash duplicates that of a preceding transaction with unspent outputs. On the other hand, BIP34 does not prevent duplicate transaction hashes from different transactions. Two cases of duplicate transaction hashes have already occurred, one of which was exempted from validation because it had become buried in the chain, while the other complied with the BIP30 rule due to its predecessor being spent. BIP34 now precludes exact duplicate transactions. The collision of regular transactions is highly unlikely due to inputs and usage of entropy, but coinbase transactions, which do not have inputs, present a worrying case. BIP30 introduces committed height to prevent collisions on coinbase transactions.Overall, while the likelihood of transaction hash collisions is low, precautions must be taken to ensure the integrity of the Bitcoin network. The discussions highlight the importance of maintaining a secure hash function and implementing measures such as BIP30 and BIP34 to prevent collisions and chain splits.


Updated on: 2023-08-01T19:14:30.939869+00:00