I'm learning bitcoin protocol theory.

To pay to someone you use a transaction. In the transaction you specify some of old transactions that gave you money (so called inputs). These inputs should have not been already spent.

Therefore the bitcoin network must check these inputs are unspent. Bitcoin network holds the list of all unspent transactions. Transactions are in tree-like structures, and all unspent transactions are the roots of these trees. So bitcoin network checks that input transaction is in this list.

After current transaction is done, all used input transactions (inputs) are now spent, and output transaction and change are now put in the list of unspent transactions.

Is the above process and terminology correct?

EDIT: I found confusing now the thing that transaction can have multiple outputs. This means I cannot just state that transaction is my input, and that the it gets invalidated when used for new transaction, as this transaction has an output that is someone else input. How is this handled?


Yes, you've basically got it.

Regarding multiple outputs, the solution is quite simple. Your input, instead of just specifying a transaction to spend, instead specifies a particular output of a transaction. So instead of your input saying "I am spending transaction abc123", it says "I am spending output #2 of transaction abc123".

Every full node on the Bitcoin network maintains a database of unspent transaction outputs or UTXOs. It is indexed by transaction ID and output number. So when a node sees your transaction, it will mark transaction abc123 output #2 as spent. Outputs #0 and #1 of that same transaction have their own independent entries in the database and so their states are unchanged; if they have not been spent previously, they can be spent by some later transaction.

  • 1. Every full node maintains list of all processed transactions? 2. This list is called blockchain? And only part of this list is UTXO. – croraf Oct 21 '17 at 14:59
  • 1
    @croraf: Yes, a full node maintains a complete list of all transactions. That's what "full node" means. The blockchain consists of this list, plus block headers. It would be inefficient to search the whole list every time a new transaction has to be verified, so as the node downloads each block for the first time, it builds the UTXO database, so that it can check UTXOs in constant time. – Nate Eldredge Oct 21 '17 at 15:08

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.