A UTXO is an unspent transaction output. These are previously spent outputs that are alive and available to be used in a new transaction as long as you can unlock them.
UTXOs store in chainstate database, which allows nodes to quickly verify UTXOs are available to be spent.
Most people think their account holds a collection of Bitcoin, but it really holds a collection of UTXOs that make up an account's balance. Think of UTXOs as a collection of outputs from the previous transaction that sent Bitcoin to your address.
UTXOs cannot be broken down, you can't spend a fraction of a UTXO. You must use the entire UTXO as an input and return the change amount as an output to an address you control, otherwise the difference will be counted as a miner fee. The iCoin Wallet handles UTXO selection for you.
First, the wallet looks for the UTXO at least greater than the amount intended to be spent, plus fee. If no single UTXO can create this amount of Satoshis, the wallet will select the most efficient allocation of UTXOs with minimal fee being the primary consideration.
If you're an advanced user, coin control is on the road map for future releases.
A Bitcoin transaction is made up of inputs and outputs.
Inputs = UTXOs required to send a certain amount of Bitcoin to a destination address, constructed from the UTXOs that sit in an address (can be multiple)
Outputs = The amount sent to any given address (can be multiple, can be un-spendable data)
Inputs - Outputs = Miner Fee
EXAMPLE: Say a User would like to send 2 BTC to a friend and their address has the following breakdown of UTXOs.
1 BTC
.75 BTC
.5 BTC
3 BTC
The user has the option to construct the inputs to their transaction in a few ways:
Inputs = 1 BTC, .75 BTC, .5 BTC
Input = 3 BTC
Bitcoin transaction fees are measured in weight, or byte size. The more inputs and outputs, the 'heavier' the transaction's bytes, the higher the fee. The amount of BTC being transferred is inconsequential, it's all about the number of inputs and outputs. Inputs are heavier than outputs, they require more data to reference and therefore more bytes.
Example 1: There are three inputs for a total of 2.25 BTC. Remember we only want to send 2 BTC, so that's one output, but the remaining .25 BTC needs to be returned to a change address we control. We can't forget the miner fee or the transaction won't be processed, say the fee is .0001 BTC
Input 1 = 1 BTC
Input 2 = .75 BTC
Input 3 = .5 BTC
Output 1 = 2 BTC (friend we're sending 2 BTC to)
Output 2 = .2499 BTC (change we send to an address we control)
Example 2: There is 1 input for a total of 3 BTC, so we still need our change
Input 1 = 3 BTC
Output 1 = 2 BTC (friend's address)
Output 2 = .9999 BTC (our change address)
Example 1 is a heavier transaction, it has more inputs than example 2. This means it has more bytes and will command a higher fee to process than example 2. In both examples Output 2 becomes a new UTXO in the change address.
Sometimes people like to perform housekeeping on an address and consolidate UTXOs into one. This requires a transaction using every UTXO as an input and then generating 1 Output, which becomes a single UTXO.
While most people won't notice this because the wallet obfuscates these technical details, there is sometimes confusion when people want to send rapid fire transactions and don't give their previous transaction time to settle. When a UTXO is tied up in a transaction, it should not be spent until the transaction settles and the change is sent back to the sender. Some wallets do allow Users to spend UTXOs that are still pending, but if the transaction fails the entire chain will be rolled back.
Always select a fee that will take this into account. Historically, fees have been relatively cheap in Bitcoin, with a tens of cents equating to significantly faster transaction speeds. However with the introduction of ordinals and the minting of BRC tokens, and other un-spendable data, fees have become much higher.