Journey through Blockchain
It has been days since I have been trying to learn this beast and finally when the office gave me some time off, I thought of putting it to use. The IT industry has a way of keeping you away from any new technology by unwanted jargon. But it’s just the way it is. Here is the gist of what I got to know so far -
The Who’s — It all started with a white paper being published by Satoshi Nakamoto on Oct 31st, 2018. In simple words, it showed a way to exchange money between users without involving a central authority like a Bank. This was then superseded by Vitalik Buterin’s white paper which proposed we can do a lot more than just money and brought in the concept of Ethereum.
How Web2 works — To simplify this further let us visit how the current web works. We have clients who need websites and software for their business. We have programmers who make them. And then we have places to host these websites so that it is publicly accessible. This is usually done by some authority like GoDaddy, Heroku, AWS, etc.
So how is blockchain different. Well, instead of a central authority, we have a peer network that does all the hosting. A peer network is basically a group of computers that take part in doing something. Can you be a part of this network? Yes. You basically need Ethereum client software that will give you access to hosting. Anyways, we will talk about that later.
Basically, websites/software are analogous to what we call smart contracts and a blockchain is just a set of computers or servers to host these smart contracts. So the learning is to write smart contracts. And for that, we have web3.js or our age-old JavaScript. And for transactions and stuff, you need something called MetaMask. It’s analogous to a wallet basically. The takeaway is this much. Write using web3.js, transact using MetaMask, and host using Ethereum.
A network of networks — Just like the Internet is a network of other smaller internets, similarly, Ethereum allows us to have a lot of smaller blockchains inside it. There is the main blockchain called Ethereum whose coins are actually worth something in dollars but apart from that, you will find a lot of other test networks. When you start out you will actually be part of transacting in such test networks. I am using Rinkeby for e.g.
When you log in to the wallet, you will be allotted a unique address. This address never changes. This remains the same across all the networks you join using your wallet. So you have one username/address and a million smaller networks you could join.
The unit of work — The basic unit of a blockchain is a transaction. It could be anything but let us go with a money transaction as that is easy for us to understand. Let us understand how the current web works. You visit a website and click on a button. The button sends a request to the server. The server does some calculations using the database and sends you back the response. The blockchain works in a similar manner.
Once you request a transaction via a wallet, your wallet sends a request to the backend server written using nodeJs. This then talks to the blockchain (database) and sends you back the response. The blockchain is just a database of transactions. The only difference is the distributed manner. Every computer on the network has a copy of this database. So what is the big deal then? I am glad you asked. It’s the security and the absence of a middle man that made this a hit. Let us understand in detail.
No one to rule — Unlike a CRUD operation, you do in a database, adding a transaction into the blockchain is a very complicated process. Here is the most simplified version of why. At any point in time, there will be thousands of transactions waiting to be executed on the blockchain. Once a set of transactions (block) is chosen for addition, a complicated process happens via which a hash (unique code) is chosen for this block. Every block on the blockchain has a unique hash and also stores the hash of the previous block.
Even though it seems a very easy process, it takes on an average of 15 seconds to add a transaction. This process is called mining. Since every block is related to blocks before and after it, tampering with something is really difficult because doing so will force you to change all the other blocks in the chain. Even if you manage to do so, it will still mismatch with the database on other peers as the blockchain(database) is copied onto all the other peer nodes as well. Damn!!! Once the system finally figures out a combination of hashes to add your block to the blockchain it gives a success. This is where the time is spent. This chart shows the time it takes to add a block (block time)over the years.
I don’t want to be a part of this — As I said, anyone can be a participant in the blockchain. So there is a high possibility that you will get bored and turn off your computer. This means a loss of processing power for the blockchain. The blockchain is intelligent enough and makes the hash calculation even more difficult based on the amount of computers participating.
Phew!!! That is a lot but understanding what is happening inside will always allow us to be better at something.
Stay Tuned for more. You will find the link to the next chapter below when I learn more about it.