Blockchain 101

The Ins and Outs of Understanding the revolutionary Blockchain Technology!

Manroop Kalsi
14 min readNov 6, 2020

Bitcoin. Cryptocurrencies. Blockchain.

These buzz words are heard all the time, but what are they really?

Blockchain is the underlying technology of which Bitcoin and other cryptocurrencies are based off.

In 2008, Satoshi Nakamoto released the Bitcoin white paper, which was when the first Blockchain was conceptualized. Currently, this technology is immensely associated with cryptocurrencies, yet, it has the potential to be implemented in an abundance of applications beyond that.

Taking it back a couple of decades.

The emergence of the internet has completely revolutionized the way that society functions. It upended our world, and in a couple of decades changed the way that we communicate. With the many benefits that the internet comes with, so come many risks as well.

This is where what some may call the digitization gambitcomes in.

“With great risk comes great reward” ~ Thomas Jefferson

In our society, value is agreed on by what humans believe should have value. Humans tend to attach value to things such as information, books, movies, music, software, yet, if it is possible to copy and transfer these things infinitely, how do we preserve the value?

In the digital world, anything is mutable, and it can be very difficult to maintain truth and security. With digitization on the rise into our future, how can address this issue?

The answer is Blockchain.

Blockchain technology allows to create value, trust, and truth using a distributed network, immutable ledger, cryptography, and computation. This technology holds the power to distribute power, and removes the need for third-party intermediaries.

Blockchain removes the need for centralization and instead, it is copied and spread across a network of computers (allowing for decentralization). When a new block is added to the chain, it is broadcasted to the rest of the network so it’s able to reflect the change.

Why Decentralization?

  1. In centralized systems, the data is concentrated to one central authority who can censor data and holds complete control. In decentralized systems, power is distributed therefore there is no censorship
  2. Intermediaries are not needed, and each individual has complete control over their information and is able to make decisions about their data for themselves
  3. Centralized systems have a single point of failure that can bring the entire network down, which is not possible using decentralized systems (making it nearly impossible to bring the entire network down)

An Overview: Blockchain as a town

Imagine this.

A small population is living in Blockchain town, it has a small active economy with the people buying, selling, and trading goods with one another. Whenever someone makes a transaction they are required to report it to the town accountant who logs all the transactions onto a piece of paper.

As the day wraps up, the accountant must head over to the town square and staple the page of transactions to the previous day transactions which are all publicly accessible. He then coats the staple with crazy glue so that no one can remove the previous paper or tamper it without it being very obvious.

In this town, there are many accountants recording transactions and each one is competing to be the one who gets to add their record of transactions to the chain. There are also many town squares, each with their very own copy of the local blockchain. Despite all of this only one accountant, the account who can make it through all the traffic first, gets to add their record to the chain, and that record will be copied and added to the rest of the town square ledgers.

Analogy Cast:

  • The Population = Individual Nodes (each node has a copy of the blockchain, therefore making the entire network decentralized)
  • Record of Transaction = Block
  • Ledger = Blockchain
  • Accountant = Miners or Validators (these are the people who verify the transactions, more on that later in this article)
  • Traffic = Computationally Difficult Problem (the problem the miners must solve in order to add their block to the blockchain)

In addition to this each time someone reports a transaction, they must sign the ledger to confirm that they actually approved the specific transaction. But if blockchain is a digital ledger, what’s to keep the accountant from editing each transaction?

This is where digital signing comes in.

Public Key Cryptography and Digital Signing

At first, it may seem impossible that a digital signature can even be feasible as whatever data is used to make up the signature can simply be duplicated, but that is where public-key cryptography comes in.

This method of cryptography is used to ensure that the source of transactions is legitimate and that the alleged source of the transaction has actually seen and approved it.

But how does this actually work?

Each individual generates a public key and private key pair, which essentially looks like a string of bits. The private key mathematically derives the public key, which is then hashed in order to be represented as Wallet Import Format (WIF).

The long hexadecimal number is an example of a hashed address.

This digital signature is completely random, but would always yield the same output in accordance with a specific input.

But, couldn’t someone just reverse engineer the public key to find the private key?

To derive the public key an extremely complicated mathematical algorithm is used, yet, reversing this process is even more complex. Using the world’s most powerful computer, in order to successfully reverse the process, you would need 40000000000000000000000000000000 years (that’s 31 zeroes!) to complete this calculation.

Furthermore, as the name suggests, the private key would be something that you’d want to keep private, it acts as a lock whereas the public key acts as a key.

When producing a signature, it would require using a hash function that is dependent on the message itself, and the private key. The private key ensures that you are the sole individual who can produce that signature, the message ensures that no one can copy the signature and put it onto another message.

Sign(Message, Private Key) = Signature

In the real world, handwritten signatures look the same yet, digital signatures can be considered much stronger because they change for each message.

