paint-brush
A brief introduction to Consensus mechanisms, Smart contracts and distributed apps on the…by@akshaykore
3,669 reads
3,669 reads

A brief introduction to Consensus mechanisms, Smart contracts and distributed apps on the…

by Akshay KoreJanuary 8th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The first blockchain was conceptualized by an anonymous person or group known as Satoshi Nakamoto in 2008. It was implemented in 2009 as a core component of Bitcoin. Like our <a href="https://medium.com/zenturtle/blockchain-for-dummies-ae786c6a5fe7" target="_blank">Fruit spreadsheet</a> example, the words <em>block</em> and <em>chain</em> were used separately in Satoshi Nakamoto’s original paper, but were eventually popularized as a single word, <em>blockchain</em>.<br>Bitcoin or any other digital currency isn’t a file saved somewhere. It is a representation of the transactions taking place on the Bitcoin’s Blockchain, where each transaction is verified and approved by a large peer-to-peer network. Apart from digital currency, blockchains can be programmed to record anything of value and importance to humans securely like land records, birth certificates, identities, medical records, etc.
featured image - A brief introduction to Consensus mechanisms, Smart contracts and distributed apps on the…
Akshay Kore HackerNoon profile picture


The first blockchain was conceptualized by an anonymous person or group known as Satoshi Nakamoto in 2008. It was implemented in 2009 as a core component of Bitcoin. Like our Fruit spreadsheet example, the words block and chain were used separately in Satoshi Nakamoto’s original paper, but were eventually popularized as a single word, blockchain.Bitcoin or any other digital currency isn’t a file saved somewhere. It is a representation of the transactions taking place on the Bitcoin’s Blockchain, where each transaction is verified and approved by a large peer-to-peer network. Apart from digital currency, blockchains can be programmed to record anything of value and importance to humans securely like land records, birth certificates, identities, medical records, etc.


A lot has been talked about the opportunities and possibilities of this technology in the domain of finance, viz. micro-payments, currency conversions, remittances, insurance, Blockchain IPOs, Altcoins etc. I will stray away from these topics as much as possible. Partly because enough has been written by experts in economics and partly because the immediate transformation felt by people will most likely not be in this domain. I truly believe that for the technology to be adopted, it’ll have to ease in into the world of finance, much like the internet did, rather than be this gift from a mysterious person here to change the face of finance. Again, I’ll be the happiest if proven wrong.Although revolutionary, it would benefit us more if we stop thinking of the Blockchain as this revolutionary technology (which it is) and start thinking of it as a tool that secures and embeds trust in systems. “Any design that incorporates lightness and thinness conveys the impression of being smaller, lesser, and humbler. Pity gives way to respect when much more value is delivered than originally expected” says John Maeda in his book The Laws of Simplicity. We can be more forgiving if the technology which is yet to mature misbehaves, if we stop thinking of it as the David set out to defeat all the evils that exist in world. If we just stop thinking of it as a doorway to a new world order.

Starting small

The Blockchain needs to be thought of as a tool to be used to secure trust in systems rather than a solution to all of the world’s problems. Although the idea is revolutionary, it’s value is in the execution. The killer app for blockchain will probably not come from a large company. It’ll come from the fringes, maybe a few kids in a garage somewhere tinkering with it. We need to start at a small scale. Simple applications. Maybe a small house or maybe a room in the house.

Hey! They are calling Blockchain the new internet. What does that even mean?

The internet ushered in a new era of entrepreneurs and industries. Although some feel, it failed to fulfill it’s promise of being democratic, of providing equal opportunity to all stakeholders. Much like the era before, the internet has turned into a monopoly with a handful of companies controlling majority of the traffic and thereby majority of the wealth. All this at the expense of privacy of the people these companies generate wealth from. Jaron Lanier argues in his book “Who owns the future” that the middle class is increasingly disenfranchised from online economies. By convincing users to give away valuable information about themselves in exchange for free services, firms can accrue large amounts of data at virtually no cost. Many feel that Blockchain might become a way for these firms to start being accountable. It’s a long shot, but one that we need to get right.

The internet was not meant for distribution of value, it was meant for sharing of information. It made copying of data easier, it failed in enabling transfer of value.. Money, is not like a selfie, a tweet or any other information good. You can send the same selfie to all your friends, but not the same dollar. The money you send needs to leave your bank account. The same dollar cannot be used for two transactions. This is called the double spend problem. For people to be able to do business on the internet, there was a need for intermediaries which people could trust. Banks and number of tech companies jumped at this opportunity. They solved the double spend problem by clearing every transaction through central databases of one or many third parties. Each third party took a cut of the transaction in fees. The settlement in many cases can take days. The blockchain promises to reduce transaction costs and settlement times drastically without the need of a central authority.

Satoshi designed the system to work on top of the internet, but it can run without it if necessary. Dictatorial governments could shut down the internet and the blockchain could still function as a mechanism for transaction. You could perform transactions over shortwave radio, morse code or even a series of emoticons in text messages. Unlike the internet, the blockchain is a much more inclusive system.



There are two major questions that the blockchain needs to answer, 1. When people reach a consensus, who does the work? 2. How do we even leverage this chain of transactions to build things other than just currency?

Blockchain allows for creation and usage of other ways in which consensus can be achieved and lets users build applications that leverage the network. There are two fundamental components in the blockchain’s design that enable this; Consensus algorithms and Smart contracts.

Consensus mechanisms

