- The role of the Bitcoin node in distribution
- The mempool: the transaction waiting room
- Blockchain: a public time-stamping register
To understand what Bitcoin mining is all about, we first need to follow the path of a typical Bitcoin transaction. This will show you exactly where the block comes into play, and why it's at the heart of the system. That's what I'd like you to discover in this first chapter.
In Bitcoin, a transaction is a data structure that transfers ownership of bitcoins from one user to another. In concrete terms, it consumes
outputs from past transactions (so-called UTXOs), referring to them as inputs, and then creates new outputs that define to whom these bitcoins now belong and under what conditions they can be spent later.An important point about Bitcoin is the authorization to spend. Bitcoins are not in an account, as your money in the bank might be, but are locked by spending conditions. When a wallet wants to use a UTXO as an input, it must provide cryptographic proof that it has the right to unlock it. This proof often takes the form of a digital signature generated from a private key. That's why bitcoiners insist on securing your private keys: it's these that unlock access to your bitcoins and, consequently, enable you to spend them.
The digital signature in Bitcoin plays two important roles:
- Authorize expenditure: this proves that the user possesses the private key expected by the UTXO expenditure condition;
- Integrity protection: links authorization to the precise details of the transaction (recipients, amounts, fees, etc.). If someone alters the transaction afterward, the signature will no longer be valid.
Once the transaction has been correctly constructed and signed by the user's Bitcoin wallet, it must be broadcast on the Bitcoin network.
The role of the Bitcoin node in distribution
Bitcoin is a peer-to-peer network: there is no central server that receives and processes all transactions. This role is played collectively by the nodes. A Bitcoin node is a piece of software (e.g. Bitcoin Core) connected to other nodes in the Bitcoin network, whose main mission is to verify, store and relay transactions and blocks.
When you send a transaction from a wallet, the wallet forwards it to a node (your own, or that of a service). This node will first check that the transaction complies with various rules, such as:
- signatures are valid;
- the inputs reference existing UTXOs (i.e. bitcoins that exist);
- these UTXO have not already been spent elsewhere;
- the amount of outputs is less than or equal to the amount of inputs (bitcoins are not created from nothing);
- etc.
If the transaction passes all these checks, the node propagates it to the other nodes in the network with which it is connected. They in turn check it and relay it, and so on. In a matter of seconds, the transaction is propagated and becomes known to the whole, or at least to a large part, of the Bitcoin network.
The mempool: the transaction waiting room
Between the moment a transaction is broadcast and the moment it is confirmed in a block, it must wait. This waiting area is called the mempool (contraction of
memory and pool). A mempool is therefore a temporary storage space for valid, but still unconfirmed, transactions.Important point: there's no such thing as a single mempool, only mempools. Each node maintains its own mempool, with its own local constraints. This means that at any given moment, two nodes may have slightly different mempool contents (depending on what they have received, what they have rejected, or what they have purged).
At this stage, the network knows about the transaction, has verified it and is holding it in memory until it is confirmed. But confirmation of this transaction will only come when a miner inserts it into a block, and this block is accepted by the network.
Blockchain: a public time-stamping register
As bitcoin is an intangible currency, it has to address one problem: preventing double spending without a central authority. If two transactions attempt to spend the same UTXO, everyone must be able to converge on a single, coherent state. Satoshi Nakamoto sums up this issue with this famous sentence:
The only way to confirm the absence of a transaction is to be aware of all transactions.
In other words, to know that a bitcoin hasn't already been spent, you need a common record of past spending.
This is the role of the blockchain: a public register containing the history of transactions. But rather than writing each transaction as it happens, Bitcoin groups them into blocks. Each block acts as a history page, and the system thus functions like a time-stamp server: it orders transactions over time in a verifiable way.
This register cannot be rewritten, thanks to a simple principle: each block includes the cryptographic fingerprint (hash) of the previous block. Thus, blocks are linked: if you modify a block from the past, its hash changes, which breaks the link with the next block, which breaks the link with the block after that, and so on. It's this chain of dependencies that gives the "blockchain" its name.
Once we've understood these basic principles of Bitcoin, we can describe a miner's objective in more concrete terms: to build a new block that extends the existing chain, by inscribing pending transactions, and then attempt to make it valid (this is the famous "proof of work" that we'll study in a later chapter). But first, let's discover together in the next chapter how a candidate block is constructed.
Quiz
Quiz1/5
min1012.1
According to the idea summarized by Satoshi, what is the only way to ensure the absence of double-spending?