What exactly is the "vout" field? This is driving me nuts. Through trial-and-error, asking numerous people and attempting to read endless articles and manuals, I've come to the conclusion that the &quot;transactions&quot; listed by listsinceblock are quite misleading.
They are not transactions at all?
The &quot;txid&quot; field is not unique, for example. It is only unique when coupled with the mysterious &quot;vout&quot; field, which can apparently be 0 or 1.
This, coupled with the multiple different &quot;categories&quot; (besides receive and send) really make me confused and worried that my Bitcoin Core-based payment system is somehow fundamentally broken.
Can somebody please explain to me once and for all why vout exists and why txid is not unique? And what does this mean in practice? Is this because a &quot;Bitcoin payment&quot; can be made in multiple different &quot;sub-transactions&quot;? I never was able to understand the purpose of that, and it's making me beyond confused.
Would love to get this straightened out now that I'm actually close to actually launching a Bitcoin service!
vout is the 0 based output index. It can be more than just 0 or 1, but those tend to be the most common because people don't make transactions with lots of outputs.
To understand vout, you must understand how Bitcoin transactions actually work. A Bitcoin transaction consumes transaction outputs as inputs, and creates transaction outputs. It can consume multiple transaction outputs, and create multiple transaction outputs. Furthermore, these transaction outputs can be consumed by different transactions, so each one needs to be able to be uniquely identified. So a unique identifier contains two items: the transaction id to identify the transaction an output belongs to, and an index to point to the position in the list of outputs in that particular transaction.
That index is what the vout is. As with many things in computer science, it is a 0 based counter so the first item is at index 0, the second at 1, and so on.
listsinceblock, listtransactions, and some other RPCs in Bitcoin Core don't actually list Bitcoin transactions. Rather they list the logical transaction - the one that humans tend to think of. This is because a single Bitcoin transaction can both send Bitcoin away from you, and allow you to receive Bitcoin.
In a single Bitcoin transaction, you can be consuming your own transaction outputs, so the transaction is sending your Bitcoin away. However not all transactions contain inputs from the same person. This transaction could involve another person who has their own transaction outputs as inputs to this transaction. And perhaps they are creating an output that you would be able to spend. So this transaction is also sending Bitcoin to you. This single Bitcoin transaction would then consist of two logical transactions - one where you are sending, and one where you are receiving.
This can often occur with change outputs, but the software should not be showing you those as it is smart enough to hide them and not consider them as a distinct logical transaction. Change outputs are when a transaction output is created by you that sends the Bitcoin back to yourself. They exist because a transaction output must be spent in full, but often the amount you are actually sending does not exactly match the exact amount of the output your are spending. So you must create an output that sends the remainder back to yourself.