Hi it’s Keir Finlow-Bates here, and today i
want to explain how Bitcoin transactions work; in particular looking at what spent
and unspent transactions are and what inputs and
outputs to a transaction are. And the analogy is that you’ve got an imagine
that when you have five bitcoin, say, what you actually have is a cup containing
500 million grains of sand: each grain of sand represents a satoshi, and the cup is
standing upright holding the sand. And when you decide to send one Bitcoin
to a friend, what you are doing then is – you are tipping the cup upside down so
that all the sand pours out, and that means that your cup, which used to be an
unspent transaction, is now a spent transaction. And there’s a record on the
blockchain at the point that your transaction takes place that says this
cup is now upside down and empty, and then the second part of the transaction
is that you specify that other new cups that were initially empty get placed
underneath that flow of sand – so if you’re transferring one Bitcoin that’s a
hundred million grains of sand – your friend’s cup gets put under part of the
stream so it catches that 100 million, and now there’s another 400 million
grains of sand that are pouring down, so you create a new empty cup for yourself
using your what is called a change address, to catch the remainder, and now
you have a new unspent transaction which is a new cup containing 400 million
grains of sand. Except it won’t actually contain 400 million because you have to
leave a little bit over for the transaction fee, so your cup might not
catch the 400 million grains of sand: you might specify that it’s only going to
catch 390 million grains of sand, leaving 10 million grains of sand spare. And when
a miner mines the block they then put a third cup to catch that final residue,
and that is the transaction fee. So this one simple transaction of tipping up
your initial cup full of sand, the sand is now
caught in three different cups and the unspent transaction – the initial full cup
with the 500 million grains of sand – now becomes a spent transaction. It was
the input to the transaction and the outputs are those three new cups each
containing a fraction of the original 500 million grains of sand. So it’s not
the simplest thing initially to get your head around, because it’s not the
intuitive way of handling balances, which is subtract the number from one balance
and add that same number to another balance in a database. But that’s the way
that Nakamoto decided to implement it. And one side effect of this is that when
bitcoins are transferred from person to person you can track the whole
transaction flow – it’s all recorded on the blockchain and that is actually one
of the reasons why Bitcoin isn’t truly anonymous, because if you can work out
who received some coins you may be able to track back and find another address
and link two people together. So you can mine for more information. But anyway, I
hope this cups of sand analogy helps you understand transactions and transaction
flow, and what spent and unspent transactions are and what inputs and
outputs to a transaction are – I’ll see you in the next video soon. Bye for now!