A transaction is a transfer of Bitcoin value that is broadcast to the network and collected into blocks. A transaction typically references previous transaction outputs as new transaction inputs and dedicates all Bitcoin values to new outputs. Transactions are not encrypted, so it is possible to browse and view every transaction ever collected into a block. Once transactions are buried under enough confirmations, they can be considered irreversible.
Standard transaction outputs nominate addresses, and the redemption of any future inputs requires a relevant signature.
All transactions are visible in the blockchain and can be viewed with a hex editor. A blockchain browser is a site where every transaction in the blockchain can be viewed in human-readable terms. This is useful for seeing the technical details of transactions in action and for verifying payments.
Bitcoin is comprised of a few major pieces: nodes and a blockchain. The role of a typical node is to maintain its own blockchain version and update it once it hears of a “better” (longer) version. Simply put, the blockchain has blocked, and blocks have transactions.
With this simplified but accurate picture in mind, you might be wondering what exactly a transaction is made out of.
How will understanding transactions help me to become a better blockchain investigator?
How do transactions allow people to transfer some bitcoin to another individual?
It turns out that the answers to these questions vary based on many things. Even assuming that we’re talking the only bitcoin, we can use transactions in many creative ways to accomplish various personalized goals. Let’s start initially; that is, let’s look at a good old-fashioned pay-to-PK-hash transaction type. After all, this type of transaction accounts for over 99% of all transactions on the bitcoin blockchain.
First, let’s build a mental model. It’s tempting to think of bitcoin as an account-based system. After all, when I send bitcoin to somebody, that person receives money, and I’m left with a remaining balance. In the real world, though, things are represented a bit differently. Generally speaking, when I send money to somebody, I am sending spending all of that money (minus transaction fees). Some of that money will be spent back on my own personal account if there exists a remaining balance. The point is that all of the money moves every single time. You can skip to section 3.1 for an explanation of why this model is preferable.
With that in mind, we can generalize and say that a bitcoin transaction has some inputs and outputs. A graphical representation might look something like this:
This was somewhat confusing to me when I first saw it, so I’ll elaborate a bit. When I post a transaction, I’m essentially “claiming” an output and proving that I have permission to spend the amount of money at that output. So if I’m Bob and I want to pay Alice, those inputs prove that I have been given a certain amount of money (although this might be a portion of my total balance), and the outputs will correspond to Alice’s account. In this simple case, there would be only a single input and a single output.