区块链生成公钥和私钥的过程是什么,区块链生成公钥和私钥的过程是
请查看相关英文文档
1. [Cat Talk] There are two keys to open a Bitcoin wallet: private key and public key
If you don’t understand the blockchain, you don’t know the public key and private key. These are the most basic concepts. For newcomers to the currency circle, owning a wallet is like poking a crocodile in the head with your finger. The risk is extremely high. This article is dedicated to new friends in the currency circle to help you sort out the basic common sense of Bitcoin wallets.
Blockchain Observation Network mentioned in the article "What is Blockchain" that in the blockchain world, everyone has two unique virtual keys: public key and private key.
"Public key" can be simply understood as a bank card, which can be sent to the counterparty of the transaction. The bank card number is equivalent to the "address" used in Bitcoin transfers.
To put it more professionally, the public key is a 65-byte string. How long is it? 130 letters and numbers piled together. If the public key is too long, firstly, it will be too troublesome to make transactions. Secondly, why do you have to expose the true content of the public key? This is like taking out your bank card and showing it to others everywhere. Therefore, the address we see now is a shorter public key generated by the digest algorithm.
The other party can send you money only if they know your address; moreover, anyone who has your address can check the number of transactions (No. Transactions) of this wallet address on the official website of Blockchain.info, and receive How many Bitcoins have been received (Total Received), and how many Bitcoins are left in the wallet (Final Balance), as shown below:
"Private key" is like a bank card that cannot be told to others. password. It is a string of 256-bit random numbers. Because it is particularly inhumane for non-IT users to remember this binary private key full of 0s and 1s, this large string of private keys was processed, and the final private key was a string starting with 5/K/L presented before us.
The relationship between public key, private key and address is:
1) Private key → public key → address
The private key generates a unique corresponding public key key, and the public key generates a unique corresponding address;
2) Private key encryption, public key decryption
In other words, A uses the private key to encrypt the transaction information (digital signature ), B uses A’s public key to decrypt the digital signature.
Among them, the private key is an extremely private thing. If you send your private key to someone else, start writing a novel now. The name has been decided for you, and it will be called "Farewell, Bitcoin."
If it were Li XiaolaiBig names in the currency circle such as Teacher (who is said to own hundreds of thousands of BTC online) strongly recommend using cold wallets (offline wallets) and storing them separately; the rich people on TV have their own safes in banks, and you can refer to them if you have the conditions.
At that time, the above method was the safest approach. But as the successor of Leek, let’s assume for the moment that we only use idle funds and hold a small number of Bitcoins, for example, less than 5. Then, cold wallets that cost thousands and are complex to operate are a bit overkill; therefore, Blockchain Observation Network limits the choices to exchanges and light wallets:
On the trading platform If you buy (a very small amount of) Bitcoin on the exchange, you can continue to store it on the exchange without withdrawing it. This method is most suitable for newbies in the currency circle. Before we have a deep understanding of the story behind each cryptocurrency, we are always full of curiosity. Bitcoins placed on the exchange can be directly traded. The transaction is simple and fast, without the need to go through a digital wallet. ; On the other hand, the platform has a complete range of currencies, which can satisfy our early adopter mentality and make it easy to try out our skills at any time.
Moreover, large exchanges such as Huobi and Binance (which have been blocked) not only have a much higher security level than some small platforms designed to harvest leeks, but are also simple to operate and can be used quickly. To get started, you only need to keep your account and password safe (for a higher level of security, turn on Google two-step verification), and leave the rest to the platform.
It is worth noting that the assets stored on the exchange do not entirely belong to ourselves, but rather are lent to the platform. The number we see in the asset column is equivalent to the platform providing us with A white note for borrowing money. In addition, the trading platform itself is not decentralized. If security measures are not in place, users’ account passwords may be obtained by hackers.
Light wallets are relative to "full node" wallets.
Full-node wallets, such as Bitcoin-Core (core wallet), need to synchronize all blockchain data when running, occupy a considerable amount of memory space (currently at least 50GB or more), and are completely decentralized;
Although the light wallet also relies on other full nodes on the Bitcoin network, it only synchronizes transaction data related to itself, basically achieving decentralization and improving user experience.
According to different device types, we divide light wallets into:
1) PC wallet: suitable for computer desktop operating systems (such as Windows/MacOS/Linus);
2) Mobile wallet: suitable for Android and iOS smartphones, such as Bitether wallet (Ethereum also has a PC version);
3) Web wallet: accessed through a browser, such as mentioned above The web version of blockchain.
Light wallets are relatively simple to operate and are generally available for free. When applying for a wallet, the system will generate a private key. Get ready to hit the blackboard!
1) Do not take screenshots or photos and store them in your mobile phone;
2) Do not send the private key information to anyone;
3) It is best to copy it by hand (several copies) , hide in the place where you feel safest.
In a word, whoever masters the private key of the wallet has absolute control of the wallet. As long as the private key is in your hands, your Bitcoins will never be lost.
Finally, a few words. As ordinary investors, we don’t need to do much:
1) Take a snack and don’t lose your mobile phone. After all, you have lost the right mobile phone. There are risks in the Bitcoin wallet;
2) Don’t delete the wallet application on the device. Unless you decide not to use this wallet anymore, it will be very troublesome later;
3) Set a complex password (see point 1 for the reason) and remember it carefully. This is what you will keep if the private key is lost.
For those of you who can’t remember your password and are too lazy to back up your private key scientifically, let’s just keep the money in the bank.
2. How to obtain the blockchain key file
1. A method for retrieving the blockchain system key, which is characterized by including the following steps: Step 1. Create the original key pair; Step 2. Calculate the business key pair based on the original key pair; Step 3. Calculate the address and account based on the business key pair; Step 4. When the business key is lost, perform Step 2. 2. According to the rights The method for retrieving a blockchain system key according to claim 1, characterized in that the original key pair includes an original private key and an original public key. 3. The method for retrieving the blockchain system key according to claim 2, characterized in that in step 1, creating an original key pair includes the following steps: Step 11. Generate an original seed using a random number. ; Step 12: Generate an original key pair from the original seed through an asymmetric encryption algorithm. The original key pair includes an original private key and an original public key. 4. The blockchain system key retrieval method according to claim 1, characterized in that in step 2, the business key pair includes a business private key and a business public key. 5. The method for retrieving the blockchain system key according to claim 4, characterized in that in step 2, specifically, a business seed is generated according to the seed production data, and a business key is generated according to the business seed. Yes, it specifically includes the following steps: Step 21, use the original private key as the encryption key, perform a seed generation operation on the seed production data, and obtain a unique ciphertext as the business seed; Step 22, use the business seed The non-pair encryption algorithm generates a business key pair, which includes a business private key and a business public key. 6. The blockchain system key retrieval method according to claim 5, characterized in that in step 21, the seed production data includes the original public key or any other selected data. 7. The method for retrieving the blockchain system key according to claim 5, characterized in that:In step 21, the seed generation operation includes hmac encryption algorithm operation, salted hash encryption algorithm operation, symmetric encryption algorithm operation or asymmetric encryption algorithm operation. 8. The method for retrieving the blockchain system key according to claim 3 or 5, characterized in that the asymmetric encryption algorithm includes rsa algorithm, ecc algorithm, ecdsa algorithm, sm2 algorithm and sm9 algorithm. Any of them. 9. The method for retrieving the blockchain system key according to claim 5, characterized in that if the unique ciphertext is not a hash value, then a hash operation is performed on the ciphertext to obtain The hash value of the ciphertext is used as the service seed; if the ciphertext is a hash value, it can be directly used as the service seed, or the hash operation can be performed again or multiple times, and the obtained hash value is used as the service seed. 10. The method for retrieving the blockchain system key according to claim 7, characterized in that the symmetric encryption algorithm includes des algorithm, 3des algorithm, rc2 algorithm, rc4 algorithm, rc5 algorithm, aes algorithm, Any one of the sm1 algorithm, sm4 algorithm, sm7 algorithm and zuc algorithm.
3. In a blockchain-based digital currency like Integrity Coin, what exactly are the private keys, public keys, and addresses?
Many novices wonder when they first enter the market. Confused by the relationship between private keys, public keys, addresses, etc. Some even lost their private keys, and there was a lot of money in the address, but they just couldn't get it out. Today Xiaobai will explain to you the relationship between private keys, public keys, and addresses.
The relationship between the private key, public key and address is:The private key is converted (generated) into a public key, and then converted into an address. If there is Bitcoin or integrity currency on an address, you can Spend the integrity coins above using the private key converted to this address. The generation of public key and address both depends on the private key, so the private key is the most important.
The same is true for mobile wallets, but because the file management method of mobile phones is not as convenient as that of computers. Therefore, generally mobile wallets will provide a function called or similar to "Export Private Key". Through this function, the private key can be exported in various forms.
For example, the Bitcoin mobile wallet can be exported as a QR code, which can be printed or scanned onto paper. When changing your mobile phone, install your Bitcoin wallet and scan this QR code to migrate your Bitcoins. The Bitcoin mobile wallet and the Integrity Coin mobile wallet can be exported as a clear text string and printed on paper - this is a paper wallet.
The paper wallet allows users to go to any terminal with a Bitcoin or Integrity Coin wallet to spend your Bitcoin or Integrity Coin.
As the wallet is lost or damaged, the private key will be lost, thereby completely losing the right to transfer the digital currency. To prevent such a tragedy, remember to always back up the data in your wallet. In addition to the address, all private keys are also saved during the backup.
SummaryThe private key must be protected to prevent loss and forgetting. The method will be cleared when clearing information on the mobile phone. It is best to copy it by hand, but do not disclose it..
You must prevent your wallet from being lost or damaged, resulting in the loss of the private key and the loss of the right to transfer digital currency. Otherwise, no matter how many coins you have, it is still useless if you cannot withdraw them.
4. The difference and application of public keys and private keys.
In real life, if I want to transfer 1 Bitcoin to Yiyi, I need to enter my Bitcoin wallet address and Yiyi’s wallet on the Bitcoin trading platform, Bitcoin wallet or Bitcoin client. Address, amount of Bitcoin transferred, and handling fee. Then, we wait for about ten minutes. After the miner processes the transaction information, the 1 Bitcoin is successfully transferred to Yiyi.
This process seems very simple and convenient, no different from our current bank card transfers, but do you know how this process is implemented in the Bitcoin system? What principles does it hide? Or, how does it ensure that transactions can be conducted in a safe environment?
Let’s talk about it today.
For the transferor and the receiver, that is, Yiyi and I (I am the transferor and Yiyi is the receiver), we both need to produce two things: wallet address and private key.
Let’s talk about the wallet address first. A Bitcoin wallet address is actually equivalent to a bank card, Alipay account, or WeChat wallet account. It is the "voucher" for Bitcoin payment transfers, recording transfer information between platforms, wallets, and wallets.
When we use bank cards, Alipay, and WeChat transfers, we need passwords to make successful payments. Well, in Bitcoin transfers, there is also such a "password", and this "password" is called the "private key". Once you master the private key, you have the power of life and death on its corresponding Bitcoin address.
"Private key" is a concept in the "asymmetric encryption algorithm", and there is another concept corresponding to it, called: "public key".
We can understand the public key and private key from the literal meaning: the public key can be made public; while the private key is private, owned by you, and needs to be kept absolutely confidential.
The public key is calculated based on the private key. The Bitcoin system uses the elliptic curve encryption algorithm to calculate the public key based on the private key. This creates a unique correspondence between the public key and the private key: when you use one of the keys to encrypt information, only the matching other key can decrypt it. Therefore, it is based on this unique corresponding relationship that they can be used to verify the identity of the information sender and achieve absolute confidentiality.
Let’s take an example to talk about how public and private keys work in asymmetric encryption algorithms.
We know that the public key can be made public, so everyone knows our public key. During the transfer process, I not only have to ensure that the bitcoins are transferred to Yiyi and not to anyone else, but I also have to let Yiyi know that these bitcoins belong to me.The person who forwarded it to her was not Lulu or Brother Ji.
The Bitcoin system can meet my above demands: the Bitcoin system will shorten my transaction information into a fixed-length string, that is, a summary, and then attach my private key to this summary. to form a digital signature. Because the digital signature contains my private key information, the digital signature can prove my identity.
After completion, the complete transaction information and digital signature will be broadcast to the miners. The miners will use my public key to verify and see if my public key and my digital signature can match. If If the verification is successful and there is no problem, it means that this transaction was indeed sent by me and the information has not been changed.
Next, the miner needs to verify whether the Bitcoin spent in this transaction is an "unspent" transaction. If the verification is successful, it will be put into "Unconfirmed Transaction" and wait to be packaged; if the verification fails, the transaction will be marked as "Invalid Transaction" and will not be packaged.
In fact, the simple understanding of public key and private key is: since it is encrypted, I definitely don’t want others to know my message, so only I can decrypt it, so it can be concluded that the public key is responsible For encryption, the private key is responsible for decryption; similarly, since it is a signature, I definitely don’t want anyone to pretend to be my identity. Only I can issue this digital signature, so it can be concluded that the private key is responsible for signing and the public key is responsible for verification.
Here, let’s briefly summarize the above content. Above we mainly talked about the following words: private key, public key, wallet address, digital signature. Let’s understand the relationship between them:
(1) The private key is randomly generated by the system. The public key is calculated from the private key, and the wallet address is calculated from the public key, that is: private key - public key - wallet address, such a process;
(2 ) Digital signature is calculated from transaction information + private key information. Because the digital signature implies private key information, it can prove your identity.
Private keys and public keys are both in the category of cryptography and belong to the "elliptical encryption algorithm" in the "asymmetric encryption" algorithm. The reason why this algorithm is used is to ensure the security of transactions. 2. The role of the operator is:
(1) Public key encryption, private key decryption: the public key is public to the entire network, I use Yiyi’s public key to encrypt the information, and Yiyi can decrypt it with her own private key;< br />
(2) Private key signature, public key verification: I send a message to Yiyi, and I add my own private key information to form a digital signature. Yiyi uses my public key to verify it, and the verification is successful. It was indeed the message I sent.
It’s just that in Bitcoin transactions, encryption, decryption, and verification are all left to the miners.
As for the wallet APP we often use now, it is just a private key, wallet address and other blockchain numbers.It's just a data management tool. Wallets are divided into cold wallets and hot wallets. Cold wallets are offline and never connected to the Internet. They usually appear in the form of some entities, such as small notebooks. Hot wallets are connected to the Internet, and the wallet APP we use is a hot wallet. .
5. Blockchain technology
Background: After the birth of Bitcoin, it was discovered that the technology was very advanced, and blockchain technology was discovered. Bitcoin and blockchain technology were discovered at the same time.
1.1 The purpose of the birth of Bitcoin:
①Currency transactions have records, that is, ledgers;
②The disadvantages of centralized institution accounting - it can be tampered with; Yi Chaofa
Bitcoin solves the first problem: anti-tampering - hash function
1.2 hash function (encryption method)
① Function: convert any A string of length, converted to a fixed-length (sha256) output. The output is also called a hash value.
② Features: It is difficult to find two different x and y such that h(x)=h(y).
③Application: md5 file encryption
1.3 Blockchain
①Definition
Block: Split the general ledger into zones Block storage
Blockchain: On each block, add a block header. It records the hash value of the parent block. By storing the hash value of the parent block in each block, all blocks are connected in order to form a blockchain.
②How does the blockchain prevent transaction records from being tampered with?
After the blockchain is formed, tampering with any transaction will cause the hash value of the transaction block to be different from that of its sub-blocks. , tampering was discovered.
Even if you continue to tamper with the hash value in the sub-block header, the hash value in the sub-block will be different from that in the grandchild block, and the tampering will be discovered.
1.4 The essence of blockchain
①The essence of Bitcoin and blockchain: a big ledger visible to everyone, only recording transactions .
②Core technology: Through cryptographic hash function + data structure, it ensures that the ledger records cannot be tampered with.
③Core function: Create trust. Fiat currency relies on government credibility, and Bitcoin relies on technology.
1.5 How to trade
① To conduct transactions, you need an account number and password, corresponding to the public key and private key
Private key: a string of 256-bit binary numbers , you don’t need to apply for it, you don’t even need a computer, you can generate the private key by tossing a coin 256 times
The address is converted from the private key. The address cannot reverse the private key.
The address is the identity, which represents the ID in the Bitcoin world.
After an address is generated, it can only be known by everyone if it enters the blockchain ledger.
②Digital signature technology
Signature function sign (Zhang San’s private key, transfer information: Zhang San transfers 10 yuan to Li Si) = signature of this transfer
< p> Verify Korean verify (Zhang San’s address, transfer information: Zhang San transfers 10 yuan to Li Si, signature of this transfer) = TrueZhang San uses his own signature function sign() The private key signs this transaction.
Anyone can verify whether the signature was issued by Zhang San himself who holds Zhang San's private key by verifying the Korean vertify(). It returns true, otherwise it returns false.
sign() and verify() are cryptographically guaranteed not to be cracked. ·
③Complete the transaction
Zhang San will provide the transfer information and signature to the entire network. Under the premise that the account has a balance, after verifying that the signature is true, it will be recorded in the blockchain ledger. Once recorded, Zhang San's account will be reduced by 10 yuan, and Li Si's account will be increased by 10 yuan.
Supports one-to-one, one-to-many, many-to-one, and many-to-many transactions.
In the Bitcoin world, private keys are everything! ! !
1.6 Centralized Accounting
① Advantages of Centralized Accounting:
a. No matter which center keeps accounts, don’t worry too much
< p> b. Centralized accounting, high efficiency②Disadvantages of centralized accounting:
a Denial of service attack
b Stop service after getting tired
p>c Central institutions are vulnerable to attacks. For example, destroying servers and networks, committing self-intrusion, legal termination, government intervention, etc.
All attempts at confidential currencies with centralized institutions in history have failed.
Bitcoin solves the second problem: how to decentralize
1.7 Decentralized accounting
①Decentralization: Everyone can keep accounts. Everyone can keep a complete ledger.
Anyone can download open source programs, participate in the P2P network, monitor transactions sent around the world, become an accounting node, and participate in accounting.
②Decentralized accounting process
After someone initiates a transaction, it is broadcast to the entire network.
Each accounting node continues to monitor and continue transactions across the entire network. When a new transaction is received and the accuracy is verified, it is put into the transaction pool and continues to be propagated to other nodes.
Due to network propagation, the transactions of different accounting nodes at the same time are not necessarily the same.
Every 10 minutes, one person is selected from all accounting nodes in a certain way, and his transaction pool is used as the next block and broadcast to the entire network.
Other nodes delete the transactions that have been recorded in their own transaction pool based on the transactions in the latest block, continue accounting, and wait for the next selection.
③ Features of decentralized accounting
A block is generated every 10 minutes, but not all transactions within these 10 minutes can be recorded.
The accounting node that obtains the accounting rights will be rewarded with 50 Bitcoins. After every 210,000 blocks (approximately 4 years), the reward is halved. The total amount is about 21 million, and it is expected to be mined in 2040.
Recording the reward of a block is also the only way to issue Bitcoin.
④ How to allocate accounting rights: POW (proof of work) method
Compete for accounting rights by calculating mathematical problems on several accounting points.
Find a random number that makes the following inequality true:
There is no other solution except traversing the random numbers starting from 0 and trying your luck. The process of solving the problem is also called mining.
Whoever solves the problem correctly first will get the accounting rights.
If a certain accounting node finds the solution first, it will announce it to the entire network. After other nodes verify that it is correct, a new round of calculation will start again after the new block. This method is called POW.
⑤ Difficulty adjustment
The generation time of each block is not exactly 10 minutes
As Bitcoin develops, the computing power of the entire network does not increase.
In order to cope with changes in computing power, the difficulty will be increased or decreased every 2016 blocks (about 2 weeks), so that the average time for each block to be generated is 10 minutes.
#欧易OKEx# #BTC[超话]# #digital currency#
6. What is the relationship between the blockchain private key, public key and address
The relationship between the blockchain private key, public key and address is that the private key generates a public key, and the public key is converted into an address. So the private key is the most important. The three are irreversible. The address cannot generate a public key, and the public key cannot be converted into a private key.
Again the blockchain address, which is usually composed of 26 to 35 characters of letters andIt consists of a digital string. The blockchain address mainly comes from the public key. The blockchain address is equivalent to the bank card number we usually use. It can be disclosed to anyone. There are no security restrictions. Its main function is to be used in the receiving and sending area. Digital assets on the blockchain.
Blockchain technology is now in its early stages of development, but because of its decentralization, security, non-tampering and other characteristics, it may have killer-level applications in life and work in the future and has attracted much attention from various countries. Pay attention to. This article is for reference only, please leave a message for discussion.
- 上一篇: 瑞丰区块链真的能挣钱吗安全吗,瑞丰资讯是真的吗
- 下一篇: 莫名其妙的区块链焦虑