What is blockchain?
Blockchain
Blockchain, a term that has never been discussed or heard before until the existence of the popular cryptocurrency, Bitcoin which was invented by Satoshi Nakamoto back in 2009. The blockchain space has since been growing with the introduction of other platforms such as Ethereum, NEO, Cardano and many others.
These platforms have sparked discussions among the people and even family members and friends around us. However, when I was having conversation with them, I have noticed that almost all of them does not know what actually is blockchain and how it works. They were only aware of the cryptocurrencies side of the blockchain due to the recent bull run. Some were capitalizing on it, some were highly skeptical and against using it while some were interested in the blockchain technology and has been asking how blockchain works.
So what is blockchain?
Blockchain at its core is essentially a database that most of you have heard of, a system/platform where users can store data on and read it anytime they want. Let’s take an online marketplace like Amazon, Lelong, or Lazada for example. When you want to buy and sell item on the marketplace, you would have to either post a selling advertisement or make a purchase by placing an order on the site. These data are being stored on a database server such as MySQL, MSSQL, MongoDB and many more.
Now replace these databases with blockchain and you will have the same system where data are now stored on blockchain instead of traditional databases. This is only the core functionalities of the blockchain technology in layman explanation, so…
What is so special about blockchain?
Blockchain is bundled with several familiar technologies that some of you might have heard of before:
- A peer to peer distributed system (Torrent)
- An append only ledger system (A database without the ability to modify previous data)
- Cryptographic keys and hashing (File checksum)
Peer to Peer Distributed System
If you have used torrent in the past, you have used a peer to peer distributed system. The way a torrent system work is that essentially there are seeders and leechers in the system. Let’s say you want to share a video of a cute puppy, you will upload the video to the system and become the first seeder. A seeder is a user who has a copy of the same file and are uploading and sharing the file to other users. If a user wants to download the video, the user will have to connect to the uploader aka the seeder who has a copy of the video and download from the seeder. Once the user has downloaded a copy of the video, the user can become a seeder and share the same video to the other leechers aka the users who want to download the video.
This network of peers has formed a distributed system where copies of the video are stored and hosted at different location that can be accessed by anyone anytime and anywhere they want. As opposed to a file sharing platform such as DropBox or Google Drive where a single entity hosts and controls files that you upload. Although unlikely, if the entity hosting your files shut down suddenly, you won’t have any way to retrieve your files whereas in a peer to peer system, your files are safe on the network and can still be retrieved anytime even if the initial hoster shut down their system.
Append Only Ledger System
Blockchain utilizes an append only ledger system in which users can only append new data to the ledger. Any data that has been added to the blockchain previously is permanent and immutable. If you have heard of linked list, blockchain is exactly like a linked list. New data are appended to the ledger which references to the previous and thus forming a chain of block (Blockchain).
Cryptographic Keys and Hashing
Keys
Blockchain uses asymmetric cryptography (also known as public-key cryptography) to identify ownership of a data on the blockchain. Asymmetric cryptography uses two keys, public keys and private keys to perform digital signature and verification of messages. This allows users to share and verify if the sender has indeed send the message and has not been tampered with.
Let’s take example of the online marketplace that we have discussed previously, when a user creates an account on the blockchain based marketplace, the user will be given a generated account with private key and public key attached to it. (Note: These generated keys are not stored anywhere on the backend of the system. You can even access your data on the blockchain directly without going through the marketplace.) Think of the private key as the password and public key as the username of a traditional account. Username is usually public on the platform to let the users verify who is the buyer or seller while password is kept securely by the user to ensure no unauthorized access to their own account.
When a user wants to sell something on the marketplace, the user will need to post the selling advertisement on the platform and sign it with their private key before adding to the blockchain. When a user wants to buy something from the same seller, the user will first verify if the advertisement is actually posted by the same seller by using their public key to verify. This ensures that the ad post has not been tampered with and is indeed posted by the same seller.
Hash
Cryptographic Hash Function is used to hash data to be stored on a blockchain. Regardless of input data, when cryptographic hash function is used, the output will always produce a one-way fixed size string. Search up any hash generator online and play around with it. Here is one SHA256 hash generator that you can use: https://passwordsgenerator.net/sha256-hash-generator/. Notice how different input gives different hashes? Notice how the same input always result in same hash? Notice how all the input always result in same fixed length?
Try typing “Blocklime” and you will get
3D572211C8B71436CAAB25942E1DB5A4451312F473E3D5A46E9E75D79C1FFA01
And typing “blocklime” will get you
254F086573D5E670A0DBE642ED38EBBB20B783BBB1ECBE6B8FE16718C1C9575C
The beauty of cryptographic hashing is that it is difficulty to reverse engineer the hash produced to get the input data of the hash. As such, in order for a user to know what data has been used to be hashed, the user will have brute force input data into the hashing function in hope to get the same hash as a slight change in data will result in totally different hash.
When a block is being added to the blockchain, the block will include data such as list of transaction hashes and most importantly the hash of the previous block. These data are then hashed again together to form a new hash known as the block hash. This prevents malicious user from tampering the blockchain due to the inclusion of previous block hash in the block. When a malicious user tamper a data on a block, this will effectively invalidate all the subsequent blocks the user is trying to re-add to the blockchain as the hash of the block has been changed due to a slight change in the input data. The user will have to spend a lot of resources just to tamper a data and re-validate all the subsequent blocks in the blockchain. This gets more expensive as more subsequent blocks are added to the blockchain after the tampered block. Anders Brownworth has a simple web demo on how block hashing works and what happens if you modify a data in a block as shown here: Blockchain Demo
To Summarize
Let’s modify the flow of the traditional marketplace to utilizing blockchain instead to compare the differences.
As you can see, comparing to a traditional application, the flow of how data are being stored is identical. The difference is that instead of logging in with a username and password account, private key is used instead which the user has control over how they manage the key. Public keys are used to verify the authenticity of the ads to ensure it is genuine from the seller and all these ad posts are stored on the blockchain for the public to see. This has essentially created a trustless system where you do not have to rely trust on the people behind the marketplace to handle your data instead trust is relied on the blockchain which is public and tamper proof.
Blockchain has bring something new to the table with benefits such as immutability of data as well as distribution of data across limitless peers. The combination of these technologies has made blockchain special and a potential alternative to how people can store data in the future as the technology is being built and improved on.
By
Tommy Ang, Blockchain Developer
Blocklime Technologies