Course: Blockchain & Bitcoin 101
Section: Bitcoin Basics
07 Transactions and UTXOs
08 Transactions, UTXOs & Fees
09 Homework - UTXOs
Notes:
This section explains how a wallet constructs a transaction.
It uses UTXOs.
UTXO stands for Unspent Transaction Output
A transaction has inputs and outputs.
Input: At least one, can be more than one. It is where you got the money from.
Output: At least one, can be multiple outputs.
Outputs are people you send money to, and can include yourself.
An output is a UTXO until it becomes an input in another transaction. The person in your output now has UTXO. That person can use it as input to another transaction.
Your wallet will Store your private key information.
When you want to send money it will:
Query the blockchain, asking which UTXOs you have,
Sum your UTXOs (money you can spend),
Show the balance,
Calculate the transaction fee,
Construct the transaction, and
Broadcast your transaction.
A wallet does not store a balance figure like a regular bank account. It calculates a balance when you want to send money.
The Important Rule is you have to spend all of your UTXOs in a transaction.
Can combine UTXOs to have enough for an output transaction.
Can send extra back to yourself.
Inputs = Outputs + Transaction Fee
The transaction fee is calculated by the wallet.
.
Homework
1. Describe what Unspent Transaction Outputs (UTXO) are.
a) A UTXO is money previously received and not yet spent.
b) The sum of a private key’s UTXOs are its balance.
c) UTXOs are inputs to a transaction.
d) The sum of the UTXOs must equal the Outputs plus a Transaction Fee.
2. What would happen if you don’t have any single UTXO that is large enough to cover for your transaction?
Your wallet will combine all your UTXOs. This sum is your total input.
IF this total is less than the amount you need
THEN there is a problem – insufficient funds – your transaction will not be valid
ELSE no worries, your transaction is valid.
Example using paper money: You want to purchase something for $7. You have two $5 bills. The sum avilable is thus $10 and enough to cover a $7 purchase.
3. How would a bitcoin wallet specify the transaction fee when creating a transaction?
Your wallet will look at recent transaction fees and propose an ideal transaction fee value. You will then know how much of your UTXOs to send back to yourself (or another of your private key addresses). You will construct the transaction as money to send to others and money to send back to yourself (if any). Your wallet will calculate the transaction fee using this formula:
Total inputs minus total outputs equals transaction fee.
.
4. How could you use the notion of transaction inputs and outputs to increase privacy in your transaction?
You can create more private keys, each with its own address. You can send money to those addresses. It is like having multiple bank accounts.