Current location - Quotes Website - Signature design - Private and public keys in the blockchain
Private and public keys in the blockchain

Public key (public key, referred to as public key) and private key (private key, referred to as private key) are the contents of asymmetric encryption algorithms 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. Because the public key is too long, for simplicity and practicality, an "address" appears, and the address is derived 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.