What Is Coin Selection and Why Does It Matter?

in #cryptocurrency6 years ago

Untitled design (1).png

Coin selection is the process that describes how the algorithms are driving Bitcoin to choose which of your Bitcoins to spend when you approve a spending transaction.

If you have 1.2 BTC in your wallet and you pay out 0.3, you have 0.9 BTC left, right? Well, yes.

That 1.2 BTC in your digital wallet is no different.

The difference with BTC is that when you approve a BTC spend, you also have to pay the transaction fees.

So the process of choosing which specific Bitcoins are handed over in the spend is more of a costly one.

Coin Selection in Action

Let's go back to your hypothetical wallet with 1.2 BTC in it.

Knowing it is unlikely that you actually have one whole BTC and 0.2 BTC, let's assume you have the following: 0.5 BTC 0.4 BTC 0.2 BTC 0.1 BTC Now, when spending 0.3 BTC, you would hope the algorithm would combine the 0.2 and 0.1 BTC to reach the spend value.

It makes good sense, and given how Bitcoin calculates fees, there are lower costs in doing it this way.

This is only since the Bitcoin developer team updated the algorithm earlier this year, to ensure more streamlined coin selection.

Continuing with the above scenario, when you approved the 0.3 BTC spend, the older version of the algorithm would almost always create a change output.

This means it would invariably have taken the 0.4 or 0.5 BTC, and return the change of 0.1 or 0.2 BTC to your wallet, less the fees.

While the algorithm update is good news for the future, the fact is that there are years of Bitcoin transactions that happened before this update.

The difference is that you cannot take your Bitcoin wallet into the bank and ask them to change all of those Satoshis back into Bitcoins for you.

How Does This Happen?

Bitcoin runs on a concept called UTXO, or unspent transaction output.

Each time a spend transaction is authorized, the Bitcoin algorithm ensures that the wallet contains at least the value of the spend plus fees before the PoW consensus protocol approves the transaction.

Bitcoin opted for the UTXO mechanism because it keeps the proof of work algorithm simple.

The upshot is that yes, Bitcoin has now updated the algorithm.

The situation remains that there are many, many tiny pieces of Bitcoin now circulating.

Last year, one Bitcoin developer attempted a complex calculation to work out the possible value of these tiny pieces.

Eventually, fees for moving the trinkets out of the vault could end up being more than the value of the trinkets themselves.

A Possible Solution?

It was blockchain developer Mark Erhardt who first proposed how to optimize the Bitcoin coin selection algorithm.

There, he has developed Predictive UTXO, which helps to offset the fees involved in spending many small UXTO values.
Bitcoin transaction fees are lower when there is less traffic on the network, and much higher when traffic is high.

This is why many people were complaining about high fees during December 2017 when Bitcoin's value spiked at nearly $20k. Predictive UTXO uses an algorithm to bundle together the tiniest fragments of BTC in transactions when fees are lower.

When fees go up, it will minimize transaction sizes to offset the increase.

If Predictive UTXO could be rolled out across other exchanges and wallets, it will provide some cushioning against the fees involved in spending the tiny BTC fragments that now exist in many of our wallets.

If you are interested in knowing more about coin selection in general, here is an excellent presentation explaining coin selection and UTXO in detail.
Warning: it is a long one!

Fees Matter

Some people may consider that fees are so small so as not to matter.

While fees can end up being pennies on the dollar, savvy investors know that compound interest matters.

If we can reduce fees and reinvest the difference, they are potentially worth far more in years to come.

Pounds refers to sterling, but the principle also stands for dollars - and your Bitcoins.

Article made by S.

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.030
BTC 58183.32
ETH 2475.34
USDT 1.00
SBD 2.38