Is bitcoin safe? In other words, is the bitcoin in your wallet easy to steal by hackers?

**Private key, Public key, Address**

Just as a password is required for bank withdrawal and online banking transfer, it is also necessary to use bitcoin in your wallet. This password is called “private key”.

Corresponding to “private key” is “public key”, and “public key” is like your bank account. Each bank account has a unique account number, which is the bank card number. In the Bitcoin network, this bank card number is the “address”. As long as others know your “bank card number” (that is,address), they can transfer bitcoin to you.

In a bank, the basic process of opening an account is “opening a bank account – giving a bank card number – setting a bank card password – opening an account successfully”. But in the blockchain world, it is first to set the “password” (private key), then to open a “bank account” (public key), and finally to give the “bank card number” (address).

If you pick up a piece of paper on the road with only the bank card code but no bank card number, even if the bank card code is true, you can’t take the money from the relevant account.

But in the blockchain world, as long as you know someone else’s “bank card password” (private key), you can know someone else’s “bank account” (public key) and “bank card number” (address), and you can take away the inside currency.

**Why is this?**

This is because in the blockchain, the private key generates the public key through encryption, and the public key converts the format to generate the address. In other words, the private key can deduce the public key, and the public key can deduce the address.

**Reverse derivation? No Way!**

Since “the private key can deduce the public key, the public key can deduce the address”, and the “password (private key)” must be entered to use the bitcoin in the account. If a hacker wants to steal the bitcoin in your wallet, he must and only need to get the “private key”.

In theory, hackers can steal your private key in two ways:

_{1.Through the address/public key, the private key is derived backward.}

_{2.Try the private keys one by one, which is brute force.}

The first method is not feasible, because the encryption algorithm used in bitcoin is “a drop in the ocean, a thousand miles away!”. If the input content is slightly changed, even if a little bit of things are changed, the output result after encryption is very different from the output before, and these results have no rule to follow.

Therefore, this encryption algorithm is “unidirectional” and “irreversible”, and hackers cannot deduce the input (private key) from the output (address / public key).

**How difficult is it to brute force Bitcoin private keys?**

Since the first method is not feasible, what about the second one? Before answering this question, let’s take a look at how the private key is generated.

Suppose you toss a coin, heads up is 1, and the reverse is 0. Toss 256 times in a row, record the result of each toss, and convert it into a hexadecimal number, which is a Bitcoin private key.

**What? So easy? So wayward?**

Yes, bitcoin’s private key is randomly generated by “tossing coins 256 times” through the program. Therefore, the essence of bitcoin private key is 256 bit binary number.

Every time you flip a coin, there are two sides, so if you toss 256 times, you can see “2 x 2 x 2 x 2 2 x 2×2 “, which is 256 times 2, is the result of” 256 power of 2 “. Therefore, the total number of bitcoin private keys is theoretically “2 to the 256 power”.

Note: the actual value of the total number of private keys is slightly lower than the theoretical value above, because a small number of private keys are not available, but the impact on the total number is negligible.

How big is “2 to the 256 power”? It is approximately equal to “10 to the 77 power.” How big is “10 to the 77 power”?

If the earth we live in, the oceans, rocks and underground magma are all filled with sand, the amount of sand in the whole earth is about “10 to the 30th power”. In other words, a planet as big as the earth, all made up of sand, needs to use “10 to 30th power” grains of sand.

“The 77th power of 10” is greater than “the 30th power of 10” times, and the “37th power of 10” is exactly 37 zeros. In the bitcoin private key set, which is “10 to the 37th power” times more than the amount of sand on the earth, it is even more difficult to crack the private key corresponding to a certain address one by one, rather than looking for a needle in a haystack.

Therefore, even if a hacker has a supercomputer, he cannot brute force the Bitcoin private key.

That’s why many people say, “bitcoin, for the first time, has ensured the sanctity of private property through technological means.”.

**If it’s better than a supercomputer?**

Although no one can accurately predict the future development of science and technology, if one day, mankind invents a computer more powerful than supercomputer and quantum computer, will the private key of bitcoin not be secure?

Indeed, many people want to know whether quantum computers are a threat to the security of Bitcoin, and if so, what measures bitcoin has to deal with.

Since this problem can not be explained clearly in a few words, we will open a separate article to discuss this problem. Please look forward to it.

Of course, security issues not only involve technical issues, but also involve the preservation of private keys. If the private key is not kept properly, or the computer is infected with a virus, or the wallet software used has a loophole or a back door, which causes the private key to be stolen by hackers, the security of bitcoin in the wallet will be out of the question.

However, the private key is stolen because of your own mistake. Bitcoin can’t be carried on this pot, can’t it?

So, if someone questioned the security of Bitcoin with the theft of Bitcoin, how would you answer him?