When you think about it, Bitcoin transactions should be simple: I send money from one Bitcoin address to another. All I need to know is the origin, destination and amount, right? It turns out that Bitcoin transactions are much more complicated than this. We’re going to learn how to read a Bitcoin transaction simply, as well as understand all that gibberish that generally follows.
[tweet_box design=”box_02″]Bitcoin addresses don’t actually exist like you may think they do.[/tweet_box]
The blockchain is not a ledger of all the accounts that exist and their respective balances, but rather a comprehensive history of all Bitcoin transactions. In fact, the entire blockchain is full of transactions and not much else (and a bit of data that connect the blocks).
Bitcoin is a system designed to avoid having to trust account balances (maintained by third parties), and in fact allows everyone to verify and track every single fraction of a coin that ever existed to make sure no one is gaming the system. This can be done by making all transactions public and verifiable.
See, Bitcoins don’t actually move between addresses, they actually exist in virtual vaults with special cryptographic locks. Instead of sending them, you just change the locks. If Alice “owns Bitcoins”, she actually just has a cryptographic key to a vault that has BTC inside. And when Alice wants to send those Bitcoins to Bob, she just unlocks her lock and puts the Bitcoins in a vault with Bob’s lock on it. Now Bob “owns” them.
Vaults and locks are free and easy to make, so if Alice only wants to send some of the coins (and keep the rest), she can create a new vault with her lock and put the change in it. Every time someone opens a lock, the whole network needs to be able to verify it (otherwise they will consider it cheating), so a cryptographic signature is used to prove you have the key to that lock.
Since this is all done digitally, a Bitcoin transaction is simply a record of:
- Input(s): signature proving you can actually open a locked vault.
- Output(s): how many Bitcoins are placed in each new vault and with what lock.
The sum of your outputs cannot be higher than the sum of your inputs (otherwise you’re making Bitcoins out of thin air), but it can be lower. The difference in the sum of inputs and outputs equals to the miner fee. This means that you will never see any reference to miner’s fees in a transaction, rather you simply infer it: one BTC inputs – 0.9 BTC outputs = 0.1 BTC miner fee. Bitcoin wallets manage this automatically for you.
So what does a Bitcoin transaction actually look like?
“Raw” Bitcoin transactions are actually very difficult to read, which is why there is a plethora of “block explorers”, which are websites or other software used to “translate” and more easily read what’s going on in the blockchain. For this example, we will look at Blocktrail, but you can really use any of many (and trust me, there are many).
Blocktrail, like many block explorers, will show more information about the transaction than the transaction itself: things like when it was first seen, how long it took to confirm; other explorers will tell you how much money was “sent” and how much was “change”, etc. Most of this extra information is useful, but it is also mostly guessing. Only the transaction itself in the blockchain can be verified cryptographically.
The following transaction (following the convention of being named after the “hash” of the transaction itself: 61a1..0b0c) is a pretty simple and common transaction: it collects BTC from two different inputs (previous transactions) for a total of 159 bits and then sends them to two different outputs for a total of 59 bits. Note that there are 100 bits leftover, which were never used in the transaction outputs: they were leftover for miner fees.
The basics: inputs, outputs and values
These are the most important parts of the transaction page, they tell us where the money is coming from and where it’s going. Let’s say we want to confirm receiving a Bitcoin payment (let’s say 50 bits to the address 1AFc…7VeQ), so we’ll look for our address in the list of outputs, and confirm that the correct amount of coins were sent there. In this case, we see that the transaction indeed includes our payment.
The other output (which sends nine bits to 3GmY…6J4S) is probably their change address, but that’s extrapolation, and honestly not much of our business. We can follow each address by clicking on it, or follow each input/output by clicking the arrow next to it. The ‘P2SH’ label means that the address (the lock on the vault) is a script hash, which means that the address allows for the recipient to use more complex signatures (such as multisig).
The information above the inputs and outputs could be of use, such as when Blocktrail first saw the transaction (“Relay time”), as well as how long it took until it was confirmed in a block (“Time until confirmed”). Of course, it will show us in which block it was confirmed (“Block”), as well as how many confirmations it has (“Confirmations”). The “Priority” is Blocktrail’s way of calculating how good the fees are on this transaction (based on coin age and transaction size in bytes).
The real, hard information about the transaction is actually listed in the scripts on the bottom: that’s the “raw” information about each of the inputs and outputs. The output script includes the cryptographic lock and vault that you’re sending the Bitcoins to. The input script includes the signature proving that the owner of the vault can open the lock determined by the previous output (from the previous transaction).
If you’re interested in learning more in depth about Bitcoin transactions, I highly recommend browsing through the Transactions chapter in Mastering Bitcoin by Andreas Antonopoulos.