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.

As a software engineer at Microsoft S01E01

It have been a looong time since last time I write something here and it is already 2018. A lot of things happened during 2017 and I just don't feel like it to write them down. I implemented a in-memory transactional key-value database,  a interpreter for future use as a scripting language for Morpheus, an experimental decentralized file system based on blockchain architecture, bifrost have been through several iteration and become more robust.

The most notable is Factual fired me together with my team in Shanghai. Then, I am here at Microsoft, the exact opposite of what I used to as a programmer: Java to C#, Linux to Windows, IntelliJ to Visual Studio, MacBook to ThinkPad, luckily I can still use Google Chrome here.

There is nothing wrong with Microsoft except I need to get used to those tools and techniques that I have already give up or not not been touched at all. I am a fast learner so this is not an issue. The food here is great and free, there is a GYM, I started to loose some weight, and colleges are good people, My manager even willing to discuss with me some topic on software architecture that is not related to my work at all.

There is one thing that tipped my impression on Microsoft after I learned about it is that it is no long that one leaded by Steve Ballmer. It's focus is moving to cloud computing, like moving to search engine 4 years ago (although that was a failure). The conversion have already paid off, it's stock market price rises rocket high. The company used to sale it's own products, like Windows Server and SQL Server, have been providing various of chooses that customer needs. Database fields, Azure have managed MySQL, PostgreSQL, SQL Server and more coming. They even have managed Kubernetes Linux container services. Yes, that Linux used to been called cancer now have over half of  the occupation in Microsoft Azure Virtual Machine service, and they love it.

The team I joined is responsible for global MySQL database service on Microsoft Azure cooperate with Data group. At the time I start to work there the project have been for years and it's almost ready for general availability. The first few month there is get used to the workflow, fix some bugs, do some minor improvements that does not impact much. Typical works for first few month in a mega software company.

I do looking forward to this adventure.