Bitcoin Forum
June 17, 2019, 08:14:20 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can a transaction be included in multiple blocks?  (Read 2730 times)
wolverine.ks
Sr. Member
****
Offline Offline

Activity: 375
Merit: 250



View Profile
May 26, 2013, 08:50:39 PM
 #1

Can a miner include a transaction in a block, if that transaction has already been confirmed to the block chain?

Would that whole block be rejected? Would just the duplicate translation be rejected and the remaining transactions be accepted? Or would the block be accepted just fine, but the miner wouldn't be rewarded the transaction fee for the duplicate transaction?

or something completely different....
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
1560759260
Hero Member
*
Offline Offline

Posts: 1560759260

View Profile Personal Message (Offline)

Ignore
1560759260
Reply with quote  #2

1560759260
Report to moderator
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1064
Merit: 1036


View Profile WWW
May 26, 2013, 09:26:56 PM
 #2

Can a miner include a transaction in a block, if that transaction has already been confirmed to the block chain?
No, as the inputs of the transaction are already consumed by the first transaction, the second one will be considered a double spend (even without specific code to detect this case).

Quote
Would that whole block be rejected?

The whole block will be considered invalid and ignored by other nodes.

Quote
Would just the duplicate translation be rejected and the remaining transactions be accepted?

Blocks are always accepted or rejected as a whole. There is no middle ground.

Quote
Or would the block be accepted just fine, but the miner wouldn't be rewarded the transaction fee for the duplicate transaction?

The fee of a transaction is defined as the value of its outputs minus the value of its inputs. As its inputs do not exist anymore for the second instance of the duplicate, you can't even talk about a notion of fee. These things only make sense when the transaction is valid.

I do Bitcoin stuff.
jim618
Legendary
*
Offline Offline

Activity: 1708
Merit: 1000



View Profile WWW
May 26, 2013, 09:47:41 PM
 #3

You could have the same transaction appearing in a block in both the main chain and a side chain temporarily when there was a fork.

Say you have a fork at A below:

A --- B --- C --- D  (main chain)
\
 \
   E --- F (side chain)

The same transaction might appear in, say, blocks B and F. The two forks temporarily offer a different view of which transactions were confirmed until one dominates and the side chain gets reorganised. When the side chain gets reorganised the transactions in blocks E and F that are not yet in the main chain go back into the 'pot' for the miners to grab. Our transaction is already in the main chain (in block B) so the miners would ignore it.

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
vertak
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
June 06, 2014, 10:18:38 PM
 #4

I know this thread is old, but I came to it first, and then found an example of a transaction hash being in multiple non-forked blocks in the block chain. The blocks that contain the transaction with hash

d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599

are 91812 and 91842. As long as the previous transaction outputs have all been spent, this double transaction hash is considered valid. If any of the addresses that received BTC from the transaction in block number 91812 hadn't spent their coins yet, this would be invalid.
DannyHamilton
Legendary
*
Offline Offline

Activity: 2198
Merit: 1405



View Profile
June 06, 2014, 10:59:50 PM
 #5

I know this thread is old, but I came to it first, and then found an example of a transaction hash being in multiple non-forked blocks in the block chain. The blocks that contain the transaction with hash

d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599

are 91812 and 91842. As long as the previous transaction outputs have all been spent, this double transaction hash is considered valid. If any of the addresses that received BTC from the transaction in block number 91812 hadn't spent their coins yet, this would be invalid.

This is a known bug in the early days of bitcoin.  I don't think it is possible any longer to have 2 coinbase transactions with the same transaction hash.

piotr_n
Legendary
*
Offline Offline

Activity: 1988
Merit: 1048


aka tonikt


View Profile WWW
June 07, 2014, 03:00:00 PM
Last edit: June 07, 2014, 03:18:19 PM by piotr_n
 #6

I know this thread is old, but I came to it first, and then found an example of a transaction hash being in multiple non-forked blocks in the block chain. The blocks that contain the transaction with hash

d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599

are 91812 and 91842. As long as the previous transaction outputs have all been spent, this double transaction hash is considered valid. If any of the addresses that received BTC from the transaction in block number 91812 hadn't spent their coins yet, this would be invalid.

This is a known bug in the early days of bitcoin.  I don't think it is possible any longer to have 2 coinbase transactions with the same transaction hash.

It wasn't a bug, but the initial design.

BerkeleyDB that was used by the project back then had no problems handling records with non-unique keys.
After Satoshi had left, guys who took over the development replaced BerkeleyDB with LevelDB. And LevelDB only works with unique keys.
Whoever made the decision back then apparently did not care about handling non-unique IDs anymore (in reality only coinbase could have non-unique IDs), so they essentially changed the block chain protocol at that point. Which was a good decision, IMHO, since there were only 2 txs like this while the architectural complication of keeping it backward compatible wouldn't rather be worth these 100 BTC, for which most likely nobody has a key anyway.

It is not a fist time when I read misinformation about this had being an alleged bug.
You guys better get your records straight, because in fact it was not a bug - such was the initial design and the original implementation had no problems whatsoever with handling same TX IDs.
Then in blocks version 2 they started to require a block height value inside the coinbase, which makes it now impossible to replicate a previous TXID, even if the miner had really wanted to.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
apxu
Member
**
Offline Offline

Activity: 222
Merit: 12


View Profile
June 07, 2014, 07:04:46 PM
 #7

Quote
keeping it backward compatible wouldn't rather be worth these 100 BTC, for which most likely nobody has a key anyway.
200 btc to be correct

https://blockchain.info/tx/d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599
https://blockchain.info/tx/e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468
piotr_n
Legendary
*
Offline Offline

Activity: 1988
Merit: 1048


aka tonikt


View Profile WWW
June 07, 2014, 10:41:13 PM
 #8

But 100 from it can still be spent - they are in UTXO DB, except as single records, instead of doubled.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!