0

Suppose I have 1 bitcoin, I give Alice 0.2 bitcoin first, then Bob 0.2 bitcoin immediately, both transactions are legal

  1. can miners reverse the chronological order when packing block ?
  2. If (1) is true, as a payment system, you can't get the correct timeline when backtracking, is this a design flaw?

2 Answers 2

3

Transactions have no order until they are included in a valid block. That is the entire function of the blockchain: to act as a distributed timestamp server for transactions.

can miners reverse the chronological order when packing block ?

A miner can order transactions in a block however they would like (assuming that the block remains valid otherwise, of course). Saying things like 'what is the chronological order of unconfirmed transactions?' doesn't make any sense. There are simply unconfirmed transactions, and then there are confirmed (and thus ordered) transactions that are a part of the blockchain record.

There are some cases where the ordering of transactions will matter though, for example if you create two transactions, and the second transaction spends an output that was created by the first transaction. In that case, the second transaction would only be valid if the first transaction is included ahead of it, since the second transaction would otherwise be spending a non-existent output.

If (1) is true, as a payment system, you can't get the correct timeline when backtracking, is this a design flaw?

As mentioned above, the explicit ordering of transactions is defined by their inclusion in the blockchain record. Building a system that attempts to order unconfirmed transactions wouldn't be very useful in many cases.

2

Bitcoin uses a UTXO model – all bitcoin exists in the form of unspent transaction outputs (UTXOs). So there are a number of different scenarios depending on how many UTXOs you have and what you do with them:

  1. You have a single* UTXO of 1 BTC. You create a single transaction paying 0.2 BTC to Alice, 0.2 BTC to Bob and 0.6 BTC back to yourself. A transaction is atomic, so miners cannot in any way separate the payment to Alice from the payment to Bob.

  2. You have a single* UTXO of 1 BTC. You create a transaction paying 0.2 BTC to Alice and 0.8 BTC to yourself, and then another transaction spending that 0.8 BTC, paying 0.2 BTC to Bob and 0.6 BTC to yourself. Because the latter transaction is dependent on the former, it cannot be confirmed (mined) before the former is confirmed. They may be mined within the same block, but they must have a correct order within that block.

  3. You have two UTXOs of 0.5 BTC each. You create two transactions each paying Alice and Bob respectively 0.2 BTC and 0.3 BTC to yourself. Broadcasting them to the network in a specific order doesn't guarantee that they will be confirmed in that order.

* Or multiple smaller UTXOs that you will be spending together in one transaction.

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.