11

Suppose I publish the private key of an address that contains 1 bitcoin. If two people try to transfer this bitcoin to another address before a new block is found, who gets it? How is this decision made?

1

2 Answers 2

7

When a node receives two conflicting transactions, it will only relay the first one that it received, dropping the other. If one transaction fully propagates through the network before the other is sent, the first will prevent the second from ever reaching any miner nodes.

If both transactions are sent at roughly the same time, the network will be in disagreement about which one is valid. This will be resolved once a miner node finds a block and includes whichever transaction it had first heard about.

2

Miners are not obligated to include any specific transaction in a block.

If one person gets a headstart then any non mining node will not relay the duplicate so the "first mover" will quickly cut off portions of the network from other contenders. However if both transacitons are create at roughly the same time it is possible that each duplicate transaction will reach the nodes that support mining pool(s) via different routes.

A mining pool can include any transaction they wish and tend to run customized versions of the bitcoind to optimize block generation. It is in the miner's best interest to take the transaction with the higher fee at the detrimnent of other transactions. Thus using a transaction fee could increase the chance of being included in the next block.

Utltimately the transaction included in the block will resolve the "race".

1
  • The network "cut off" might be bypassed by sending TXs directly to the pools.
    – kermit
    Mar 29, 2012 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.