Learning Blockchain

I wrote a post about being a skeptic in this particular technology called blockchain a while ago. Apparently, this bite me in the ass because just one day after writing that post, Andi Taufan (our CEO in Amartha) stated in our yearly plan townhall that he would like to start exploring how blockchain could benefit our business in the upcoming years.

Well, that leave me no choice but start diving  because as skeptic as i am into blockchain, who doesnt want the opportunity to work in something the whole fuckin world goes bonkers about. Besides its always exciting to learn something new.

Studying in midnight. The only quite time a parent with a high energy toddler can have

So here in this post i share some of things i read or watch to help me understand the hypebeast that is blockchain. I am by all means a complete rookie so do help me by recommending better or more comprehensive source in the comments below.

Lets go!

Understanding Basic Concept

The easiset way to get basic understanding of this technology is by watching explainer videos. You can find tons of them right now in Youtube. I personally recommend explainer made by Savjee Channel. It has good visual, detailed enough to be educating yet still easily digestible even for non-technical person.

From watching the video, several basic things about block chain can be learned.

  • Blockchain is basically a data structure in which you can store information.
  • Blockchain has three unique characteristics : Immutable , Distributed and Anonymous
  • Immutable : data stored in blockchain cannot be changed and deleted
  • Distributed : data stored in blockchain is synchronized over the whole network
  • Anonymous : data stored in blockchain is uniquely-identified by hash code

In each block in a blockchain, there are usually three basic elements : information stored in the block, its own hash code and the hash code of previous block. Illustration can be seen in the image below :

2018-01-30 13_58_13-(180) How does a blockchain work - Simply Explained - YouTube
A block of information + chain of hash identifier = blockchain

Note that the first block in the chain has no previous hash. This is called genesis block. The integrity of data stored in individual block is validated using its own hash. While the integrity of the whole chain is validate through chained hash code from one block to another. These are the reason why blockchain is so secure and virtually tamper-proof.

But wait there is more. Since blockchain is distributed ledger, each person or institution connect to a particular blockchain peer-to-peer network will have the exact copy of the chain. If someone create new information / new block, this block will be synchronized to all users.

2018-01-30 14_30_53-(180) How does a blockchain work - Simply Explained - YouTube
Blockchain is distributed through  p2p networks

If someone want to add something in a block chain, the change will need to be communicated to all parties involved. In block chain, this is called a consensus. 

This is the end of my summary on basic blockchain knowledge. Since its very enjoyable, I recommend watching Savjee’s other explainer on Blockchain and other cryptocurrentcy technology ecosystem.

  • Blockchain Hard Fork : Explain separation between blockchain and bitcoin protocol. Also explain what is hard and soft fork which resulted in the creation of Bitcoin Cash.
  • Bitcoin Lightning NetworkExplain transaction limitation of bitcoin and the technology to overcome that
  • Smart Contracts : Programmable software to distribute cryptocurrency automatically which can be stored in a blockchain. It is the key technology behind second famous cryptocurrency, Ethereum.
  • Iota’s Tangle : A cryptocurrency implemented not in blockchain but DAG (distributed aciclic graph)
  • Cardano : Another increasingly popular cryptocurrency which have several features to improve scalability of blockchain

Another series of explainer videos that i recommend is from Blockgeeks. Their videos are more focused to Ethereum ecosystem which i wont cover much in this post because it is a whole another beast to digest. So before diving into these videos, make sure to read or skim Ethereum explanation on wikipedia first.

One more thing before moving to the next chapter, yet another fantastic resource to learn the basic of blockchain is Khan Academy course on bitcoin . Its comprehensive and you can follow the comment discussion and ask the question yourself. It is however in my opinion, a little bit too academic.

Going a little bit technical

Next step after understanding the surface, i want to know the stuff under the hood. How does the high-level concept actually implemented ? video explainer comes to the rescue once again. Savjee has two part video demonstrating livecoding blockchain implementation using java script. These videos really help me to understand how blockchain works in step-by-step manner

In the first part below, we can see :

  • how to initialize single block and block chain object with basic parameters
  • how to create hash code
  • how to check validity of one block and the whole chain
  • what happened if the data / parameter stored in a block is edited

As mention in the narration, the video only show simplify version of blockchain. Complex mechanism such synchronizing blockchains over the multiple user and how to verify blockchain in a p2p2 using consensus is not shown. The code however is simple enough to follow as long as you have basic understanding of java script

The second part of Savjee blockchain is a bit trickier. It introduce and show the concept of proof of work (PoW).

PoW is a method to check validity of a new block created in blockchain. Once it pass through PoW, a block will then added to the chain and distributed to the whole blockchain networks. Bitcoin use this method to check validity of each transaction. This process is what people called as mining.

