Bitcoin: Transactions, Outputs, and the UTXO Model — VegaX Research Report
The previous installment of the Bitcoin Educational Series explored Bitcoin’s central investment thesis: a maximum supply cap of 21 million coins, and the digital scarcity that results from known, fixed supply. It is beneficial to understand the big-picture of course, but a protocol like Bitcoin contains a multitude of details — when these nuances are properly understood, they add to the central value proposition of a digitally scarce asset.
At the core, Bitcoin is a global, permissionless, peer-to-peer payments network that allows users to construct transactions in order to send value anywhere on the planet. If one wishes to understand the Bitcoin blockchain, it is vitally important to understand which constructs the blocks: transactions.
In this piece, we will cover:
- Transactions on the bitcoin network — what are they, and how do they work?
- Outputs of transactions and their significance.
- A brief exploration of bitcoin’s “UTXO” model and why it is important.
- Output locks as a means to safeguard against double-spending.
A transaction on the Bitcoin network is a single line of data that contains information on the amount being sent, the account it is being sent from and the account it is being sent to. When a user makes a transaction, the transaction data is transmitted to the Bitcoin network — via a node — which then relays the transaction to the rest of the network.
A few points of clarification before going further:
- “Node” is a concise way of referring to a device that is running a version of the bitcoin software and relaying information around the network.
- Before relying on transaction data across the network, nodes validate that transactions follow a set of pre-programmed rules.
- Anyone can run a full node on the bitcoin network, it can be done with an old laptop, desktop, or dedicated hardware device — all that is required is a reliable internet connection and enough storage to maintain a copy of the blockchain.
In summary, nodes have three main jobs: follow rules, share information and keep a copy of confirmed transactions (the blockchain).
Once a node has validated and propagated the transaction throughout the network, the transaction sits in a queue called a “mempool.” A mempool serves as a waiting area for transactions yet to be added to the newest block. Note that even though the transaction has been deemed valid by nodes, it has yet to be added to a block, and thus, the transaction’s status is ‘pending’ at this point. () This is where miners come in — a miner is a specialized node whose purpose is to batch pending transactions into blocks through a resource-intensive data compression process. While miners (or pools of miners) receive a reward for mining the latest block, they are also incentivized by transaction fees — we’ll circle back to this later — but know that miners tend to give preference to transactions with higher fees.
At the point when a transaction is mined into a block, its status moves from ‘pending’ to ‘confirmed,’ and from that point forward, the recipient of the Bitcoin can spend as they so choose.
But how do Transactions WORK?
Functionally, a Bitcoin address is like an account number that holds a certain amount of Bitcoin, as well, the address keeps track of every transaction that it has participated in. However, the process of a transaction is not the same as taking a handful of coins and moving them from one jar to another. When you want to send someone Bitcoin, you are taking whole amounts (that you’ve previously received) and using them to send a new amount to a new address. So in effect, you receive Bitcoin in batches and then use those batches to create new batches to send to other people. Those batches are called outputs.
There are situations where the total of the batch you are sending is more than the amount you wish to spend: in this scenario, you would create an additional output in the transaction — called “change” — and send this output back to yourself. In any case, note that once an address has been used as a transactional input, that input address is effectively dead, as the Bitcoin has been sent to a new address (output).
A commonly asked question is “what is stopping someone from spending Bitcoin they don’t own?” The answer here is that each output is locked by, you guessed it, an output lock. These locks can only be unlocked by a private key, which is associated with ownership of a particular Bitcoin address. Nodes will only validate transactions with inputs that are unlocked; any locked inputs will result in a rejected transaction. We will circle back to the concepts of output locks and private keys a little later in this piece, but that is essentially how a Bitcoin transaction works.
The Significance of Outputs
To quickly reiterate: the Bitcoin transaction system involves sending and receiving whole batches of Bitcoin, called outputs. Simple enough, but a great way understands the process is to review some example transactions.
Say that you are a Bitcoin miner, have successfully managed to mine a block, and have received a block reward of 25 Bitcoin (sent to an address you’d previously specified). Later that day, you wish to spend 1 Bitcoin on a car, at a dealership that accepts Bitcoin as payment. In order to make that spend, you would use the entire 25 Bitcoin output as an input and create two new outputs: a 1 Bitcoin output to an address controlled by the dealership, and a 24 Bitcoin output to a new address that you control.
This time let’s paint a different picture: say that you have been saving up different amounts of Bitcoin in outputs ranging from 0.3–to 0.001. Now, in order to make a 1 Bitcoin transaction, you would have to gather up as many smaller outputs as necessary to equal or be larger than 1 Bitcoin. And again, if the amount of inputs is greater than your intended spend, you would create an additional output (change) and send that back to yourself. Bitcoin developer and educator Greg Walker explains that
“The reason why transactions work this way is because it’s an easier and more secure way of doing it from a programming perspective.”
What is unique about the Bitcoin transaction model is that it places a high significance on transactional outputs, as opposed to inputs. The reason for this is that the address of output represents the potential to spend in the future, whereas the address of input is unusable post-transaction. Outputs that have yet to be spent are referred to as “UTXOs” (unspent transaction outputs). As a quick aside, when you see the balance of Bitcoin in your wallet, you are seeing the sum of all UTXOs that your wallet owns.
An aspect that was not covered in either of the previous examples is transaction fees. Without transaction fees, the intended transaction would likely sit idle in a mempool for quite some time before getting mined into a block.
This is because transaction fees give a transaction priority as it relates to miners’ willingness to include it in the next block. Recall that miners are incentivized by the block reward AND transaction fees. Any amount that’s left over in a transaction (inputs — outputs) always gets picked up by a miner — so if you constructed a transaction and forgot to create a change output for yourself, the miner would pick up the difference regardless of the amount.
As previously discussed, output locks are the mechanisms that protect coins from being spent by people who don’t control the address where those coins are located. When boiled down, an output lock is a set of requirements placed on output, these requirements must be met/satisfied before that output can be used in a transaction. Recall that output locks are unlocked by private keys — which only the owner of the specific address has access to.
So, circling back to the above examples, when you “send” Bitcoin to the car dealership, you are creating two new outputs: one of which is the change that will be locked to an address that we control, and the other locked to an address that only the dealership has private keys to unlock. Because the dealership controls the private keys for this address, they effectively “own” that new Bitcoin output.
When making transactions, one never really “sends” Bitcoin anywhere; in reality, constructing a transaction creates new outputs (with new locks), and sends that transaction data into the network, where it sits and waits to get mined into a block.
Practically, the Bitcoin blockchain can be visualized as a storage unit for outputs. When you ‘send’ Bitcoin to someone else, you reference the outputs in the blockchain that you have private keys to unlock — once the transaction gets mined into a block, the outputs you used as inputs will be unusable from then on, as new outputs (UTXOs) have been created. Note that the blockchain stores ALL UTXOs currently in existence, provided you are able to unlock them (with private keys).
The Bitcoin blockchain’s system of transactions, outputs, output locks, and UTXOs can seem daunting at first glance. Fundamentally, the system discourages address re-use, as it reduces the privacy and security of both transactional parties, as well as the future holders of that Bitcoin. And while a deep dive into the technical rationale for this system is out of this piece’s scope, programmatically, focusing on outputs makes the system run more smoothly overall.
When “sending” Bitcoin to another user, the Bitcoin doesn’t “go” anywhere else, the UTXOs used as inputs in the transaction create new outputs, which are locked to an address that the user on the other side of the transaction controls. Again, a useful metaphor is the concept of the blockchain being storage units for outputs. Outputs (UTXOs) are locked by output locks, which restrict their being spent — unless a user possesses the private keys, which prove ownership of the particular address.
The Bitcoin blockchain was designed to emphasize reliability, security, and pseudonymity for its users — the system by which transactions function supports all three of these characteristics. Just remember: include a transaction fee, if the total amount of inputs is greater than the amount you intend to spend, create a change output locked to an address you control, and NEVER re-use the same address.
🚀Better Indexes, Better Returns — VegaX
Questions? 👉🏼 firstname.lastname@example.org
🎯Follow, Message, Tweet, Clap, & Join Us Here:
VegaX Holdings creates next-generation indices and financial products that are needed to support the growth of the cryptocurrency industry and improve returns for investors worldwide. Learn how to get better returns today: www.VegaXHoldings.com