3

I was wondering why the order in which the transactions occur matters when we reconstruct ownership information. Can't we just aggregate all the input and output for each account to calculate how much it owns?

4

I was wondering why the order in which the transactions occur matters when we reconstruct ownership information. Can't we just aggregate all the input and output for each account to calculate how much it owns?

There are no accounts on Bitcoin, but even if there were accounts, how would you deal with the case where the sum of the transactions exceeds the funds necessary for all of them to be valid? Transaction order is necessary to deal with that case. Here's an example:

  1. Mallory receives 1 BTC to her account
  2. Transaction A spends 0.5 BTC to Alice from Mallory's account
  3. Transaction B spends 0.5 BTC to Bob from Mallory's account
  4. Transaction C spends 0.5 BTC to Charlie from Mallory's account

Assuming negative balances are forbidden, the order of these transactions determines who gets paid.

Because transaction order matters, and for other reasons, Bitcoin doesn't have accounts. Each time you receive funds, it's paid to an output that's uniquely identifiable. That is, it may have the same spending condition (e.g. address) as other outputs you've received, but each output can be uniquely identified by the transaction it appears in (txid) and its sequence in the series of outputs in that transaction (output index number, or output vector (vout)).

When you spend funds, you create an input that uses that unique identifier (called an outpoint) to references the output you're spending. Bitcoin only allows you to spend an output once within a block chain (an ordered list of transactions), so you have to spend all of the value of that output or you lose the value you don't spend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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