Читать книгу Introduction to Blockchain Technology - Tiana Laurence - Страница 21
Private and public keys
ОглавлениеLet’s take a look at how blockchains use asymmetric encryption, known as public-key cryptography, to secure the transfer of cryptocurrency from one address to another.
Blockchain ledgers are widely distributed public accounts that let anyone see who has what cryptocurrency and the full history of that coin over time. Meaning you can look up any transaction and see who sent it.
Asymmetric encryption allows a sender to transfer cryptocurrency to the recipient without someone else being able to steal it. It allows them to do this without having met or exchanged information. As long as the sender has the public key of the recipient, they can send them cryptocurrency.
The public-key on a blockchain is the “address”. The address and the private key are connected mathematically and have specific fascinating mathematical properties. The public key and private key are created together by combining randomly chosen, ridiculously huge prime numbers. Prime numbers are whole numbers that can only be divided by themselves.
If you encode a message, such as the transfer of cryptocurrency to a new address, using a recipient’s public key, the recipient can decode it using their matching private key and gain ownership of the cryptocurrency. Whoever is in possession of the private key can transfer cryptocurrency to a new address. The ledger holds a record of all these transfers between addresses. Anyone can see the history of transmission between addresses.
The extraordinary mathematical properties of private and public keys make them inverse. If you encrypt a message, such as the transfer of cryptocurrency with your private key, it can only be decrypted by its matching public key. So, when you send a cryptocurrency to a new public address, only the recipient can decode it, and everyone can see that you had the right to transfer cryptocurrency. This is because mathematically only you, with your private key, could have encrypted the transaction. This is called “signing your transaction”.
It is evident that you need to keep your private key safe and secure. If your private key is destroyed or lost, you won’t be able to transfer your cryptocurrency. If a criminal person copies your private key by physical access to your computer or through malware on your device, then they can transfer your cryptocurrency to a new address. The blockchain will not know that the criminal is pretending to be you and sign your transaction. The transfer of cryptocurrency can only be done with a private key for the public address that the cryptocurrency was last sent to, so once a cryptocurrency has been sent the transaction is irreversible.