Bitcoin Tutorial for Beginners
Bitcoin (bitcoin) was born from a paper in 2008.
One signed asSatoshi Nakamotowho came up with the revolutionary idea: let's create a currency that is not controlled by the government or anyone else! The idea was insane: how could anyone want to accept a string of numbers, backed by no assets or anyone responsible for them, when you pay them as money?
But the rhapsody actually became a reality. In the years that followed, with the support of countless enthusiasts around the world, the Bitcoin network was up and running, with more and more people and capital involved, and the fire of a star eventually became a prairie fire. Just this past 2021, Bitcoin saw explosive growth, rising as high as $66,000, and the world was shaken by it, from governments down to ordinary people. The truth is that Bitcoin has and will continue to change the world.
The news media tends to focus on its fiery performance and ignore or fail to answer some basic questions.
- What is the principle of Bitcoin?
- Why does this unmanaged system work successfully?
- What is the process of bitcoin trading all about?
- And how does it relate to the blockchain?
Below, I try to answer these questions in the hope of helping you understand Bitcoin. Technical details aside, it's still easy to explain.
One note, this article only discusses technical issues and does not cover how to invest in bitcoin, let alone predict price movements.
I. Asymmetric Encryption
First, to understand Bitcoin, one must understand asymmetric encryption.
You may have heard the term. The so-called asymmetric encryption is actually quite simple: two keys are required for encryption and decryption: a public key and a private key.
The public key is public and can be accessed by anyone. The private key is confidential and can only be used by the owner. Someone else uses your public key to encrypt a message and sends it to you, and you use the private key to decrypt it and take out the message. Conversely, you can also encrypt a message with your private key and someone else uses your public key to decrypt it, thus proving that the message was indeed sent by you and has not been tampered with, which is called a digital signature(see What is a Digital Signature for a more detailed introduction).
Now imagine,what would happen if the public key encrypted not an ordinary message, but an encrypted sum of money that was sent to you.
First of all, you can unlock the encrypted package and take out the money inside, because the private key is in your hands. Secondly, others cannot steal the money because they do not have your private key. Therefore, the payment can be successful.
This is the principle of Bitcoin (and other digital currencies): asymmetric encryption ensures that payments are reliable.
Since the money paid must be removed via the private key, it doesn't matter who you are, it matters who has the private key. Only if you have the private key can you take out the money paid to you. (In fact, the real transaction process is slightly different in that the private key guarantees not that the money paid to you is taken out, but that only you can pay out the money that belongs to you, as detailed later.)
For Bitcoin, money is not paid to an individual, but to a particular private key. This is the fundamental reason for the anonymity of the transaction, because no one knows, who the owner behind those private keys is.
So,the first thing that happens with bitcoin transactions is you have to have your own public and private keys.
You go to one of those online bitcoin exchanges to open an account, and they will ask you to first generate a bitcoin wallet (wallet).This wallet is not for bitcoins, but for your public and private keys.The software will generate these two keys for you and put them inside the wallet.
According to the protocol, the length of the public key is 512 bits. This length is not very convenient for dissemination, so the protocol again stipulates that a 160-bit fingerprint is to be generated for the public key. The so-called fingerprint is a relatively short, easily propagated hash. 160 bits is binary, written in hexadecimal, and is about 26 to 35 characters, for example, 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2. this string is called the address of the wallet, and it is unique, i.e., the address is definitely different for each wallet.
When you collect money from someone, you simply tell them your wallet address and they pay to this address. Since you are the owner of this address, you will receive the money.
Since whether you own a certain wallet address is proven by a private key (the exact method of proof will be described later), make sure to protect the private key. This is extremely important. If your private key is stolen, your bitcoins are gone, because someone else can use your identity and transfer all the money inside your wallet.
Similarly, when you pay someone for bitcoins, you must not write down the wrong address of their wallet, otherwise your bitcoins will be paid to a different person.
III. The Transaction Process
Below, I've strung together the entire process to see how Bitcoin completes a transaction.
A transaction is a transfer of bitcoins from one address, to another address.Since the transaction records for bitcoin are all public, which address has how many bitcoins is available. Therefore, it is easy to verify that the payer has enough bitcoins to complete the transaction.
The problem is how to prevent other people from declaring transactions in your name. For example, someone declares a transaction where address A pays address B 10 bitcoins. How do I know that this declaration is genuine and that the person who declared it is the owner of address A?
The Bitcoin protocol states that when declaring a transaction, in addition to the transaction amount, the party transferring the Bitcoin must also provide the following data.
- Hash of the last transaction (where you got those bitcoins from)
- Addresses of both sides of this transaction
- The public key of the payer
- The digital signature generated by the payer's private key
Verifying that this transaction is genuine requires three steps.
Step one, find the previous transaction and confirm the source of the payer's bitcoins.
The second step is to calculate the fingerprint of the payer's public key and confirm that it matches the payer's address, thus ensuring that the public key is genuine.
Step 3, use the public key to decode the digital signature to ensure that the private key is true.
After the above three steps, the transaction can be recognized as real.
IV. Transaction Confirmation and Blockchain
After confirming the authenticity of the transaction, the transaction is not yet complete.The transaction data must be written to the database before it can be established and the other party can actually receive the money.
Bitcoin uses a special database called blockchain. For a detailed introduction,please see the Blockchain Tutorial.This article only discusses how transactions are written to the blockchain.
First, all the transaction data is transmitted to the miner. The miner is responsible for writing these transactions to the blockchain.
According to the Bitcoin protocol, the maximum size of a block is 1MB, and a transaction is roughly 500 bytes, so a block can contain up to 2000+ transactions. Miners are responsible for packing these 2,000+ transactions together into a block, and then calculating the hash of that block.
The process of calculating the hash is called mining, and it requires a lot of computation. Miners are also competing with each other. Whoever calculates the hash first will be the first to add a new block to the blockchain and thus enjoy the full benefits of that block, while other miners will get nothing.
Once a transaction is written to the blockchain, it cannot be reversed. Here's where the idea needs to be established:Bitcoins are not stored in wallets or anywhere else, but only on top of the blockchain.The blockchain records every transaction you've been involved in, how many bitcoins you've received, and how many bitcoins you've paid out, so you can figure out how much equity you have.
V. Benefits for miners
Transactions can't be confirmed without miners. Why would anyone want to be a miner?
The Bitcoin protocol states that miners who mine new blocks will be rewarded, at first (2008) with 50 bitcoins, then every 4 years by half, and currently (2018) with 12.5 bitcoins. This is the mechanism by which the supply of bitcoins increases, and new bitcoins in circulation are born this way.
As you can probably see, the reward is halved every 4 years, and since bitcoins can be split to eight decimal places, then in 2140, miners will get no reward and the number of bitcoins will stop increasing. At that point, miners' earnings would be entirely dependent on transaction fees.
By transaction fees, I mean that miners can take a percentage of each transaction, the exact amount of which is voluntarily determined by the payer. You can give the miners nothing, but then your transactions will be unprocessed and delayed from being written to the blockchain and confirmed. Miners always prioritize the transactions with the highest fees.
Currently, due to the surge in the number of transactions, the fees have gone through the roof and can total 3 to 10 bitcoins for a block of over 2000 transactions. If you give a low fee, it's likely that after a week, the transaction hasn't been confirmed.
The reward money of 12.5 bitcoins for a block, plus the fee, is a considerable gain. At current prices, it can reach 1 million to 2 million RMB. Think about it, if you are lucky, you can mine a block in a few minutes and get such a large sum of money, no wonder people are rushing to mining.
Ⅵ, the expansion of the block
please see the Blockchain Tutorial.the Bitcoin protocol states that a block is born in 10 minutes on average. The size of a block is only 1MB, and can only contain up to 2000 transactions. That means that every 10 minutes, the Bitcoin network can only process up to 2,000 transactions, which translates to a processing speed of 3 to 5 transactions/second.
There are so many bitcoin transactions around the world, but the blockchain can only process up to 5 transactions per second, which has become a bottleneck limiting the development of bitcoin.
There have been calls for a long time to reform the Bitcoin protocol and improve the processing speed. This came to a head a bit in August 2017, when a fork in the blockchain occurred, Bitcoin Cash(BCH for short). This new currency is otherwise identical to Bitcoin, except that the size of each block has been increased from 1MB to 8MB, resulting in an eight-fold increase in processing speed and much lower fees. The protocol was a fork of the original blockchain, so anyone holding bitcoin at the time was given one copy of the same amount of BCH.
BCH is tantamount to creating a new currency, and there is also a proposal to increase the block size of the original Bitcoin to 2MB, which is called SegWit2x . This proposal was scheduled to be implemented in November 2017, but was cancelled at the last minute due to lack of consensus and is still under discussion.
Bitcoin is a worldwide open network, and as long as you have a server, you can join this network and become a node. Each node contains the entire blockchain (currently about 100+ GB), and information is constantly being synchronized between nodes at all times.
When you make a payment, the node you are on tells another node about the transaction, until it spreads throughout the network. Miners collect all kinds of new transactions from the web and write them to the blockchain in a packet. Once written successfully, the blockchain of the miner's node becomes the latest version, and all other nodes come to copy the new blocks, ensuring that the blockchain is consistent across the network.
Finally, your node also gets the latest blockchain, and thus learns that the transaction you made earlier, has been written in it, so that the transaction is confirmed successful.
Please specify source if reproducedBitcoin Tutorials for Beginners | Dexnav Blockchain Navigation