Wallet encryption could cause duplicate coinbase txes #482

issue TheBlueMatt opened this issue on August 31, 2011
  1. TheBlueMatt commented at 7:56 PM on August 31, 2011: member

    Quote from https://github.com/bitcoin/bitcoin/commit/59ed5cb398f3817cebd8f5c6aeba3424de2acefe#commitcomment-562434

    This edit states that the "default key" will be used as the target for payouts for mining. If this is correct, then it might be problematic and could result in a loss of funds to miners. When miners mine more than one block using the same payout address, the coinbase transactions in each block are identical, which results in them having an identical sha256 hash, which results in all but the first one being unidentifiable and hence unspendable. I suppose you might be aware of that, but wanted to point this out just to prevent the possibility of it being an expensive consequence for somebody else.

  2. gavinandresen commented at 4:27 PM on September 1, 2011: contributor

    Can somebody double-check to see if I'm reading the code correctly?

    Looks like both BitcoinMiner and getwork() call IncrementExtraNonce() to create unique coinbase transactions, so I don't think this is an issue.

  3. sipa commented at 10:01 AM on September 6, 2011: member

    They both call IncrementExtraNonce... which resets the extra nonce every second after overflowing. This guarantees unique block candidates, but not unique coinbase transactions. When an infinite supply of pubkeys are available, this isn't a problem, because after creating a block, the previous default pubkey will be in use, and a new one will be used.

    My suggestion: add the current timestamp to the coinbase when no fresh pubkeys are available.

  4. makomk commented at 7:55 PM on September 6, 2011: none

    Also, the extra nonce used in IncrementExtraNonce isn't stored across restarts. This isn't normally an issue due to the timestamps in block headers - it's very unlikely a bitcoin restart will take less than a second - but it means that not resetting the extranonce isn't a solution.

  5. gavinandresen closed this on Sep 9, 2011

  6. coblee referenced this in commit 92e857f47b on Jul 17, 2012
  7. ptschip referenced this in commit a0fdcdffd4 on May 4, 2017
  8. dexX7 referenced this in commit cad404df58 on Jul 7, 2017
  9. IntegralTeam referenced this in commit efaa69e6a6 on May 15, 2019
  10. kallewoof referenced this in commit d24ecf21a4 on Oct 4, 2019
  11. rajarshimaitra referenced this in commit a7108dd4ec on Aug 5, 2021
  12. rajarshimaitra referenced this in commit 2046820fd9 on Aug 5, 2021
  13. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me