30

What is the meaning of the term "unspent output" in the Bitcoin protocol?

42

An unspent output is simply an output of a transaction which isn't yet an input of another transaction.

To take the example from ripper234's answer (in which generated coins are immediately spendable, and we don't have to wait 100 blocks for them to mature), where:

  • The first block contained 50 mined BTC in address A (A = 50)
  • The second block contained 50 mined BTC in address A, a transaction sending 20 BTC to address B, and putting the change in address C (A = 50, B = 20, C = 30)
  • The third block contained 50 mined BTC in address A, a transaction sending the 20 BTC from address B to address D (A = 50 + 50, C = 30, D = 20)

So, after three blocks, there are four unspent outputs:

  • A has two unspent outputs worth 50 BTC each
  • C has a single unspent output worth 30 BTC
  • D has a single unspent output worth 20 BTC

And there are two spent outputs:

  • the 50 BTC generated in the first block, spent in the 2nd block
  • the 20 BTC output created in the 2nd block and spent in the 3rd block

Note that unspent outputs don't merge together. The two unspent 50 BTC outputs at address A are separate, and will remain separate at least until they are spent in a transaction

  • I must be missing something, as I cant create any logic which can explain the above. A has 50 (I am assuming this is its balance, which we are saying is also called unspent outputs), and sends 20 to B and 30 to C. Now A has zero. Later A magically has 50 again, then 100. Does this mean A started off with more than 50? – John Little Feb 5 '18 at 13:25
  • In the second row, surely A's output WERE spent by making them inputs of B and C, so why are they still unspent? – John Little Feb 5 '18 at 13:26
  • @JohnLittle A is the miner, he got another 50 for the second block he mined. – xczzhh Feb 26 '18 at 9:34
  • Can we assume that: Total balance = Sum of unspent transactions – DeveScie May 23 '18 at 3:44
  • @Umarov I think the Total balance = Sum of unspent transactions - Sum of spent transactions. – zhaozhiming Jun 7 '18 at 7:12
12

It means "Bitcoins that were not spent".

Imagine the early days, when the blockchain was of length 3 (imaginary chain of events):

  • The first block contained 50 mined BTC in address A
  • The second block contained 50 mined BTC in address A, a TX sending 20 BTC to address B, and putting the change in address C
  • The third block contained 50 mined BTC in address A, a tx sending the 20 BTC from address B to address D

So, after 3 blocks, this is the "sum total":

  • A has 100 BTC
  • C has 30 BTC
  • D has 20 BTC

Total 150 BTC in unspent outputs. These are the "unspent coins" - all the generated BTC, without counting transactions that moved BTC twice.

  • I don't quite understand what you mean by "bitcoins that were not spent". So what is a bitcoin that is spent? When a TX sends 20 BTC from A to B, aren't those coins considered spent? When will a coin be considered spent? – Pacerier Aug 16 '13 at 5:22
  • 1
    @Pacerier The coins in A are considered spent after this tx, but the coins now reside in B in an "unspent form". Note that it's not bitcoins that are actually spent or unspent, it's "outputs". Read Chris' answer for more details. – ripper234 Aug 18 '13 at 18:06
  • Then the number of unspent coins will only increase and never decrease right? What's the point, I mean, Isn't the number of unspent BTCs forever equivalent to the number of BTCs? – Pacerier May 22 '14 at 21:19
  • Yes, to total value of unspent transaction output are the total bitcoin in circulation. – Haddar Macdasi Mar 11 '15 at 15:53

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