区块链公钥与私钥图片区别,区块链公私密钥
请查看相关英文文档
『一』 Do you understand the address, public key and private key of Bitcoin?
To understand Bitcoin, it is inevitable to understand what Bitcoin is. Address, public key, private key, we will explain them one by one below.
The address is like a bank account (card) number, which will be automatically generated after creating a digital wallet. To put it simply, when creating a wallet, a pair of private key and public key are first generated. The public key is then used through a set of algorithms to generate an address, which is essentially a string of characters, for example.
Just like a bank account (card) number can be used to receive payments, a Bitcoin address can also be used to receive Bitcoins.
This Bitcoin address is not only known to the person who transferred the coins to you, but also to everyone on the entire Bitcoin network. It can be said that the addresses of all users in the world can be known by anyone. Why do you say this way? Because Bitcoin is essentially a large public ledger, all transactions are visible to everyone. The transaction record includes the transaction slip number, the coin issuing address of the coin issuer, the coin recipient's address, and the coin issuer's change address.
The private key can be regarded as a bank password, which is a long string of random numbers generated by the wallet, for example, LBB9ZXMCJ. The private key is the only thing that can prove that the Bitcoins you own belong to you, and only with the private key can you transfer, trade and use the Bitcoins in your digital wallet.
We all know that bank passwords must not be leaked to others, and the same goes for private keys. Don’t tell others even if you kill yourself, otherwise your Bitcoins will be easily transferred away. If the bank money is stolen, it may be recovered because of state supervision and third-party credit. However, Bitcoin is decentralized. There is no third party. You can only take care of your own coins. If you lose them, or they are If someone transfers it away, you can never get it back. So never tell others the private key, don’t save the private key on your phone or computer, and don’t transmit your private key over the Internet. So what should I do? Remember, write it on paper with a pen, write two or three copies and put them in different places and keep them well.
The public key, as the name suggests, can be made public, and like the address and private key, it is a long string of characters. The public key is generated from the private key through the elliptic curve encryption algorithm. The only public key can be calculated through the private key, but the private key cannot be deduced reversely from the public key.
So what role do Bitcoin addresses, public keys, and private keys play in transactions?
First, the wallet encrypts the private key into a string (also called a signature) through an encryption algorithm, then writes this string together with the public key into the transaction information, and then sends it to the miners. After the miner receives the information, he will write the signature and public key into a verification function. If the result is "true", then the transaction will be confirmed to be authentic and valid, and it will be verified. And the result is "false",This means that there is a problem with this transaction and cannot be verified.
Through the above simple words, I hope it can help you have a preliminary understanding of Bitcoin addresses, public keys and private keys! Thank you for reading!
『二』【In-depth knowledge】Illustration of the encryption principle of blockchain (encryption, signature)
First, let’s put an architecture diagram of Ethereum:
In the learning process, we mainly use a single module to learn and understand, including P2P, cryptography, network, protocols, etc. Let’s start with the summary directly:
The problem of secret key distribution is also the problem of secret key transmission. If the secret key is symmetric, then the secret key can only be exchanged offline. If the secret key is transmitted online, it may be intercepted. Therefore, asymmetric encryption is used, with two keys, one private key is kept privately, and the other public key is made public. Public keys can be transmitted over the Internet. No offline transactions required. Ensure data security.
As shown in the figure above, node A sends data to node B, and public key encryption is used at this time. Node A obtains the public key of node B from its own public key, encrypts the plaintext data, and sends the ciphertext to node B. Node B uses its own private key to decrypt.
2. Unable to solve message tampering.
As shown in the figure above, node A uses B's public key to encrypt, and then transmits the ciphertext to node B. Node B uses the public key of node A to decrypt the ciphertext.
1. Since A’s public key is public, once an online hacker intercepts the message, the ciphertext will be useless. To put it bluntly, this encryption method can be decrypted as long as the message is intercepted.
2. There is also the problem of being unable to determine the source of the message and the problem of message tampering.
As shown in the figure above, before sending data, node A first encrypts it with B's public key to obtain ciphertext 1, and then uses A's private key to encrypt ciphertext 1 to obtain ciphertext 2. After node B obtains the ciphertext, it first decrypts it using A's public key to obtain ciphertext 1, and then decrypts it using B's private key to obtain the plaintext.
1. When data ciphertext 2 is intercepted on the network, since A's public key is public, you can use A's public key to decrypt ciphertext 2 and obtain ciphertext 1. So this seems to be double encryption, but in fact the private key signature of the last layer is invalid. Generally speaking, we all hope that the signature is signed on the most original data. If the signature is placed later, the signature lacks security since the public key is public.
2. There is a performance problem, which is not correct.It is said that the encryption itself is very inefficient, and the encryption process is performed twice.
As shown in the figure above, node A is first encrypted with A's private key, and then encrypted with B's public key. After receiving the message, node B first uses B's private key to decrypt it, and then uses A's public key to decrypt it.
1. When ciphertext data 2 is intercepted by a hacker, since ciphertext 2 can only be decrypted using B’s private key, and B’s private key is only owned by node B, others cannot keep it secret. Therefore, the safety is the highest.
2. When node B decrypts and obtains ciphertext 1, it can only use A’s public key to decrypt it. Only data encrypted by A's private key can be successfully decrypted with A's public key. Only node A has A's private key, so it can be determined that the data was transmitted by node A.
After two asymmetric encryptions, the performance problem is serious.
Based on the above problem of data tampering, we introduced message authentication. The encryption process after message authentication is as follows:
Before node A sends a message, it first performs a hash calculation on the plaintext data. A digest is obtained, and then the illumination and original data are sent to Node B at the same time. When node B receives the message, it decrypts the message. Parse out the hash digest and original data, then perform the same hash calculation on the original data to obtain digest 1, and compare the digest and digest 1. If they are the same, they have not been tampered with; if they are different, they have been tampered with.
As long as ciphertext 2 is tampered with during the transmission process, the resulting hash will be different from hash1.
The signature problem cannot be solved, that is, both parties attack each other. A never acknowledges the message he sent. For example, A sends an error message to B, causing B to suffer losses. But A denied that he did not send it himself.
In the process of (3), there is no way to solve the problem of mutual attacks between the two interacting parties. What does that mean? It may be that the message sent by A is not good for node A, and later A denies that the message was not sent by it.
In order to solve this problem, signatures were introduced. Here we combine the encryption method in (2)-4 with the message signature.
In the above figure, we use node A's private key to sign the summary information sent by it, then add the signature + original text, and then use B's public key to encrypt. After B obtains the ciphertext, he first uses B's private key to decrypt it, and then uses A's public key to decrypt the digest. Only the content of the two digests is compared to see if they are the same. This not only avoids the problem of anti-tampering, but also circumvents the problem of attacks from both parties. Because A signed the information,Therefore it cannot be denied.
In order to solve the performance problem when asymmetrically encrypting data, hybrid encryption is often used. Here we need to introduce symmetric encryption, as shown below:
When encrypting data, we use a symmetric secret key shared by both parties to encrypt. The symmetric secret key should not be transmitted on the network to avoid loss. The shared symmetric key here is calculated based on one's own private key and the other party's public key, and then the symmetric key is used to encrypt the data. When the other party receives the data, it also calculates the symmetric secret key and decrypts the ciphertext.
The above symmetric secret key is unsafe because A's private key and B's public key are generally fixed in the short term, so the shared symmetric secret key is also fixed. To enhance security, the best way is to generate a temporary shared symmetric key for each interaction. So how can we generate a random symmetric key during each interaction without transmitting it?
So how to generate a random shared secret key for encryption?
For the sender node A, a temporary asymmetric secret key pair is generated every time it is sent, and then a symmetric secret key can be calculated based on the public key of node B and the temporary asymmetric private key. (KA algorithm-Key Agreement). The symmetric secret key is then used to encrypt the data. The process here for the shared secret key is as follows:
For node B, when receiving the transmitted data, the random public key of node A is parsed. Then the symmetric secret key (KA algorithm) is calculated using the random public key of node A and the private key of node B itself. The data is then encrypted using a symmetric key.
For the above encryption methods, there are still many problems, such as how to avoid replay attacks (adding Nonce to the message), and problems such as rainbow tables (refer to the KDF mechanism to solve). Due to limited time and ability, I will ignore it for now.
So what kind of encryption should be used?
Mainly based on the security level of the data to be transmitted. Unimportant data can actually be authenticated and signed, but very important data needs to use an encryption scheme with a relatively high security level.
Cipher suite is a concept of network protocol. It mainly includes algorithms for identity authentication, encryption, message authentication (MAC), and secret key exchange.
During the transmission process of the entire network, the algorithms are mainly divided into the following categories according to the cipher suite:
Key exchange algorithm: such as ECDHE, RSA. Mainly used for authentication when the client and server handshake.
Message authentication algorithm: such as SHA1, SHA2, SHA3. Mainly used for message summarization.
Batch encryption algorithm: such as AES, mainly used to encrypt information flow.
Pseudo-random number algorithm: For example, the pseudo-random function of TLS 1.2 uses the hash function of the MAC algorithm to create a master key - a 48-byte private key shared by both parties in the connection. The master key serves as a source of entropy when creating session keys (such as creating a MAC).
In the network, a message transmission generally needs to be encrypted in the following four stages to ensure safe and reliable transmission of the message.
Handshake/network negotiation phase:
During the handshake phase between both parties, link negotiation is required. The main encryption algorithms include RSA, DH, ECDH, etc.
Identity authentication phase:
In the identity authentication phase, the source of the sent message needs to be determined. The main encryption methods used include RSA, DSA, ECDSA (ECC encryption, DSA signature), etc.
Message encryption stage:
Message encryption refers to encrypting the sent information flow. The main encryption methods used include DES, RC4, AES, etc.
Message identity authentication phase/anti-tampering phase:
Mainly to ensure that the message has not been tampered with during transmission. The main encryption methods include MD5, SHA1, SHA2, SHA3, etc.
ECC: Elliptic Curves Cryptography, elliptic curve cryptography. It is an algorithm that generates public and private keys based on point multiple products on ellipses. Used to generate public and private keys.
ECDSA: used for digital signatures and is a digital signature algorithm. A valid digital signature gives the recipient reason to believe that the message was created by a known sender, so that the sender cannot deny that the message has been sent (authentication and non-repudiation), and that the message has not been altered in transit. The ECDSA signature algorithm is a combination of ECC and DSA. The entire signature process is similar to DSA. The difference is that the algorithm used in the signature is ECC, and the final signed value is also divided into r and s. Mainly used in the identity authentication phase.
ECDH: It is also a Huffman tree secret key based on the ECC algorithm. Through ECDH, both parties can negotiate a shared secret without sharing any secrets, and this shared secret key is the current The communication is temporarily generated randomly, and the secret key disappears once the communication is interrupted. Mainly used in the handshake negotiation phase.
ECIES:It is an integrated encryption scheme, also known as a hybrid encryption scheme, which provides semantic security against selected plaintext and selected ciphertext attacks. ECIES can use different types of functions: key agreement function (KA), key derivation function (KDF), symmetric encryption scheme (ENC), hash function (HASH), H-MAC function (MAC).
ECC is an elliptical encryption algorithm, which mainly describes how the public and private keys are generated on the ellipse, and is irreversible. ECDSA mainly uses the ECC algorithm to make signatures, while ECDH uses the ECC algorithm to generate symmetric keys. All three of the above are applications of the ECC encryption algorithm. In real-world scenarios, we often use hybrid encryption (a combination of symmetric encryption, asymmetric encryption, signature technology, etc.). ECIES is a set of integrated (hybrid) encryption solutions provided by the underlying ECC algorithm. This includes asymmetric encryption, symmetric encryption and signature functions.
<meta charset="utf-8">
This precondition is to ensure that the curve does not contain singular points .
Therefore, as the curve parameters a and b continue to change, the curve also shows different shapes. For example:
All the basic principles of asymmetric encryption are basically based on a formula K = k G. Among them, K represents the public key, k represents the private key, and G represents a selected base point. The asymmetric encryption algorithm is to ensure that the formula cannot be inverted (that is, G/K cannot be calculated). *
How does ECC calculate the public and private keys? Here I describe it according to my own understanding.
I understand that the core idea of ECC is to select a base point G on the curve, then randomly pick a point k on the ECC curve (as the private key), and then calculate our public key based on k G K. And ensure that the public key K is also on the curve. *
So how to calculate k G? How to calculate k G to ensure that the final result is irreversible? This is what the ECC algorithm is supposed to solve.
First, we randomly select an ECC curve, a = -3, b = 7 and get the following curve:
On this curve, I randomly select two points. How to calculate the multiplication of these two points? We can simplify the problem. Multiplication can be expressed by addition, such as 2 2 = 2+2, 3 5 = 5+5+5. Then as long as we can calculate addition on the curve, we can theoretically calculate multiplication. Therefore, as long as addition calculations can be performed on this curve, multiplication can be calculated theoretically, and the value of expressions such as k*G can also be calculated theoretically.
How to calculate the addition of two points on the curve? Here, in order to ensure irreversibility, ECC has customized an addition system on the curve.
In reality, 1+1=2, 2+2=4, but in the ECC algorithm, the addition system we understand is impossible. Therefore, it is necessary to customize a set of addition systems suitable for this curve.
The definition of ECC is to randomly find a straight line in the graph and intersect the ECC curve at three points (or possibly two points). These three points are P, Q, and R respectively.
Then P+Q+R = 0. Among them, 0 is not the 0 point on the coordinate axis, but the infinity point in ECC. In other words, the infinity point is defined as point 0.
Similarly, we can get P+Q = -R. Since R and -R are symmetrical about the X-axis, we can find their coordinates on the curve.
P+R+Q = 0, so P+R = -Q, as shown in the figure above.
The above describes how addition operations are performed in the world of ECC curves.
As can be seen from the above figure, there are only two intersection points between a straight line and a curve, which means that the straight line is the tangent line of the curve. At this time, P and R coincide.
That is, P = R. According to the above-mentioned ECC addition system, P+R+Q = 0, it can be concluded that P+R+Q = 2P+Q = 2R+Q=0
So we get 2 P = -Q (is it getting closer to the formula K = k G of our asymmetric algorithm?).
So we come to the conclusion that multiplication can be calculated, but it can only be calculated at the tangent point, and it can only be calculated by 2.
If 2 can be turned into any number for multiplication, then it means that multiplication can be performed in the ECC curve, then the ECC algorithm can meet the requirements of an asymmetric encryption algorithm.
So can we calculate the multiplication of any random number?The answer is yes. That is the dot product calculation method.
Choose a random number k, then what is k * P equal to?
We know that in the computer world, everything is binary. Since ECC can calculate the multiplication of 2, we can describe the random number k as binary and then calculate it. Suppose k = 151 = 10010111
Since 2 P = -Q, so k P is calculated. This is the dot product algorithm. Therefore, multiplication can be calculated under the ECC curve system, so this asymmetric encryption method is feasible.
As for why this calculation is irreversible. This requires a lot of deduction, and I don't understand it either. But I think it can be understood this way:
Our watches usually have time scales. Now if we take 0:00:00 on January 1, 1990 as the starting point, and if we tell you that a full year has passed until the starting point, then we can calculate the current time, that is, we can calculate it on the watch. The hour, minute and second hands should point to 00:00:00. But conversely, I said that the hour, minute and second hands on the watch are now pointing to 00:00:00. Can you tell me how many years have passed since the starting point?
The ECDSA signature algorithm is basically similar to other DSA and RSA, both using private key signature and public key verification. It’s just that the algorithm system uses the ECC algorithm. Both parties interacting must adopt the same set of parameter systems. The signature principle is as follows:
Select an infinite point on the curve as the base point G = (x, y). Randomly pick a point k on the curve as the private key, and K = k*G to calculate the public key.
Signature process:
Generate a random number R and calculate RG.
According to the random number R, the HASH value H of the message M, and the private key k, Calculate the signature S = (H+kx)/R.
Send the message M, RG, S to the receiver.
Signature verification process:
Receive message M, RG, S
Calculate the HASH value H according to the message
According to the sender For the public key K, calculate HG/S + xK/S, and compare the calculated result with RG. If equal, the verification is successful.
Formula inference:
HG/S + xK/S = HG/S + x(kG)/S = (H+xk)/GS = RG
Before introducing the principle, let me explain that ECC satisfies the associative law and the commutative law, that is to say, A+B+C = A+C+B = (A+C)+B.
Here is an example on WIKI to illustrate how to generate a shared secret key. You can also refer to the example of Alice And Bob.
For Alice and Bob to communicate, both parties must have public and private keys generated by ECC based on the same parameter system. So there is a common base point G for ECC.
Secret key generation stage:
Alice uses the public key algorithm KA = ka * G, generates the public key KA and the private key ka, and makes the public key KA public.
Bob uses the public key algorithm KB = kb * G, generates the public key KB and the private key kb, and makes the public key KB public.
Calculation ECDH stage:
Alice uses the calculation formula Q = ka * KB to calculate a secret key Q.
Bob uses the calculation formula Q' = kb * KA to calculate a secret key Q'.
Shared key verification:
Q = ka KB = ka * kb * G = ka * G * kb = KA * kb = kb * KA = Q'
Therefore, the shared secret keys calculated by both parties do not need to be disclosed before they can be encrypted using Q. We call Q the shared secret key.
In Ethereum, other contents of the ECIEC encryption suite used:
1. The HASH algorithm uses the most secure SHA3 algorithm Keccak.
2. The signature algorithm uses ECDSA
3. The authentication method uses H-MAC
4. The ECC parameter system uses secp256k1, others The parameter system can be found here
The whole process of H-MAC is called Hash-based Message Authentication Code. Its model is as follows:
In Ethereum's UDP communication (RPC communication encryption methods are different), then The above implementation method is adopted and extended.
First of all, the structure of Ethereum’s UDP communication is as follows:
Among them, sig is the signature information encrypted by the private key. mac can be understood as a summary of the entire message, ptype is the event type of the message, and data is the RLP-encoded transmission data.
The entire encryption, authentication, and signature model of UDP is as follows:
『三』 Let’s talk about wallets, private keys, public keys and addresses
Since Bit Since the birth of the currency, related concepts such as private key, public key, and address have been constantly appearing in front of the public. So what is the relationship between these four concepts? Today I will briefly talk to you about some related professional terms and the logic behind them.
1 What is the relationship between these nouns?
If I could explain the relationship between these terms in one sentence, it would be: Wallet generates private key → Private key generates public key → Public key generates public key hash → Public key hash generates address → Address Used to accept Bitcoin, it’s simple and you can understand it.
2 What are these nouns?
Or to sum it up in one sentence, except that the wallet is software, the remaining four are all strings of different lengths , for example, the private key is a 52-bit string, and the address is a 34-bit string.
3 Where do these four strings come from?
The private key is randomly generated by the wallet software, and then a cryptographic algorithm is used to generate the public key and address. If expressed by an equation, it can be written in the following form:
Public key = algorithm 1 (Private Key)
Public Key Hash = Algorithm 2 (Public Key)
Address = Algorithm 3 (Public Key Hash)
Therefore, address = algorithm 3 (algorithm 2 (algorithm 1 (private key)))
Among them, algorithm 1, algorithm 2, and algorithm 3 are all public algorithms.
4 Which of these strings must be kept secret, and which one can be made public?
The private key must not be made public, because having it essentially gives you the ownership of the corresponding Bitcoin.
The address is public, as it is used to accept Bitcoins, and the public key and public key hash are also public, but generally you cannot see it.
5 Why can addresses and public keys be made public?
Because even if someone else knows your address and public key, they can't figure out your private key, and they can't control your Bitcoins.
Why can’t it be calculated?
Give me an example. In the movie "The Imitation Game", the British army was still unable to crack the German password even after obtaining the engima cipher machine (algorithm). The reason was that the German army used a new password (private key) as the starting point every time it sent a message. Without knowing the password, it would take tens of millions of years to perform reverse brute force cracking. However, in the end, the rigid Germans used the same password as the starting point every time, and this password was still natural language, resulting in the password being cracked.
Therefore, every time you make a transaction, you will be required to generate a new private key and then get a new address, so that the security of your transaction is greatly guaranteed.
6 Do what makes you happy
From the above description, we can infer that the essence of the private key is the solution to a complex mathematical problem. When someone sends Bitcoin to a public address At this time, you are actually sending a mathematical question to all Bitcoin clients on the entire network, and the correct answer to this question is your private key. Because that question was generated using your private key, so only you can answer the answer at the first time, and the Bitcoin belongs to you. Therefore, the private key must not be shared with others.
How to find the private key and keep it safe?
In the bitcoin-qt software, enter the windows debug or debugging window and enter the getaddressbyaccount command on the command line to view all generated wallet addresses. Select one of the addresses and use the mpprivkey "address" command to see the private key (54-bit string).
The picture below is a screenshot of using the getaddressbyaccount "" command to view the address list and using mpprivkey to view the private key. Note that in the first picture, since the wallet is encrypted, the private key cannot be seen directly by issuing the mpprivkey command. .
Only after entering the wallet password can you use the mpprivkey command to see the private key.
As I just said, the private key is very important. It is the proof that truly determines who owns the Bitcoin. The private key in the bitcoin-qt client actually exists in a file called wallet.dat, and the newly installed bitcoin-qt client does not have a password. It would be extremely embarrassing if the computer falls into the hands of criminals or is attacked by hackers and the private key is lost. Therefore, you must set a password, and the password must comply with the rules of random complex uppercase and lowercase characters and numbers. It is recommended to useSpecial password generation software is generated. Regarding the password software, I will find an opportunity to talk about it specifically.
Pay special attention, remember it, and don’t forget your password! Because you forget your password, you cannot open the wallet.dat file, and you cannot find the private key. Then, there is nothing more.
I once had the embarrassment of getting the password wrong when I first tried to open a wallet, and then couldn't open the wallet. In the end, I had to delete the wallet.dat file angrily and let the system generate another one by itself. This is how I felt at this time. It is roughly equivalent to burying a sum of money on a certain planet in the universe and then losing the coordinate map, because the Bit world only recognizes the private key and not the ID card. If you lose it, it is lost and you can never get it back.
However, because the ownership of Bitcoin is confirmed by the private key, there is the most ruthless way to save it. Lao Mao also mentioned it, that is, after finding the private key, write it down on paper, and then Lock the paper in a safe, or simply remember it in your head, but who the hell can remember a 54-bit string? Then delete the client on the computer together with the wallet file.
Okay, that’s about all I can say about the wallet client. I have just begun to understand the relevant knowledge. As I learn more information, I may have newer understanding, and I will write it down again when the time comes. .
Be careful, be careful, be careful not to lose your private key.
『四』 Read this article to understand the cryptography and blockchain theoretical terms you must master in XFS
People’s deep understanding of things is not like "how to put the elephant away" In the refrigerator?" It's as simple as "open the refrigerator, put the elephant in, and close the refrigerator." Everything requires a cognitive process of peeling off the cocoons and breaking them into parts. Especially an emerging concept or thing requires a more detailed understanding.
The XFS system is a distributed file system, but it is not a single framework structure. It is an organic whole that combines cryptography, blockchain, the Internet and other technical means. Therefore, I would like to To understand it in more detail, we must know the concepts of some professional terms.
1. Encrypted network
An encrypted network is simply a public blockchain. Before the birth of blockchain technology, there was no encryption method for data transmission in the Internet network. Once a hacker intercepted the data, unless the data itself was ciphertext, the data would be directly exposed to the hacker. .
The encrypted network uses blockchain technology and is maintained by each node of the blockchain. Anyone can join without permission. More importantly, the data running in the entire network is encrypted. XThe FS system is a typical encrypted network.
2. Hash algorithm
The hash algorithm is a special program in the blockchain to ensure data integrity and security. The hash algorithm uses a mathematical relationship called a "hash function" and the resulting output is called a "cryptographic digest". The characteristic of the encrypted digest is that after inputting data of any length, a unique and fixed-length value is returned.
A hash function has:
Based on these properties, it is also used to be tamper-proof when ensuring cryptographic security, because even small changes to the data input to the hash function will results in completely different output. This has also become the workhorse of modern cryptography and blockchain.
3. Distributed ledger
Blockchain is a distributed ledger, but this ledger can not only record transaction information, but also record any data interaction. Each ledger transaction is an encrypted digest, so entries cannot be changed without detection. This allows blockchain to enable participants to audit each other in a decentralized manner.
4. Private key and public key
Private key and public key are a set of "keys" generated for decryption after the blockchain is encrypted through a hash algorithm. By encrypting the private key, a public key is formed. At this time, the original information can only be viewed through the private key and is saved by the user. The public key is like a house address, which is used for data interaction and can be made public. On the contrary, if the public key is encrypted to form a private key, an immutable digital signature will be formed, because only the owner of the private key can create a signature on this public key.
1. Node
Node is the most basic construction of a blockchain network, and it is also the physical device that connects the blockchain network to reality. A single node has many functions, such as caching data, validating information, or forwarding messages to other nodes.
2. Point-to-point (P2P) network
What the blockchain builds is the data interaction between nodes after decentralization. Traditional Internet data transmission is a client-server-client hub-and-spoke model. A point-to-point network is more consistent with the word "network". In this network, each node runs under a single communication protocol to transmit data between them, avoiding network collapse caused by a single point failure of the server.
3. Consensus verification
The consensus verification of the blockchain solves the problem of inconsistent opinions among a large number of scattered nodes. Based on the philosophical basis of "the minority obeys the majority", in the blockchain In the network, more node recognition means "consensus". Generally speaking, if more than 51% of the nodes in the blockchain network approve it, it will be adopted and recognized.
4. Replication proof and space-time proof
These two proofsIn the XFS system, they can all be collectively called storage certificates. One of the core functions of the XFS system is data storage. Therefore, in order to prove the effectiveness of storage, replication proof is used to verify whether the data exists in the node storage space, and space-time proof is used to verify the persistence in time. If the storage provider can continue to submit storage certificates during the storage validity period, then he will receive rewards provided by the XFS system.
5. Redundancy strategy and erasure coding
These are two ways that XFS uses to balance the amount of data storage. The redundancy strategy backs up data through multiple copies to ensure that data can be retrieved if it is damaged or lost.
Erasure coding ensures that excessive backups will not be generated during data copying and transmission, saving storage space and improving transmission efficiency.
6. File fragmentation protocol
XFS divides the file into N small fragments and stores them in the nodes. As long as there are any M fragments of these fragments, the data can be recovered. In this way, as long as N-M+1 nodes do not fail at the same time, data integrity can be ensured without loss.
7. Smart Contract
The smart contract in XFS is a piece of program code. Since it is generated based on the blockchain, it also inherits the non-tampering, traceability, etc. of the blockchain. Features, it can ensure the certainty of the execution results of both parties, which also makes data interaction in the XFS network more trustworthy.
8.Dapp
It is a decentralized APP, which has a more convenient and faster network access port like an ordinary APP. The only difference is that it abandons the centralization of traditional APPs. characteristics, which makes the data in the Dapp belong to the users themselves, without having to worry about privacy leaks, big data maturity and other issues.
The XFS system is an open platform where users can freely use, design, and create various Dapps.
Conclusion
It is difficult to elaborate on the theoretical terminology in XFS due to space reasons, which involves more Internet and blockchain expertise. But through the above simple explanations, I believe everyone has a more three-dimensional understanding of the XFS system. Then, we look forward to breaking the shortcomings of traditional centralized storage and launching a new generation of XFS distributed file system in a new storage era.
『Wu』 Private key and public key in the blockchain
Public key (public key, referred to as public key), private key (private key, referred to as private key) It is the content of asymmetric encryption algorithm in cryptography. As the name suggests, the public key can be made public, while the private key must be kept securely.
The private key is generated by a random seed, and the public key is derived from the private key through an algorithm. Since the public key is too long, for simplicity and practicality, an "address" appears. The address isDerived from the public key. These derivation processes are one-way and irreversible. That is, the address cannot derive the public key, and the public key cannot derive the private key.
From this we can see that the public key and the private key exist in pairs. Their usefulness can be summarized in 16 words: public key encryption, private key decryption; private key signature, public key signature verification.
Public key encryption, private key decryption. That is, the original data is encrypted with the public key, and only the corresponding private key can decrypt the original data. This prevents the original data from being stolen during transmission on the network and protects privacy.
Private key signature, public key signature verification. Use the private key to sign the original data, and only the corresponding public key can verify that the signature string matches the original data.
Locks and keys can be used as metaphors for public keys and private keys. The lock is used to lock an item, and the key is used to unlock the item. The key owner is the owner of the item. In fact, this is the case. The public and private key pairs establish the ownership of the blockchain's account system and assets (Token, etc.). The blockchain assets are locked on the public key, and the private key is used to unlock the asset and then use it. For example, if I want to transfer assets to you, I use my private key to sign a transaction in which I transfer assets to you (including assets, quantity, etc.) and submit it to the blockchain network. The node will verify the signature and it is correct. Then the assets are unlocked from my public key and locked to your public key.
We have seen the role of the private key. It is as important as the password of the centralized accounting system (Alipay, WeChat Pay, etc.). Having the private key means ownership of the asset, so we must keep it. A good private key cannot be leaked.
『Lu』 [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. The most basic concept is that for a newcomer to the cryptocurrency industry, 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.
Only the other party can send you money if they know your address; moreover, anyone who has your address can check how many times this wallet address has been traded on the official website of Blockchain.info (No. Transactions), how many Bitcoins have been received (Total Received), and how many Bitcoins are left in the wallet (Final Balance), as shown below:
"Private Key", like beating to death You cannot tell others your bank card 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 you are a currency circle boss like Mr. Li Xiaolai (who is said to own hundreds of thousands of BTC online), it is strongly recommended to use a cold wallet (offline wallet) and store it separately; the rich people on TV have their own in the bank Safes can also be used as a reference if conditions permit.
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 just need to keep your account and password safe (for further security, turn on Google two-step verification), and the restJust leave it 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 private key information to anyone;
3) It is best to handwrite (a few words) copy) and hide it 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.
『撒』 In a blockchain-based digital currency like Integrity Coin, what exactly are the private keys, public keys, and addresses?
When many newbies first enter the market, I am confused by the relationship between private keys, public keys, addresses, etc. Some even lost their private keys, and the address was particularly rich, butBut I just can’t get it out. Today Xiaobai will explain to you the relationship between private key, public key and address.
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.
『八』【Blockchain】Bitcoin private key, public key, signature
When understanding the basic noun concept of blockchain, it is mentioned that addresses are composed of characters and numbers, but There is no explanation of how it came about. The bank card number is generated by the bank's core system, so how is the Bitcoin address generated? Look at the picture below:
For those who are new to Bitcoin, they will be confused when they see this picture. What are private keys and public keys? Why is it so troublesome to generate an address?
Now please remember this sentence: The private key generates the public key through elliptic curve multiplication, and the private key cannot be derived using the public key; the public key generates the Bitcoin address through the hash function, and the address cannot be derived Export the public key.
The address is calculated through such a complex algorithm. Are the private key and public key just for generating the address? No, they have other uses. Let’s first understand the private key and public key.
Now that we have explained the concepts of addresses, mining, proof of work, computing power, blocks, blockchain, etc., do you still have any impressions? If you forget, please review these concepts because they will be used in many places later. Tomorrow I will explain the characteristics of blockchain.
Reference books: "Mastering Bitcoin"
Blockchain knowledge topics:
Bitcoin accounting method (Blockchain knowledge 2)
Understanding blocks The basic noun concept of chain (blockchain knowledge 1)
『玖』 What is the relationship between blockchain private key, public key and address
Blockchain private key, public key The relationship between the three and the address is that the private key generates the public key, and the public key is converted into the 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.
The blockchain address is again, which usually consists of a string of letters and numbers of 26 to 35 characters. The blockchain address is mainly derived from the public key, block The chain address is equivalent to the bank card number we usually use. It can be disclosed to anyone with no security restrictions. Its main function is to receive and send 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.