A little later than planned, but here is finally the second part of my "Bitcoin for beginners" series :)
In the first part (https://getqu.in/HvPg4I/) we looked at the topic of money and its history - from shells and gold to paper money - and the emergence of $BTC (+0,37 %) as a form of digital, scarce money. Now we're following on directly from this and taking a look at how Bitcoin actually works.
As the article was a bit long, I've added a small table of contents for you. If you're only interested in individual parts, you can of course just read those - have fun!
Table of contents
1 Bitcoin as an open protocol and network
2 The blockchain as a decentralized ledger
3 Who forms the network?
4 Bitcoin's monetary policy
5 UTXOs - understanding Bitcoin transactions
6 Mining in detail
7 Summary: BTC transactions in detail
8 Conclusion / TL;DR
Bitcoin is an open protocol and network
There is no Bitcoin company, no managing director and no customer service that you can call if you have a problem. Bitcoin has no shares, pays no dividends - and it cannot go bankrupt like a company. Instead, Bitcoin is an open protocol, comparable to the internet. Just as no one owns the Internet as a whole, no one owns Bitcoin alone. Anyone can participate, no one has to.
Bitcoin is probably the most inclusive financial instrument that exists. Anyone, regardless of gender, skin color, sexuality, etc. can participate without having to ask anyone's permission. Anyone with a computer or smartphone and internet access can freely use the Bitcoin software, view the code and theoretically even modify it and make suggestions for improvements, as Bitcoin is completely open source is completely open source.
Bitcoin's network is completely decentralized. It consists of tens of thousands of computers worldwide, all of which communicate with each other on an equal footing. There is no superordinate authority that controls or favors individual participants. It is therefore referred to as a peer-to-peer network.
The blockchain as a decentralized cash book
The blockchain is essentially the core of Bitcoin - it acts as a decentralized ledger in which all past Bitcoin transactions are listed. Each "page" in the ledger corresponds to a block in the blockchain. A new block is added approximately every ten minutes and follows on from the previous block.
Each block contains a unique "fingerprint" (a hash, more on this later) that links it to the previous block. If you subsequently change something on an earlier "page" of the cash book, this fingerprint would no longer be correct -> because the subsequent pages would no longer match. Any subsequent manipulation of the blockchain would therefore be noticed immediately because the linking of the blocks is violated by the fingerprint.
This means that Once something is in the blockchain, it is practically impossible to change it retrospectively.
And this is of course the basis for Bitcoin being used as a decentralized network for sending and receiving values. After all, there is no central actor who has control over the network and could intervene in the event of fraud. The network must therefore fundamentally protect itself against fraud.
For example, if I sell my car for 0.1 BTC and receive the money from the sender, I don't want the money to suddenly disappear from my wallet after a while because the buyer has taken the money back.
There is simply no arbitrator like with banks or PayPal, for example. No third party can access your Bitcoin. All transactions are irreversible.
Who forms the network?
The network is made up of three parties with different tasks. Each individual can represent one to three of the following parties:
(1) User
Users are all those who carry out or receive transactions. And as is usual with networks, the value of a network increases proportionally with its users (-> Metcalfe's Law).
(2) Nodes
Nodes can be visualized as nodes in a network. Nodes are computers that run the Bitcoin software and, in most cases, have stored the entire blockchain, i.e. the entire transaction history or the "Bitcoin cash book", as well as recording and storing new transactions and forwarding them to connected nodes. Their task is therefore to store, check and forward every transaction that goes through the network (more on this later). Nodes act as independent bookkeepers, so to speak. They verify whether new transactions comply with the Bitcoin rules - e.g. whether the Bitcoin that is to be spent actually exists and has not already been spent elsewhere. They also check newly found blocks from miners for correctness.
(3) Miner
Miners are special nodes with a special task. They collect transactions, create a new block from them, check whether the new block is valid and, if successful, attach it to the blockchain or the cash book. If the block is invalid, it is discarded and the game starts all over again. If the block is valid according to the miner, the block is passed on to the network and the accountants - i.e. the nodes - then check whether the miner is telling the truth. If the miner's block complies with the rules of the BTC protocol, the block is added to the ledger as a new page.
Monetary policy of Bitcoin
Before we delve deeper into the technology, it is important to take a look at Bitcoin's monetary policy. As you know by now, Bitcoin is limited to a maximum of just under 21 million Bitcoin limited. More will never exist. This upper limit was firmly anchored in the Bitcoin code by Satoshi Nakamoto from the very beginning. This makes Bitcoin probably the scarcest commodity in human history. This absolute limit cannot be found anywhere else in nature. Of course, gold, for example, is also limited - but we do not know how much gold is still underground, how much may exist in accessible space and whether gold can ever be produced profitably in a laboratory.
But how does the Bitcoin network ensure that this 21 million limit is never exceeded? This is where the mechanism of halving comes into play.
A so-called halving takes place every 210,000 blocks (which corresponds to around four years). This means that the block subsidy - i.e. the proportion of the block reward that consists of newly created Bitcoin - is halved (more on this in the mining section).
At the beginning, in 2009, the block subsidy amounted to 50 BTC per block. At the first halving at the end of 2012 (after block no. 210,000), it was reduced to 25 BTC. Four years later, it fell to 12.5 BTC, then in May 2020 to 6.25 BTC, and in April 2024 the fourth halving to date took place, as a result of which the subsidy is now only 3.125 BTC per block. This process continues until no more new Bitcoin is distributed - after 33 halvings, around the year 2140, the maximum amount of money is almost reached. There will then be just under 21 million BTC in circulation (actually a little less -> 20,999,999.9769 BTC).
The consequence of this steady halving of the issue is a decreasing inflation rate of Bitcoin. Initially, 50 new BTC were created every ten minutes, which corresponded to very high annual inflation. However, due to the halvings, the inflation rate drops sharply every four years and approaches zero in the long term.
(Source: Blocktrainer)
UTXOs - Understanding Bitcoin transactions
Bitcoin transactions can be compared to the exchange of cash rather than a bank transfer. This is because a transaction always consists of so-called "Unspent Transaction Outputs (UTXO)" together.
Put simply, a Bitcoin transaction consists of a digital instruction such as "Transfer X Bitcoin from address A to address B".
Technically speaking, every transaction has an input part (inputs) and an output part (outputs). The inputs refer to previously received Bitcoin (which has not yet been spent) - these are the "sources", so to speak, of the coins that you want to spend - e.g. the coins in your wallet.
The outputs determine to which Bitcoin addresses the money is sent and in what amount. Often there is also an output back to the sender. This is the so-called change or simply the change.
Example:
I have received three times 0.01 BTC in the past - i.e. 3 UTXOs of 0.03 BTC each. Now I want to send 0.025 BTC. In this scenario, the wallet, i.e. the digital wallet that contains the access to the Bitcoin, would collect as many UTXOs as necessary until the desired amount to be sent is reached. In my example, this means that my 3 UTXOs with 0.01 BTC each are used as input for the transaction. However, because I do not want to send 0.03 BTC, but only 0.025 BTC, 0.005 BTC is returned to me as change output. This means that I have received a new UTXO with 0.005 BTC from that point on, which I could spend in the future.
In the picture I have tried to illustrate this with my Premium Paint skills😂
However, the whole thing is not yet complete, as I have left out the transaction fees for the sake of simplicity.
The sender always pays transaction fees to the miners. The miners are service providers who spend energy and time recording my transaction in the blockchain - and they want to be paid for this. In practice, this means that an additional output is always included in the transaction as a "fee". The sender determines the amount of the fee themselves. This depends entirely on the urgency of the transaction - the more urgent it is, the higher the fee should be set so that the miners can add the transaction to a block more quickly. In practice, a transaction looks like this, for example:
For a transaction to be valid, it must also adhere to certain rules. For example, you can logically only spend Bitcoin that you own (i.e. for which you have valid inputs), and the sum of the outputs must not exceed the sum of the inputs (otherwise you would be creating money).
The most important thing, however, is the digital signature of the transaction. If I want to make a transfer in the Bitcoin network, I have to prove that I own the Bitcoin I want to spend. This is done by signing the transaction with my private key.
Every Bitcoin address has a pair of keys: a private key and a public key. The private key is like a secret password or the access key to the Bitcoin on this address. Only those who have the private key can spend the associated Bitcoin. This key must therefore be kept secret. You can think of it in the same way as a bank account. The private key corresponds to the access data for online banking - if someone else knows this password, they can - if things go badly - empty the account.
The private key is used to generate the public key (public key), which in turn is used to create the Bitcoin address. The Bitcoin address is comparable to the IBAN of a bank account - it can be passed on without hesitation, as it can only be used to receive money but not to spend it. So when I sign a transaction, I use my private key to create a digital fingerprint that proves that I am the rightful owner of the Bitcoin. The Bitcoin network can then use my public key to check whether this signature is valid - in other words, whether it really comes from the person who has the private key. This ensures that no one can send transactions for someone else.
As soon as a transaction has been created and correctly signed, it is published on the network. However, a Bitcoin transaction is only considered to have actually been carried out once it has been included in a block. Until then, it remains in the so-called memory pool (mempool). The mempool is the Bitcoin queue and contains unconfirmed transactions.
As soon as a miner has added a valid block to the blockchain that contains my transaction, the transaction is said to have been confirmed or to have "1 confirmation". With each new block added, the number of confirmations increases by one. Each confirmation increases the certainty that the transaction is irreversible. After 2-3 transactions, this is in fact already the case - after 6 confirmations at the latest, the transaction is set in stone.
This is because the Bitcoin network always accepts the currently longest chain of blocks. If, for example, two miners find a block A and B relatively simultaneously and attach it to the blockchain, it depends on whether the next one found was then attached to A or B. If, for example, the next miner has not mined on the basis of block A but on block B and has found a block, block A is invalid and is discarded. These are known as orphaned blocks. If my transaction had already existed in block A, but not in block B and the following block, my transaction would have been thrown out of the confirmed state and added to the mempool again.
Mining in detail
I have already mentioned mining and "finding valid blocks" several times. Accordingly, I would like to explain how mining actually works. You often hear or read that miners have to "solve complicated arithmetic puzzles" or crack a "cryptographic puzzle" in order to find a Bitcoin block. However, such descriptions are somewhat misleading.
In truth, the principle is simpler than it sounds:
-> Miners search for a valid block hash by pure trial and error.
To be more precise: the miner builds a new block and calculates its SHA-256 hash - If this hash (interpreted as a number) is below a certain target value, then the block is valid and is accepted. This target value is called target is called the target. The miners' task is therefore essentially to find a block hash that is smaller than the specified target. And they don't need any special creativity or complex mathematics to do this - it's a pure game of luck and diligence through "try and error", similar to the lottery or throwing dice.
But let's take a look at the details:
What is a hash and what is SHA-256?
A hash is the result of a so-called mathematical one-way function. You enter any text and receive a seemingly random character string of fixed length as the output (the hash).
Important: This function is easy to calculate "forwards", but practically impossible to reverse. The hash (output) can therefore be easily calculated from a character string (input). However, you cannot get back to the original data from the hash -> hence "one-way".
Bitcoin uses the hash algorithm SHA-256 (Secure Hash Algorithm with 256-bit output).
What does this mean in concrete terms? As an example, you can try out a SHA-256 generator online (e.g. www.sha-generator.de).
If you hash the text "Bitcoin for beginners - Part 2: How does Bitcoin work?" using SHA-256, you will get the result:
f67292e63df873adbbb716fe86b27e414df4005f13fd007f983ae9e119fbd045
The same input always produces the same output. But if you change just a single character of the input, you get a completely different hash. From "Bitcoin for beginners part 2: How does Bitcoin work?" (here I have removed the hyphen after "beginner") becomes, for example:
7493b3cf6cd8c0aad96e2faf1afa5ddd9d3af39dbda3386e8b205b1182d01446
As you can see: This output is drastically different from the first hash, although the input was only minimally different. It is precisely these properties that make hashes so useful. Even a small change in the data generates a completely new, unpredictable hash value. And without knowing the exact input, the hash cannot be "deciphered". For Bitcoin, this means that this hash function gives each block a unique fingerprint.
So, now we know what a hash is. But the question remains as to what the target is and how this relates to the difficulty (Difficulty)?
As mentioned, the target is a threshold value. A new block is only valid if its hash is numerically smaller than this target. The Bitcoin software calculates and adjusts the target so that, on average, a block is found every 10 minutes. The lower the target, the more difficult it is to find a suitable (underlying) hash - simply because there are fewer possible hash values that are small enough. A high difficulty therefore corresponds to a low target.
All 2016 blocks (approximately every two weeks), the Bitcoin protocol automatically checks how quickly the last blocks were found. If the miners were faster than 10 minutes per block on average, the target is lowered (difficulty is raised). If they were slower, the target is increased (difficulty lowered). This Difficulty Adjustment ensures that the speed of block production remains stable. Even if there were suddenly twice as many miners at work (with twice the total computing power) and the blocks were initially found every ~5 minutes, the network adapts after 2016 blocks at the latest and halves their chance of success, so to speak, so that you end up back at ~10 minutes per block. This biweekly readjustment is a central element of Bitcoin and keeps the creation of money within the specified framework.
The mining process is therefore as follows:
(1) Collect transactions
A miner selects a number of transactions from the mempool that he wants to include in his new block. In most cases, he will give preference to those transactions with the highest fees in order to maximize his own reward.
(2) Compile block
The miner builds a new block. The block has a defined structure - you can imagine it as a form with certain fields. These include a reference to the last valid block (the hash of the previous block), a timestamp, the block version, a field for the target or the current difficulty, a counter field called nonce (an arbitrary number that the miner can change to achieve different hash results) and much more.
The miner also writes the collected transactions into the block. At the top is a special transaction, the "Coinbase transaction", with which he credits himself with the block reward (this is the only transaction without inputs, it "creates" new Bitcoin according to the rules) and has nothing to do with $COIN (-0,49 %) to do with
(3) Calculating hashes (proof of work)
Now the actual "mining" begins. The miner calculates the SHA-256 hash of the entire block content. If the calculated hash is smaller than the current target the miner has hit the jackpot, so to speak - the block is valid, found and the miner can pay himself the block subsidy and transaction fees (provided the nodes recognize the block as valid).
If not, the miner must change something in the block and try again. Typically, he increases the nonce by 1 and recalculates the hash. If necessary, he can also vary other things - e.g. change the order of the transactions or omit/replace a transaction to get a new hash result. Basically, it boils down to repeating this process until a sufficiently small hash appears by chance. The miners try this out billions and billions of times per second.
(4) Block found - distribution to the network
As soon as a miner has "hit the jackpot" - i.e. finds a block whose hash is smaller than the current target - it has officially found a valid block. This block is then immediately sent to the network (similar to a transaction) and spreads from node to node. Each full node checks the block for correctness. Is the hash really smaller than the target? Are all transactions in the block correct, i.e. are they valid and not duplicated? Has the miner followed the rules correctly (e.g. not created more new BTC than permitted)?
If so, the nodes accept the block and add it to their local blockchain. My own node would therefore add the new block to its ledger as the "newest page". If, on the other hand, a node discovers discrepancies, it discards the block - which in practice means that this faulty block will not be accepted in the network and the miner will be left empty-handed.
(5) Reward for the miner
If the block conforms to the rules and is accepted by the majority of nodes, the successful miner receives the block reward.
This consists of two parts:
- the block subsidythe newly created Bitcoin (currently 3.125 BTC per block and
- all transaction feesthat users have added to the transactions contained in the block.
This reward is the economic incentive that motivates miners to use their electricity and hardware for mining and to secure the network.
Summary: BTC transactions in detail
Now that we've gone through the basics, let's take another look at a Bitcoin transaction in detail as a summary. Once you have understood the basic concept, everything that follows with self-custody, etc. is no longer difficult :)
So let's say I want to send you 0.1 BTC. What exactly happens?
(1) Create transaction
First, I enter the recipient address and the amount in my Bitcoin wallet - in this case your Bitcoin address and 0.1 BTC. I also have to set a transaction fee that goes to the miners. Depending on the transaction volume, the wallets already suggest suitable fee rates for this - depending on how urgent the transaction is.
Once I have filled in everything, I click on "Send".
The wallet software then constructs the transaction data internally. It selects suitable inputs from my available Bitcoin (e.g. perhaps a UTXO worth 0.2 BTC, 0.1 of which goes to you and the rest back to me as "change") and defines the outputs (your address with 0.1 BTC, the fee for the miner and my own address for the change).
(2) Sign and publish the transaction
Before the wallet can actually send the transaction to the network, it must be signed. The wallet does this automatically in the background using my private key. With this digital signature, I prove to the Bitcoin network that I am authorized to spend the inputs used - in other words, that the Bitcoin really belongs to me. After signing, my wallet sends the transaction to the Bitcoin network.
Technically, as already described, it first goes to a connected full node. This verifies the transaction and, if successful, forwards it to its peer nodes. In this way, the transaction reaches many nodes in a very short time and spreads across the globe in waves. After a few seconds, practically all active Bitcoin nodes have heard about my transaction.
If you use a wallet that is connected to the internet, it will also very quickly receive the information via a node that 0.1 BTC is on its way to your address. Your wallet would therefore already show this unconfirmed transaction.
(3) Mempool (waiting for confirmation)
Now my transaction - like all other unconfirmed transfers - is in the mempool. It is valid and known, but not yet in a block. The transaction is therefore waiting in the queue to be included in a new block by a miner. Depending on the fee selected, this can happen quickly (if my fee is high enough, perhaps in the next block in just a few minutes) or it can take a long time (several hours or even days if the fee is very low). During peak times, when the network is busy, many transactions compete for limited block space, and those with the highest fees are confirmed first.
(4) A miner records the transaction in a block.
Sooner or later, a miner grabs my transaction from the mempool of his node during his mining process and puts it into a new block. The miner fills the block with transactions (including mine) and tries to find a valid block. As soon as this happens, my transfer is officially confirmed at that moment.
(5) The found block is published and accepted
The miner (or the miner's node) sends the newly found block to all its neighbors, who in turn disseminate the block. Within seconds, the full nodes worldwide have received the new block.
And each node checks it again: Is the block hash below the target? Are all transaction signatures correct? Have the rules been adhered to?
If the rules have been complied with, the nodes accept the block and add it to their local blockchain copy.
This is the principle behind every single Bitcoin transaction. From creation in the wallet, signing with the private key, distribution in the network to inclusion in a block and final confirmation.
The entire system works without a third party - it is only the users, nodes and miners involved who ensure that everything runs smoothly. Bitcoin achieves its security and decentralization through this interplay of cryptography (digital signatures, hashes), game theory (incentives for miners) and network technology (peer-to-peer distribution).
Conclusion / TL;DR
Bitcoin combines cryptography, game theory and an open peer-to-peer network to enable digital money without a central authority.
Bitcoin is a decentralized peer-to-peer network operated by thousands of peer computers around the world. There is no central authority - the participants themselves validate transactions and blocks according to defined rules.
All transactions are stored in the blockchain, the public ledger, and secured against subsequent manipulation by cryptographic chaining. New transactions are added to this ledger by miners using proof-of-work. The miners invest computing power to find a valid block hash and receive Bitcoin as a reward. The interplay of difficulty adjustment and economic incentives ensures that the system is stable and that a new block is created approximately every 10 minutes, which in turn secures Bitcoin's monetary policy and limits the money supply to just under 21 million, while the halving mechanism ensures that the issue of new BTC is predictable and transparent for the future.
The next part will probably be about buying Bitcoin, wallets and self-custody.
I hope I was able to explain the technology behind Bitcoin in a way that you can understand. You can of course write any questions in the comments again👇
Have a nice evening!✌️