As a software engineer at Microsoft S01E02: Blockchain fever

It have been some time since first time I heard Microsoft is working on blockchains, at that time that I was even not joined Microsoft. The message have been confirmed after my on-board and I am lucky to be a member in the the team.

I am not going to give any details on what Microsoft is going to do, just to talk about my story and understanding on blockchain technology, how it works and why.

My first contact with blockchain is before my interview, I attended a hackathon invited by my recommend-er, the one helped me get in Microsoft also told me Microsoft's plan on blockchain. Sure, that was planned and I also have some interest on building "the internet we deserve", which I can harvest some ideals from how blockchain was build, so I agreed and did wide range of research.

The competition is not going very well. My recommend-er was depressed on beaten by other mediocre projects. But still, I was excited because after some tests I think this idea may actually works. There is some difficulty though.

There are a lot of article on blockchains already. Most of the people are misguided and blinded by it's capital attributes and ignore it's original meaning to the industry, what problem it solved etc.  I personally somehow detests people talking about blockchain is cryptocurrency, a blockchain is always accompany with cryptocurrency. Those people have no idea why cryptocurrency exists, do they?

Let's talk about public blockchains first. Bitcoin, Ethereum are all public blockchain. A ledger and database that everyone on the internet can have a copy, read it's content, and most importantly, a consensus will be made for each block to change states. And after that, nothing before the block, including the block can be changed again by any means.

How to achieve that? For the immutable part, blockchain blocks have a hash, crypto hash calculated by the payload it carries together with it's previous block hash. This incremental hashing attribute enforces the blockchain have to be consist. Every slight volidations in any of the block will leads to diverge, or we can say fork. It will be detected easily and such data without majority agreement on the network will be abandoned. The database, aka states can also been ensured and validated by a data structure called Merkle tree, which shares the same idea of blockchain itself, that is any modifications on a Merkle tree will leads to a inconsistent root hash and all leaf nodes can be verified.

That's for security, ensuring no one even the developer themselves can't change anything on the ledger in blockchain network. The only way to change states, is to issue a transaction, that will be recorded on the ledger, so people are able to check how it changes and who changed that. This is the core value of a blockchain network: to store something verifiable in a "place" that no one owns it and no one can tamper with it without authorizations.

In other sense, if a blockchain network need to be upgraded, or even slight changes in the protocol, it can only be achieved by forks. More than majority nodes in the network must upgrade to the new software, or the network will be unstable. Usually blockchain protocols can't change often because you have to change every single node in the network in order to be operable in the future. So, just like old school software upgrade without internet, blockchain infrastructure software are not suitable for rapid iteration.

Maintain such network have a cost, especially on a network that supports smart contract, a program that can only live with the blockchain and will run when a preceding to next block. It can only get access to states belong to it in the blockchain. To achieve determinant, it must have no side effect and cannot do anything to harm the computer that running it.

The cost comes from 2 parts: reaching consensus and executing blockchain business logic (like smart contracts). Mining is part of the consensus part of the cost. The idea of consensus is to make the whole system reach a agreement for a right upcoming outcome. In Ethereum network, there are billions of computers willing to join the consensus procedure, how to find out the one that can be trusted (that will not make fake changes) is an issue. Bitcoin and Ethereum all solved such problem by proof of work, computing hashes that can be verified as it have committed it's resources. The first one calculated expected answer wins this round and able to contribute it's computing power to the actual business logic for the next block. When the next block generated, it broadcast to the network and other nodes can verify and sync into it's own local database. A node that committed such work and successfully win the block can get some reward, cryptocurrency, to encourage it continue it's work. This is crucial to the process of maintaining.

The whole idea of cryptocurrency is to encourage strange untrusted people in virtually any number to contribute their hardware, electricity and network resources to maintain the system. When the value of cryptocurrency rises in real world, more people will join the team and make the network more robust and resistant to attack. Because in POW you need more than 50% to get more chances tempering the network, in a network like Bitcoin, that is impossible.

Let's talk about private chain. People tend to obscure the public with private but there are much of difference in principle and use case between those two. Private chains are usually to been use in a group of entities, they have a same vision that is to make their transaction transparent. This is good for cutting down tedious reviewing paperwork  to save more time and manpower. Unlike public chain, members in private chains are assigned, or invited. Not everyone can join the network without some kind of approval and the number of members is significantly smaller than public chain.

This provides a lot of chances to solve some problem on public chain, like performance, Bitcoin requires hours to confirm a transaction but in a private chain it can be reduced to sub-second thanks to it's consensus differ to public chain. Also, it can be more secure. A successful miner may also temper the network it feels like because smart contracts and transactions are all running on only one trusted node. If we employ some algorithms like PBFT, which is impossible to be implemented in public network due to it's scaling problem, majority of nodes in the network will run the same business logic and compare their results all together to ensure no one is doing anything nasty.

Also, because the purpose of join a private chain is for transparency, we don't need to provide any award to participating nodes, we can also remove cryptocurrency in the blockchain if the business logic itself does not involve any currency transactions. Because a cryptocurrency is useless if it cannot been convert into other values in real world.

A private chain is nothing more than a secure, shared distributed system across various entities. A private chain cannot procedure any value by itself, but the business it carries. It's more easy to implement than public chains, and also more easy to maintain and governance.

I hope this article give someone need for more intuition on how blockchains are operate and why you don't need cryptocurrency everywhere. The value of blockchain is not about money, it's about public good.