The digital signature looks like a string of 1s and 0s, and altering the message even slightly will completely change what the signature on that message would be.

A second function is used in order to verify the source of the transaction. This function inputs the message, signature, and the public key and outputs either a true or false to verify that the signature you are using was produced using the private key that was associated with the public key you are using for verification.

Verify(Message, Signature, Public Key) = T/F

The idea is that it’s basically impossible to find a valid signature without the associated private key.

When a signature is verified against the public key and message, it assures you that the only way that the signature could have been made was by using the private key associated.

But hold on a second, what’s to stop me from copy-pasting and using a message multiple times?

That is why each message also includes some sort of unique id that’s associated with the transaction, therefore if Alice pays Bob $500 multiple times, each transaction would require a unique signature.

Every transaction on the network is publicly visible yet, on the ledger, instead of the explicit names (e.g. Alice or Bob) being visible, the public key associated with the account is visible instead. Therefore, individual identities stay anonymous whereas account activity does not.

Where does my transaction go next?

Once the transaction is conducted, it goes into a mining pool. From there, transactions are authenticated and validated prior to being permanently added onto the blockchain.

How is the blockchain immutable?

A blockchain is considered to be immutable as a result of the hashes of each block.

A hash is a unique set of numbers and letters that is used to “stamp” a block. In order to get the hash of a block, a function called SHA-256 (one-way cryptographic hashing algorithm) is used.

All the contents inside the block are taken and put through the SHA-256 function, which always outputs a 64 hexadecimal number (2²⁵⁶ possible outcomes).

For each unique input, the output always remains the same, yet, if there was even a slight change such as a space being added, or a letter being replaced, the output would completely change.

This is what allows for immutability within the chain. Each block contains its own hash and the hash of the previous block. If anyone were to try and make an edit to a block, the hash would completely change and the chain would break, as the block would be rendered invalid.

The Genisis Block is the first block in a specific Blockchain.

The computationally efficient SHA-256 function outputs a completely random set of numbers and is collision-resistant, which means that it’s extremely rare to find 2 inputs that render the same output.

The Double Spend Problem’

In the physical world, conducting exchange is simple. If Alice gives Bob a dollar, then Alice no longer has it, and it’s in Bob’s possession. Yet, in the digital world, there are possibilities to create endless copies of an original file. If Alice sends a file to Bob, Alice retains the original whilst Bob keeps a copy of the original.

If this same mechanism was applied in the world of digital currencies it would be catastrophic. This is referred to as, ‘the double-spend problem’.

Satoshi Nakamoto had to create a system in which Bob could verify that the bitcoin he was receiving wasn’t a copy that had already been spent elsewhere. In the physical world, it’s the responsibility of third party central authorities such as banks and PayPal to verify these transactions.

However, in the digital currency world, that responsibility could be anyones.

Enter: Consensus Mechanisms

Consensus mechanisms are used to verify that transactions are valid without a centralized authority. Developed by Nakamoto, this system avoids using a central record keeper and instead uses “miners” in order to verify the validity, which keeps the network decentralized.

In order to validate a specific transaction, one must ensure that the account transferring currency has enough of that currency in their account to actually conduct it.

This is done by checking the history associated with the account. Whilst validating, all the transfers associated with the account are tallied in order to verify that the right amount of currency in present. This is also how each account can see how much currency they have associated with their account right now.

Currently, there are 2 main consensus mechanisms that that are used to audit transactions: Proof of Work and Proof of Stake.

Proof of Work

With a proof of work consensus mechanism system, anyone a part of the network can become a miner.

When a new transaction occurs, it is put into the mining pool and is broadcast to every miner on the network. From there, miners collect the transactions and put it into a block, and try to create a valid block. Solely one miner wins the privilege of adding their block to the blockchain.

To complete proof of work and validate a block, miners must use their computers to solve an extremely complex and time-consuming math problem. The difficulty of the problem is controlled and maintained so that the blocks are added at regular intervals (e.g. Bitcoin adds one new block every 10 minutes).

The basic components that make up each individual block are the hash of the previous block, the transactions, a nonce, and the hash of the current block.

Miners must find a way to generate a hash for the block that meets a certain difficulty threshold (e.g. a hash must start with a specific number of 0s). Because the hash function provides completely random outputs, this is what makes it so difficult.

But how do you change the hash, without tampering with the transaction data?

That is where the nonce(number only used once) comes into play. Blockchain miners are solving for this nonce. Miners cannot tamper with the transactions, yet, they have the ability to keep playing around with the nonce until they find a nonce that allows the block to be hashed meeting the difficulty threshold.

Once a miner solves the problem, it is announced to the rest of the network, along with the next block of transactions. If 51% of the miners agree on the transactions contained in the block, the network updates itself, and the transactions become irreversible.

