I guess I just don't understand then.
So you are saying that even before a tx receives a confirmation, it is "added" to the UTXO set.
There are no transactions in the UTXO. Only outputs.
Even before a transation receives a confirmation, the outputs that are referenced by the inputs are REMOVED from the UTXO, and the new outputs are ADDED to the UTXO.
So if the mempool is flooded with millions of spammy valid txs, but they pay an appropriate fee, in
theory, there would be an increase of millions of new UTXOs within the UTXO set for at least 72 hours?
Every one of those transactions also spends outputs that used to be in the UTXO. Those spent outputs are removed.
So the data in the UTXO set are not always valid unspent transactions?
They are valid unspent outputs. They can be used in another transaction.
Furthermore, the only way a "spent transaction output" becomes an unspent output is if the transaction that spent it either becomes invalid or is dropped from the mempool to free up space for newer transactions. It doesn't become an unspent output when it gets included in the blockchain. It remains spent.
Don't you mean the prior tx remains spent, and it child is unspent, but is already in the UTXO set?
Transactions don't get spent. Outputs do. The spent output remains spent. The new confirmed transaction has its own outputs. Those outputs were unspent and in the UTXO before the transaction got confirmed. They remain unspent and in the UTXO when the transaction is confirmed. Confirming the transaction doesn't change that.
So, all broadcasted but unconfirmed txs are all already in the UTXO set and thus are only removed
from the UTXO set if the spending tx was invalidated or dropped from the mempool?
The outputs of those unconfirmed transactions are in the UTXO. The outputs that are spent by the inputs are removed from the UTXO.
The outputs that are added to the UTXO are removed from the UTXO if the transaction is invalidated OR if the transaction is dropped from the mempool OR if the outputs are spent by another transaction.
The UTXO set assumes all broadcast txs are valid until told otherwise.
Transactions are validated before being added to the UTXO. If the transaction is invalid, then it won't be added to the mempool or the UTXO. However, a transaction that was previously valid can become invalid. In that case the now invalid transaction is removed from the mempool and its outputs are removed from the UTXO (and depending on why it became invalid, some of the outputs spent by its inputs may be added back into the UTXO.
What I thought was that: The inputs were the spent outputs from it's parent tx. When an
address has valid inputs that are unmoved, the address is an "unspent output". Thus the UTXO term.
So metaphorically, the input only exists to validate spent outputs that are being transformed into
unspent outputs within a new address for example. Coinbase's would be the only true input in my
thinking, since they "originate" outside of the blockchain. This was my reasoning.
I thought outputs were moving from a state of unspent to spent continuously.
Inputs were just another representation for of an unspent output.
Well, to start with, there are no addresses. Those are an abstraction that our wallets and block explorers create for us humans to make it easier to talk about the transfer of control over value. They don't exist in transactions or the blockchain.
Next, inputs never "move". They are listed in a transaction and they remain there.
Finally, coinbase transactions have outputs, but never have inputs.
Here's a good analogy:
Transaction A (Coinbase)
Inputs:
none
Outputs:
Value:1250000000 Encumbrance: Signature required from private key associated with public key Z
("Transaction A, first output", added to UTXO)
Transaction B
Inputs:
Transaction A, first output, signature from valid private key
Outputs:
Value 1000000000 Encumbrance: Signature required from private key associated with public key Y
Value 0240000000 Encumbrance: Signature required from private key associated with public key X
("Transaction A, first output", removed from UTXO
"Transaction B, first output", added to UTXO
"Transaction B, second output", added to UTXO)
Transaction C
Inputs:
Transaction B, first output, signature from valid private key.
Outputs:
Value 0500000000 Encumbrance: Signature required from private key associated with public key W
Value 0400000000 Encumbrance: Signature required from private key associated with public key V
("Transaction B, first output", removed from UTXO
"Transaction C, first output", added to UTXO
"Transaction C, second output", added to UTXO)
Invalid transaction D
Inputs:
Transaction A, first output, signature from valid private key
Outputs:
Value 0500000000 Encumbrance: Signature required from private key associated with public key U
Value 0740000000 Encumbrance: Signature required from private key associated with public key T
(Transaction D rejected because Transaction A, first output is not in the UTXO)
Transaction E
Inputs:
Transaction B, second output, valid signature
Transaction C, first output, valid signature
Outputs:
Value 0730000000 Encumbrance: Signature required from private key associated with public key S
("Transaction B, second output", removed from UTXO
"Transaction C, first output", removed to UTXO
"Transaction E, first output", added to UTXO)
So at this point the UTXO lists:
- "Transaction C, second output"
- "Transaction E, first output"
If transaction E takes too long to confirm and is removed from the mempool then "Transaction E, first output" will be removed from the UTXO list. "Transaction B, second output" and "Transaction C, first output" will both be added back into the UTXO list.
In that case, the UTXO list would revert to:
- "Transaction B, second output"
- "Transaction C, first output"
- "Transaction C, second output"
Note that the UTXO is just a list. Things are added to that list, and removed from that list, but that doesn't have any effect on what is in the transaction. They transaction remains static exactly the way it was created with its own lists of inputs and outputs.
My point was that the term "input" was just a place holder to describe an unspent output.
So when I gather multiple inputs to make a new tx with 1 output, I am really gathering
multiple unspent outputs and making a new tx to spend them to another address where the
process could begin again if I controlled that new address.
The term "input" is not just a place holder. An input is an actual list item in a transaction. A transaction consists of two lists. The list of inputs is a list of references to transaction outputs. It is part of the transaction and it doesn't go away. It is permanently stored in the blockchain when the transaction is confirmed.
Do inputs exist within a UTXO?
No. Inputs are not listed in the UTXO. Additionally, outputs are removed from the UTXO when they are referenced by an input.
Are you saying UTXOs are unspent inputs then?
Inputs are never spent or unspent. Their existence is what causes an output to be removed from the UTXO.
I guess I really do not understand.
Like I said earlier,
"
Bitcoin doesn't work the way a lot of people expect it to, and when they are first exposed to the whole input and output concept it can be confusing."
Edit: After a superficial search, I understand why I am incorrect. When I am using the
term "input" I am only referring to the "coins" associated with the prior tx, when in reality an
"input" contains an "outpoint", a "signature script", and a "sequence number". I assumed they
were separate and part of the full tx and not part of the input/output aspects of the tx.
There are not "coins". There are
ONLY inputs and outputs in a ledger.
Ultimately, I need to read a well written book on Bitcoin for Novices and really learn everything
from the beginning and properly.
I'm happy to discuss it with you. The first step is to unlern what you think you know and understand that from a technical standpoint:
"coins" are an abstraction for us humans. They do not actually exist at transaction and blockchain level.
"addresses" are an abstraction for us humans. They do not actually exist at transaction and blockchain level.
A transaction is really just 2 lists. There isn't much more to it. The first list is called "inputs", and is a list of outputs of other transactions along with signatures that satisfy the encumbrance of those outputs. The sum of the values of those outputs is the total value available for the transaction to use in its own outputs. The second list is called "outputs" and is a list of new unspent outputs each encumbered with a requirement (typically a signature requirement). The sum of the values of those outputs is not allowed to exceed the total value supplied by the inputs.
I am really impressed with you, you are a member legend, and the information you provide is really helpful, I feel like you. You give the answer to all the above comments, I feel very surprised. This forum needs more than members like you. The information is really useful, I thank you. The currency and address is actually an abstract, the true nature of which is a sequence of interrelated and marked data that does not really exist. There are inputs and there is always output, that is a transaction, they have a close relationship and have equal value. No difference is allowed. That's what I can understand from your information.