Bitcoin: Short technical guide for beginners
Before the advent of Bitcoin, all types and methods of cash payments were into two main categories;
- Cash payments are made directly between the two parties. They are convenient because they are carried out instantly and do not require the mutual trust of the parties. Besides, they exclude payment delays and third-party mediation. The main disadvantage of cash payments is the need for both parties to meet in the same place at the same time.
- Non-cash (intermediary) payments require a trusted third party’s participation and use of checks, credit or debit cards, bank transfers, or systems like PayPal. For such charges, by definition, an intermediary is required who transfers funds between the parties to the transaction. The main advantage of an intermediary payment is the ability to make an exchange without meeting the parties. In addition, the payer does not need to carry money with him. The main disadvantages are the problem of trust (you will have to trust the intermediary, and he may not fulfill his obligations), additional costs, and the time that the recipient will have to wait for the final transfer of funds before he can dispose of them.
Of course, with non-cash payments, the problem of owning and disposing money also arises. The owner delegates to a third trusted party (usually a bank) the right to hold his money at least for the transfer time. In addition, having transferred this right, the de facto owner can no longer freely dispose of his money but is forced to act within the framework of an agreement concluded between him and the bank. They are operating within the framework of bank instructions.
To combine the advantages of both categories of payments and at the same time eliminate their disadvantages means the following:
It is necessary to create an electronic money exchange network between remote parties, which will work without an intermediary (trusted center).
At the same time, the following tasks need to:
They were ensuring trust between the parties. The sender must be sure that his money transfer has reached the recipient and that he has received it. The recipient must be sure that the sender cannot cancel the money transfer and that the money received will remain with him (the recipient). That is, it is necessary to ensure that the transaction is accurately recorded between the parties so that none of the parties could challenge it in the future.
The problem of “double spending.” It is necessary to prevent double-spending of the sent funds, i.e., to ensure that the sender cannot send the same money to two or more recipients.
For a long time, it was not possible to solve these problems without the participation of a third trusted party. And the first engineering solution that allowed electronic payments to be made directly, without the involvement of trusted intermediaries, was Bitcoin — a decentralized electronic monetary system.
A primary objective of this guidance is to make it easy to understand how Bitcoin works and how it helps with the things listed above.
The guide on the course “Teach me Bitcoin” (Learn me a bitcoin) by Greg Aka inersha.
What is the Bitcoin network?
The Bitcoin network consists of everyone who works with Bitcoin software. Bitcoin is a network of people (computers) working with the same computer program.
What does the Bitcoin network do?
People (more precisely, bitcoin clients) communicate on the network. “communication” means transmitting information about what is happening in other parts of the network by sending messages.
For example, the message may be information about a new transaction. The exchange of information (for example, about marketing) allows everyone on the network to keep up to date, which is very important if you want to use digital currency on the Internet. Everyone in the network knows that the new deal is a good one, after all.
People call the Bitcoin network a “peer-to-peer” or “p2p” network (peer-to-peer network) because:
- Everyone to each other, so it’s a network.
- Everyone in the network is equal, i.e., everyone is of the same rank (peer—equal, peer-to-peer).
Who belongs to the network?
As was said, a bitcoin client can respond to anyone with an active internet connection. Indeed, anyone can join the Bitcoin network. Everything you need is a way to connect to the Internet and a bitcoin client. That is just a piece of software like any other.
And as soon as you start working, your computer will be called a node in the Bitcoin network.
How to join the network?
All you have to do is get the Bitcoin client and run it. At startup, the client will connect to other network nodes and begin downloading a full copy of the blockchain (a file containing all verified transactions). After that, the client will start receiving transactions from other nodes and relaying them over the network.
What is a node?
A node is a computer running a Bitcoin program (a Bitcoin client). More importantly, the node is connected to other computers (running the same program) to create a Bitcoin network. In other words, the Bitcoin network consists of nodes.
What does a node do?
A node has three purposes:
- Follow the rules.
- Share information.
- Save a copy of the confirmed transactions.
- Let’s look at all three node tasks in more detail.
1. Follow the rules
Each node (Bitcoin client) is programmed to execute a set of rules. Following these rules, a node can verify the transactions it receives and relay them if they are OK. If there are any problems, the transaction is not transmitted further to the Bitcoin network.
For example, one of the rules is that a person (the owner of a bitcoin address) must own an equal or more significant number of bitcoins than he is trying to send. Therefore, if a node receives a transaction in which someone tried to send more bitcoins than he has, it will not transfer the transaction to other nodes.
2. Share information
The main job of the node is to exchange information with other nodes, and the quintessence of the information that the node transmits is transactions.
Nodes send out two different kinds of transactions:
New (fresh) transactions are transactions that have recently entered the network.
Confirmed transactions are transactions that have been “confirmed” and written to a file. They are shared in transaction blocks, not individually.
Do not worry about how these two kinds of transactions are different. Everything will become apparent in the chapters on Mining and Blocks.
3. Keep a copy of the confirmed transactions
As already mentioned, each node also stores blocks of confirmed transactions. They are held together in a file (database) called the blockchain.
New transactions are sent over the network until they go to the blockchain and a list of trades is confirmed.
Any server maintains a safe copy of the blockchain and distributes it with other nodes if their document has not.
When a bitcoin client, the network does not “teach the client what to do.” Instead, your Bitcoin client is self-sufficient and self-aware.
Thus, the entire Bitcoin network consists of nodes making their own decisions, but each of them makes the same decisions as the others, which makes it a wholly decentralized but robust network.
Even if all the other nodes were disabled, your single node would support the entire Bitcoin system.
Do I need to be a node to use Bitcoins?
No! You can send and receive bitcoins without being a node. You need to send a transaction to the Bitcoin network.
For example, if you use a web wallet, it will transfer your transactions to the Bitcoin network without being a node.
Each node in the Bitcoin network shares information about new transactions. Nodes store these transactions in their memory pool (memory pool or mempool).
Every node can additionally attempt to add transactions from its memory pool to a separate database. This database is a ledger of all bitcoin transactions and is called a blockchain. It is like an accounting book in all monetary transactions — who, when, to whom, and how much money.
What is this difficult task?
Imagine that you are a node. At any time, you can compress transactions in the memory pool into a single “string” of numbers and letters. This process is called hashing, and the resulting result is a hash.
Now your goal is to cache this string with another number called nonce to get a new column that starts with a certain number of zeros.
It sounds simple enough, but it isn’t straightforward. This process is entirely random, and you can only hope for the desired result by brute force — making trial and error are mining — a lot of hashing operations (using the computing power of your computer) in the hope of luck.
But suppose you are lucky enough to find a successful hash result (the nonce number). In that case, you can add all transactions from the memory pool to the blockchain, and every other node in the network updates the blockchain with the transaction block you added on your computer.
You will also receive a reward in bitcoins (at the time of writing this article — 15.5 BTC) for your efforts, as well as commissions for all transactions that you have just added to the blockchain.
“A certain number of zeros” means that the hash is less than a certain specified number (target), which depends on the complexity (difficulty). It is by the network and varies depending on the number of miners (more precisely, on the total mining power) — the more people in mining, the higher the unlimited power of their computers.
The more significant the complexity, the more zeros at the beginning of the hash make it challenging to find the desired result (nonce).
Why is mining necessary?
Good question. Why not just add transactions from the memory pool to the blockchain?
First, we must decide which node in the peer-to-peer network will add a block of new transactions to the blockchain.
Secondly, mining allows the entire Bitcoin network to agree on which transactions are “archived,” and this is how it prevents fraud with digital currency.
When you make a bitcoin transaction, the nodes in the network do not receive information about it immediately. Instead, new transactions pass through the entire Bitcoin network, transmitted from one node to another.
However, it is possible to make another transaction using the same bitcoins and send this transaction to the network. For example, you can buy beer for bitcoins and quickly try to buy a piece of pizza for the same bitcoins.
However, even if you make a pizza transaction after a beer transaction, due to the way transactions move through the Bitcoin network, the network will disagree about what you bought with your bitcoins – beer or pizza.
How then, does the network determine which transactions to include on the blockchain?
Of course, this is a slightly unusual way of choosing transactions, but this is precisely the solution that the Bitcoin network uses to reach consensus when dealing with conflicting information.
In contrast, each new block of transactions is added to the blockchain every 10 minutes; thus, you only need to wait 10 minutes to validate that the bitcoins have “arrived” at the new address (and have not been sent to an alternative address).
Another advantage of mining.
If you want to single-handedly manage (manipulate) the blocks (i.e., transactions) that to the blockchain, you must compete to solve block puzzles with all the other mining nodes in the Bitcoin network.
In other words, you need a computer with sufficient computing power capable of surpassing the combined computing power of all other Bitcoin miners.
It is quite possible — you need to spend a few billion dollars on hardware, and you’re ready to go (although this figure increases with each new miner joining the network). Thus, the Bitcoin network from the manipulation of transactions.