From there, the process repeats.

When someone conducts a transaction on the network, they must also pay a small transaction fee. When a miner successfully mines a block, they receive the transaction fees from the transactions in their block, along with new bitcoin that is automatically generated through the successful mine (helps to introduce new bitcoin, and incentivize mining).

The more computing power than individuals have, the higher their chances are of solving the computationally difficult problem. Therefore, some miners take advantage of this and crowdsource their computing power, increasing their chances of winning, removing the point of decentralization.

If Bitcoin’s top 5 mining pools combined they would own over half of the network. Owning that much of the network results in allowing you to approve any transaction, which is considered to be Bitcoin’s biggest flaw.

Proof of work is considered to be extremely inefficient, therefore many Blockchain networks are leaning towards using different consensus mechanisms.

Proof of Stake

Another consensus mechanism that is currently on the rise is proof of stake.

The key difference between these consensus mechanisms is that in proof of stake instead of anyone being able to mine a block, there are specific validators that the network elects in order to validate a block.

To be elected, one must have bitcoin “staked”. You hand over a certain amount of your crypto to the network, the network holds it in exchange for your right to validate blocks. If you validate a fraudulent block, the network punishes you and takes away your staked crypto which disincentivizes fraud.

This way, instead of rewarding validators based on their computing power, they‘re rewarded based on the currency they own, their take in the network (e.g. own 10% of currency => forge 10% of blocks -> 10% of transaction fees).

To take over a network using a proof of stake consensus mechanism, you would need to own 51% of the crypto on the blockchain (which is difficult, very expensive, and not rewarding). The chances of this occurring are much less likely in comparison to owning 51% of the computing power (to take over a proof of work network) as a result of mining pools.

The proof of stake mechanism helps bring transactional costs down, as each individual is no longer paying for the electricity that goes into mining, they are only paying for the loan of the stake given. In addition, it’s also more environmentally friendly in comparison to proof of work, because less energy is being used as less computers are guessing.

Forks in the Road

Imagine this.

You’re casually playing a game with millions of people, and then at one point, a part of the community disagrees with the rules.

The part of the community that wants to change the rules goes off and continues the game with the new rules, and anyone is allowed to join either game.

Similarly, when the blockchain community disagrees on protocols the users branch off into various chains (with alterations from the open-source code). All the past transactions are recorded on both the chains, yet, at the breakoff point, each block continues to follow its own rules.

The breakoff point where the blockchain splits is called a fork.

There are two types of forks; a soft fork and a hard fork.

Soft forks are like changing a lane in the blockchain; when small changes occur to the source code they are still compatible to be a part of the main blockchain.

Hard forks are like turning onto another road; the rules are changed, and they are no longer compatible with the previous chain, therefore a new chain is created.

On Aug 1, 2017, a hard fork occurred in the bitcoin community. When the Bitcoin network was experiencing extremely heavy traffic, transactions were taking very long to process and transaction fees became more expensive as well. The community could not agree on whether to increase the sizes of each individual block to 8mb or to decrease the data included in each transaction (smaller data size = more fit into one block).

In the end, the community decided to implement a hard fork, where the original blockchain was maintained, and another one was also created that branched off from the original called Bitcoin Cash.

Up until Aug 1, the transactions on both the chains looked exactly the same. For those, who chose to transfer to the Bitcoin cash blockchain, their assets were transferred as well (e.g. if Alice had 1 bitcoin on the main network, and chose to transfer she would then have 1 bitcoin cash on the new network).

This is solely one example of forks in the Bitcoin community. Forks occur all the time and within multiple different cryptocurrencies as well.

Blockchain is only a technology that is 11 years old, and cryptocurrencies are solely the beginning of its potential. The future is full of possibilities, and blockchain will provide the base of the next revolution.

Key Takeaways:

  • Cryptocurrencies(such as bitcoin) are ONE type of application for the blockchain technology, lots more is possible!
  • The hash function (such as SHA-256) allows for the blockchains to be immutable, and tamperproof.
  • Each message or transaction that is conducted through the blockchain has its’ own unique digital signature that is associated with the public/private key pair of an account.
  • Consensus mechanisms are used in order to validate blocks, the proof of work mechanism allows anyone to validate, and the block that is added is based on who solved the computationally difficult problem needed for validation first.
  • The proof of stake consensus mechanism network allows for validators to be elected rather than anyone validating (uses less computational power, and is less likely that the network could be taken over).
  • Forks occur in blockchains when the community does not agree with a certain set of rules, and therefore branch off into different chains (if its a hard fork) to follow their own set of protocols (chain the same up till the point of the fork).

Let’s Connect!

If you enjoyed reading this article or learned something new, I’d love to connect on LinkedIn. If you’d like to stay updated on my new articles or projects you can subscribe to my monthly newsletter here!