Consensus is achieved by tallying the hash values of all copies of the chain. This requires the people in the network to spend a lot of computing power to maintain the blockchain. The fruit spreadsheet group is not a multi-national corporation. How then do we reward people for contributing resources for maintaining the network?

Satoshi leveraged the existing peer-to-peer networks with clever cryptography to create a consensus mechanism that could solve the double-spend problem as well as, if not better than a trusted third party. To achieve this, the bitcoin network uses a Proof of work (PoW) mechanism. Miners or participants on the network who run bitcoin nodes gather up recent transactions as a block of data where each block must refer to the previous block. This process repeats every 10 minutes. The problem is that there are multiple miners trying to solve for the same block. To select a miner who will be assigned to solve a block of transactions, we create a mathematical puzzle that is hard to solve, i.e. it takes a lot of work. The puzzle often is to find a really long number (hash value) where the computer tries to guess each number. Whoever solves the puzzle first gets to mine the block. In exchange for mining the block, the miner receives bitcoin as a reward. After every successful transaction, the puzzle starts increasing in complexity i.e. miners need to look for an even larger hash value. The complexity of the puzzle also depends on the number of miners in the network. Finding the hash statistically takes about 10 minutes. The first version of the Ethereum blockchain also used proof of work. There are however other consensus mechanisms that exist.

Proof of stake is a mechanism that requires miners to spend a native currency to perform a transaction i.e. users need to have a stake in the transaction being carried out. For the Ethereum blockchain, the native coin is ether. To achieve consensus, the network participants spend a tiny amount of ether to exercise their vote.

Proof of activity combines proof of work and proof of stake. A random number of miners have to perform work (solve the puzzle) and sign off on a block using a crytpokey (currency) to make a block official.

Proof of capacity requires miners to allocate a sizable volume of their hard drive to mining while proof of storage requires miners to allocate and share disk space in a distributed cloud.

There exist other mechanisms like the one used by Ripple (XRP) which rely on social networks for consensus. The value of a member in a social network is determined the number of unique members/nodes it connects to. This type of a mechanism is biased where newcomers need social intelligence and reputation to participate. Only authorized member groups reach consensus. This model allows for corporate style structures to exist with accountability on the blockchain.

Satoshi chose owners of computing power as an economic set. Ethereum chose owners of ether while Ripple chose owners of social capital as the economic set.

Smart contracts

These are computer programs that secure, enforce and execute the settlement of a contract between organizations, people and things. The term Smart contract was coined in 1994 by Nick Szabo, back when it was an idea nowhere to go. Blockchain changed all that. It enabled people to write programs that were enforceable. Transactions can be executed on a decentralized technological platform with a built in settlement system. What it means is that when you purchase a stock or a mutual fund, it shows up instantaneously without having to wait on intermediaries. That’s kinda cool.

The blockchain enables you to enforce complex smart contracts which require multiple people to approve a transaction by enabling a multiple signature protocol. It is also known as multi-sig. Think of it as a lock which requires multiple keys to open. Each member has a key or signature. Multi-sig could be used in cases of arbitration or a remote shareholder meeting to decide a company’s strategy. A set of smart contracts can be bundled together perform complex transactions called distributed apps a.k.a dApps.

Distributed applications (dApps)

A distributed application (dApp) is a set of smart contracts that stores data and enforces multiple smart contracts on a blockchain. These dApps can start interoperating with each other to perform specific functions on the network. For example, a universal verification dApp can be used by anyone to request and verify the identity of a person. In this case the verification dApp can decide how much information about the identity is needed for the transaction to be performed. In the case of John’s taxi service, Seema only needs to provide her wallet information to John’s taxi, which the verification dApp provides. If John requests for any other information, the dApp flags this request and asks Seema if she wants provide the same.

Simple smart contracts require people to sign off on the transactions, however for simple repetitive actions like getting milk delivered every morning and making realtime payments, people might choose to automate the task to a program. We call these autonomous agents. Some autonomous agents could be intelligent, that they could adapt to the state of the system and act accordingly. For example, the system knows that you are on vacation and thereby stops the milk subscription temporarily. At the other end, a collection of dApps can enable companies to craft clever, self reinforcing agreements. A simple request for a new device shouldn’t go through multiple approval emails, a smart contract could streamline the process. Another case would be when building a product, goods can be micro scheduled to arrive at the factory floor directly from the supplier. No need of a warehouse.

The X-axis indicates the degree to which humans participate in the model. Y-axis shows the functional complexity of the model.

Now imagine an entire company running on the blockchain network without any human intervention. This is the holy grail of what blockchain could accomplish and we call it the Distributed Autonomous Enterprise (DAE). The blockchain makes the stuff of sci-fi movies truly possible, freeing humans to do other (hopefully better) things with their time.

Peace!

References

  1. Blockchain revolution by Alex Tapscott and Don Tapscott
  2. Who Owns the Future? by Jaron Lanier
  3. Smart Cities: Big Data, Civic Hackers, and the Quest for a New Utopia by Anthony M. Townsend
  4. The Laws of Simplicity by John Maeda
  5. How the blockchain is changing money and business by Don Tapscott (TED Talk)
  6. How the blockchain will radically transform the economy by Bettina Warburg (TED Talk)


P.S. I have deliberately not covered IOTA which works on a different protocol. A lot has been talked about the opportunities and possibilities of this technology in the domain of finance, viz . micro-payments, currency conversions, remittances, insurance, Blockchain IPOs, Altcoins etc. I have tried to stray away from these topics as much as possible.All views are personal.

Liked it? Read a longer version of this article here.


If you liked this article, please click the 👏 button (once, twice or more). Share to help others find it!