The Anatomy of a Bitcoin Transaction
This edition will cover some key basics of transacting on the Bitcoin network.
Read on to get the rundown of how this impacts holders and miners alike.
Bitcoin Transaction Overview
A Bitcoin transaction involves a sender and a receiver. The sender needs a public address containing funds and a private key to access and move the funds.
The receiver will need a public address to receive funds.
A seed phrase is where it all starts (and why it’s called a “seed” phrase). A seed phrase can be generated independently (i.e. rolling dice or some other randomized process) or via a wallet.
A seed phrase (also known as the backup or recovery phrase) is technically a 128-256-bit master private key. It is commonly represented in 12 to 24 words sourced from the Bitcoin Improvement Proposal(BIP) 39 list.
When a wallet generates a seed phrase, it can create 2²⁵⁶ number of private/public key pairs.
Most wallet applications will not show the user this. That is one of the nice things about Sparrow Wallet, as it lets you see all your addresses.
There are a couple of benefits to this:
- Simplifies backup, as users only need to secure their BIP39 recovery seed to ensure access to all their keys.
- Enhances privacy by allowing users to generate new addresses for every transaction, making tracking more difficult.
- The structure allows users to organize their funds across different accounts in a structured manner, i.e., labeling (KYC vs non-KYC).
To send bitcoin you of course, first need to have bitcoin.
Most wallet applications will show your bitcoins as an account balance, but underneath the hood, it actually works somewhat differently.
Instead of Bitcoin operating like a digital bank account, where transactions are added or subtracted from your total balance, it behaves more like cash in your wallet.
Here is a quick example:
Any amount of bitcoin is a UTXO.
UTXO is the fancy acronym for Unspent TX(transaction) Output.
If you buy a $75 steak with a $100 bill, you likely receive $20 and $5 UTXOs in change.
The $100 bill is the spent tx input, and the $20 and $5 bills are the unspent tx outputs.
Bitcoin functions in a similar manner, except the spent input gets destroyed and recreated as unspent outputs at the receiving address.
Again, most wallet applications will not show you the status of your UTXOs but a combination of them all, so it appears like an account balance.
Sparrow is a wallet that does show UTXOs:
Now that we’ve briefed the components of a wallet let’s look into how a transaction goes from creation to confirmation.
- A transaction is created from UTXOs in Bob’s wallet. Bob uses his 1 BTC and 0.5 BTC UTXOs to pay Sally and cover the TX fee.
This input-output would look something like this:
2. Bob signs the transaction data and broadcasts it to the network.
The transaction data gets compared to the records on nodes (a node is a copy of the entire history of Bitcoin blocks; this is how it knows if a transaction is fraudulent).
If the transaction looks good, it is added to the mempool (a basket of transactions waiting to be confirmed).
3. Miner finds a block and adds aggregated transactions to the official chain.
4. After the block containing Bob and Sally’s Bitcoin transaction gets added to the chain, they will both see the Bitcoin has arrived in their wallet with 1 confirmation. A confirmation is a successful block added that verifies the transaction.
Considering each block takes roughly 10min, a transaction will be 100% complete and verified after 6 blocks (60min).
You can give yourself a pat on the back, because you now understand the fundamentals of a Bitcoin transaction.
Note that this example assumes that Bob and Sally’s transaction will be included in the next block, when in reality, that may not always be the case.
This is because miners choose the best fees offered, and there is only so much space in a block. If other transactions offer a higher fee, the miners will handle those with higher priority.