Transactions and confirmations
The Bitcoin network is essentially a public ledger that's able to record and validate millions of transactions. Transactions validated by the network are irreversible and impossible to change or alter. In this section, we're going to look at two core aspects of the network: transactions and confirmations.
Transactions
A Bitcoin transaction is a record of a transfer between two or more bitcoin addresses. Similar to a credit or debit on your bank statement, the transaction records the sender, the receiver, and a date/time stamp.
All Bitcoin transactions are publicly accessible. However, the user's identify is never stored. Similar to a Swiss Bank account, only their public addresses are recorded. This makes it difficult to trace the address back to its owner. Therefore, we say that Bitcoin is pseudonymous.
Note
Bitcoin has been used to fund illegal online markets, such as the Silk Road, with a special internet protocol call Tor. Using Tor allows the users to hide their computers' IP addresses, making it difficult to discover their physical location.
Using Tor, the users are able to place orders for illegal items. With payments made in Bitcoin and the shipping addresses encrypted, it is very difficult to link customers with their orders.
While Bitcoin's design hides the owner of an address, if an identity can be associated with a previous transaction, it can be possible to link a purchase with a user.
More flexible than a simple bank transfer, a Bitcoin transaction can withdraw from multiple addresses to pay a list of addresses. The transaction records every address used and must account for the full balance. Any unspent bitcoin must be sent back to a "change address". It works like paying for an item that costs 12 dollars with two 10 dollar bills. The merchant accepts the two bills and returns 8 dollars in change.
In Figure 1.10, we show a starting balance of 5BTC between two addresses in our bitcoin wallet. We then send 4BTC to the receiver. To account for the full balance, the transaction returns 1BTC to our change address. After the transaction, the two funding addresses will contain 0BTC each.
The change address is optional as we can reuse an existing bitcoin address. However, most wallets create a new address as it's recommended to increase your privacy.
Before sending a transaction to the Bitcoin network for confirmation, it must be signed with the private keys of the input addresses listed. Similar to your bank requiring your signature on a check, the Bitcoin network requires you to sign your transaction before confirming it.
Bitcoin uses a digital signature to sign your transaction. The signature can only be generated by the holder of the private key. Illustrated in Figure 1.9, we can see how this signature is created and stored in the transaction.
The digital signature is used by the network to verify that the transaction was created by someone who has access to the private key. Without this verification, the transaction would be rejected from the public ledger.
The process of computing the digital signature is handled automatically by your Bitcoin wallet. The digitally signed transaction is now ready for confirmation by the network. We will discuss digital signatures in detail later in Chapter 4, Understanding the Blockchain.
Note
Bitcoin wallet software is designed to handle the complexities of sending/receiving bitcoin. The example is given here to help deepen our understanding of how transactions work.
Confirmations
After it's digitally signed, the transaction is broadcasted to the Bitcoin network and reviewed by many nodes on the network. Each node is essentially a computer with a copy of the ledger, with access to all the transactions since the beginning. The node's job is to listen for new transactions and relay them to the other nodes on the network.
Some nodes serve as miners. Miners perform computational work to ensure that each transaction is valid that it does not double the, or spend more than the available. Each miner must then prove the results to the other miners. Any discrepancies will cause the network to reject a miner's results.
Note
Miners have a financial incentive to do this work. Along with confirming the transactions, there is a cryptographic puzzle to solve. If the miner can prove their solution, they are awarded new Bitcoins and/or transaction fees. The solution to the puzzle is called proof-of-work.
This process is what makes the Bitcoin network both resilient and trustworthy. The larger the network of miners with consensus, the more we can trust the validity of the ledger. This is how Satoshi was able to design a network for exchanging virtual cash without a single point of control or failure.
Unconfirmed transactions start with zero confirmations. When a miner's work is accepted by the network, the number of confirmations for each transaction is incremented by one. Confirmations are generally accepted every 10 minutes but can vary depending on the various computational aspects of the network.
As more miners confirm the results of the previous miners, the number of confirmations for your transaction continues to increase. After some time, your transaction can have hundreds or even thousands of confirmations. With such a large number of confirmations, you can be assured that your transaction cannot be reversed.
Note
The more confirmations your transaction has, the more difficult it is to break, or hack. Mathematically speaking, a total of six confirmations is accepted as unchangeable but as few as one confirmation is sufficient for most small transactions.
The Bitcoin network is a very powerful network, especially when there is a large number of miners working together to validate and confirm the transactions on a public ledger. The entire ledger is copied by new miners joining the network. Transactions confirmed by an increasing number of miners results in more trust in the network. This design creates redundancy to guard against transaction fraud. Once a transaction is confirmed in the ledger, it cannot be deleted or changed.
Now that we have a basic understanding of how Bitcoin works, let's look at some wallet services and compare their differences.