Blockchain knowledge from 0: Bitcoin, Blockchain technology articles
Before starting, I would like to ask you to try and answer the following questions to see how much you know about Bitcoin
1. Can you believe that this money is real, not forged?
2. Can you be sure that the digital currency can only be used once? (Commonly known as “double payment”, “double spending” problem)
3. Can you ensure that no one but I can claim that my sum of money belongs to them?
These three questions come from the book Mastering Bitcoin. They are the three most basic questions about digital currencies. We will answer these three questions one by one, and I will try to explain the technical principles in the plainest language.
Explain in one sentence what Bitcoin will be: Bitcoin is a string of code, protected by cryptographic principles. It runs on several servers on the network at the same time, and every ten minutes there will be one more block (“block” is also A new piece of code).
Next, you will have three things in your hand, private key/public key, and address.
The private key is a string of 0 and 1 numbers, a total of 256 bits, and all possibilities are 2²⁵⁶ (2 to the 256th power). The visual description is that every grain of sand on the earth is treated as earth. These sand piles of the earth The total of each grain of sand is approximately equal to the power of 2²⁵⁶. Another way of saying that is that the number of atoms that can be observed in the entire universe, multiplied by 1000, is equivalent to 2²⁵⁶. Regarding how big this number is, you can refer to the bottom supplementary information.
The public key is obtained after a series of mathematical calculations on the private key. To put it simply, that’s it, but… come on!
This is the elliptic curve encryption (ECC) of the secp256k1 standard. Our goal is to find a consistent solution (x, y). Bitcoin’s private key k, multiplied by the constant G (the standard number built-in by secp256k1), will get a public key K(x,y). How big is this number? It looks like this: x = F028892BAD7ED57D2FB57BF33081D5CFCF6F9ED3D3D7F159C2E2FFF579DC341A
y = 07CF33DA18BD734C600B96A72BBC4749D5141C90EC8AC328AE52DDFE2E505BDB
(represented in hexadecimal )
The last is the address, which usually looks like “1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy”, which is calculated from the public key K. The calculation method is as follows:
is the result of the address calculated by SHA256, and then calculated again with RIPEMD160.
Then to prevent incorrect filling, most of the addresses will be displayed in the form of Base58Check. There is no zero 0, uppercase O, lowercase L, and uppercase I in Base58Check, and the verification code CheckSum is also added.
The first question can be viewed from several angles. Let’s first look at how to determine authenticity. The source of all bitcoins is mining. The behaviour of “mining” is a mathematical problem that several servers compete to guess. The server that guesses the correct one can obtain bitcoins from the system itself. . After that, Bitcoin may change hands to multiple people and then flow into my hands. In each transfer process, the transaction information will be certified by the elliptic curve encrypted ECDSA digital signature to prove that a certain amount of money (to be precise, a piece of code) was transferred to another person. This signature proves that the owner of the private key authorizes the transfer of money to another address, including to whom and how much is recorded. Others can use the public key to verify whether this is true. This information will be broadcast to the Internet, waiting for the miners to complete the puzzle and package the information into new blocks. Blocks are stringed into a blockchain. We can use this method to make sure that every transaction is true. If a person passes Bitcoin (again, he is a string of code) to you, and he It also contains the digital signature that it should have, and it is packaged and confirmed by the miners, then this Bitcoin is undoubtedly true.
I’m writing here today, I’m afraid I’ll start to find fault if I don’t post it first… I’ll post after the next two questions.