In my last post I gave an overview describing blockchain with the help of houses and roads to create a visual image of blockchain as a whole. I also went into how blockchain is an underlying technology with an endless variety of use cases.

As promised, here is part two in which we will dip into how cryptography plays a key role in blockchains and describe how new blocks are added to a blockchain.

How Cryptography Eliminates The Need For A Third Party

Users in a blockchain network hold their coins or tokens in a wallet that contains a public key and a private key. The public key is, well, public to everyone in the blockchain network and the private key is only known to you, the user.

The two keys are generated through cryptographic means — the private key is a very large and very random number, while the public key is generated from the private key through an equation known as a trap-door. This means that it is easy to generate the public key, but tremendously difficult to figure out the private key from the public key. Just as it is easy to fall through a trap door but nearly impossible to go back through it.

So the two keys are a pair: if a message is encrypted with a public key only the corresponding private key can unlock or decrypt that message.

What are the two keys for?

Private keys can be used to sign documents or in the case of blockchain, transactions. Only you know your private key and therefore only you can use your private key to sign a transaction.

On the other end, everyone else has access to your public key so they can use it to verify that it was you who signed the transaction due to the two keys being linked.

If I send you five bitcoin, my private key is used to encrypt that transaction message, which is then broad-casted to all the other nodes in the blockchain network. The other nodes check the source of my transaction message by decrypting it with my public key.

Source

This combination of keys and nodes allows for transactions to be verified without any third party such that the entire process is decentralized.

In addition, transactions and blocks are both validated and time stamped throughout the entire blockchain, meaning that transactions cannot be altered or tampered with.

How are new blocks added to the blockchain?

Source

Let’s use an extended analogy to describe the relationship among nodes during the process of validating a new block to the blockchain. You can read through the story leaving out the technical terms and come back to swap out the common terms with their technical counter parts.

You (the user) work as a journalist for an online publication (blockchain) and want to publish an article (new transaction). You send copies of the final draft of your article to each of the editors (nodes) in your publication. The editors individually review the article and approve or disapprove the article by signing their signatures. If they approve of the article, they sign. If they do not approve, they do not sign.

Source

The editors sign with magic ink that automatically updates every copy of the article so that each editor can see all the signatures. Every editor knows who has signed the article and who has not signed.

It is company policy that 2/3 of the editors must sign (reach consensus) before the article can be published. You manage to collect 2/3 of the editors signatures in your company before the deadline (transaction time limit) to publish your article has passed.

You successfully publish your article (new block) and it is now a part of the online publication (blockchain). All the editors in your company know that your article has been published, your article is permanently a part of the publication, and your article cannot be erased.

What if there are Malicious Writers?

Sometimes there will be malicious writers (malicious nodes) or journalists who do not follow the rules of the company (rules of the blockchain code). Maybe these journalists are accepting bribes to present a certain angle on a story. When a writer like this sends out copies of their article, editors will not sign the article as long as they themselves are not scheming with the malicious writer.

Even if there is more than one malicious editor there will not be enough to sign the article. The company policy of having 2/3 editors reach a consensus on an article before publication prevents articles like these from being published.

What does this have to do with how users earn rewards?

When an editor signs an article they receive a reward if that article gets published. In blockchain terms, when a node sends in its digital signature approving of a transaction, and a new block is validated into existence, the user will earn rewards in the form of coins or tokens.

An Ending and a Beginning

This concludes my introduction to blockchain from my understanding as an intern. It was incredible to have the opportunity to deep dive into blockchain and its community — Harmony connects so many brilliant and passionate people that it was an amazing space to be a part of, if even just for a couple months.

I know that writing these two posts helped me to organize the influx of information I gained in my past months working at Harmony; connecting the concepts I learned to previous experiences allowed me to retain the information such that I can continue exploring blockchain on my own, even as I go back to school.