What’s Behind a Transaction?
We know how we handle cash, I mean the banknotes and coins in my wallet. Similarly, there are wallets for Bitcoin, where we “see” the amount of bitcoin we have. The difference is that the bitcoin we have is not physically stored in the Bitcoin wallet. Rather, inside my Bitcoin wallet there is something that can unlock some unused transaction records, which is equivalent to the bitcoin I own. In this way the wallet looks more like a bank account than the wallet we use daily.
Let’s break it down a little bit.
When I say I have some bitcoin, what actually do I have?
When I say I have a certain amount of bitcoin, a more accurate way to say is that I have some unused bitcoin transaction records that belong to me and are kept in a ledger. If the ledger says I have one bitcoin unused, then I have one bitcoin, and inside my wallet I have something to use this unused bitcoin. That is what I have.
Some points to make here. First, the ledger only keeps bitcoin transaction records, not a record of individual bitcoins. Bitcoin is not stored in ledger one-by-one. We cannot see “this” bitcoin belongs to someone, but only a transaction record of certain amount of bitcoin from someone (someone’s address) to another (anyone’s address). Like cash, no one is interested in which a particular banknote belongs to whom.
As a result, there is no denomination in Bitcoin. In Hong Kong we have banknotes of $10 and $50, but there is no banknote of a denomination $60. But in Bitcoin, a transaction record can be of any amount, like a record of 60 bitcoins.
Finally, bitcoin is not handled in whole unit: the amount of bitcoin can be down to 8 decimals. The amounts in all bitcoin transactions are almost in decimal. We don’t need to buy a whole bitcoin.
Now let’s imagine an example. Alice and Bob has their own wallets. Alice sees 3 bitcoin in her wallet, while Bob sees 1 in his. That means each of their wallets sees an unused record (or records) in the ledger which belong to that wallet. Assuming the simplest situation: there is one record of 3 bitcoin for Alice’s wallet, and one record of 1 bitcoin for Bob’s wallet.
Now Alice is going to give Bob 0.5 bitcoin. What Alice needs to do is to open her wallet, input Bob’s Bitcoin address (usually in QR code of Bob’s address, as most wallet comes with scanner), and the amount 0.5.
After the request is sent, Alice has done what she needs to do. Now she sees her wallet has 2.5 bitcoins (should be slightly less than 2.5 due to transaction fee, which we will talk about later). After a while, Bob sees his wallet has 0.5 bitcoin more, and he now has 1.5 bitcoin.
What has wallet done?
When Alice sends out request, her wallet creates a transaction record. This transaction record is composed of two sets of information: INPUT and OUTPUT.
The INPUT part shows which unused records Alice will use to fulfil this transaction. In this example, the unused record (3 bitcoin) is the only entry here. If the transaction is completed, this transaction record is considered “used”, and Alice cannot use this any more in future .
The OUTPUT part shows where the bitcoin of all INPUT entries will go. In this example there are two entries: 0.5 bitcoin to Bob, and 2.5 bitcoin to Alice (again, we put aside the transaction fee for sake of simplicity). That means a new record for Alice herself is generated, which is the remainder after this transaction.
Here is how the transaction record Alice sends out looks like,
Note that after Alice’s wallet sends out this transaction record, the transaction is not completed yet. It is because this transaction is not yet kept in the ledger. After a while, when the transaction is successfully kept in the ledger, let’s see what happens in both wallets.
In the ledger Alice’s original record of 3 bitcoin is used, but a new record of 2.5 bitcoin belongs to Alice is there. Now Alice sees 2.5 bitcoin in her wallet. Bob has a new record of 0.5 bitcoin in the ledger. His wallet recognizes this. He has two records now, and his wallet shows 1.5 bitcoin.
This is how a transaction looks like, how the wallet, transaction request, and ledger interact one another.
Wish to see a real record? Here is one picked randomly from blockexplorer.com. The left side is the INPUT part, and the right side is the OUTPUT. Note that the summation of OUTPUT entries is not the same as the amount in the INPUT entry, and the difference is the transaction fee (see the bottom left corner).
(source: a randomly picked transaction record from www.blockexplorer.com)
In next article, we will take a look on another exciting part of Bitcoin: the Ledger.