Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: senanahmedli on July 20, 2017, 01:39:57 PM



Title: UTXO amount decrease
Post by: senanahmedli on July 20, 2017, 01:39:57 PM
Hello,

There is point that I can not understand, It would be great if someone could explain it. As we know UTXO is amount of unspent transactions. In my opinion, the amount of UTXOs should be always increasing. For example, If userA has 10 BTC and he sends 7 BTC to userB. In this case, unspent transaction for userA would be 3 BTC and for userB UTXO would be 7 BTC. as a total value, the amount of unspent transaction output will be always same which 10 BTC in my case. As long as we know that miners get 12.5 btc for every validation.By the help of this fact, the amount of UTXO in blockchain should always be increased in every 10 minutes. However when I check the blockchain.info I see the amount of UTXOs decreased in some extent. Maybe the time while validating transaction could be the reason for this but i am not sure about that. Could you please explain it to me.

Thank you.


Title: Re: UTXO amount decrease
Post by: mocacinno on July 20, 2017, 01:45:53 PM
Hello,

There is point that I can not understand, It would be great if someone could explain it. As we know UTXO is amount of unspent transactions. In my opinion, the amount of UTXOs should be always increasing. For example, If userA has 10 BTC and he sends 7 BTC to userB. In this case, unspent transaction for userA would be 3 BTC and for userB UTXO would be 7 BTC. as a total value, the amount of unspent transaction output will be always same which 10 BTC in my case. As long as we know that miners get 12.5 btc for every validation.By the help of this fact, the amount of UTXO in blockchain should always be increased in every 10 minutes. However when I check the blockchain.info I see the amount of UTXOs decreased in some extent. Maybe the time while validating transaction could be the reason for this but i am not sure about that. Could you please explain it to me.

Thank you.

I could also consolidate unspent outputs.
For example, i have received 1000 payments of 0.001 BTC in the past. I'm able to spend 1000 unspent outputs.
If i decided to purchase a 0.999 BTC item, i would use all 1000 unspent outputs as an input, and i would generate one new unspent output (and 0.001 as a fee, which will likely not be enough).

If my transaction was the only one that made it into the last block, the utxo set would have decease by 999, since i have used 1000 unspent outputs, and only created one new unspent output :)


Title: Re: UTXO amount decrease
Post by: tspacepilot on July 20, 2017, 07:59:18 PM
Right, OP seems to be confusing the BTC value of unspent outputs with the count of unspent outputs.

OP: UTXO db is there to keep track of spendable outputs, irrespective of their combined value.  I think your intuition is correct that the value of UTXO should be increasing over time because of the block reward (it is possible to "burn" bitcoins by sending them to unusable addresses, but I think you're right about the trend).

However, you have to consider the way transactions actually work (in the simple case): they assign a number of Satoshis to a script which specifies spending conditions.  In the case of sending N Satoshi's to address A, what you're doing is creating a script which says that a good signature from the private key corresponding to address A is good enough to spend N Satoshi's.  These N Satoshis are then in an unspent output waiting for someone with the private key for address A to send them elsewhere.  Now, imagine this, someone else sends M Satoshis to address A in the same fashion, there are now N+M spendable satoshis for the person with the private key for address A, but there are two outputs in the UTXO db that represent them (the two transactions which funded address A).  If the person with address A now sends those M+N satoshis to address B, We just got one less unspent output in the UTXO.  The value M+N is still there, but it's now stored in a single unspent output instead of two.

You can find out more about this stuff by looking at raw transactions and how they work.  You'll see that when your wallet sends a transaction to spend X, that transaction might have any number of inputs and may have more than one output as well (change addresses, etc).

Have fun!


Title: Re: UTXO amount decrease
Post by: DannyHamilton on July 20, 2017, 09:54:03 PM
OP, are you asking about QUANTITY of UTXO, or are you asking about VALUE of UTXO?

Theoretically, for example, if someone had access to the private keys then all of the value could all be sent to a single UTXO.  The QUANTITY of unspent transaction outputs would be 1.  But the VALUE would still be more than 16,000,000 BTC.

Quantity can be reduced by creating transactions that spend multiple transaction outputs (which removes them from the UTXO), and which create less new unspent outputs than they spend.

Total UTXO value can be reduced by miners if they choose to reward themselves with less than the maximum amount of BTC they are entitled to.


Title: Re: UTXO amount decrease
Post by: Coding Enthusiast on July 23, 2017, 05:26:32 PM
However when I check the blockchain.info I see the amount of UTXOs decreased in some extent.

If you are looking at this chart on blockchain.info (https://blockchain.info/charts/utxo-count?timespan=all), try including a screenshot so we also see what you see and can give a more accurate answer.

For example if you are looking at the sharp rise of early 2015 followed by a smaller but still sharp drop a couple of months after then that is because of the spam attack of 2015 which they called "Stress Testing". Some call this particular method "Fan Out" because it splits input(s) into many outputs which occupies a bigger size on blocks and also increases the UTXO set.
That particular drop indicates the end of this Spam Attack and indicates the "cleanup" afterwards when they spent all those small new UTXOs and created much smaller number of new outputs.


Title: Re: UTXO amount decrease
Post by: senanahmedli on July 24, 2017, 06:51:37 AM
Thank you all,

I have understood everything