Public-Private Keys and How they work in the blockchain realm


If you are new to crypto, you must be wondering about what are public and private keys. Bitcoin, as well as all other major cryptocurrencies, is built upon public-key cryptography, a cryptographic system that uses pairs of keys: public keys and private keys to authenticate transactions on the blockchain – send or receive funds. 

Public keys can be described as an email address. You openly share your email address so that your friends or families can send you emails (or messages). Similarly, public keys can be shared with everyone. So to send a transaction (or fund), one first should know the public key of the other user. Like knowing the bank account number to transfer money.

Each public key comes paired with a unique private key. The private key gives the user a ‘write-access’ – meaning ownership of the funds on a given address and must remain known only to the user (or owner). The private key is akin to the password of your email account, that only you have a copy (or knowledge). Anyone who learns the associated password has access to the account and may misuse it. Therefore, this information should not be shared with anyone and stored secretly.

Use of these Public-Private keys in the blockchain:

As explained above, the most common use of these key-pairs is to securely send or receive funds. Other than that, it allows access to decentralized applications. Like in real-world applications, we use Gmail to auto-login to Web2 applications, similarly, these key pairs help to interact with smart contracts of any decentralized application.

Other advance use of Public-Private keys in blockchain:

  • For data encryption purposes. Using these keys users can share cryptographic messages with each other. Let’s say, Bob wants to send Alice an encrypted email. To do this, Bob encrypts his message with Alice’s public key. Then, when Alice receives the message, she takes the private key that only she has the knowledge to decrypt the message from Bob.
  • Use as a digital signature to bind a person to the digital data. i.e. provide verification that the message was created by a known person and the message was intact and not altered in transit. In BFT consensus blockchain protocol, validators sign with their key to show authenticity or their agreements on the block produced.

What are mnemonics keys (or seeds):

The public and private keys consist of a string of random numbers.

It looks something like this: HTyeXQeQcSwD5xLXV9tNKYmc8zMtdhAyhxm47sSS3uL2. 

Not as easy as remembering your Gmail account ID and security password. Given the difficulty to remember crypto key-pairs, users need to store it somewhere safe. The complexity adds when users have to manage multiple blockchain protocols key-pairs. If a user loses the keys, especially private-key, they lose access to funds in the account. This can be a barrier to user adoption. 

To make private keys user friendly, today most blockchains use Mnemonic keys. Mnemonic keys are a human-readable version of the private keys. Mnemonic is a way to reproduce something hard to remember. To a series of data like in private keys, random words are associated so as users can remember the original form.

Remember the phrase – ‘Some People Have Curly Brown Hair Turn Permanently Black’ from your school days. It’s a mnemonic form to remember Sin, Cos, and Tan trigonometric formulas.

Nowadays, most wallets use mnemonic seeds – 12,18 or 24-word easy to remember phrases that are tied to a given private key. The longer the phrase, the more complicated it becomes to figure out the correct combination.

This conversion goes through the method called BIP 39. BIP represents a proposed change to the bitcoin protocol. Using BIP 39 standards, 128-256 bits of random data is encoded to 12-24 word phrases. The selection of phrases is from the wordlist which contains 2048 words.

Users who own different blockchain protocol’s cryptocurrencies can easily manage funds with crypto wallets like Metamask or Trust wallet. This is done through the implementation of BIP 44 standard in the wallet. BIP 44 standard generates multiple blockchain addresses in the wallet’s account, and BIP39 generates one recovery mnemonic phrase that controls all the cryptocurrencies in their wallet account.



Source link