As decribed in the video, proof-of-work is implemented by trying random number one by one and calculate the hash of that random number until it satisfy certain condition. In bitcoin, the condition is certain amount of zeros in the first x digit of the hash. The random number which satisfy that condition is called nonce value and it serves like a receipt which proof you have the rights to add new block to the blockchain.

This is a bit complicated to explain, so i draw simple diagram below. Hopefully it helps.

Nonce Value.png
Simple illustration of mining process

Since hash code generation cant be predicted, searching for nonce value require brute force iteration. Checking hundreds or thousand of random numbers against the satisfying condition. This is why mining process require huge computing resource and power.

PoW is just one of the several ways to implement consensus in blockchain. It is deemed unsustainable because it cost massive electric consumption. Proposed alternative for this is proof-of-stake which is planned to be implemented in latest version of Ethereum. High level comparison of both can be read here

If youre interested to know more on the technical specification and detail regarding blockchain, i recommend checking this Cloud Foundry summit talks.

Frameworks, libraries and developer tools for blockchain

So far i have cover both basic and technical understanding on blockchain. So the next step is i want to know if i want to start developing or at least building proof of concept application using blockchain, is there any tools or library that i can use ?. Here are some them which ive read so far.

Quick note, all of these are skewed to financial services because i want to see whether we can use it in Amartha.

Chain Core – Blockchain framework for financial services

Chain Core is framework designed to build blockchain infrastructure in a financial industry setting. It is designed from the ground up to be scalable, secure and better yet it is open source. In the website Chain Core claimed to be used by giants in financial industry such as Visa, Citigroup and even Nasdaq. This is very impressive. However i cannot find in their website any study case document showing how these companies use chain core in their product.

2018-01-31 12_02_37-Chain _ Chain Core.png
Chain Core proposition

High level overview of Chain Core can be read in their white paper while complete framework documentation can be accessed here. Chain core can be downloaded via Docker.  It has also comprehensive development kit for Java, Node.js and Ruby.

Sequence – Cryptographic ledger cloud services

Sequence is a cloud services which provide managed cryptographic ledger. It is designed to manage “balance” information in a application. For example, you want to develop payment wallet where user can deposit, store, withdraw and even send payments to one another. Rather than developing you own ledger to store and record these transactions, you can use Sequence to do this for you.

1__68dvHXhyY6-pBCj5yaSPA (1)
How Sequence API works

In Sequence documentation there four example use-cases: mobile wallet, ride sharing, lending and crypto exchange. Each use-case has snippet of code (Jave, Ruby and Node) showing how you can implement various features using Sequence. In my opinion, this is the best way to understand the value of Sequence frameworks because both the code and the documentation is well-written and easy to understand.

Sequence is not officially launched yet, but you can register to get their developers preview.

Truffle Frameworks – Various tools for ethereum development

2018-01-31 14_00_30-Truffle Suite - Your Ethereum Swiss Army Knife.png
one tools to rule them all

Truffle is a compilation of various tools to develop application which use Ethereum-base tech such as Smart Contract and Dapp. Truffle is developed on Node.js hence it can be installed via npm. Included in the Truffle suite is :

  • Solidity (smart contract programming language)
  • Truffle Boxes ( various boilerplate code for dapp development)
  • Ganache (Ethereum local networks to test and develop smart contract)
  • Geth (official Ethereum client written in Golang)
  • and other libraries.

It is a very impressive tools i must say. It already includes all things needed for smart contract and dapp development hence setting up development is only the matter of typing “npm install -g truffle”. Not only that, Truffle documentation also include best practice to test smart contract, setting up build process and deploying into main Ethereum network.

Bloom – Ethereum-based decentralized credit scoring system 

Bloom is a decentralized credit scoring system developed using Ethereum and IPFS. IPFS stands for interplanetary filesystem, a decentralized storage which also closely associated with ethereum. Bloom’s mission is to make decentralized credit scoring by putting financial transaction and credit history into a blockchain network.  Bloom protocol consist of three parts : BloomID ( hash identification of all lenders ), BloomIQ (storing current and historical debt into blockchain ) and Bloomscore (credit score which calculated in real time).

2018-01-31 16_03_54-Bloom - Say Hello to Inclusive Credit.png
decentralized credit scoring protocol

Even though the premise of Bloom seems exciting, it is still in a very early phase. The only public documentation shared on their site is their whitepaper. There are no use case, no API documentation and no downloadable library or SDK yet. Hence it still a question whether this protocol is as good as its website

Thats all for todays post. Do you have another good learning resource to learn blockchain related stuff ? do recommend me by writing in the comment below. Thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.