# data[].attributes.body
1:40 to watch

# data[].attributes.headline
The Future is not Blockchain. It's Hashgraph.

# data[].attributes.subject
The Future is not Blockchain. It's Hashgraph.

# data[].attributes.body
1:25 to watch

# data[].attributes.attachment_link.title
The Future is not Blockchain. It's Hashgraph.

# data[].attributes.headline
From Bitcoin To Hashgraph (Documentary) Hidden Secrets Of Money

# data[].attributes.subject
From Bitcoin To Hashgraph (Documentary) Hidden Secrets Of Money

# data[].attributes.body
1:15 to watch

# data[].attributes.attachment_link.title
From Bitcoin To Hashgraph (Documentary) Hidden Secrets Of Money Episode 8

# data[].attributes.body
10 min to read

# data[].attributes.attachment_link.readable_text
Last updated: 21 March, 2018
Hailed as one of the most potent solutions to cryptocurrency scaling currently under development, the lightning network effectively creates a layer on top of bitcoin, enabling fast and cheap transactions which can net settle to the bitcoin blockchain.

Proposed by Thaddeus Dryja and Joseph Poon in a 2015 white paper, the idea is based on a network that sits on top of the bitcoin blockchain, and eventually settles on it. The network is comprised of user-generated channels that send payments back and forth in a secure and trust-less fashion (trust-less means that you don't need to trust or even know your counterparty).

Say, for instance, that I wanted to pay you for each minute of video that I watched. We would open up a lightning channel, and as the minutes rolled by, periodic payments would be made from my wallet to yours. When I'm done watching, we would close the channel to settle the net amount on the bitcoin blockchain.

Because the transactions are just between me and you and don't need to be broadcast to the whole network, they are almost instantaneous. And because there are no miners that need incentivizing, transaction fees are low or even non-existent.
How it works
First, two parties who wish to transact with each other set up a multisig wallet (which requires more than one signature to enact a transaction). This wallet holds some amount of bitcoin. The wallet address is then saved to the bitcoin blockchain. This sets up the payment channel.

The two parties can now conduct an unlimited number of transactions without ever touching the information stored on the blockchain. With each transaction, both parties sign an updated balance sheet to always reflect how much of the bitcoin stored in the wallet belongs to each.

When the two parties have done transacting, they close out the channel, and the resulting balance is registered on the blockchain. In the event of a dispute, both parties can use the most recently signed balance sheet to recover their share of the wallet.

It is useful to note that it is not necessary to set up a direct channel to transact on lightning - you can send payments to someone via channels with people that you are connected with. The network automatically finds the shortest route.

Development of the technology got a significant boost with the adoption of SegWit on the bitcoin and litecoin networks. Without the upgrade's transaction malleability fix, transactions on the lightning network would have been too risky to be practical.

Without the security of the blockchain behind it, the lightning network will not be as secure, which implies that it will largely be used for small or even micro transactions which carry a lower risk. Larger transfers that require decentralized security are more likely to be done on the original layer.
Where are we now?
Although it was originally designed for bitcoin, the technology is currently being developed for a range of cryptocurrencies, such as litecoin, stellar, zcash, ether and ripple. Litecoin plans to launch its version at the same time as bitcoin's.

In December 2017, startups behind the three most active lightning implementations (ACINQ, Blockstream and Lightning Labs) revealed test results, including live transactions, proving that their software is now interoperable.

Furthermore, version 1 of the lightning specifications, which set out the rules of the network, has been published. This will encourage the development of other implementations and applications.

However, the network is not yet ready for launch. Engineers have yet to release software with which real users can make transactions. Apps supporting lightning as a payment method are already cropping up, but so far they're not easy to use.

That has not stopped some of those working on projects from testing lightning transactions on the bitcoin network. Lightning developers discourage this, however - not only does it act as a distraction to developers, but it also puts users' funds at risk.

Given the complexity of the code, and the need for rigorous testing (we are talking about payments, after all), developers are urging patience. In addition, lightning can't be implemented at scale until SegWit is more widely extended - so, while some believe that there is enough SegWit support to run the network on mainnet now, others predict that a usable lightning network could be at least a year away.

In March 2018, California startup Lightning Labs announced the launch of a beta version of its software, making available what investors and project leads say is the first thoroughly tested version of the tech to date. It is still early days, however - transaction sizes are limited, and the release is aimed at developers and "advanced users".
Authored by Noelle Acheson. Lightning image via Shutterstock.

# data[].attributes.attachment_link.title
What is the Lightning Network? - CoinDesk

# data[].attributes.attachment_link.description
Last updated: 21 March, 2018 Hailed as one of the most potent solutions to cryptocurrency scaling currently under development, the lightning network effectively creates a layer on top of bitcoin, enabling fast and cheap transactions which can net settle to the bitcoin blockchain. Proposed by Thaddeus Dryja and Joseph Poon in a 2015 white paper, ...

# data[].attributes.body
15 min to read

# data[].attributes.attachment_link.description
Several applications for a Bitcoin (BTC) exchange-traded-fund (ETF) have been sent to the US Securities and Exchange Commission (SEC) for review and approval. The demand for a Bitcoin ETF in the crypto community is also increasing day by day, however, the federal watchdog has rejected many crypto ETF applications due to "significant investor protection issues" and various other regulatory concerns.

# data[].attributes.headline
Proof of Work vs Proof of Stake: Basic Mining Guide

# data[].attributes.subject
Proof of Work vs Proof of Stake: Basic Mining Guide

# data[].attributes.body
25 min to read

# data[].attributes.attachment_link.readable_text
Recently you might have heard about the idea to move from an Ethereum consensus based on the Proof of Work (PoW) system to one based on the so-called Proof of Stake.

In this article, I will explain to you the main differences between Proof of Work vs Proof of Stake and I will provide you a definition of mining, or the process new digital currencies are released through the network.

Also, what will change regarding mining techniques if the Ethereum community decides to do the transition from "work" to "stake"?

This article wants to be a basic guide to understanding the problem above.

What is the Proof of work?

First of all, let's start with basic definitions.

Proof of work is a protocol that has the main goal of cyber-attacks such as a distributed denial-of-service attack (DDoS) which has the purpose of exhausting the resources of a computer system by sending multiple fake requests.

The Proof of work concept existed even before bitcoin, but Satoshi Nakamoto applied this technique to his/her - we still don't know who Nakamoto really is - digital currency revolutionizing the way traditional transactions are set.

In fact, PoW idea was originally published by Cynthia Dwork and Moni Naor back in 1993, but the term "proof of work" was coined by Markus Jakobsson and Ari Juels in a document published in 1999.

But, returning to date, Proof of work is maybe the biggest idea behind the Nakamoto's Bitcoin white paper - published back in 2008 - because it allows trustless and distributed consensus.

What's trustless and distributed consensus?

A trustless and distributed consensus system means that if you want to send and/or receive money from someone you don't need to trust in third-party services.

When you use traditional methods of payment, you need to trust in a third party to set your transaction (e.g. Visa, Mastercard, PayPal, banks). They keep their own private register which stores transactions history and balances of each account.

The common example to better explain this behavior is the following: if Alice sent Bob $100, the trusted third-party service would debit Alice's account and credit Bob's one, so they both have to trust this third-party is to going do the right thing.

With bitcoin and a few other digital currencies, everyone has a copy of the ledger (blockchain), so no one has to trust in third parties, because anyone can directly verify the information written.

Proof of work and mining

Going deeper, proof of work is a requirement to define an expensive computer calculation, also called mining, that needs to be performed in order to create a new group of trustless transactions (the so-called block) on a distributed ledger called blockchain.

Mining serves as two purposes:

1. To verify the legitimacy of a transaction, or avoiding the so-called double-spending;

2. To create new digital currencies by rewarding miners for performing the previous task.

When you want to set a transaction this is what happens behind the scenes:

Transactions are bundled together into what we call a block;

Miners verify that transactions within each block are legitimate;

To do so, miners should solve a mathematical puzzle known as proof-of-work problem;

A reward is given to the first miner who solves each blocks problem;

Verified transactions are stored in the public blockchain

This "mathematical puzzle" has a key feature: asymmetry. The work, in fact, must be moderately hard on the requester side but easy to check for the network. This idea is also known as a CPU cost function, client puzzle, computational puzzle or CPU pricing function.

All the network miners compete to be the first to find a solution for the mathematical problem that concerns the candidate block, a problem that cannot be solved in other ways than through brute force so that essentially requires a huge number of attempts.

When a miner finally finds the right solution, he/she announces it to the whole network at the same time, receiving a cryptocurrency prize (the reward) provided by the protocol.

From a technical point of view, mining process is an operation of inverse hashing: it determines a number (nonce), so the cryptographic hash algorithm of block data results in less than a given threshold.

This threshold, called difficulty, is what determines the competitive nature of mining: more computing power is added to the network, the higher this parameter increases, increasing also the average number of calculations needed to create a new block. This method also increases the cost of the block creation, pushing miners to improve the efficiency of their mining systems to maintain a positive economic balance. This parameter update should occur approximately every 14 days, and a new block is generated every 10 minutes.

Proof of work is not only used by the bitcoin blockchain but also by ethereum and many other blockchains.

Some functions of the proof of work system are different because created specifically for each blockchain, but now I don't want to confuse your ideas with too technical data.

The important thing you need to understand is that now Ethereum developers want to turn the tables, using a new consensus system called proof of stake.

What is a proof of stake?

Proof of stake is a different way to validate transactions based and achieve the distributed consensus.

It is still an algorithm, and the purpose is the same of the proof of work, but the process to reach the goal is quite different.

Proof of stake first idea was suggested on the bitcointalk forum back in 2011, but the first digital currency to use this method was Peercoin in 2012, together with ShadowCash, Nxt, BlackCoin, NuShares/NuBits, Qora and Nav Coin.

Unlike the proof-of-Work, where the algorithm rewards miners who solve mathematical problems with the goal of validating transactions and creating new blocks, with the proof of stake, the creator of a new block is chosen in a deterministic way, depending on its wealth, also defined as stake.

No block reward

Also, all the digital currencies are previously created in the beginning, and their number never changes.

This means that in the PoS system there is no block reward, so, the miners take the transaction fees.

This is why, in fact, in this PoS system miners are called forgers, instead.

Why Ethereum wants to use PoS?

The Ethereum community and its creator, Vitalik Buterin, are planning to do a hard fork to make a transition from proof of work to proof of stake.

But why they want to switch from one to the other?

In a distributed consensus-based on the proof of Work, miners need a lot of energy. One Bitcoin transaction required the same amount of electricity as powering 1.57 American households for one day (data from 2015).

And these energy costs are paid with fiat currencies, leading to a constant downward pressure on the digital currency value.

In a recent research, experts argued that bitcoin transactions may consume as much electricity as Denmark by 2020.

Developers are pretty worried about this problem, and the Ethereum community wants to exploit the proof of stake method for a more greener and cheaper distributed form of consensus.

Also, rewards for the creation of a new block are different: with Proof-of-Work, the miner may potentially own none of the digital currency he/she is mining.

In Proof-of-Stake, forgers are always those who own the coins minted.

How are forgers selected?

If Casper (the new proof of stake consensus protocol) will be implemented, there will exist a validator pool. Users can join this pool to be selected as the forger. This process will be available through a function of calling the Casper contract and sending Ether - or the coin who powers the Ethereum network - together with it.

"You automatically get inducted after some time," explained Vitalik Buterin himself on a post shared on Reddit.

"There is no priority scheme for getting inducted into the validator pool itself; anyone can join in any round they want, irrespective of the number of other joiners," he continued.

The reward of each validator will be "somewhere around 2-15%, " but he is not sure yet.

Also, Buterin argued that there will be no imposed limit on the number of active validators (or forgers), but it will be regulated economically by cutting the interest rate if there are too many validators and increasing the reward if there are too few.

A safer system?

Any computer system wants to be free from the possibility of hacker attacks, especially if the service is related to money.

So, the main problem is: proof of stake is safer than proof of work?

Experts are worried about it, and there are several skeptics in the community.

Using a Proof-of-Work system, bad actors are cut out thanks to technological and economic disincentives.

In fact, programming an attack to a PoW network is very expensive, and you would need more money than you can be able to steal.

Instead, the underlying PoS algorithm must be as bulletproof as possible because, without especially penalties, a proof of stake-based network could be cheaper to attack.

To solve this issue, Buterin created the Casper protocol, designing an algorithm that can use the set some circumstances under which a bad validator might lose their deposit.

He explained: "Economic finality is accomplished in Casper by requiring validators to submit deposits to participate, and taking away their deposits if the protocol determines that they acted in some way that violates some set of rules ('slashing conditions')."

Slashing conditions refer to the circumstances above or laws that a user is not supposed to break.

Conclusion

Thanks to a PoS system validators do not have to use their computing power because the only factors that influence their chances are the total number of their own coins and current complexity of the network.

So this possible future switch from PoW to PoS may provide the following benefits:

1. Energy savings;

2. A safer network as attacks become more expensive: if a hacker would like to buy 51% of the total number of coins, the market reacts by fast price appreciation.

This way, CASPER will be a security deposit protocol that relies on an economic consensus system. Nodes (or the validators) must pay a security deposit in order to be part of the consensus thanks to the new blocks creation. Casper protocol will determine the specific amount of rewards received by the validators thanks to its control over security deposits.

If one validator creates an "invalid" block, his security deposit will be deleted, as well as his privilege to be part of the network consensus.

In other words, the Casper security system is based on something like bets. In a PoS-based system, bets are the transactions that, according to the consensus rules, will reward their validator with a money prize together with each chain that the validator has bet on.

So, Casper is based on the idea that validators will bet according to the others' bets and leave positive feedbacks that are able accelerates consensus.

# data[].attributes.attachment_link.title
Proof of Work vs Proof of Stake: Basic Mining Guide - Blockgeeks

# data[].attributes.attachment_link.description
Recently you might have heard about the idea to move from an Ethereum consensus based on the Proof of Work (PoW) system to one based on the so-called Proof of Stake.

# data[].attributes.headline
What is Cryptocurrency Game Theory: A Basic introduction

# data[].attributes.subject
What is Cryptocurrency Game Theory: A Basic introduction

# data[].attributes.body
60 min to read

# data[].attributes.attachment_link.readable_text
What is Cryptocurrency Game Theory? One of the greatest innovations of the 21st century is, undoubtedly, the advent of cryptocurrency.

What is that makes the blockchain technology such a breakthrough? Let's look at the real world and how fiat currency is maintained and stored. No matter who you are, your money is going to be stored in a centralized location, i.e. the bank. The problem with this model is that you are giving your money over to an entity and it is at the risk of getting compromised because of a variety of reasons. The blockchain solves this problem by being completely decentralized and corruption free internally. The way it achieves this is by the incorporation of cryptography and game theory.

What are market structures?

Image Courtesy: ThingLink

Before we understand the concept, we need to go through some basics first. The organization and fundamental characteristics of any market are called market structure. The market structures are differentiated based on many factors like a number of producers, control over prices and barriers to entry. Based on these factors, there are four different kinds of market structures:

Perfect Competition.

Monopoly.

Monopolistic Competition.

Oligopoly.

Perfect Competition
Perfect competition is a market place where it is easy for anyone to get into the market and individual sellers don't have any power over the price of the product. Think of mangoes. It is easy for anyone to get into the market, all that anyone has to do is to grow mangoes. Plus, they can't willingly change the price of the mangoes. If one person sells a mango for $10 then the buyer can simply buy it from someone who is selling mangoes for $5.
Monopoly
A monopoly is the polar opposite of a perfect competition. This is a market place which is dominated by one corporation and the barriers to entry are so high that nobody else can enter it. De beers diamonds are a great example of a monopolistic market.
Monopolistic Competition
This is a marketplace which has a lot of sellers and very low barriers. Their products are similar but not really identical. Think of the pizza delivery service. Now, dominoes and pizza hut have the same product with subtle differences. Obviously one can slightly price their product a little higher based on factors like customer preferences. However, if dominoes price their pizzas way too high, then people will simply go over to pizza hut. Consequently, if dominoes and pizza hut both start overcharging, since the barriers to entry is so low, another player can come in and take all the customers.
Oligopoly
Oligopolies are market places which are dominated by a few markets and the barriers to entry are high. One of the best examples of an oligopoly is the smartphone market. The market is dominated by few number of companies like Samsung, Apple, and Huawei. Much like monopolistic competitions, the products are similar but not identical. While this does give them some control over their prices, they don't really have much of a leeway. If tomorrow, Apple decides to price their iPhones at $4000, apart from the Apple fanatics, most will simply opt for an Android phone. Obviously, they can always get together and decide as a group to mutually increase the prices, but this is called "collusion" and is illegal in many countries, including the United States.

So, when they can't compete by changing prices, how can they get that edge over their competitors? They do so by "non-price competition", which means competing without changing the price. How do they do that? They do so by changing the look and style of their products and giving a unique experience. However, the most recognizable form of non-price competition is advertising.

Advertising is one of the most effective ways of showing unique qualities of your products and to introduce new products. But then again, there is a problem. How many of the advertisements do you watch actually stick? Chances are that you have been bombarded by tons of ads today itself, how many of them do you actually remember? If you are a player in an oligopoly and you keep blindly advertising, you are going to be spending a lot of money.

As a result of that, in order to make up all that money, you are going to invariably have to increase the price of your products. If that happens, your buyers are simply going to go to your competitors. So how do you go about this? How do you advertise your products without losing out on your customers? You will have to basically take decisions based on the actions that your competitors will take. In order to do that, you will have to use Game Theory.

What is the Game theory?

Game theory is the study of strategic decision making. This is how many corporations make decisions while keeping in mind the actions that their competitors will take. Game theory was devised by John Van Neumann and Osker Morgenstern in 1944 and was considered a breakthrough in the study of oligopoly markets.

Since then the game theory has found a life of its own and has seen widespread implementations in various other technologies and fields.
A game theory model has at least 3 components:

Players: The decision makers. Eg. The managers in the firms.

Strategies: The decisions they want to take to further their companies.

Payoff: Outcome of the strategies.

In game theory, there are two types of games.

Zero sum game: It is a game in which the gain of one player comes at the expense of another player.

Non zero sum game: A game where the gain of one player doesn't come at the expense of another player.

So, how does one apply game theory? Let's go back to what we were discussing again, should or shouldn't a company advertise a particular aspect of their product. Suppose there are two firms A and B.
The table that you see above is called a "payoff matrix". The table basically reads like this:

If Firm A and B both decide to advertise then the payoff for both of them is 4 and three respectively.

If Firm A doesn't advertise and B decides to advertise, then the payoff is 2 and 5.

If Firm A advertises and B doesn't advertise then the payoff is 5 and 1.

If both Firms A and B don't advertise then the payoff is 3 and 2.

So, what decision should both A and B take which will give them the best pay off? To solve this, we need to look at the scenario that serves both A and B.

Firstly, let's look at Firm B.

Then Firm B has a payoff of 3 if they advertise and one they don't advertise. So, obviously, their best payoff lies in advertising.

Then Firm B has a payoff of 5 if they advertise and 2 if they don't advertise. In this case their best payoff lies in advertising.

Conclusion: Regardless of what Firm A does, Firm B should advertise.

Now, let's look at Firm A.

The Firm A has a payoff of 4 if they advertise and 2 if they don't advertise. So, once again, their best payoff lies in advertising.

In this case, Firm A has a payoff of 5 if they advertise and a payoff of 3 if they don't advertise. Once again, their best payoff lies in advertising.

Conclusion: Regardless of what Firm B does, Firm A's best strategy lies in advertising.

So, in this example, for both Firm A and Firm B, their most stable state will be if they both advertise, which is:

For both Firm A and Firm B, this is their dominant strategy. A dominant strategy is the best course of action for a player regardless of what the opponent does. In this example, (4,3) is also the Nash Equilibrium.

What is Nash Equilibrium?

Image Courtesy: ICMIZER

The Nash equilibrium is a solution to a game where each player chooses their optimal strategy given the strategy was chosen by the other and they have nothing to gain by shifting their strategy. This was formulated by John F Nash who was portrayed by Russell Crowe in the movie, "A Beautiful Mind". This has humongous implications in a distributed computer system like the blockchain. In fact, the blockchain is "cheat-free" because the entire protocol is in a Nash Equilibrium. We will discuss this later, but for now, let's see the Nash Equilibrium in action in one of the most famous game theory concepts.

The Prisoner's Dilemma

Image Courtesy: "This Place" youtube channel.

Ahh.. the good old prisoner's dilemma. Chances are that if you have any idea about game theory then you must have come across this problem. Anyway, let's get right to it. Suppose Rob and Ben were caught stealing a liquor shop and during the investigation, it was discovered that both of them have committed a far more serious crime in the past, say a bank robbery. During the investigation, the cops interrogate both of them and present them with a proposition.

Proposition 1: If you both don't rat the other guy out then you will both get four years in jail.

Proposition 2: If one of you rats the other one out then the person who confessed will get 0 years while the other gets seven years.

Proposition 3: If both of you confess then you will both get two years each.

So, to put this is a pay off matrix:

Anything that is in RED is Ben's and anything in BLUE is Rob's.

So, now let's analyze.

Obviously, Rob and Ben are hardened criminals and they won't rat anyone out because there is "honor among thieves." As romantic as that notion may sound, behavioral psychology and game theory tells us otherwise. Let's look deep into it.

If they both confess, then the payoff matrix says that the outcome is (4,4). Meaning they both get 4 years each. However, that is a very unstable state because they both know that they have a better deal on the table. If they do rat the other person out, then they will have 0 years to serve. Because of this, this case is a very unstable scenario.

This is why, contrary to what pop culture tells us, in a situation like this, Nash Equilibrium happens when both of them rats the other one out. This is how Rob and Ben reach their optimal solution keeping the other's strategy in mind.

But this brings us to a problem.

What if there is a scenario where the optimal solution for both the players lies in the scenario which has bad implication towards the society? Think of this scenario where Rob and Ben are planning a bank heist. Let's make a matrix of positive payoffs that they will get in this scenario:

As you can see, in this hypothetical scenario, the best and most optimal strategy lies in both Rob and Ben stealing. While this might be good for both of them, it is not a good scenario for the society.

This is where the idea of "punishment" comes in.

What is Punishment?

The world is not necessarily a kind and fair place. Men are generally very corruptible and if not kept under check. In the real world, people will generally have a lot of opportunities to get corrupted without any consideration for the society in general. So the way we keep things like this in check is by implementing a punishment strategy.

So suppose in the example shown above we have a punishment strategy that goes like this:

"For every -0.5 of utility taken from the public a punishment factor of -7 will be given.".

In other words, every act that is considered "bad" for the society will have their payoff deduced by 7 and that will cost -0.5 in utilities for the society. Now, you may be thinking why will society do anything like that? There is a loss of utility for the society which can be money, time anything and on the other hand, the people who are committing a crime are getting a terrible punishment as well.

But the truth of the matter is that we, as a society, have always integrated this in our daily life. What adding the punishment factor does is that it reduces the payoff from "bad" activities and changes the matrix like this:

See how the payoff from the "bad" activity for deduced by a factor of 7?

As you can see, by adding the punishment factor, the Nash Equilibrium changes from something that could have been bad for the society to something that is good for the society. So it changes from, Ben and Rob doing the bank heist to Ben and Rob doing the bank heist but also facing the consequences of a punishment.

So, going back to the question, what is the incentive for a society to go through the punishment? Why will they want to waste their utilities? The way that people have answered this question is by making punishment mandatory. In, other words, if someone is a society doesn't go along with the punishment, then they themselves become criminals and are subject to punishment.

How does that apply in a civilized society? Think of a police force that is funded by tax taken from the people. In this case, we have a specialized force which will dole out the punishment and the way the society takes part in it is by paying their taxes which fund the force. If you do not pay the taxes, then you are subject to punishment as well.

Another interesting example of "punishing the non-punishable" is social ostracization. Think of a society where a person, says Max, has committed a crime. Instantly he becomes an outcast in the society. This is a scenario where everyone in that society is participating in the punishment. Now suppose, someone does mingle with Max, that person also, by association, will become "bad" and he/she, in turn, will be ostracized by the society as well.

It wouldn't be a stretch to say that this very concept is the reason why we aren't all dead right now.

The concept of Nash Equilibrium and Punishment has heavy implications in blockchain and keeping the miners honest. We will explore that in a bit. But before doing so, we must go through some more basic game theory models.

The Schelling (Focal) Point

The great economist Thomas Schelling conducted an experiment with a group of students asking them a simple question: "Tomorrow you have to meet a stranger in NYC. Where and when do you meet them?" He found out that the most common answer was, "Noon at the Grand Central Terminus." This happened because the Grand Central Terminus, for New Yorkers is a natural focal point, the focal point is also known as a "Schelling point".

So, to define a Schelling point: It is a solution that people will tend to use in the absence of communication because it feels special, relevant or natural to them.

Let's demonstrate this concept with a game. Suppose there are two prisoners kept in two different rooms and they are given a random series of numbers. Then they are told to guess the number that they another prisoner will guess, without any communication between the two. If they guess the wrong number, then they will be killed (just to up the ante).
The numbers that they are given are:

7816239, 676716313, 100000000 and 871823719.

Which number do you think they will choose?

100000000.

Why? Because it is different and special when compared with the rest of the numbers and that is why it is Schelling point. Throughout our history, human beings have unknowingly sub consciously converged in various places such as bars, churches, community centers, etc. because in a society those places are common Schelling points.

A very famous example of the Schelling point in action is a game that we hope you have never played in your life called "The Chicken Game." This is how it works, two people ride towards each other on a bike. If they collide head on, they die. However, the first person who swerves away from the incoming rider is a "chicken".

So, in this game, there are two scenarios which can end in a crash:

Image Courtesy: Mind Your Decisions blog

Case 1: Both riders head towards one another.

Case 2: One rider swerves left and the other swerves right.

Thomas Schelling gave the solution to this using the concept of focal points. He said, that the best solution to this game is to not look at the other rider in the eye (i.e. cut off communication with the other rider) but focus on one's own instincts. Since, in the United States, people drive on the right side of the road, if we let our instincts take over, we will automatically steer the bike towards the right side, because that's where our Schelling point lies.

Grim Trigger Equilibrium

In order to understand how a grim trigger equilibrium works we need to think of a scenario. Let's imagine a social situation where monarchy still exists and it is believed that kings get to rule over others because of a divine right from the Gods. However, in a society like this, if the king is killed then automatically the law of divine right disappears because it will be apparent to everyone that the king is not a divine being. What this will do is that it will open all the floodgates.

Now that it is apparent to everyone that the king is killable, it will start an endless cycle of bloody revolutions where nothing can stop from all the subsequent future kings from getting murdered. The only way to stop this vicious cycle is by NOT killing the king in the first place and to maintain the notion of "divine right". This is called a Grim Trigger Equilibrium. Think of it as a state wherein if you deviate even a little bit you are going to cause an endless cycle of recursive punishment.

Coordination Problems
Consider this matrix:
Now, if you see this matrix, there are two Nash Equilibria: (A, A) and (B, B), deviation from either of the state won't benefit them. The idea of this game is how can you convince people to go from (A, A) to (B, B)? If there are a small group of people involved then that is relatively simple, you can simply coordinate via phone or emails. But, this changes when we are talking about a huge group of people.

The fundamental difference between prisoner's dilemma and coordination problem is that in prisoner's dilemma, both the players had to choose (B, B) because that was the choice that had the most payoff even though (A, A) is a morally better solution. In Co-ordination problem, it is not about the morality or the payoff, it is the incentive for a person to go from one state to another. Why should a huge group of people change the way they do things?

A coordination game fails when an only minority of the group change their state, and the majority don't, and inversely, it is a success when a majority of the group changes their state. Let's see that with an example.

Suppose we want to change the language to a symbol based language. Eg:

Original statement: "Give me your number?"

New statement: "#?"

If only you speak using this language, it will be a failure because the majority won't understand what you are talking about and you will be shunned from conversations aka the payoff for you is very low, and you have no incentive to change.

However, if the majority of your society shifts to this language and use it exclusively, you will have to change your language otherwise you will never be able to fit in. Now the incentive for you to join is high.

Why do you think nobody speaks in ye olde English anymore? If you talk like that in your society, you will be shunned, and everyone will think "thou art a knave sirrah!"

The concept of Bounded Rationality

Imagine this scenario, Sarah goes to the grocer's shop every single day and buys an apple. She does this every single day as a ritual. However, every day she faces a situation. Every day, whenever she is in the shop, the shopkeeper leaves for 5 mins and there are no security cameras in place. She can easily shoplift an apple and nobody will get to know about it. Yet she never does that.

What Sarah does here is called "Bounded Rationality". Bounded rationality basically means that when given a choice, people will always follow a path that is simple and something they are used to. This path may not be what is best suited for them and it may not give them the highest pay offs, yet they will always follow the simplest path. The reason why Sarah chose the virtuous path of following her simple routine everyday instead of shoplifting and getting away with no repercussions is that the second scenario is a little more complex than her simple everyday routine.

Now that we have gone through some game theory models, let's see its implication in cryptocurrency and how it helps keep the system floating.

Blockchain and Cryptocurrency Game Theory

A block is a series of blocks which contains individual transactions in it. Each block also contains the hash of the previous block and this, in turn, links each subsequent block to the previous block making a chain. Hence the term, "blockchain." This is a rough visual representation of a blockchain.
Some terms:

Genesis block: The first block of the blockchain is called a "genesis" block.

Proof of work: The amount of computational work required to create the block.

Parent block: The block that immediately precedes a block is the parent block of that block. So in the diagram above, Block 50 is the parent block of Block 51.

Every block in the blockchain has a scoring function.

Score(genesis) = 0.

Score(Block) = Score (parent block) + Proof of work

The current state of the chain is the block with the highest score.
In a system based on blockchain Bitcoin there are two players:
Users, in bitcoin, have only two functions available to them:

In order to do that they need two keys, the public, and the private key. What miners do is that they authenticate the transactions AND they do the process of mining. Mining is how new blocks are discovered and added to the blockchain.

Block Mining

Through a series of computations, miners find a block and add it to the blockchain.In Ethereum, adding the block gives the miner(s) a reward of 5 ether and In bitcoin, the mining reward is 25 BTC (both as of writing). Miners have a lot of power in the blockchain system and if they do choose to cheat for their own personal gain, they can cause havoc in the system.

To mitigate that, the blockchain uses game theory mechanics to keep the system bulletproof. In order to understand how game theory keeps the miners honest, let's take a look at another peer-to-peer system which has allowed its users to, time and again, get away with cheating.

Torrenting is one most popular peer to peer systems in the world. While using torrents, users have two roles: downloading and seeding. After downloading a file, they are supposed to share it the network via a method called seeding. However, they get no compensation for seeding the said file and hence more often than not they refuse to do so. Most torrent users are "cheats" because they do not seed their files. They can get away with cheating because the system doesn't have a "punishment model" the way blockchain does.

How can miners cheat? - Cryptocurrency Game Theory

They can include an invalid transaction and give themselves extra coins.

Add blocks randomly without worrying about Proof of work.

Mine on top of invalid blocks to get more BTC.

Mine on top of a sub-optimally scoring block.

Let's take an example. Consider the block below:
The blocks in blue are the main chain. Now suppose there is a miner who, in blue block 51, spends 20 bitcoins to get 500 litecoins (hypothetically). And now he wants to create a parallel chain with a new block 51 (red), where in he never did this transaction. So, to simplify what he just did, let's do a quick recap:

In blue block 51 spends 20 bitcoins to get 500 litecoins.

Creates a new chain (fork) from block 50 and in the alternate block 51, he doesn't do the litecoin transaction.

In the end, he comes out with his original 20 BTC and 500 new litecoins.

What just happened here is called "double spending." Obviously now miners can, theoretically, mine on top of the new red chain and keep double spending and mining extra bitcoins. As you can imagine, this can destroy the bitcoin system.

So why don't miners do that? Is it because they are all good and honorable people? You can't make a system based on the morals of a person, morality is not quantifiable after all. This is where the true genius of blockchain comes in. The blockchain was designed in a way that it is a self-enforcing Nash Equilibrium. The reason why that happens is that mining has a recursive punishment system.
The Nash Equilibrium in mining and the punishment system.
If a miner creates an invalid block then others won't mine on top of it because of a rule that has been defined in blockchain mechanics. Any block that is mined on top of an invalid block becomes an invalid block. Using this rule, miners will simply ignore the invalid block and keep on mining on top of the main chain aka the blue chain in the diagram.

This similar logic stands for sub-optimally scoring block. Look at the diagram again. No miner will want to mine on Red Block 52 because the Blue Block 53 will have a higher score than the red block.

Both of these scenarios get mitigated because miners., as a group will choose the most stable state aka the state with a Nash Equilibrium. Obviously, you can make all the miners mine on the red block and make it the new blockchain, however, the number of miners is so vast that an event like that simply cannot be coordinated (we will talk about this in a bit). As the co-ordination game states, if a majority of the people in the group are not changing their state, the minority will not have any incentive to stay in the new state. Seeing this, why will a miner spend all their computation power and risk ostracization in a futile cause?
Why will users use the main chain instead of the other chain?
So, now that we have seen the reason WHY miners will prefer the blue chain...What about the users? In the blockchain game, there are two players, miners, and users. Why will users prefer the blue chain over the red chain? Once again, game theory mechanics come into play.

The first thing that you need to keep in mind is that cryptocurrency has value is because the people give it value. So, why will a normal user assign a value to coins coming out of the blue chain and not to the coins coming out of the red chain? The reason is simple. The main chain is a Schelling point from the users perspective. They give it value because the main chain seems natural and special to them.

Bounded Rationality: Another reason why users will value the main chain more is that they are simply used to it. Like bounded rationality states, people will simply opt for the simplest solution every time. Moving through a newer chain needlessly complicates things.

What is the Proof Of Work Takeover Problem?

Before we start explaining this, let's bring back our old diagram again for reference:

Vitalik Buterin gave a great example of the Takeover problem and we are going to expand on it. Suppose, someone makes a hypothetical smart contract for an activity. The terms of the contract go like this:

Any miner can join the activity by sending a very large deposit into the contract.

The miners must send shares of the partially completed blocks that they have mined into the contract and the contract verifies it and also verifies that you are a miner and that you have sufficient hash power.

Before 60% of the miners in the system join you can leave anytime you want.

After 60% of the miners join, you will be bound to the contract until the 20 blocks have been added to the hard fork chain aka the red chain.

Yes, it is indeed very diabolical and you can see the problem that this attack can have. Not only will the new chain grow bigger and longer, since 60% of the entire miners are bound contractually to this new chain this will quickly make the original older chain aka the blue chain irrelevant. This will make double spends all over the place and the value of the currency will fall fast.

Now, you might be asking why miners will join in a takeover?
Well, let's see their incentive for joining:

The possible reward at the end.

No risk of joining on their part.

What is their incentive to follow through with the contract?

The huge amount they have deposited in the beginning.

Once again, the possibility of a great reward.

Theoretically, a takeover like this can end any currency, but this is not that likely to happen because of...You guessed it.... game theory mechanics.

Grim Trigger argument to the rescue!

Think of our king argument when we first talked about grim triggers. If a king is killed and usurped, what will stop the new king from getting killed and from this becoming an endless bloody cycle? To stop this from happening, the best course of action is to not kill the original king in the first place.

Similarly, let's use this logic for blockchains. If a blockchain is taken over and destroyed and the miners are diverted into a new chain, what is stopping that new chain from being taken over by the majority anytime soon? To stop these endless hardforks (aka the red chains in the diagram) from happening, it is important that we don't do the takeover in the first place.
However, there are certain places where the Grim Trigger argument does fail, and obviously, there are places where it works pretty spectacularly:
The argument fails when the miners are not bound to singular currency. If the miners are working on several currencies, then they can simply group to take over a low-value currency.

The argument holds up if they are bound and loyal to a particular currency. After all, it is in their direct interest to uphold and maintain the value and legitimacy of the currency.

If the currency requires specialized ASICs, then the grim trigger argument holds up. If a currency can only be mined by specialized software, then miners will make sure that nothing happens to that particular currency and that it doesn't lose value. Specialized ASICs after all, can only work for a particular currency. Otherwise, it is useless. Plus, they are expensive.

The argument doesn't hold up if the currency can be mined using CPUs. CPUs are not expensive after all, and it can be used to mine other currencies.

However, if the miners who own the CPUs have a stake in the currency, the argument holds up because they don't want to lose the stake that they have invested in the currency. This is a sort of proof-of-stake.

Conclusion

As can be seen, game theory mechanics are what make blockchains so special. Nothing about the technology or mechanics is new, but it is the marriage of these two fascinating concepts that has made cryptocurrency secure from internal corruption. Even if bitcoin and Ethereum do fail for whatever reason, cryptocurrency will always live on because of this path breaking a partnership.

# data[].attributes.attachment_link.title
What is Cryptocurrency Game Theory: A Basic introduction - Blockgeeks

# data[].attributes.attachment_link.description
What is Cryptocurrency Game Theory? One of the greatest innovations of the 21st century is, undoubtedly, the advent of cryptocurrency. What is that makes the blockchain technology such a breakthrough? Let's look at the real world and how fiat currency is maintained and stored.

# data[].attributes.body
55 min to read

# data[].attributes.attachment_link.readable_text
In this guide, you will learn What are Ethereum Nodes And Sharding?

If you have been active in one form or another in cryptocurrency for the last 1 year then you would know that there has been one issue which has plagued both bitcoin and Ethereum: Scalability.

Bitcoin has somewhat addressed this issue by activating Segwit and by hard forking into Bitcoin Cash. Ethereum, however, is trying to solve this issue in a different way. One of the many protocols that they are looking to activate, as they go into the next phase of their growth, is "sharding". Before we understand what that means, we need to have a thorough understanding of networks and nodes.

What are Ethereum Nodes And Sharding?

What are nodes, networks, and parameters?

Let's understand what the concept means by using simple day-to-day activities.

(Before we begin, credit to 3dBuzz for the wonderful explanation.)

Think of a box:

This box takes in inputs, performs some sort of operations on them, and then gives an output. This box is a "node". Keep in mind, nodes are not exactly "boxes", we are just using a hypothetical case here.

A network is a collection of these nodes which are interlinked to one another.

Parameters are the rules that the nodes are bound by.

That, in essence, is what nodes and networks are. Now let's check out some simple day-to-day activities explained via nodes and networks.
Let's see how a simple paper shredder works.
So, what happened here?

You are using three nodes: The paper the shredder and the....well..." shredded stuff". These three nodes make up the "Shredding network". Let's have some more fun with this. Till now, we have assumed that nodes take in only one input. What if they take more than that?
Let's take the example of a toaster. A toaster takes in two inputs:
So this is what it will look like:

Remember one thing, a toaster can't work if even one of its inputs is missing.

Now, it's time to take it up another notch.

Let's think of a complex network, which uses parameters. Think of your television set. Your television set is connected to your service provider. Suppose you own a PS4, and because you suck at making decisions, you own an Xbox as well.

So, if we were to map out the whole "TV network", this is what it would look like:

Uh, oh.. we have a problem here.

You can only access one of those nodes via your TV. You can't really watch Game of Thrones and play Uncharted at the same time now, can you? So, how are you going to make sure that your TV can access only one node at a time? This is where you introduce the parameters. The parameters are what make your nodes unique. Suppose, you want to add a parameter to the television called "Channel Switcher". And this is what the channel switcher works like:

Just by the addition of these parameters you made your node i.e. the television unique. So, let's explore what other parameters we can give our television to make it more unique:

Size: Say, our television is a 55-inch screen.

Colour: Our TV is silvery grey in colour.

Brand: We have a Sony TV.

Type: We have a plasma screen.

Ok, so now thanks to our parameters, we have a television which is more well defined. Now we know that we have a 55 inch, silvery grey, plasma screen Sony TV.

So, from everything that we have learned so far, let's try to define what nodes, network and parameters mean.

Nodes: Individual components which take in input and performs a function on them and gives out an output.

Network: Collection of nodes which are interconnected to one another.

Parameters: Rules that define a node and make it more unique

Nodes and Network in the context of telecommunications

Our entire telecommunications system works on the basis of networks and nodes. Your internet, calls, SMSs, every single one of those work because of carefully laid out networks and nodes. So, how do you define a telecom network? According to Encyclopedia Britannica,

"Telecom network is an electronic system of links and switches, and the controls that govern their operation, that allows for data transfer and exchange among multiple users."

Why do we need a telecommunications network?

While it is possible to make one-to-one connections between individual people, it will be extremely expensive and cumbersome. Plus, it will be an extremely ineffective process because most of the communication lines will be idle and under/not utilized.

To make this process more efficient, we use a telecommunications network. So, what is the definition of a node in this context?

In this context, the node is either a redistribution point or a communications end-point.

So, let's see an example of how this works. Consider a simple GSM network. Suppose, Alice wants to send an SMS to Bob, how will the entire system work? (Shoutout to Roviell YouTube channel for the explanation).

Step 1: Alice writes the message and presses send. The message goes to the Base Station aka BST. The BST connects you to the network. There are tons of BSTs around. Think of them as waiters in a restaurant. You simply raise your hand (send an SMS) and you get their attention.

Step 2: The Base Station Controller aka BSC makes sure that the BSTs are all in order and that everything is in working condition. Using our restaurant analogy, the BSC is the "maître d'hôtel" or the head waiter who makes sure that each table is been attended to by waiters. (Remember Jean Phillippe from Hell's Kitchen? Yeah, that guy.)

Step 3: From the BSC the message now goes to the Mobile Switching Center aka MSC. It makes sure that the data moves seamlessly from the stations to the networks and vice-versa. In our restaurant analogy, the MSC are the head chefs, who take the orders and relay them to the chefs AND also put the finishing touches on the dishes before sending them out.

Step 4: Now the message gets sent to the Short Message Service Center aka SMSC. These are the chefs in the analogy. Over here, the message is saved until they get more information about the recipient. The SMSC gets help from sources like the Home Location Register (HLR) and the Visitor Location Register (VLR), these 2 are databases which contain all the information about the network. They basically help track down the sender AND the recipient to see if the message can be sent. They check whether the recipient's phone is switched off, or if it is out of coverage area etc. If for some reason the message can't be sent, then it gets stored in the SMSC for a maximum of 6 hours before it gets deleted.

Step 5: Now, if the SMS is good to go, the SMSC hands the message over to the recipient's MSC.

Step 7: The BSC forwards the message to the BST.

Step 8: The BST then finally sends the message to the recipient.

So, this is an overview of how the entire SMS system works. The BSC, BST, MSC, SMSC, HLR and VLR are all nodes in the GSM network. This is what the whole thing looks like:

What is a Peer-to-Peer Network?

A normal network structure is the "client-server " structure.

How does that work?

There is a centralized server. And everyone who wants to connect with the server can send a query to get the required information. This is pretty much how the internet works. When you want to Google something, you send a query to the Google server, which comes back with the required results. So, this is a client-server system. Now, what is the problem with this model?

Since everything is dependent on the server, it is critical for the server to be functioning at all times for the system to work. It is a bottleneck. Now suppose, for whatever reason the main server stops working, everyone in the network will be affected. Plus, there are also security concerns. Since the network is centralized, the server itself handles a lot of sensitive information regarding the clients. This means that anyone can hack the server and get those pieces of information. Plus, there is also the issue of censorship. What if the server decides that a particular item (movie, song, book etc.) is not agreeable and decides not to propagate it in their network?

So, to counter all these issues, a different kind of network architecture came about. It is a network which partitions its entire workload between participants, who are all equally privileged, called "peers". There is no longer one central server, now there are several distributed and decentralized peers. This is a peer-to-peer network.

Image Courtesy: InfoZones

Why do people use the peer-to-peer network?

One of the main uses of the peer-to-peer network is file sharing, also called torrenting. If you are to use a client-server model for downloading, then it is usually extremely slow and entirely dependent on the health of the server. Plus, like we said, it is prone to censorship.

However, in a peer-to-peer system, there is no central authority, and hence if even one of the peers in the network goes out of the race, you still have more peers to download from. Plus, it is not subject to the idealistic standards of a central system, hence it is not prone to censorship.
If we were to compare the two:
Image courtesy: Quora

The decentralized nature of a peer-to-peer system becomes critical as we move on to the next section. How critical? Well, the simple (at least on paper) idea of combining this peer-to-peer network with a payment system has completely revolutionized the finance industry by giving birth to cryptocurrency.

The use of networks and nodes in cryptocurrencies.

Let's take a look at Ethereum's network structure.

Ethereum is structured as a peer-to-peer network, such that the participants aka the peers aka the nodes are not given any extra special privileges. The idea is to create an egalitarian network. The nodes are not given any special privileges, however, their functions and degree of participation may differ. There is no centralized server/entity, nor is there any hierarchy. It is a flat topology.

All decentralized cryptocurrencies are structured like that is because of a simple reason, to stay true to their philosophy. The idea is to have a currency system, where everyone is treated as an equal and there is no governing body, which can determine the value of the currency based on a whim. This is true for both bitcoin and Ethereum.

Now, if there is no central system, how would everyone in the system get to know that a certain transaction has happened? The network follows the gossip protocol. Think of how gossip spreads. Suppose Alice sent 3 ETH to Bob. The nodes nearest to her will get to know of this, and then they will tell the nodes closest to them, and then they will tell their neighbors, and this will keep on spreading out until everyone knows. Nodes are basically your nosy, annoying relatives.

So, what is a node in the context of Ethereum? A node is simply a computer that participates in the Ethereum network. This participation can be in three ways

What is a Light Client?

As we have mentioned before, the idea of a peer-to-peer system is to distribute network responsibilities among nodes called "peers". No preference is given to any one of them. However, what about people who want to take part in the network but don't have the system resources to download and maintain the full blockchain in their system? They can choose to become "Light clients". By being a Light Client, they get high-security assurances about certain states of Ethereum and also the power to verify the execution of a transaction.

What is a Full Node?

Any computer, connected to the Ethereum network, which fully enforces all the consensus rules of Ethereum is called a Full Node. A full node downloads the entire blockchain in the user's desktop. Full nodes form the backbone of the Ethereum system and keep the entire network honest. Some of the consensus rules that full nodes enforce are:

Making sure that the correct block reward is given out for each block mined (5 ETH)

Transactions have the correct signatures

Transactions and blocks are in the correct data format

No double spending is occurring in any of the blocks

The full nodes basically validate the nodes and transactions and relay the information to the other nodes (using the gossip protocol).
Miners vs Nodes
To keep it simple, all miners are full nodes, but not all full nodes are miners. Miners need to be running full nodes to access the blockchain. Anyone who runs a full node need not mine for blocks.

What is the scalability problem that Ethereum is facing?

How does consensus happen in the Ethereum network? Each and every node in the network does every calculation, and when they all come to a consensus, the transaction is deemed good. Now, this might have worked properly, in the beginning, however, Ethereum has grown very popular and the number of transactions has been steadily increasing. Check out this graph by Etherscan:

Image Courtesy: Etherscan

Now, even though this is a good thing, the number of calculations that the networks have to go through before they can come to a consensus has increased exponentially as a result. Along with that, there is another problem that has come up. Ethereum has seen widespread adoption because of the backing by certain corporate heavyweights and the popularity of its ICOs. As a result of this, the number of nodes on the Ethereum network has increased exponentially. In fact, it is the cryptocurrency with the most nodes and hence most decentralized.

In fact, as of May 2017, Ethereum had 25,000 nodes as compared to Bitcoin's 7000!! That's more than 3 times. In fact, the number of nodes from April to May increase by 81%...that's nearly double!

Image Courtesy: Trust Nodes.

Now, you may be thinking that having more nodes in the network will help speed up the transaction time. Well... think again.

Consensus happens in a linear manner. Meaning, suppose there are 3 nodes A, B and C.

For consensus to occur, first A would do the calculations and verify and then B will do the same and then C.

However, if there is a new node in the system called "D", that would add one more node to the consensus system, which will increase the overall time period. As Ethereum has become more popular, the transaction times have gotten slower.

In fact, in a speed test, it was seen that Ethereum managed a paltry 20 transactions per second as compared to PayPal's 193 and Visa's 1667!!

Now remember one thing, Ethereum doesn't envision themselves to be just mere currency, their ultimate vision is to be something like the new internet. They want people to create DApps on the scale of Facebook and Youtube to run on top of their blockchain. In order for something like this to happen, they will need to do something about their scalability issues.

In order to address that, three proposals were raised:
Increase the block size
So, one solution is to increase the block size. While this would definitely improve the performance by increasing the number of transactions going into one block, there are several problems that can happen as a result:

Make users use different altcoins.

Another proposal was to run parallel blockchains instead of one main blockchain. Basically, instead of making 50 DApps run on one main blockchain, have 2 blockchains and run 25 DApps each. There were two problems with this proposal:

It is not wise to split up the hashrate of a chain. The hashrate of the chain after all determines how secure it is from external hackers and fast the system is.

It will be easier for malicious miners to get 51% majority on the smaller chains.

Sharding
Finally, sharding was decided as the way to go for Ethereum. Before we do a deep dive into sharding let's gain a simple understanding as to what it means. Suppose there are three nodes A, B and C and they have to verify data T. Instead of A, B and C verifying the entire data T individually, the data will be broken into 3 shards: T1, T2 and T3. After that A, B and C will verify one shard each side-by-side. As you can see the amount of time you are saving is exponential.

Anyway, let's do a deep dive!

What is sharding?

Sharding is a term that has been taken from database systems. Let's see what sharding means with respect to the database. Suppose you have a huge bulky database for your website. Having a bulky database not only makes searching for data slower, but it also hinders your scalability. So, what do you do in this case?

What if you do a horizontal partition on your data and turn them into smaller tables and store them on different database servers?

Image courtesy: Dzone

Like so?

Now, you might be asking, why a horizontal partition and not a vertical partition? That is because of the way tables are designed:

You see? It is the same table/database but with lesser data. These smaller databases are known as shards of the larger database. Each shard should be identical with the same table structure.

Sharding in the context of blockchain

Now, as we have seen, the problem with Ethereum consensus is that all the nodes need to do all the calculations and verifications for each and every transaction. This makes the whole process very slow and cumbersome. So, how is sharding going to help this?

Consider the state of the Ethereum blockchain which we shall call "Global State", which is visible to everyone. Let's consider the Merkle Root of this global state. (For Merkle trees and roots read our article on HASHING). This state root is going to be broken up into shard roots and each of these shared roots is going to have their own state. These states are going to be represented in the form of a Merkle tree.

This is a very simple structure of what that is supposed to look like.

Now, let's get into the internal mechanics.
So what happens what after sharding is activated?
In Devcon, Vitalik Buterin explained shards like this:

Imagine that Ethereum has been split into thousands of islands. Each island can do its own thing. Each of the island has its own unique features and everyone belonging on that island i.e. the accounts, can interact with each other AND they can freely indulge in all its features. If they want to contact with other islands, they will have to use some sort of protocol.

So, the question is, how is that going to change the blockchain?

What does a normal block in bitcoin or Ethereum (pre-sharding) look like?

So, there is a block header and the body which contains all the transactions in the block. The Merkle root of all the transactions will be in the block header.

Now, think about this. Did bitcoin really need blocks? Did it really need a blockchain? Satoshi could have simply made a chain of transactions by including the hash of the previous transaction in the newer transaction, making a "transaction chain" so to speak.

The reason why they arrange these transactions in a block is to create one level of interaction and make the whole process more scalable. What Ethereum suggests is that they change this into two levels of interaction.
The First Level
The first level is the transaction group. Each shard has its own group of a transaction.

Image courtesy: Hackernoon

The transaction group is divided into the transaction group header and the transaction group body.

Transaction Group Header

The header is divided into distinct left and right parts.
The Left Part:

Shard ID: The ID of the shard that the transaction group belongs to.

Pre-state root: This the state of the root of shard 43 before the transactions were applied.

Post state root: This is the state of the root of shard 43 after the transactions are applied.

Receipt root: The receipt root after all the transactions in shard 43 are applied.

The Right Part:
The right part is full of random validators who need to verify the transactions in the shard itself. They are all randomly chosen.

Transaction Group Body

It has all the transaction IDs in the shard itself.

Properties of Level One

Every transaction specifies the ID of the shard it belongs to.

A transaction belonging to a particular shard shows that it has occurred between two accounts which are native to that particular shard.

Transaction group has transactions which belong to only that shard ID and are unique to it.

Specifies the pre and post state root.

Now, let's look at the top level aka the second level.
The Second Level
Image courtesy: Hackernoon.

Don't be scared! It is easier to understand than it looks.

There is the normal blockchain, but now it contains two primary roots:

The state root

The transaction group root

The state root represents the entire state, and as we have seen before, the state is broken down into shards, which contain their own substates.

The transaction group root contains all the transaction groups inside that particular block.
Properties Of Level Two

Level two is like a simple blockchain, which accepts transaction groups rather than transactions.

Transaction group is valid only if:a) Pre-state root matches the shard root in the global state.
b) The signatures in the transaction group are all validated.

If the transaction group gets in, then the global state root becomes the post-state root of that particular shard ID.

So how does cross-shard communication happen?

Now, remember our island analogy?

The shards are basically like islands. So how do these islands communicate with each other? Remember, the purpose of shards is to make lots of parallel transactions happen at the same time to increase performance. If Ethereum allows random cross-shard communication, then that defeats the entire purpose of sharding.

So what protocol needs to be followed for cross-shard communication?

Ethereum chose to follow the receipt paradigm for cross-shard communications. Check this out:

Image courtesy: hackernoon

As you can see here, each individual receipt of any transaction can be easily accessed via multiple Merkle trees from the transaction group Merkle root. Every transaction in a shard will do two things:

Change the state of the shard it belongs to

Generate a receipt

Here is another interesting piece of information. The receipts are stored in a distributed shared memory, which can be seen by other shards but not modified. Hence, the cross-shard communication can happen via the receipts like this:

Image courtesy: Hackernoon
What are the challenges of implementing sharding?
Conclusion

As Ethereum expands and ushers in Metropolis and Serenity, sharding becomes more and more critical to their growth. If Ethereum does plan on becoming the new internet, they need to fix their scalability issues. They absolutely need to implement and nail sharding to ensure their growth. Exciting times lie ahead for Ethereum!

# data[].attributes.attachment_link.title
What are Ethereum Nodes And Sharding? - Blockgeeks

# data[].attributes.attachment_link.description
In this guide, you will learn What are Ethereum Nodes And Sharding? If you have been active in one form or another in cryptocurrency for the last 1 year then you would know that there has been one issue which has plagued both bitcoin and Ethereum: Scalability.

# data[].attributes.headline
Basic Primer: Blockchain Consensus Protocol

# data[].attributes.subject
Basic Primer: Blockchain Consensus Protocol

# data[].attributes.body
50 min to read

# data[].attributes.attachment_link.readable_text
Basic Primer: Blockchain Consensus Protocol guide. A blockchain is a decentralized peer-to-peer system with no central authority figure. While this creates a system that is devoid of corruption from a single source, it still creates a major problem.

How are any decisions made?

How does anything get done?

Think of a normal centralized organization.

All the decisions are taken by the leader or a board of decision makers. This isn't possible in a blockchain because a blockchain has no "leader". For the blockchain to make decisions, they need to come to a consensus using "consensus mechanisms".

So, how do these consensus mechanisms work and why did we need them? What are some of the consensus mechanisms used in cryptocurrencies?

We will answer these questions in this guide. Basic Primer: Blockchain Consensus Protocol
What are consensus mechanisms?
This is how Wikipedia defines consensus decision-making:

"Consensus decision-making is a group decision-making process in which group members develop, and agree to support a decision in the best interest of the whole. Consensus may be defined professionally as an acceptable resolution, one that can be supported, even if not the "favourite" of each individual. Consensus is defined by Merriam-Webster as, first, general agreement, and second, group solidarity of belief or sentiment."

In simpler terms, consensus is a dynamic way of reaching agreement in a group. While voting just settles for a majority rule without any thought for the feelings and well-being of the minority, a consensus on the other hand makes sure that an agreement is reached which could benefit the entire group as a whole.

From a more idealistic point-of-view, Consensus can be used by a group of people scattered around the world to create a more equal and fair society.

A method by which consensus decision-making is achieved is called "consensus mechanism".

So now what we have defined what a consensus is, let's look at what the objectives of a consensus mechanism are (data taken from Wikipedia).

Agreement Seeking: A consensus mechanism should bring about as much agreement from the group as possible.

Collaborative: All the participants should aim to work together to achieve a result that puts the best interest of the group first.

Cooperative: All the participants shouldn't put their own interests first and work as a team more than individuals.

Egalitarian: A group trying to achieve consensus should be as egalitarian as possible. What this basically means that each and every vote has equal weightage. One person's vote can't be more important than another's.

Inclusive: As many people as possible should be involved in the consensus process. It shouldn't be like normal voting where people don't really feel like voting because they believe that their vote won't have any weightage in the long run.

Participatory: The consensus mechanism should be such that everyone should actively participate in the the overall process.

Now that we have defined what consensus mechanisms are and what they should aim for, we need to think of the other elephant in the room.

Which consensus mechanisms should be used for an entity like blockchain.

Before bitcoin, there were loads of iterations of peer-to-peer decentralized currency systems which failed because they were unable to answer the biggest problem when it came to reaching a consensus. This problem is called " Byzantine Generals Problem ".

What is the Byzantine Generals Problem?

Image Courtesy: Medium

Ok so imagine that there is a group of Byzantine generals and they want to attack a city. They are facing two very distinct problems:

The generals and their armies are very far apart so centralized authority is impossible, which makes coordinated attack very tough.

The city has a huge army and the only way that they can win is if they all attack at once.

In order to make successful coordination the armies on the left of the castle send a messenger to the armies on the right of the castle with a message that says "ATTACK WEDNESDAY." However, suppose the armies on the right are not prepared for the attack and say, "NO. ATTACK FRIDAY" and send back the messenger through the city back to the armies on the left.

This is where we face a problem.

A number of things can happen to the poor messenger. He could get captured, compromised, killed and replaced with another messenger by the city. This would lead to the armies getting tampered information which may result in an uncoordinated attack and defeat.

This has clear references to blockchain as well. The chain is a huge network; how can you possibly trust them? If you were sending someone 4 Ether from your wallet, how would you know for sure that someone in the network isn't going to tamper with it and change 4 to 40 Ether?

What these generals need, is a consensus mechanism which can make sure that their army can actually attack as a unit despite all these setbacks.

We are now going to go through a list of consensus mechanisms which can solve the Byzantine Generals problem.

#1 Proof Of Work

Satoshi Nakamoto, Bitcoin's creator, was able to bypass the problem by inventing the proof of work protocol.

First let's see how it work in context of the Byzantine Generals problem.

Suppose the army on the left want to send a message called "ATTACK MONDAY" to the army on the right, they are going to follow certain steps.

Firstly, they will append a "nonce" to the original text. The nonce can be any random hexadecimal value.

After that, they hash the text appended with a nonce and see the result. Suppose, hypothetically speaking, the armies have decided to only share messages which, on hashing, gives a result which starts with 5 zeroes.

If the hash conditions are satisfied, they will send the messenger with the hash of the message. If not, then they will keep on changing the value of the nonce randomly until they get the desired result. This action is extremely tedious and time consuming and takes a lot of computation power.

If the messenger does get caught by the city and the message is tampered with, according to hash function properties, the hash itself will get drastically changed. If the generals on the right side, see that the hashed message is not starting with the required amount of 0s then they can simply call off the attack.

However, there is a possible loophole.

No hash function is 100% collision free. So what if the city gets the message, tampers with it and then accordingly change the nonce until they get the desired result which has the required number of 0s? This will be extremely time consuming but it is still possible. To counter this, the generals are going to use strength in numbers.

Suppose, instead of just one general on the left sending messages to one general on the right, there are 3 generals on the left who have to send a message to the ones on the right. In order to do that, they can make their own message and then hash the cumulative message and then append a nonce to the resulting hash and hash it again. This time, they want a message which starts with six 0s.

Obviously, this is going to be extremely time consuming, but this time, if the messenger does get caught by the city, the amount of time that they will take to tamper the cumulative message and then find the corresponding nonce for the hash will be infinitely more. It may even take years. So, eg. if instead of one messenger, the generals send multiple messengers, by the time the city is even halfway through the computation process they will get attacked and destroyed.

The generals on the right have it pretty easy. All they have to do is to append the message with the correct nonce that will be given to them, hash them, and see whether the hash matches or not. Hashing a string is very easy to do. That in essence is the process behind proof-of-work.

The process behind finding the nonce for the appropriate hash target should be extremely difficult and time consuming.

However, the process of checking the result to see if no malpractice has been committed should be very simple.

So, if we are to summarize how Proof Of Work Protocol works with the blockchain.

The miners solve cryptographic puzzles to "mine" a block in order to add to the blockchain.

This process requires immense amount of energy and computational usage. The puzzles have been designed in a way which makes it hard and taxing on the system.

When a miner solves the puzzle, they present their block to the network for verification.

Verifying whether the block belongs to the chain or not is an extremely simple process.

The proof-of-work mechanism definitely answered a lot of questions when it came to solving the Byzantine General's Problem, but unfortunately there are some issues with proof-of-work.

First and foremost, proof of work is an extremely inefficient process because of the sheer amount of power and energy that it eats up.

People and organizations that can afford faster and more powerful ASICs usually have better chance of mining than the others.

As a result of this, bitcoin isn't as decentralized as it wants to be. Let's check the hashrate distribution graph: Image Credit: Blockchain.info

As you can see, ~65% of the hashrate is divided among 5 mining pools alone!

Theoretically speaking, these big mining pools can simply team up with each other and launch a 51% on the bitcoin network.
Notable Crypto That Uses This Protocol: Bitcoin
#2 Proof Of Stake

Ethereum is soon planning to move on from Proof of Work (POW) to Proof of Stake (POS).

Proof of stake will make the entire mining process virtual and replace miners with validators.

This is how the process will work:

The validators will have to lock up some of their coins as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

As you can see, the POS protocol is a lot more resource-friendly than POW. In POW you NEED to waste a lot of resources to go along with the protocol, it is basically resource wastage for the sake of resource wastage.
The Biggest Roadblock to Proof of Stake
Ethereum developers always planned to eventually move on to proof of stake, that was always their plan. However, before they could do so, they had to address one of the biggest flaws of proof of stake(POS).
Consider this scenario for a moment:
Suppose we have a situation like the one above. There is a main blue chain and a red chain which sort of branches from the main itself. What is there to stop a malicious miner from mining on the red blocks and force a hardfork?

In a proof-of-work(POW) system, this risk can be mitigated.

Suppose malicious miner Alice wants to mine on the red chain. Even if she dedicates all of her hash power to it, she won't get any other miner to join her on the new chain. Everyone else will still continue to mine on the blue chain, because it is more profitable and risk-free to mine on the longer chain.

Now remember, POW is extremely expensive resource-wise.

It makes no sense for a miner to waste so much resource on a block that will be rejected by the network anyway. Hence chain splits are avoided in a proof of work system because of the amount of money that the attacker will have to waste.

However, things look a little different when you bring in POS.

If you are a validator, then you can simply put your money in both the red chain and blue chain without any fear of repercussion at all. No matter what happens, you will always win and have nothing to lose, despite how malicious your actions maybe.

This is called the "Nothing at Stake" problem.

In order to incorporate the POS consensus system, cryptocurrencies need to address this issue and Ethereum is going to do this in a very interesting way by adapting their Casper protocol.

Casper is the POS protocol that Ethereum has chosen to go with. While there has been an entire team busy creating it, Vlad Zamfir is often credited as being the "Face of Casper".

Image Credit: Blocknomi.

So how is Casper different from other Proof of Stake protocols?

Casper has implemented a process by which they can punish all malicious elements. This is how POS under Casper would work:

The validators stake a portion of their Ethers as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

However, if a validator acts in a malicious manner and tries to do a "nothing at stake", they will immediately be reprimanded and all of their stake is going to get slashed.

As you can see, Casper is deigned to work in a trustless system and be more Byzantine Fault Tolerant.

Anyone who acts in a malicious/Byzantine manner will get immediately punished by having their stake slashed off. This is where it differs from most other POS protocols. Malicious elements have something to lose so it is impossible for there to be nothing at stake.

Flawlessly implementing Casper and Proof Of Stake will be critical if Ethereum plans to scale up.
Notable Crypto That Uses This Protocol: Ethereum (in the near future)
#3 Delegated Proof Of Stake

Now we come to an interesting form of Proof Of Stake called DPOS or Delegated Proof Of Stake. EOS is using this consensus mechanism to scale up to millions of transactions per second.

If they can actually pull it off, then they will have DPOS to thank.

Firstly, anyone who holds tokens on a blockchain integrated in the EOS software can select the block producers through a continuous approval voting system. Anyone can participate in the block producer election and they will be given an opportunity to produce blocks proportional to the total votes they receive relative to all other producers.

How does it work?

Blocks are produced in the rounds of 21.

At the start of every round 21 block producers are chosen. Top 20 are automatically chosen while the 21st one is chosen proportional to the number of their votes relative to the other producers.

The producers are then shuffled around using a pseudorandom number derived from the block time. This is done to ensure that a balance connectivity to all other producers is maintained.

To ensure that regular block production is maintained and that block time is kept to 3 seconds, producers are punished for not participating by being removed from consideration. A producer has to produce at least one block every 24 hours to be in consideration.

The DPOS system doesn't experience a fork because instead of competing to find blocks, the producers will have to co-operate instead. In the event of a fork, the consensus switches automatically to the longest chain.

Confirming Transactions in DPOS?

A DPOS blockchain typically has 100% block producer participation. A transaction is usually confirmed within 1.5 seconds from the time of broadcast by a 99.9% certainty. In order to have absolute certainty over the validity of a transaction, a node need only to wait for 15/21 (i.e. a 2/3 majority) producers to arrive to a consensus.

So what happens in the event of a fork caused by negligence or malicious intent?

All the nodes will, by default, not switch to a fork which doesn't include any blocks not finalized by 15/21 producers. This will stand true regardless of chain length. Each block must gain a 15/21 approval to be considered a part of the chain.

Because of the short block creation time, it is possible to warn nodes of whether they are in the major or minor chain within 9 seconds. The reason why that is so is simple. Remember, the average time elapsed between each block is 3 seconds.

If a node misses 2 consecutive blocks there is a 95% chance that they in a minority fork.

If a node misses 3 blocks, then there is a 99% chance of them being on a minority chain.

What is TAPOS?

Transaction As Proof Of Stake or TAPOS is a feature of the EOS software. Every transaction in the system is required to have the hash of the recent block header. This does the following:

Prevent transaction replay on different chains.

Signaling the network that a user and their stake is on a particular fork.

This prevents validators from acting maliciously on other chains.

Ok, so that sounds pretty fascinating.

You have a Proof-of-stake protocol which is fast and efficient.

Where is the catch?

For that, let's bring in the insights of Ethereum co-founder Vitalik Buterin. According to him, the DPOS system fails the co-ordination game.

What is Co-ordination game theory?
Consider this matrix:

Now, if you see this matrix, there are two Nash Equilibria: (A,A) and (B,B), deviation from either of the state won't benefit them. The idea of this game is how can you convince people to go from (A,A) to (B,B)? If there are a small group of people involved then that is relatively simple, you can simply coordinate via phone or emails. But, this changes when we are talking about a huge group of people.

The fundamental difference between prisoner's dilemma and co-ordination problem is that in prisoner's dilemma, both the players had to choose (B,B) because that was the choice that had the most payoff even though (A,A) is a morally better solution. In Co-ordination problem, it is not about the morality or the payoff, it is about the incentive for a person to go from one state to another. Why should a huge group of people change the way they do things?

A co-ordination game fails when only minority of the group change their state and the majority don't and inversely, it is a success when majority of the group changes their state. Let's see that with an example.

Suppose we want to change the language to a symbol based language. Eg:

Original statement: "Give me your number?"

New statement: "#?"

If only you speak using this language, it will be a failure because the majority won't understand what you are talking about and you will be shunned from conversations aka the payoff for you is very low and you have no incentive to change.

However, if the majority of your society shifts to this language and use it exclusively, you will have to change your language otherwise you will never be able to fit in. Now the incentive for you to join is high.

The DPOS system could use the co-ordination game theory to its disadvantage. There could be a scenario where a certain situation is favoured by the block producers which are not in accordance with the the rest of the nodes.

Suppose the master nodes want to transition the chain from state A to state B. It could be a very hard task for them to help the entire chain do the same transition along with them especially if the other nodes are opposed to state B.

Only time will tell if EOS can properly and flawlessly integrate DPOS or not.

Notable Crypto That Uses This Protocol: EOS

#4 Delegated Byzantine Fault Tolerance (dBFT)

Now we come to Consensus mechanism of choice for NEO.

Imagine that there is a country "Blockgeeks" and this country has a lot of citizens. Each of these citizens would elect a Delegate to represent them and to make them happy. The job of these delegates is to pass laws that will make the citizens happy, if they are not good at their job then the citizens can simply vote for another delegate the next time.
So how do the delegates pass laws?
One of the delegates is randomly chosen as a speaker.

The Speaker then look at all the demands of the citizens and creates a law. They then calculate a "Happiness Factor" of these laws to see if the number is enough to satisfy the citizen's needs or not. They then pass that down to the delegates.

The delegates then individually check the Speaker's calculations. If the the speaker's number matches the Delegate's then they give their approval, if not then they give their disapproval.

66% of the delegates need to give their approval for the law to pass. If the majority is not sealed, then a new leader is chosen and the process starts again.

So, let's see how this applies in the blockchain.

The citizens are whoever owns NEO tokens aka ordinary nodes.

Delegates are the bookkeeping nodes. In order to be a bookkeeping node you need to satisfy a certain amount of qualifications: having special equipment, dedicated internet connections and a certain amount of GAS (1000 according to basiccrypto's article).

The "demands of the citizens" are basically the various transactions made by the token holders.

The "law" is the current block that is to be added to the blockchain.

The "happiness factor" is the hash of the current block.

Now, there are two cases where the one of the participants may act in a malicious manner. Let's check it out:
Case #1: The Speaker is malicious
Image credit: basiccrypto Steemit article

In this case, the speaker has sent a malicious message B to two delegates and an accurate message to one. This scenario can be easily mitigated because of the majority rule. The two delegates will see that their hash is not matching up with that of the speaker while one delegate will see that their hash matches up perfectly. However, 2 out of 3 will disapprove the proposal and consensus won't be reached. The speaker will henceforth be removed.
Case 2: One of the delegates is malicious
Image credit: basiccrypto Steemit article

The speaker sends the correct message to all the delegates, however one of the delegates decides to act in a malicious manner and declares that their number isn't matching up with the speaker's.

However, since 2 out of the 3 delegates are non-malicious, they will approve the law which will then be passed since a 66% consensus has been reached.

So as can be seen, dBFT presents a very interesting form of consensus mechanism.
Notable Crypto That Uses This Protocol: NEO
These are 4 of the most common consensus mechanisms that are used in cryptocurrencies. However, there are some more that you can checkout which provide interesting alternatives. They are:

Proof Of Activity.

Proof Of Burn.

Proof Of Elapsed Time.

Proof Of Capacity.

Conclusion: Basic Primer: Blockchain Consensus Protocol

Without consensus mechanisms we wouldn't have a Byzantine Fault Tolerant decentralized peer-to-peer system.

It is as simple as that. While, proof of work and proof of stake are definitely the more popular choices, there are newer mechanisms coming up every now and then. There is no "perfect" consensus mechanism, and chances are that there never will be, but it is interesting to see these newer cryptocurrencies coming out with their own protocols.

# data[].attributes.attachment_link.title
Basic Primer: Blockchain Consensus Protocol - Blockgeeks

# data[].attributes.attachment_link.description
Basic Primer: Blockchain Consensus Protocol guide. A blockchain is a decentralized peer-to-peer system with no central authority figure. While this creates a system that is devoid of corruption from a single source, it still creates a major problem. How are any decisions made? How does anything get done?

# data[].attributes.headline
What is Ethereum Gas: Step-By-Step Guide

# data[].attributes.subject
What is Ethereum Gas: Step-By-Step Guide

# data[].attributes.body
45 min to read

# data[].attributes.attachment_link.readable_text
Ethereum Gas - is the lifeblood of the Ethereum ecosystem, there is no other way of putting that. Gas is a unit that measures the amount of computational effort that it will take to execute certain operations.

Every single operation that takes part in Ethereum, be it a simple transaction, or a smart contract, or even an ICO takes some amount of gas. Gas is what is used to calculate the amount of fees that need to be paid to the network in order to execute an operation.

In this guide, we are going to understand how gas works. But before we do so, there are several concepts that we must learn. So, without further ado, let's begin our deep dive on Ethereum Gas.

What is Ethereum Gas: Step-By-Step Guide

Bitcoin, Ethereum, and the Advent of Smart Contracts

Bitcoin was created because everyone was asking the same questions.

Will it be possible to create a form of money which can be transferred between two people without any middleman?

Will it be possible to create a decentralized money which can function on something like the blockchain?

Satoshi Nakamoto answered these questions when he created bitcoin. We finally had a decentralized monetary system which can transfer money from one person to another.

However, there was a problem with bitcoin which is a problem with all first generation blockchains. They only allowed for monetary transactions, there was no way to add conditions to those transactions.

Alice can send Bob 5 BTC, but she couldn't impose conditions on those transactions. Eg. She couldn't tell Bob that he will get the money only if he performed certain tasks.

These conditions would need extremely complicated scripting. Something was required to make the process more seamless.

...And that "something" was a smart contract.

What is a smart contract?

Smart contracts help you exchange money, property, shares, or anything of value in a transparent, conflict-free way while avoiding the services of a middleman.

Vitalik Buterin's Ethereum is easily the stalwart of this generation. They showed the world how the blockchain can evolve from a simple payment mechanism to something far more meaningful and powerful.
So, what are these "smart contracts" and what's the big deal?
Smart contracts are automated contracts. They are self-executing with specific instructions written in its code which get executed when certain conditions are made.

You can learn more about smart contracts in our in-depth guide here.

Smart contracts are how things get done in the Ethereum ecosystem. When someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people.

Smart contracts are a series of instructions, written using the programming language " solidity", which works on the basis of the IFTTT logic aka the IF-THIS-THEN-THAT logic. Basically, if the first set of instructions are done then execute the next function and after that the next and keep on repeating until you reach the end of the contract.

The best way to understand that is by imagining a vending machine. Each and every step that you take acts like a trigger for the next step to execute itself. It is kinda like the domino effect. So, let's examine the steps that you will take while interacting with the vending machine:

Step 1: You give the vending machine some money.

Step 2: You punch in the button corresponding to the item that you want.

Step 3: The item comes out and you collect it.

Now look at all those steps and think about it. Will any of the steps work if the previous one wasn't executed? Each and every one of those steps is directly related to the previous step. There is one more factor to think about, and it is an integral part of smart contracts. You see, in your entire interaction with the vending machine, you (the requestor) were solely working with the machine (the provider). There were absolutely no third parties involved.

So, now how would this transaction have looked like if it happened in the Ethereum network?

Suppose you just bought something from a vending machine in the Ethereum network, how will the steps look like then?

Step 1: You give the vending machine some money and this gets recorded by all the nodes in the Ethereum network and the transaction gets updated in the ledger.

Step 2: You punch in the button corresponding to the item that you want and record of that gets updated in the Ethereum network and ledger.

Step 3: The item comes out and you collect it and this gets recorded by all the nodes and the ledger.

Every transaction that you do through the smart contracts will get recorded and updated by the network. What this does is that it keeps everyone involved with the contract accountable for their actions. It takes away human malice by making every action taken visible to the entire network

What is the Ethereum Virtual Machine?

Before we understand what the Ethereum Virtual Machine (EVM) is, we must understand why a "Virtual Machine" is needed.

So let's go back to smart contracts.

What are the desirable properties that we want in our smart contract?

Anything that runs on a blockchain needs to be immutable and must have the ability to run through multiple nodes without compromising on its integrity. As a result of which, smart contract functionality needs to be three things:

Feature #1: Deterministic

A program is deterministic if it gives the same output to a given input every single time. Eg. If 3+1 = 4 then 3+1 will ALWAYS be 4 (assuming the same base). So when a program gives the same output to the same set of inputs in different computers, the program is called deterministic.

There are various moments when a program can act in an un-deterministic manner:

Calling un-deterministic system functions: When a programmer calls an un-deterministic function in their program.

Un-deterministic data resources: If a program acquires data during runtime and that data source is un-deterministic then the program becomes un-deterministic. Eg. Suppose a program that acquires the top 10 google searches of a particular query. The list may keep changing.

Dynamic Calls: When a program calls the second program it is called dynamic calling. Since the call target is determined only during execution, it is un-deterministic in nature.

Feature #2: Terminable

In mathematical logic, we have an error called "halting problem". Basically, it states that there is an inability to know whether or not a given program can execute its function in a time limit. In 1936, Alan Turing deduced, using Cantor's Diagonal Problem, that there is no way to know whether a given program can finish in a time limit or not.

This is obviously a problem with smart contracts because, contracts by definition, must be capable of termination in a given time limit. There are some measures taken to ensure that there is a way to externally "kill" the contract and to not enter into an endless loop which will drain resources:

Turing Incompleteness: A Turing Incomplete blockchain will have limited functionality and not be capable of making jumps and/or loops. Hence they can't enter an endless loop.

Step and Fee Meter: A program can simply keep track of the number "steps" it has taken, i.e. the number of instructions it has executed, and then terminate once a particular step count has been executed.Another method is the Fee meter. Here the contracts are executed with a pre-paid fee. Every instruction execution requires a particular amount of fee. If the fee spent exceeds the pre-paid fee then the contract is terminated.

Timer: Here a pre-determined timer is kept. If the contract execution exceeds the time-limit then it is externally aborted.

Feature #3: Isolated

In a blockchain, anyone and everyone can upload a smart contract. However, because of this the contracts may, knowingly and unknowingly contain virus and bugs.

If the contract is not isolated, this may hamper the whole system. Hence, it is critical for a contract to be kept isolated in a sandbox to save the entire ecosystem from any negative effects.

Now that we have seen these features, it is important to know how they are executed. Usually, the smart contracts are run using one of the two systems:

Virtual Machines: Ethereum uses this.

Docker: Fabric uses this.

Let's compare these two and determine which makes for a better ecosystem. For simplicity's sake, we are going to compare Ethereum (Virtual Machine) to Fabric (Docker).

So, as can be seen, Virtual Machines provide better Deterministic, terminable and isolated environment for the Smart contracts. However, dockers have one distinct advantage. They provide coding language flexibility while in a Virtual Machine (VM) like Ethereum, one needs to learn a whole new language (solidity) to create smart contracts.

The EVM is the virtual machine in which all the smart contracts function in Ethereum. It is a simple yet powerful Turing Complete 256-bit virtual machine. Turing Complete means that given the resources and memory, any program executed in the EVM can solve any problem.

What is Ethereum Gas?

As explained in the introduction, Gas is a unit that measures the amount of computational effort that it will take to execute certain operations.

Note: Before we continue, huge shoutout to Joseph Chow for his amazing presentation on Ethereum gas.

Most of the smart contracts that run in the EVM are coded using Solidity (Ethereum is planning to move on to Viper from Solidity in the future). Each and every line of code in Solidity requires a certain amount of gas to be executed.

The image below has been taken from the Ethereum Yellowpaper and can be used to gain a rough idea of how much specific instructions cost gas-wise. Every transaction requires at least 21,000 gas according to this table:

Image Courtesy: Ethereum Yellow Paper

To better understand how gas works in Ethereum, let's use an analogy. Suppose you are going on a road trip. Before you do so you go through these steps:

You go to the gas station and specify how much gas you want to fill up in your car.

You get that gas filled up in your car.

You pay the gas station the amount of money you owe them for the gas.

Now, let's draw parallels with Ethereum.

Driving the car is the operation that you want to execute, like executing a function of a smart contract.

The gas is well....gas.

The gas station is your miner.

The money that you paid them is the miner fees.

All the operations that users want to execute in ethereum must provide gas for the following:

To cover its data aka intrinsic gas.

To cover its entire computation.

Now that we have covered the bare basics, you maybe asking the following question.

Why do we have this Gas system?

The answer is simple...incentivization.

Like any proof-of-work peer-to-peer system, Ethereum is heavily dependent on the hashrate of their miners. More the miners, more the hashrate, more secure and fast the system.

In order to attract more miners into the system, they need to make the system as profitable and alluring as possible for the miners. In Ethereum, there are two ways that miners can earn money:

By mining blocks and getting block rewards.

By becoming temporary dictators of their mined blocks.

Let's explore the second point.

The miners are responsible for putting transactions inside their blocks. In order to do so, they must use their computational power to validate smart contracts. The gas system allows them to charge a certain fee for doing so.

This fee is known as the miner's fee and it helps incentivize them enough to take part actively in the ecosystem.

So, how much fees can they charge? Before we can calculate that let's understand how we measure gas.

Gas is simply measured in units of gas. A transaction sent to the Ethereum network costs some discrete amount of gas (e.g. 100 gas) depending on how many EVM instructions need to be executed.

So, how do we convert the gas into Ether?

There is no fixed price of conversion. It is up to the sender of a transaction to specify any gas price they like. On the other side, it is up to the miner to verify any transactions they like (usually ones that specify the highest gas price). The average gas price is typically on the order of about 20 Gwei (or 0.00000002 ETH), but can increase during times of high network traffic as there are more transactions competing to be included in the next block.

The following chart shows you the average Ethereum gas price chart.

Image courtesy: Etherscan.

Before we go any further, it is important to know the concept of gas limit.

What is Ethereum Gas Limit?

In order to get an operation done in Ethereum, the sender of the transaction must specify a gas limit before they submit it to the network. The gas limit is the maximum amount of gas the sender is willing to pay for this transaction.

When specifying a gas limit, the following points must be considered:

Different operations will have different gas costs (as has been shown before).

The miners will stop executing the moment the gas runs out.

If there is any gas left over, it will be immediately refunded to the operation generator.

Let's see this in operation in a hypothetical scenario.

Suppose, we are adding two numbers and for that the contract must do the following actions:

Storing 10 in a variable. Let's say this operation costs 45 gas.

Adding two variables, let's say this costs 10 gas.

Storing the result which again costs 45 gas.

Suppose the sender specifies a gas limit of 120 gas.

The total gas used by the miner to run the computation is (45+10+45) = 100 gas.

The fee that is owed to the miner, assuming 1 gas costs 20 Gwei, is (100 * 20 Gwei) = 0.000002 ETH.
Now, how much gas is left over?
120 - 100 = 20 gas.

The 20 unused gas is returned back to the sender (20 * 20 Gwei) = 0.0000004 ETH.

So, having said that, there are two scenarios that one must consider:

The specified gas limit is too low.

The specified gas limit is too high.

Scenario #1: The Gas Limit is too low

If an operation runs out of gas, then it is reverted back to its original state like nothing actually happened, however, the operation generator must STILL pay the miners the fee for their computational costs and the operation gets added to the blockchain (even if it has not been executed).

Going back to our road trip analogy, if you haven't filled up enough gas in your car, then you will not be able to reach your destination, but even then you paid the gas station the money for the fuel right?

Let's see how this works in our hypothetical smart contract. The steps were:

Storing 10 in a variable. Let's say this operation costs 45 gas.

Adding two variables, let's say this costs 10 gas.

Storing the result which again costs 45 gas.

However, this time, the sender sets a gas limit of 90 gas.

Now, we know that the gas that will be required for fulfilling the transaction is 100 gas, but we only specified 90 gas limit.

In this scenario, the miner will do 90 gas worth of computation and then charge the sender fees for the 90 gas which turns out to be (90 * 20 Gwei) = 0.0000018 ETH.

Also, the contract reverts back to its original state and the transaction is included in the blockchain.

Scenario #2: The Gas Limit is too high

So, what if we set the gas limit too high?

That would make sense to do right? Afterall, whatever is leftover gets refunded to the sender right?

That sounds good on paper but it doesn't really work that well in reality.

Miners are limited by the block gas limit, which we'll suppose is 6,700,000 gas. A basic transaction (simple transfer of ETH) has at least a gas requirement of 21,000 gas. Miners can only include transactions which add up to be less than or equal to the block gas limit.

Image courtesy: Hackernoon

Suppose there is a transaction A (which does a simple transfer of ETH) and has a specified gas limit of 42,000 and two transactions B and C (also simple transfers of ETH) which have specified gas limits of 21,000.

Which will make more sense for a miner to put in their block?

Will they put in transaction A and refund back a huge amount of unused gas?

Or will they put transactions B and C and refund little to nothing back?

The second point makes more sense to them economically right?

This is precisely why having a bloated gas limit is not the sensible way to go. It is more reasonable to set a gas limit which is just a little higher than the required amount of gas for your transaction.
The following is the average gas limit chart.
Image Courtesy: Etherscan

High and Low Gas vs High and Low Fee

It should be clear to you so far that gas and ether are not the same things. Gas is the amount of computational power required while ether is the currency used to pay for that gas.

Now with the knowledge of everything we have obtained so far, let's go through certain gas and fees scenarios.

If an operation has LOW gas, then the miners won't even pick it up because it doesn't have enough gas to finish computation.

If an operation has LOW fees, then it might have just enough gas to cover it but still, the miners won't be chomping at the bits to pick it up because an operation with low fees isn't economically appealing for them.

If an operation has HIGH gas, then it means that the operation is bloated with a high gas limit and hence the miners will not pick it up.

If an operation has HIGH fees, then the miners know that they will make a lot of money from it and will be picking it up instantly.

The currently recommended gas prices for different types of transaction speeds, according to ethgasstation are:

What Happens in Gas Refund Scenarios?

In solidity, there are two commands which ensure that you get some gas refund back.

SUICIDE: This basically kills the smart contract. Doing so will get you back 24000 gas.

SSTORE: Storage deletion, which gets you back 15,000.

So, if your contract is using up 14,000 gas and deletes a storage then you should get back (15000-14000) 1000 gas refunded to you right?

It isn't that simple.

If that was the case, then miners will lose all incentive. After all, the miners shouldn't pay you to do your computations right?

To avoid scenarios like these, a condition was put in.

The refund that has been accumulated cannot exceed half the gas used up during computation.

Let's take an example to clear this up.

...Suppose we have a smart contract which uses up 14,000 gas.

The gas limit that we have set up is 20,000 gas.

The smart contract also includes an SSTORAGE command.

So, how much gas will the contract creator get back post computation?

Firstly, they will get back (20,000-14,000) = 6,000 units of unused gas.

Now, the SSTORAGE command has also been used, so theoretically they should get back 15,000 gas as well.

However, the amount of gas that has been used in the contract is 14,000 and since 15,000 > 14,000/2, the REFUND generated will be 14,000/2= 7000.

So the total gas that the creator is getting back in the end is 6000+7000 = 13,000.
Let's take another example.
Suppose this time the contract uses up 70,000 gas and it includes a SUICIDE function.

A SUICIDE function should give you 24,000 gas back which is < 70,000/2.

In this situation, the gas refund will be 24,000 + unused gas.

Criticism of Ethereum Gas. Is it Justified?

Even though the gas system has gotten praise for presenting a smoothly running mechanism which incentivizes the miners pretty positively, it has come under criticism lately for being a tad too expensive for developers and smart contract creators.

Regarding this, Danny Ryan did some interesting studies in his Hackernoon article.
Consider the following scenario:
When two numbers are added a million times in Ethereum it costs ~$26.55 in fees.

Danny Ryan compared that to a standard AWS system. He said that he can add two numbers a million times using python in 0.04 seconds, which going by the $0.0059 hourly Amazon EC2 rate costs $0.000000066.

This means that computation in Ethereum is 400 million times more expensive!

Based on his studies, this is the conclusion he made:

"To be fair, adding two numbers together 1 million times is a bit contrived. A well written contract would likely move such computational complexity off-chain and deal more with updating state in the contract. Storing vast amounts of data to the blockchain is also not an ordinary task. Depending on the task, a user would likely store a cryptographic reference (a hash) of the data on-chain and keep the rest of the data off-chain.
That said, we as developers need to be aware of these costs, and design dApps accordingly. We need to find the balance between on-chain and off-chain complexity, while still leveraging the decentralized capabilities of the blockchain."

# data[].attributes.attachment_link.title
What is Ethereum Gas: Step-By-Step Guide - Blockgeeks

# data[].attributes.attachment_link.description
Ethereum Gas - is the lifeblood of the Ethereum ecosystem, there is no other way of putting that. Gas is a unit that measures the amount of computational effort that it will take to execute certain operations. Every single operation that takes part in Ethereum, be it a simple transaction, or a smart contract, or even an ICO takes some amount of gas.

# data[].attributes.headline
0x Project: The Future of Cryptocurrency Exchanges

# data[].attributes.subject
0x Project: The Future of Cryptocurrency Exchanges

# data[].attributes.body
50 min

# data[].attributes.attachment_link.readable_text
0x Project: The Future of Cryptocurrency Exchanges. C ryptocurrencies are all the rage right now and as FOMO spreads far and wide more and more people want to be a part of this economic revolution. However, this is where we hit a snag. In order to join this revolution, people need to go through centralized exchanges which have immense problems of their own.

0x Project: The Future of Cryptocurrency Exchanges

This is why decentralized exchanges and the 0x Project in particular, are so important. In this guide, we will explore how the 0x Project works. However, before that, let's look at what exchanges, in general, are.

What is a Cryptocurrency Exchange?
Image Credit: Bite my Coin
The exchange serves one of the most critical functions in the crypto ecosystem. It basically acts as a portal between the Fiat world and the crypto world. There are usually two types of exchanges:

Fiat to Crypto

Fiat to Crypto exchanges helps you buy Cryptocurrencies in exchange for Fiat money. Coinbase is a perfect example of this kind of exchange. Coinbase helps you buy BTC, BCH, LTC, and ETH in exchange for Fiat currency.

Crypto to Crypto

Then we have the Crypto to Crypto exchanges. These exchanges help you exchange certain cryptos like BTC, ETH, BCH etc. for other cryptocurrencies. Binance is a fine example of a crypto-to-crypto exchange.

While they do offer pretty valuable services, the problem is that they are all centralized, which makes them vulnerable. This is an extremely risky proposition when you consider the sheer amount of money that these exchanges deal with each and every single day. Let's look at the 24-hour volume of the top 5 exchanges in the world:

That's nearly 10 billion USD! And that's how much money they are processing every single day! That's just absolutely ridiculous. Now, keeping in mind that centralized exchanges are vulnerable to a plethora of problems, do you really feel safe keeping your money with these entities?

The Problem with Centralized Exchanges

Let's take a look at some of the problems plaguing centralized exchanged:
#1 Vulnerability to Hacks
Centralized exchanges will always be vulnerable to hackers. Two years ago, in 2016, Hong Kong based cryptocurrency exchange platform, Bitfinex, was hacked for 120,000 BTC which was worth $72 million back then was stolen.

The price of Bitcoin went for a tumble and fell nearly 20%. One BTC went as low as $480 before it managed to recover.
#2 Subject to Mismanagement
How can we forget the infamous Mt. Gox hack? Back then, it was the biggest hack in history with bitcoins worth ~$500 million USD getting robbed. The exchange suffered from a number of issues.

However, if we were to surmise all of them, it all comes down to one thing:

Highly incompetent and childish management

Andreas Antonopoulos, in a very scathing report, had this to say:

"Magic The Gathering Online Exchange (Mt. Gox) is a systemic risk to bitcoin, a death trap for traders and a business run by the clueless."

Those are some very harsh words, but there is so much truth in that statement. The thing is that the Mt. Gox owner, Max Karpeles, was more of an idealistic programmer than a businessman. While he could code, he could never have the acumen needed to run a company. And, unfortunately, because of this, a huge disaster happened.

Another huge problem that most centralized exchanges suffer is that they just don't know how to deal with a sudden increase in demand.

On 12 th November there was a sudden surge of demand and most trading platforms just couldn't cope with the spike in volume. In fact, Bithumb, one of the biggest platforms in the world, suffered a minimum downtime of 90 mins during peak trading period. They lost 60,000 BTC worth of trade volume.

What were the after effects of this? Bitcoin Cash' s value nearly halved as a result. In fact, you can see the dip in the chart below:
#4 Subject to The Whims of the Government
The Centralized crypto exchanges have their companies registered in a country. This means that they can be directly affected by any policies that the government of that country wishes to enact.

Will you be comfortable with not having an ounce of control on your money?

Can Decentralized Exchanges be a Solution?
So what are Decentralized Exchanges or DEXs?
DEXs enable crypto exchange on a shared ledger which facilitates trustless trading without being dependent on a third party. In every sense, DEXs are the future of trading for several reasons.

Firstly, they provide stronger security. Since there are third parties, there are no single points of failures.

Secondly, there won't be possible of a malicious exchange running away with all the funds.

Thirdly, DEXs are not dependent on government regulations.

EtherDelta is one of the first DEXs that got some sort of attention. In fact, $1.4 billion is tied up in the latest version of its smart contract, which is extremely impressive.

The pic above, taken from this hackernoon article , shows the Ether Delta UI.

So, before we get into the 0x Project, it is important to learn how Ether Delta works. This will give us a grasp on DEXs in general.

How does Ether Delta Work?

Ether Delta works on top of the Ethereum blockchain via smart contract execution.

Smart contracts are automated contracts. They are self-executing with specific instructions written on its code which get executed when certain conditions are made.

When someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people.

Smart contracts are a series of instructions, written using the programming language " solidity", which work on the basis of the IFTTT logic aka the IF-THIS-THEN-THAT logic. Basically, if the first set of instructions are done then execute the next function and after that the next and keep on repeating until you reach the end of the contract.

So, Ether Delta also has a smart contract and we are going to be focusing our attention on two key areas:

Fund Management

Since EtherDelta is a DEX, the funds are completely in control of the users. The funds work in the following ways:

To use EtherDelta, one must move the funds to a smart contract.

At any point, any user can withdraw or deposit their funds.

Trading Logic
Image Credit: Hackernoon
The diagram above gives you a general idea of how EtherDelta works. The new market orders are stored on-chain or off-chain. A person, i.e. the maker, submits buy or sell orders. Another person, the taker, chooses to execute on this order.

Let's get a general overview of how EtherDelta functions:

The Maker creates an order and hashes it using SHA 3.

Maker signs the hash with their Ethereum private key.

The order and signature is then sent off-chain.

If a Taker wants to trade, the signature and order is sent to the trade function of the smart contract.

The smart contract then verifies the signature to make sure that it is valid.

The Flaws with Ether Delta

While Ether Delta provides a rather serviceable DEX, it, unfortunately, has some glaring issues.

Slow: There is a high latency in order book processing. Plus, along with that cancellation is extremely slow as well .

Blockchain Bloat: The on-chain order book results in transactions that consume network bandwidth and bloat the blockchain.

High gas costs: Because of the latency in the order book processing, Takers may not know what the other Taker is ordering for. This in turn causes a sense of competition within the Takers on the same orders which drives up the gas costs. Plus, makers are forced to spend gas every single time they post, modify, or delete their order.

Upgradation issues: Because of its architecture, the entire system comes to a standstill during upgradation. Also, the users are forced to take their money out the smart contracts and give them to a trusted third party. This defeats the purpose of a decentralized system.

Introducing the 0x Project

According to their website , "0x is an open, permissionless protocol allowing for ERC20 tokens to be traded on the Ethereum blockchain" and will be used for "powering decentralized exchange."
NOTE: The V2 of 0x will support more than just ERC20. More on this later.
0x came about in October 2016. Co-founders Will Warren and Amir Bandeali had a vision of a future where all kinds of assets, stocks, currencies, precious metals, could be traded publicly on the blockchain as tokens.

The 0x Team

0x has one of the most dedicated and respected teams in the community.

The faces of the project are undoubtedly the two co-founders Will Warren and Amir Bandeali. Will Warren did applied physics at Los Alamos Nat Lab and mechanical engineering at UC San Diego.

Amir Bandeali, on the other hand, was previously a fixed-income trader at DRW. He studied finance at the University of Illinois.

This project is financially backed by a number of companies such as Pantera Capital, Fintech Blockchain Group, Blockchain Capital and Jen Advisors

Now that we have introduced ourselves to the team let's get into the nitty-gritty of the project. There are still some basics that we need to understand before we get into anything.

0x and Ether Delta. Bridging the Gap

0x works pretty similarly to Ether Delta but there are some major differences.

0x has a group of participants called relayers (more about them later) and anyone among those can become an exchange. Ether Delta has only one unique entity which can become an exchange.

0x has its own token ZRX which is used to pay transaction and governance fees.

Most of Ether Delta's major flaws were surrounding its on-chain order book and scalability. This is why, in order to create something like 0x, two important innovations needed to be done.
#1 AMM Smart Contracts
Automated market maker (AMM) smart contracts came about as an alternative to the traditional on-chain order book. The AMM brings a price-adjustment model in which an asset's price adjusts in accordance with market forces and market participants on either side of the trade.

AMM price adjustment makes sure that the price doesn't vary wrt to liquidity. It imposes self-inflicted restraints on supply to make sure that assets remain insensitive to market liquidity.
#2 State Channels
What are state channels?

A state channel is a two-way communication channel between participants which enable them to conduct interactions, which would normally occur on the blockchain, off the blockchain. What this will do is that it will decrease transaction time exponentially since you are no longer dependent on a third party like a miner to valid your transaction.

So what are the requirements to do an off-chain state channel?

A segment of the blockchain state is locked via multi-signature or some sort of smart contract, which is agreed upon by a set of participants.

The participants interact with each other by signing transactions with each other without submitting anything to the miners.

The entire transaction set is then added to the blockchain.

The state channels can be closed at a point which is predetermined by the participants according to Slock.it founder Stephan Thual. It could either be:

Time lapsed eg. the participants can agree to open a state channel and close it after 2 hours.

It could be based on the total amount of transactions done eg. close the chain after $100 worth of transactions have taken place.
Image Courtesy: Stephan Tual Medium Article
So, in the image above. We have a car which directly interacts with the charger and does a total of $39.19 worth of transactions. Finally, after a series of interactions, the entire transaction chunk is added to the blockchain. Imagine how much time it would have taken if they had to run every single transaction through the blockchain!

0x decided to do a hybrid implementation which is referred to as "off-chain order relay with the on-chain settlement." The idea is to combine the efficiency of state channels with the near-instant settlement of on-chain order books.

Using this method, one can cryptographically sign orders and broadcast off the blockchain. Anyone interested can use one or more of these orders into a smart contract to execute trustless trading directly on the blockchain.

This method greatly decreases the gas costs for the Makers.
How?
Most of the work that they need to do is completely off-chain. Since they don't need to deal with the blockchain so much, their gas costs are greatly cut down.

Overview of The Process

The diagram above shows the general architecture of the 0x protocol. Let's look at how the process works. Suppose Maker wants to trade their Token A for Token B.

Maker firstly approves the DEX smart contract.

Maker creates order to exchange token A for token B specifying the desired exchange rate, expiration time and signs off with their private key.

Taker intercepts the order and decides to go for it.

Taker submits the Makers order to the DEX which proceeds to verify the signature.

The transfer between the Maker and Taker takes place at the specified exchange rate.

Types of Orders

There are two types of orders in 0x:
Point-to-point Orders
In point-to-point orders, two parties can directly exchange tokens between them using any communication method they prefer for message relaying. The order is made of packets of data containing a few hundred bytes of hex. It can be sent through Facebook messages, whisper, email, etc. Anyone who eavesdrops won't be able to access the order since it can only be filled by the specified Taker address.

This order format consists of the following:
Broadcast Orders
The second kind of orders in the 0x protocol are Broadcast orders. This is the more common form of exchange orders. For any exchange to work, there must be a public order book where buyers and sellers can post their orders. In the 0x protocol, there are entities called "Relayers" who "facilitate signaling between market participants by hosting and propagating an order book that consists of generic messages."

The Relayers do not execute any trades, they merely facilitate trades between Makers and Takers. Think of it as a group of participants and any of them can become an exchange.

The message format of broadcast orders has 2 major changes as compared to simple point-to-point messages.

Broadcast orders included don't specify a taker address. This means that anyone who intercepts the order can fill it in.

Secondly, broadcast orders include feeA (maker fees), feeB (taker fees), and feeRecipient (relayer address) parameters. These basically calculate the total fees that the Relayer will get upon transaction completion in their address.

The message format looks like this:

Now, let's do an overview of the whole process:

The Relayer declares their fees and the address which they are using to collect fees.

Maker creates order by setting feeA, feeB values. The feeRecipient value is set to the Relayer's address.

The maker then sends the signed order to the Relayer.

Relayer validates the order. If it is not satisfactory then the order is rejected. If satisfactory then the Relayer adds the order to their order book.

Takers receive an updated version of the order book that includes Maker's order.

The 0x Smart Contract

The entire 0x smart contract has approximately 100 lines of code and costs ~90k gas to fill in an order. There are four main components to this smart contract:
Signature Authentication
The first part of the smart contract that one must pay attention to is the Signature Authentication. The contract is able to validate the Maker signature via the ecrecover function. The function does the following:

Takes a hash and signature of the has as arguments.

Returns the public key that produced the signature.

If the public key returned is equal to the maker address, the signature is authentic.

address publicKey = ecrecover( hash, signature( hash ) );

if (publicKey != maker ) throw;

Fills and Partial Fills

In order to stop the repetitiveness of orders, the smart contract stores a reference to each previously filled order. The references are stored as a SHA 3 Keccak hash. Since the hash for a particular input is unique, it makes sure that repetitive orders aren't filled.

A Taker may partially fill an order by specifying an additional argument, valueFill, when calling the exchange smart contract's fill function. Multiple partial fills may be executed on a single order so long as the sum of the partial fills does not exceed the total value of the order.

Expiration Time

Every order in the 0xProtocol has an expiration time as specified by the Maker which is specified at the time that the order is signed. The value of the expiration time can't be changed once it has been signed.

Canceling Orders

An unfilled order can be canceled before its expiry date by the associate Maker via the cancel function. Canceling an order costs gas and, therefore, the cancel function is only intended to serve as a fallback mechanism. Typically, Makers are expected to avoid on-chain transactions by setting their order expiration times to match the frequency with which they intend to update their orders

The 0x Whitepaper notes one case where the cancel function may create an issue:

"One issue with this approach is that it can create situations where a Maker attempts to cancel their order at roughly the same time a Taker is attempting to fill that same order. One of the two parties transactions will fail, wasting gas, depending upon the sequence in which the two transactions are mined. Uncertainty regarding the sequence in which transactions are mined could lead to undesirable outcomes at times. This uncertainty could increase if the Ethereum blockchain were to experience a significant backlog of pending transactions."

Governance in The 0x Protocol

One of the biggest issues with Ether Delta is the downtime during upgradation. It is impossible for it to upgrade without causing issues to its participants. 0x aims to use their native ZRX tokens to upgrade securely. Plus, seeing how critical governance is for an entity like 0x, it is important to learn exactly how that will work in the system.

0x is envisioned as a pipeline of smart contracts (check diagram below for the visual) wherein each segment of the pipeline can be taken out and upgraded without the system coming to a halt.
Image Credit: Will Warren Medium blog.
The 0x team wanted to create a governance system which:

Ties in the ZRX token for voting purposes.

Has sound governance mechanics.

In order to create a system wherein all 0x stakeholders are represented fairly and equally, an implementation roadmap was conceptualized. The roadmap looks like this:

There are three main phases of this governance system:

Community Managed Token Registry

0x uses a token registry contract to store a list of ERC20 tokens with associated metadata. The registry basically is an official on-chain reference that maybe used by participants to verify token addresses and exchange rates before going through with the trade.

The registry, for now, is centrally managed by the 0x core team, however, they plan to convert that into a community managed on-chain registry. This is the first phase of the governance system.

Community Veto Power

Before the core team hands over governance completely to token holders, they want to make sure that the system is properly vetted. The way they plan to do that is by launching a system where the core team proposes various upgrades and the ZRX holders have the power to veto.

Liquid Democracy

The final phase is liquid democracy.

So, how does it work?

People can vote on their policies directly.

People can delegate their voting responsibilities to a delegate who can vote on their policies for them.

The delegates themselves can delegate their voting responsibilities to another delegate who can vote on their behalf. This property wherein a delegate can appoint their own delegate is called transitivity.

If a person, who has delegated their voting doesn't like the vote that their delegates have chosen, then they can simply take back their vote and vote on the policy themselves.

This fluid transition from direct democracy to representative democracy and back is called liquid democracy.

Conclusion

It won't be a stretch to say that 0x protocol could be the future of cryptocurrency exchanges. The really fascinating part of it is the sheer amount of flexibility it provides. They are about to release a V2 version soon where:

Any and all token standards will be supported. Currently, 0x only supports ERC20 tokens. So with v2 implementation, you can trade a cryptokitty with a ZRX token.

It will be easier and simpler to write your own external smart contracts that plug into 0x. Eg. you can now have a whitelist of people that can trade on your exchange.

Implementation of EIP 712 to make users less susceptible to possible scams.

Support for signature types of Trezor hardware wallet.

Support for adding multiple orders together.

It will be fascinating to see how this brilliant project pans out in the future.

# data[].attributes.attachment_link.title
0x Project: The Future of Cryptocurrency Exchanges

# data[].attributes.attachment_link.description
The world is moving from the use of centralized exchanges to using decentralized exchanges. This guide gives you all the need to know information about decentralized exchanges with a special focus on 0x Project and how they plan to change the world!

# data[].attributes.headline
Intro to MakerDAO: Understanding Stablecoins (Part 1)

# data[].attributes.subject
Intro to MakerDAO: Understanding Stablecoins (Part 1)

# data[].attributes.body
45 min to read

# data[].attributes.attachment_link.readable_text
Cryptocurrencies are revolutionary in every sense of the word. However, despite all its good qualities, there is one thing that has consistently stopped them from mainstream adoption. In fact, this one thing is so deeply interwoven with the crypto-culture, that it has almost become a joke.

Intro to MakerDAO: Understanding Stablecoins

(Part 1)

Let us give you a hint:

Does that ring a bell?

Well.. how about this:

Still doesn't ring a bell?

We are talking about volatility. That, in many ways, is the biggest barrier that cryptocurrencies are facing right now.

When you keep that statement in mind, you will understand why Stablecoins are so important.

If you were to define them, Stablecoins are:
digital tokens which are intended to provide measurable stability and security. In layman's term, their value remains constant and stable.
Stablecoins have been called many things from " the holy grail of cryptocurrencies" to the " foundational component of the next-generation economy." They have been embroiled in controversy and they have been dissected and studied by some of the smartest minds in the cryptospace.

For your reading convenience, we are going to be splitting up this guide into two parts. In the first part, we are going to acquaint ourselves with stable coins and why they are necessary.

In the second part, we are going to do a deep dive on the most promising stablecoin out there, MakerDAO.

The Importance of Stable Currencies

Stability of currencies is such an important aspect. In fact, let's see a real-world example of how instability and over-inflation can cause havoc to the economy.

Back in the 80's, the Zimbabwean dollar had strong growth and measured up pretty well against the US dollar. However, all that was about to change. From 1991-1996, the Zimbabwean Zanu-PF government of President Robert Mugabe embarked on an Economic Structural Adjustment Programme (ESAP) that had serious negative effects on Zimbabwe's economy. Over that 5 year period, Zimbabwe went through extreme hyperinflation. In fact, in November 2008, the hyperinflation rate went up to 79,600,000,000% per month, which resulted in $1 USD becoming equivalent to the staggering sum of Z$2,621,984,228!
Image Credit: Wikipedia.
In fact, the government ran out of paper to print money, which left a lot of soldiers without any pay. They were even forced to print a trillion-dollar note!

Now, what happened because of this hyperinflation?

The banking sector collapsed.

The farmers were unable to get any loans from the bank and as a result, for a 10-year period from 1999-2009, there was a sharp drop in food production.

Unemployment rose to 80%.

Life expectancy also dropped.

Zimbabwe was eventually forced to give up their currency for the USD.

Making The Case For Stablecoins

A good currency should fulfill the following three roles:

While cryptos do a great job as a medium of exchange, it is as a unit of account and store of value where it falters miserably. The reason? It is just not stable enough. If you own something that is extremely volatile, will you trust it as a store of value?

Would you want to safely invest your hard-earned money in an asset which may be worth half of its present valuation in 24 hours?

In fact, let's do some more research on this.

What are the problems that we face because of the volatility of cryptocurrencies and what are the main advantages of stablecoins?

While traders take advantage of this volatility to make their profits, the reality is that they could easily lose all their money by taking their eyes off the screen. Most of these crypto-crypto exchanges don't support fiat funds, which is why it is necessary to have a stablecoin where traders can keep their profits untouched.

Cryptocurrencies are not ideal for time-based contracts. If someone were to bet 1 BTC on an event occurring in a year's time, then they are exposing themselves to two major risks. Firstly, the event may not occur at all, and secondly, the value of BTC may drop down in that time. This volatility makes it extremely difficult to do a proper risk assessment.

Finally, in order to have widespread mainstream adoption, stablecoins maybe the best form of the currency to take up that role.

So, where does the stability comes from? For that, we need to understand the idea of "pegs".

Understanding Pegs

The concept of pegs or fixed exchange rates lies at the very heart of stablecoins. According to Wikipedia:

"A fixed exchange rate, sometimes called a pegged exchange rate, is a type of exchange rate regime where a currency's value is fixed against either the value of another single currency, to a basket of other currencies, or to another measure of value, such as gold."

So, why do we do it?

A peg is used to keep the value of a currency stable by directly fixing its value in a predetermined ratio to a different more stable or more internationally prevalent currency (or currencies).

This method is extremely useful for small economies, economies which borrow primarily in foreign currency, and in which external trade forms a large part of their GDP.

So how do they do it?

In order to maintain a peg, the country needs to first accumulate large reserves of foreign currency. As Richard Chen says in his article:

"This is because if the country needs to appreciate its own currency to maintain the peg, then it can buy its own currency on the market using its reserves of foreign currency. The country can also raise interest rates and contract the money supply to attract foreign demand for its currency, thereby causing appreciation."

Similarly, if a country needs to depreciate its own currency to maintain the peg, then it can sell its own currency on the market, lower interest rates, and expand the money supply."

Pegs Through the Ages
#1 The Classic Gold Standard
From 1880 to 1914 the classic gold standard was followed by most of the countries. The very first use of a gold standard was in the UK in 1821. In this standard, the external value of all currencies is denominated in terms of gold with central banks ready to buy and sell unlimited quantities of gold at the fixed price. Each central bank maintained gold reserves as their official reserve asset.

During this time period, 1 USD was denominated as 0.048 troy oz. of pure gold.
#2 The Brenton Woods System
Following the second world war, various countries came to the realization that a new system was required. They knew that that gold standard was far too rigid, and they also knew that main reason behind the second world war was the economic imbalance during the inter-war period.

To prevent a third world war, 730 delegates from all 44 Allied nations gathered at the Mount Washington Hotel in Bretton Woods, New Hampshire, United States, for the United Nations Monetary and Financial Conference, also known as the Bretton Woods Conference.

After the second world war, the US had the majority of the world's gold reserves, so it was decided that the other countries will peg their currencies to the USD, while the USD remains pegged to gold. Now, this does sound good in theory, however, it didn't really workout.

Due to various reasons, the dollar got devalued and over the course of 25 years, other countries exchanged their USD foreign reserves for gold, slowly draining Fort Knox of gold. This led Nixon to terminate convertibility of USD to gold, and the USD has remained a free-floating fiat currency ever since.

Maintaining Pegs - The Four Questions

There are still some Pegs out there, however, most of nations and banks have moved away from them. Time and again, we have seen economic and financial disasters that have happened because of rigid pegs. The Soros attack of 1992 is a classic example (more on that later).

Ok, so we have seen that stablecoins can't exist without pegs and we have just mentioned that pegs are fast becoming outdated in the international economy. Does that mean that all stablecoin pegs will fail?

Turns out that that's not true.

Any peg can be maintained, provided it is within a certain bandwidth of market behavior. In other words, "within at least some market conditions, it's possible to maintain a peg."

For a peg to maintain itself, it must ask 4 questions (taken from this article):

Can the peg withstand a good amount of volatility?

Is it expensive to maintain?

How easy is it to analyze the band of behavior from which it can recover?

How transparently can traders observe the true market conditions?

The final two questions are critical before that's where the Schelling point game theory comes in.

What is the Schelling (Focal) Point?

The great economist Thomas Schelling conducted an experiment with a group of students asking them a simple question: "Tomorrow you have to meet a stranger in NYC. Where and when do you meet them?" He found out that the most common answer was, "Noon at the Grand Central Terminus." This happened because the Grand Central Terminus, for New Yorkers is a natural focal point, the focal point is also known as a " Schelling point ".

So, to define a Schelling point: It is a solution that people will tend to use in the absence of communication because it feels special, relevant or natural to them.

Let's demonstrate this concept with a game.

S uppose there are two prisoners kept in two different rooms and they are given a random series of numbers. Then they are told to guess the number that they other prisoner will guess, without any communication between the two. If they guess the wrong number, then they will be killed (just to up the ante).

The numbers that they are given are:

7816239, 676716313, 100000000 and 871823719.

Which number do you think they will choose?

100000000.

Why?

Because it is different and special when compared with the rest of the numbers and that is why it is Schelling point. Throughout our history, human beings have unknowingly subconsciously converged in various places such as bars, churches, community centers etc. because in a society those places are common Schelling points.

A very famous example of the Schelling point in action is a game that we hope you have never played in your life called "The Chicken Game." This is how it works, two people ride towards each other on a bike. If they collide head-on, they die. However, the first person who swerves away from the incoming rider is a "chicken".

So, in this game, there are 2 scenarios which can end in a crash:
Image Courtesy: Mind Your Decisions blog
Case 1: Both riders head towards one another.

Case 2: One rider swerves left and the other swerves right.

Thomas Schelling gave the solution to this using the concept of focal points. He said, that the best solution to this game is to not look at the other rider in the eye (i.e. cut off communication with the other rider) but focus on one's own instincts. Since, in the United States, people drive on the right side of the road, if we let our instincts take over, we will automatically steer the bike towards the right side, because that's where our Schelling point lies.

So how does Schelling point help us in understanding the strength of the peg? As Haseeb Qureshi puts it in his Hackernoon article:

"If market participants cannot identify when a peg is objectively weak, it becomes easy to spread false news or incite a market panic, which can trigger further selling - basically, a death spiral. A transparent peg is more robust to manipulation or sentiment swings."

The Three Kinds of Stablecoins

There are three kinds of stablecoins:
#1 Fiat Collateralized
Fiat-collateralization is probably the most simplistic and straightforward execution of stablecoins. The way it works is pretty simple. A certain amount of fiat is locked up as collateral and coins are issued 1:1 against it. Instead of fiat currency, gold, silver, oil etc. can also be kept as collateral.

Tether is probably the best example of this and it also happens to be the most widely used stable coin. We will talk about Tether and its problems a bit more in the second part.
#2 Crypto Collateralized
Crypto-collateralized stablecoins are actually pretty similar to fiat-collateralized coins...with one major distinction. Instead of using fiat as a peg, they use another cryptocurrency.

However, we all know that cryptocurrencies are unstable, unlike fiat currency (comparatively), so how does this system work?

The answer to that question is "over-collateralization." So, if you want $100 worth of stablecoins then you will need to deposit $200 worth of ether. It is not a straightforward 1:1 ratio.

Dai is an example of this kind of stablecoin. In the next part, we will explore them in detail.
#3 Non-Collateralized
Finally, we have the non-collateralized stablecoins. These are the coins who are not backed by anything. If you think about it, a privately issued, non-collateralized, price-stable currency could pose a radical challenge to the dominance of fiat currencies.

But, how does one execute this?

Back in 2014, Robert Sams came up with the concept of Seignorage Shares and it is based on a very simple idea. Create a smart contract which would act as a central bank with only one policy, issue a currency which will always trade at $1.

So what happens if the coin is trading at $2?

Since the price is high, the smart contract will automatically create more coins to increase the supply and dilute the price. The extra profit that would be left over in the smart contract, as a result, is called seignorage.

Now let's look at the other scenario.

What if your coin is trading at $0.50? How does the smart contract reduce the supply? The contract simply buys up coins in the open market to reduce the supply.

This method has come under criticism because of its resemblance to a pyramid scheme.

Anyway, we now know the three form of stablecoins. In the next part, we are going to looking into MakerDAO in detail.

However, before we do that, let's look into a possible vulnerability that stable coins may face.

The Unholy Trinity - Possible Vulnerability?

To conclude the first part of the article, let's checkout a concept in international economics which can lead to some rather "interesting" consequences with stablecoins. The name of this concept is the "Unholy Trinity" and we are going to thank Richard Chen and his article "The Macroeconomics of Stablecoins" for introducing us to this.

The unholy trinity aka the impossible trilemma states that it is impossible to have all three at the same time:

A fixed foreign exchange rate (peg).

Free capital movement (absence of capital controls)

Sovereign monetary policy.
Image Courtesy: Medium.
We already know what "peg" means let's look into the other two.

Free capital flow (i.e. no capital controls): This basically means that citizens will have the freedom to diversify their holdings by investing abroad. Conversely, this also allows foreign investors to bring their expertise into the country.

Sovereign monetary policy: This means that the central bank can increase the money supply to reduce interest rates when the economy is down and they can reduce the money supply and raise interest rates when the economy is up.

So, when you bring it all together, the unholy trinity states that central banks can only execute two out of the three mentioned properties. Trying to execute all the three at the same time may lead to some truly catastrophic results, such as the 1997 Asian financial crisis.

In the 90's, East Asian countries had their currency pegged to the USD, they were making their own independent monetary policy, and had free capital flow. This meant that their citizens could not only invest anywhere they wanted, foreign investors were also encouraged and incentivized to invest a lot of money in these countries.

While the trade conditions were favorable, the investments made by these foreign investors reaped enormous amounts of profit and contributed to an overheated economy. However, when the trade balance reversed, the investors quickly pulled their money out which resulted in one of the worst financial catastrophes in history.

In fact, the damage done economically was equivalent to a full-scale war. Thailand, in particular, ran out of USD reserves and were forced to let their currencies float and devalue.

This means that we now have three options left. According to the diagram given above, the options are labeled: A, B, and C.

The Three Options

Option A: Free Capital and Fixed Exchange

In this option, the banks are letting go off the option of enacting their own monetary policy.

This kind of system is especially prevalent in the Eurozone. All the countries in the zone are bound by one currency i.e. Euro. Plus, there is free capital flow in and out of all the member nations.

However, the member nations cannot enact their own independent monetary policy. This means that it is extremely tough for a member nation to take care of an overheated or depressed economy. In fact, this is exactly what happened in Greece. This option may make you feel like that there is a one-size-fits-all solution when there really isn't.

Option B: Free Capital and Sovereign Policy

In this option, the investors will have the freedom to invest wherever they want and the central bank of the country has the power to enact their own monetary policies, however, there is no fixed peg.

The US uses a system like this. They have their own monetary policy and has a free flow of capital. However, the exchange rate is floating and is determined by the market.

Option C: Fixed Exchange and Sovereign Policy

Finally, we have option C. In this case, you can have a fixed peg and the central bank can issue their monetary policy, however, there is no free capital.

China is an example of a country that uses their own monetary policy while maintaining an exchange rate. However, they control the amount of capital flowing inside and outside the country.

Which option works best for Stablecoins?

Since stablecoins already have a fixed peg, option B is automatically out of the contention.

Let's examine Option A and C:

Option C says that one cannot have free capital. However, that defeats the very purpose of decentralization. In a decentralized ecosystem, one cannot have any third party to control the flow of funds. This is why Option C is out.

That leaves us with Option A. But, this, however, leaves Stablecoins open to a Soros attack. So, what is this Soros attack?

In 1992, George Soros, a Hungarian-American investor made over a billion dollars. However, in the process, he broke the Bank of England. This is what happened as per Wikipedia:

"Soros had been building a huge short position in pounds sterling for months leading up to September 1992. Soros had recognized the unfavorable position of the United Kingdom in the European Exchange Rate Mechanism. For Soros, the rate at which the United Kingdom was brought into the European Exchange Rate Mechanism was too high, their inflation was also much too high (triple the German rate), and British interest rates were hurting their asset prices."

What Soros did is often called the "Greatest financial bet of the 20th Century."

The Bank of England realized that raising interest rates during a recession would be political suicide which is why they broke the peg and let the Pound float with the German Deutsche Mark.

Now the question is, what happens if something stablecoins face is a Soros attack?

If a stablecoin were to become the currency of the future, then it makes sense that there will be wrong periods of recession. Since stablecoins can't control the monetary policy, if someone attempts a Soros attack during a recession, the Stablecoin's smart contract would immediately contract the money supply to counterattack, which will make the recession even worse.

As Richard Chen concludes,
"Thus, stablecoins are subject to the impossible trilemma and, in achieving their stability, make a conscious choice to give up monetary policy. This is politically popular in the short-term, but without the ability to use monetary policy to alleviate an overheated or depressed economy, it would be difficult for stablecoins to become a world currency in the long-term."

Conclusion

So, now that you know what a stablecoin is, in the next article you will learn the following:

Look forward to it!

Want to learn more about MakerDAO?

Take Blockgeek's MakerDAO Course!

# data[].attributes.attachment_link.title
Intro to MakerDAO: Understanding Stablecoins (Part 1 Blockgeeks)

# data[].attributes.attachment_link.description
Cryptocurrencies are revolutionary in every sense of the word. However, despite all its good qualities, there is one thing that has consistently stopped them from mainstream adoption. In fact, this one thing is so deeply interwoven with the crypto-culture, that it has almost become a joke.

# data[].attributes.headline
Understanding Ethereum Mining and the Need for a Stake/Proof of Work Hybrid Model

# data[].attributes.subject
Understanding Ethereum Mining and the Need for a Stake/Proof of Work Hybrid Model

# data[].attributes.body
80 min to read

# data[].attributes.attachment_link.readable_text
Understanding Ethereum Mining and the Need for Proof of Stake. is the lifeblood of all POW based cryptocurrencies. When miners "mine" to form new blocks to add to the blockchain. Miners use heavy duty computational power to solve cryptographical puzzles to satisfy a difficulty level.

Understanding Ethereum Mining and the Need for a Stake/Proof of Work Hybrid Model

This is one of the most path-breaking mechanisms in blockchain technology. Earlier decentralized peer-to-peer digital currency systems used to fail because of something called the "Byzantine General's Problem". The proof-of-work consensus system finally provided a solution to this problem.

What is the Byzantine General's Problem?
Image Courtesy: Medium
Ok so imagine that there is a group of Byzantine generals and they want to attack a city. They are facing two very distinct problems:

The generals and their armies are very far apart so centralized authority is impossible, which makes coordinated attack very tough.

The city has a huge army and the only way that they can win is if they all attack at once.

In order to make successful coordination, the armies on the left of the castle send a messenger to the armies on the right of the castle with a message that says "ATTACK WEDNESDAY." However, suppose the armies on the right are not prepared for the attack and say, "NO. ATTACK FRIDAY" and send back the messenger through the city back to the armies on the left. This is where we face a problem. A number of things can happen to the poor messenger. He could get captured, compromised, killed and replaced with another messenger by the city. This would lead to the armies getting tampered with information which may result in an uncoordinated attack and defeat.

This has clear references to blockchain as well. The chain is a huge network; how can you possibly trust them? If you were sending someone 4 Ether from your wallet, how would you know for sure that someone in the network isn't going to tamper with it and change 4 to 40 Ether?

Satoshi Nakamoto was able to bypass the Byzantine General's problem by inventing the proof of work protocol. This is how it works. Suppose the army on the left want to send a message called "ATTACK MONDAY" to the army on the right, they are going to follow certain steps.

Firstly, they will append a "nonce" to the original text. The nonce can be any random hexadecimal value.

After that, they hash the text appended with a nonce and see the result. Suppose, hypothetically speaking, the armies have decided to only share messages which, on hashing, gives a result which starts with 5 zeroes.

If the hash conditions are satisfied, they will send the messenger with the hash of the message. If not, then they will keep on changing the value of the nonce randomly until they get the desired result. This action is extremely tedious and time-consuming and takes a lot of computation power.

If the messenger does get caught by the city and the message is tampered with, according to hash function properties, the hash itself will get drastically changed. If the generals on the right side, see that the hashed message is not starting with the required amount of 0s then they can simply call off the attack.

However, there is a possible loophole.

No hash function is 100% collision-free. So what if the city gets the message, tampers with it and then accordingly change the nonce until they get the desired result which has the required number of 0s? This will be extremely time consuming but it is still possible. To counter this, the generals are going to use strength in numbers.

Suppose, instead of just one general on the left sending messages to one general on the right, there are 3 generals on the left who have to send a message to the ones on the right. In order to do that, they can make their own message and then hash the cumulative message and then append a nonce to the resulting hash and hash it again. This time, they want a message which starts with six 0s.

Obviously, this is going to be extremely time consuming, but this time, if the messenger does get caught by the city, the amount of time that they will take to tamper the cumulative message and then find the corresponding nonce for the hash will be infinitely more. It may even take years. So, eg. if instead of one messenger, the generals send multiple messengers, by the time the city is even halfway through the computation process they will get attacked and destroyed.

The generals on the right have it pretty easy. All they have to do is to append the message with the correct nonce that will be given to them, hash them, and see whether the hash matches or not. Hashing a string is very easy to do. That, in essence, is the process behind proof-of-work.

The process behind finding the nonce for the appropriate hash target should be extremely difficult and time-consuming.

However, the process of checking the result to see if no malpractice has been committed should be very simple.

Ok, so now you know what the fundamental principle behind mining is. Now let's look at how it actually happens.

The Different Types of Mining

CPU Mining: This is the most basic form of mining. The idea behind CPU mining is simple. Anyone, anywhere can use their computer to mine. While this method is not that applicable anymore, it's a good entry point

GPU Mining: Up next we have GPU mining. The GPU, or graphics processing unit, is a part of the video rendering system of a computer. The typical function of a GPU is to assist with the rendering of 3D graphics and visual effects so that the CPU doesn't have to.The GPUs offer a far more stronger system for mining than the CPU. Some ASIC resistant coins like Monero are mined via GPU.Bitcoin/Ethereum used to be originally mined like this, however this became more and more difficult, as the difficulty increased. We will talk more about difficulty later on in the guide.

FPGA Mining: FPGA or Field-Programmable Gate Array Mining is the next step from GPU mining. According to this article by Free Learner, FPGA "is a device that has a series of gate arrays (obviously) that create truth tables to calculate inputs from a data stream, and output a desired result. In industry you can use this to optimize an industry process, such as cutting 2x4s from a log, provide machine learning or even to perform DNA sequencing. FPGA's excel at any task that can be done in a parallel process, such as a mining hash to create an output resulting in a successful hash, and if you're lucky a successful block."

ASIC Mining: ASIC stands for Application-Specific Integrated Circuit and it was created for the specific purpose of mining Bitcoin and Litecoin. The idea of having machinery specifically designed for mining was ahead of its time, so much so that when KNCMiner launched their pre-orders for ASICs they received $25 million in orders in the first 5 hours. Bitcoin and Litecoin is now exclusively mined through ASICs. Bitmain recently released ASICs for Ethereum.

How to Build an Ethereum Mining Rig

Alright, now that we have gone through the different types of mining, Let's set up your Ethereum mining rig!

Before we continue a HUGE shoutout to this article by Antonio Madeira for Crypto Compare.

You will need the following pieces of hardware.

Motherboard

The motherboard is the base of the mining rig. The amount of GPUs that you can use is directly related to the number of GPU slots that your motherboard has. The more GPUs you can attach to your motherboard the more your hash rate i.e. the rate at which you are computing hashes.

Some examples of good mining Motherboards are:

GPU

Before getting GPUs you need to ask yourself two questions:

How powerful do you want your rig to be?

How much do you want to spend?

Make sure to get efficient GPUs.

Here is a chart of the performance levels of different GPUs in Ethereum mining as seen by NIceHashMiner:

Hard Drive

Now, you will need something to store your OS and mining software. For that, you need a hard drive. For this a standard SSD (solid state drive) hard drive will do.

So, how big should your hard drive be? If you are planning to download the whole blockchain, then you should have enough space to compensate for future growth.

RAM

RAM or Random Access Memory is required for fast calculation and information computation. A 4GB RAM should be more than enough.

Power Supply Unit

The size of the Power Supply Unit (PSU) depends on how many GPUs you are using. So firstly you need to sum up the power consumption of your GPUs and all other components to make sure the capacity of the PSU is more than the sum of your GPUs. So, if you are using 2 220 Watts GPUs and other components are consuming 250 Watts then your PSU must have more than (2*220 + 250) 690 Watts.
image Credit: tom's HARDWARE
Software for Mining

Firstly, obviously, you will need to have an operating system.

You can download ethOS which is a specifically designed APP for Ethereum Mining. It is a 64-bit linux distro that mines Ethereum out-of-the-box, allowing you to control all your rigs from a single location, and drill down to specific GPUs where necessary. ethOS supports eth-proxy/stratum immediately upon installation

You can checkout ethOS here.

Setting up MyEtherWallet

After you have set everything up, you need to create an Ethereum Wallet. There is no point in mining all these coins if you are not taking adequate measures. You can read our guide on crypto wallets right here. My Ethereum Wallet is one of the best wallets out there, though they have faced some issues lately.

Following are the steps required to set up your MyEtherWallet:

Next, click on the help tab.

Scroll down and click on option 5:

Now open the link highlighted here:

After that download this zip file into your computer:

Now open the zip file in your computer and click on the index.html file. Before doing that, switch off your internet so that you are offline.

Now create a new password and generate your wallet, be sure that you are putting in a strong password:

Now you will have to download your keystore file which is basically your wallet file. Be sure to keep a back up of this file. After you are done with that click on "I understand. Continue."

And there you go, your wallet has been generated. What you see here is your private key. DO NOT share this with anyone.

You should now print your wallet by clicking on the "Print" button. This is what you will get. Notice that you can see both your private and public keys here:

And there you go. That is how you create an Ethereum paper wallet.

Ethereum Mining Solo vs Mining Pools

Alright, so you have the entire system and your wallet set up. Now you need to decide how you are going to mine.
Are you going to mine solo or are you going to mine in a pool?
You can of course mine solo, but there is a reason why nobody mines Ethereum solo anymore. It is extremely impractical and you won't see any results.

This is why people prefer mining pools.

What are mining pools?
(NOTE: In this section, we will be talking exclusively wrt BTC).
The entire blockchain works because of a network of "miners". The miners basically "mine" for new blocks in the blockchain by solving complex cryptographical puzzles using their computational power. As a result of this, they get a mining reward which is 12.5 BTC.

Once they successfully mine a block, they gain the power to put in transactions inside the block. That's basically how transactions happen in all cryptocurrency, a miner puts in the record of the transaction inside the block.

Now remember one thing, there are only a limited number of bitcoins that were created (21 million coins). Satoshi Nakamoto, the creator of bitcoins, envisaged that as more and more miners got in, the rate of bitcoin mining would exponentially increase, so much so that all the available bitcoins could be mined out in a couple of years!

Now, this could be a disaster for bitcoins, because, like all economic commodities, the value of bitcoin lies in supply and demand. If the supply of bitcoins suddenly increases, then that would decrease the demand, which would, in turn, hurt its value. The supply-demand relationship is one of the most critical economic concepts, the following is what the supply-demand graph looks like:

To prevent the supply of bitcoins from going out of hand and to make it a more sustainable model, Satoshi implemented a difficulty adjust system.

What is difficulty adjustment? As more and more blocks get mined, the difficulty of the cryptographic puzzles increases exponentially. Basically, the more bitcoins you mine out, the more difficult the process of mining becomes. Miners soon found out that they can't really mine efficiently by themselves anymore, the process was getting more and more expensive. So, they decided to pool their resources together and form cliques and groups to mine bitcoin more efficiently. These groups of miners are called "mining pools".

Advantages and Disadvantages of mining pools

Advantages

The pools are run by pool managers. It is far easier to upgrade the overall network because instead of coordinating with random independent miners, the pool managers can simply upgrade the network by themselves.

Reduces variance in mining rewards: One of the biggest reasons why miners join pools is to reduce variance in their mining rewards. To understand what variance means and how that affects miners, we will need to do some mathematics. Credit to L.M. Goodman and her medium article for the explanation.

First, let's understand what Bernoulli distribution is. The Bernoulli distribution basically states that for every discrete distribution which has two outcomes "success" and "failure" if the probability of success is p (where, 0<p<1), then the probability of failure is 1-p.

Now, let's apply this in bitcoin. If a miner controls a fraction "p" of the overall mining power and as a result, has a probability p of mining a new block where 0<p<1, then, on applying Bernoulli's distribution, he/she has the probability of (1-p) of NOT mining a new block.

In Bernoulli's distribution: variance = p*(1-p)

Now, let's see how many blocks are mined in a year.

Every 10 mins, 1 block is mined. Which means each hour 6 blocks, every day 24 * 6 blocks and every year 365*24*6 blocks are mined.

Basically, for a miner who has "p" probability of mining a block, is expected to mine 365*24*6*p blocks per year. That's their expected return.

Similarly, the overall standard variance that they are going to be facing the entire year is: 365*24*6*p*(1-p).

Now, we shall define "standard deviation". Standard deviation is a term which defines by how much are the members of a particular distributed group varying from the mean of the group.

In the context of the blockchain and this example, the standard deviation is by how much is this miner's reward going to have deviated from the expected reward.

Standard deviation = [sqrt]variance / expected return.

Now, as we know:

variance = 365*24*6*p*(1-p)

expected return = 365*24*6*p

So, on substituting these values we get:

Standard deviation = [sqrt] (365*24*6*p*(1-p)) / 365*24*6*p

Now let's take an example.
Suppose a miner owns 0.01% of the hash rate in the network. (Meaning p=0.0001).

If you substitute the values accordingly to the standard deviation equation then you will get a standard deviation of 0.4364 OR 43.6%!!

A 43.6% deviation from the expected reward or a miner who owns 0.01% hash rate.

The only solution to decrease this deviation and variance is to pool in resources to together to increase the overall hash rate percentage, which is exactly what mining pools offer.

Cons

A lot depends on the ethics of the pool manager.

Centralization: We will talk more about this later."

Advantages of Becoming a Miner

So, why should you become a miner?

You get to have Ether! First and foremost, the most obvious reason. You get to have your own Ether. Plus, the moment you mine a block, you get to collect a transaction fees for all the transactions that go inside it.

If you believe in Ethereum or Cryptocurrency in general then you get to have a voice in the network through mining.

Finally, as Ethereum moves on to Proof of Stake, building a large Ethereum deposit now through Proof of Work will definitely be helpful.

What is Proof of Stake?

So speaking of Proof of Stake (POS), what exactly does it mean and why is Ethereum going to move on to it? Let's focus on the first part of the question for now.

Proof of stake will make the entire mining process virtual and replace miners with validators.

This is how the process will work:

The validators will have to lock up some of their coins as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

POS will make mining completely virtual and greatly reduce the wastage that will come about through POW.

Ethereum's POS implementation is called the Casper protocol.

Why was Casper needed? Turns out, there is one big problem when it comes to POS implementation.

The Biggest Roadblock to Proof of Stake

Ethereum developers always planned to eventually move on to proof of stake, that was always their plan. However, before they could do so, they had to address one of the biggest flaws of proof of stake(POS).

Consider this scenario for a moment:

Suppose we have a situation like the one above. There are a main blue chain and a red chain which sort of branches from the main itself. What is there to stop a malicious miner from mining on the red blocks and force a hard fork?

In a proof-of-work(POW) system, this risk can be mitigated.

Suppose malicious miner Alice wants to mine on the red chain. Even if she dedicates all of her hash power to it, she won't get any other miner to join her on the new chain. Everyone else will still continue to mine on the blue chain because it is more profitable and risk-free to mine on the longer chain.

Now remember, POW is extremely expensive resource-wise.

It makes no sense for a miner to waste so much resource on a block that will be rejected by the network anyway. Hence chain splits are avoided in a proof of work system because of the amount of money that the attacker will have to waste.

However, things look a little different when you bring in POS.

If you are a validator, then you can simply put your money in both the red chain and blue chain without any fear of repercussion at all. No matter what happens, you will always win and have nothing to lose, despite how malicious your actions may be.

This is called the "Nothing at Stake" problem, and this is something that Ethereum had to address.

They needed a protocol which could implement POS and mitigate the "Nothing at Stake" problem.

Ethereum Mining: Enter Casper

Casper is the POS protocol that Ethereum has chosen to go with. While there has been an entire team busy creating it, Vlad Zamfir is often credited as being the "Face of Casper".
Image Credit: Blocknomi.
So how is Casper different from other Proof of Stake protocols?

Casper has implemented a process by which they can punish all malicious elements. This is how POS under Casper would work:

The validators stake a portion of their Ethers as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

However, if a validator acts in a malicious manner and tries to do a "nothing at stake", they will immediately be reprimanded and all of their stake is going to get slashed.

As you can see, Casper is designed to work in a trustless system and be more Byzantine Fault Tolerant.

Anyone who acts in a malicious/Byzantine manner will get immediately punished by having their stake slashed off. This is where it differs from most other POS protocols. Malicious elements have something to lose so it is impossible for there to be nothing at stake.

This is not the only place where Casper punishes the validators.

As Hudson James and Joris Bontje note in their answers in "StackExchange", Casper designs harsher incentives in order to guarantee network security, including punishing miners who go offline, unintentionally or not.

This means that validators will have to be careful about their node uptime. Carelessness or laziness will lead to them losing their stake. This property reduces censorship of transactions and overall availability.

Along with all that, the "slashing" property also lends casper a distinct edge over normal proof of work protocols.

Let's bring back our chain diagram again:

In a proof of work protocol, it doesn't matter whether a miner mined on the blue chain or the red chain. Both the honest and the malicious miner would have spent the same amount of resources.

In Casper, however, if an honest validator mines on the blue chain then they would get reward proportionate to their bet, however, a malicious miner will get their stake slashed off for betting on the red chain.

Ok so that's all well and good but how is Ethereum going to make sure that miners will move on from POW to POS?

They plan to do that via a difficulty time bomb.

What is The Difficulty Time Bomb?

What is there to incentivize the miners to move from a proof-of-work protocol to a proof-of-stake protocol?

Miners buy thousands of dollars' worth of equipment so that they can mine for blocks. The moment POS comes on board; all that equipment becomes worthless. Imagine spending so much money and having super intricate pools set up, and all that becoming completely useless.

If that is the case, then what is there to stop the miners from staying on the old proof-of-work chain and continue mining on it? This will, in essence, create three Ethereum coins: Ethereum Classic, Ethereum Proof-of-work, and Ethereum Proof-of-stake. That is going to be an absolute nightmare.

Not only will that greatly decrease the economic value and credibility of Ethereum, it is also going to dilute the hash rate of the overall chain which can make it vulnerable to hacker attacks.

In order to make sure that there is a proper incentive to miners to join the new chain, the Ethereum developers introduced the difficulty time bomb. The time bomb was introduced on 7th September 2015. To understand how the difficulty time bomb works, it is important to understand how difficult and mining works.

What is difficulty and how does it work?

The concept of difficulty started with bitcoin. When bitcoin was first introduced, mining was extremely simple and anybody could do it using their PC. However, as bitcoin got more and more popular the number of miners on the network increased. This raised a very real possibility of miners going out of control and mining out all the remaining bitcoins in the space of a year. Satoshi Nakamoto envisioned this happening and hence introduced the "difficulty" system.

The difficulty system works like this: Miners spend their computational power to solve cryptographic puzzles. The way they do that is that they randomly append a random string (called nonce) to the hash of the block and then they hash the whole string. If the resulting number is less than a particular fixed number, then it is considered to be successful and the new block is added to the blockchain. Finding this "nonce" is extremely difficult and random and that is the heart of all mining.

If we were to recap the whole process, then this is what it would look like:

The hash of the contents of the new block is taken.

A nonce (random string) is appended to the hash.

The new string is hashed again.

The final hash is then compared to the difficulty level and seen whether it's actually less than that or not.

If not, then the nonce is changed and the process repeats again.

If yes, then the block is added to the chain and the public ledger is updated and alerted of the addition.

The miners responsible for this given the block reward.

The difficulty is adjusted every 2016th block.

The difficulty level is directly proportional to the rate at which the blocks are being mined. Bitcoin has an average block time of 10 mins.

If the block time goes below that, then the difficulty level is increased, if it goes up, then the difficulty time decreases. This is done to make sure that the block time of bitcoin stays ~10 mins.

This is basically how bitcoin mining works and Ethereum follows the same protocol as well, the difference being that a block is mined every 15 seconds in Ethereum.

Following graph shows the increasing difficulty in Ethereum:

So what will the difficulty time bomb do?

The difficulty bomb will exponentially increase the difficulty so much so that mining will become impossible.

Like we have said before, the difficulty level adjusts according to the rate at which the blocks are being mined. The Ethereum difficulty adjustment algorithm looks like this:
block_diff = parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99) + int(2**((block.number // 100000) - 2)) (In here "//" is the division operator such that 6//2 = 3 and 9//2 = 4.)
So, let's understand what that basically means in plain English:

Block_timestap = the time at which the block was mined.

Parent_timestamp = the time at which the parent block aka the block before this was mined.

If (block_timestamp - parent_timestamp) < 10 seconds then a factor of "parent_diff // 2048 * 1" is added to the difficulty.

If (block_timestamp - parent_timestamp) is between 10-19 seconds then the difficulty is kept the same.

If (block_timestamp - parent_timestamp) > 20 seconds then the difficulty is reduced by "parent_diff // 2048 * -1" to a maximum of "parent_diff // 2048 * -99".

This is how the difficulty adjustment algorithm worked in the Homestead version of Ethereum. The idea is to keep the block time ~15 seconds.

So, what the difficulty bomb is going to do is that it will increase the difficulty by such an exponential amount without adjusting it that it will take more and more time to solve the cryptographic puzzles. Eventually it will become near impossible to mine on the chain. This phenomenon is called the "Ethereum Ice Age", the time all mining POW style becomes impossible.

When this happens, the miners will have no option BUT to go the new Ethereum chain which has Proof-Of-Stake on it.

Alright, so why is this desired? What are the problems that we are facing with Proof of Work that Proof of Stake is looking to solve?

Why POS is Needed over POW?

There are several advantages of implementing proof-of-stake. They can all be broadly listed down among the following categories. (Big shoutout to Jon Choi and his article).

Helps achieve decentralization.

Energy efficiency.

Economic security.

Scaling.

Transition to POS.

Ethereum Mining: Achieving Decentralisation

As we have seen above, POW protocols are not really decentralization friendly anymore. Let's check out the hashrate distribution chart for bitcoin :

And here is the hashrate distribution of the mining pools in Ethereum:
Image Courtesy: Etherchain.org
As you can see, majority of the hashrate is concentrated within some specific pools and this means that no matter what happens, they will always have a better chance of mining blocks and obtaining rewards than anyone else.

Because they can obtain more money, they can therefore afford better and faster ASICs. This basically means, no matter what happens, big mining pools will always have an edge over individuals and smaller pools. In other words, the rich will always get richer.

Proof-of-stake makes this completely irrelevant by making mining completely virtual. However, that's not the only way POS mitigates the effects of centralization. In order to understand that, first we need to know what "Economies of Scale" means. (Thank ACDCLeadership youtube channel for the data).

When it comes to production, there are two kinds:

In the short run production, at least of the input resources are fixed. Consider a small-time pizzeria which has only one oven. It doesn't matter if they have to produce 1 pizza of 25, there is the only oven that they can use to create those pizzas.

In a long run production, all the resources are variable, and this is where economies of scale come in.

So, in a long run production where the quantity of the input resources is variable, what happens if you double the input? There are only three outcomes to this particular scenario. We call this "returns to scale".

The output more than doubles. Meaning there is an increasing return to scale.

The output doubles. Meaning there is a fixed return to scale.

The output does not double. Meaning there is decreasing returns to scale.

The following will show you a graphical representation of economies of scale.
Image Courtesy: Wikipedia
What exactly is going on here?

When the production is increased from Q to Q2, the overall cost of the production goes down from C to C1. This is called Economies of scale.

After that, it evens out for a bit. This is where you get constant returns to scale.

And then when you go beyond that, the cost increases as you increase the output beyond Q2.

What this means is that large corporations can decrease the average cost of their products by increasing the number of their outputs! (Till a limit)
In a sense...more is less!
Let's take a real-world example of that.

A small-time baker's initial costs will obviously be less than a big baking company's because the company will have to invest in a lot of machinery. However, over the long run, the average cost of each and every loaf of bread will be much lesser for the company than it is for the baker.

Ok, all this is fine, but how does it apply to mining pools?

Quite like big corporations, larger mining pools can decrease the cost of their input resources by:

Amortizing a fixed cost over a larger operation.

Having bargaining power by operating as a larger entity.

What this basically means is, a large influential mining pool can, dollar-for-dollar, generate more hash-rate than other pool even if they spend the same amount of money.

This problem is completely mitigated in proof-of-stake because of one simple reason. In POS you invest a stake. You can't simply pool together and make your stake more valuable dollar-for-dollar. At the end of the day, 1 dollar = 1 dollar. Economies of scale don't work here.

Energy Efficiency

The biggest problem of Proof-of-work is the energy wastage. The worst part is that it is energy wastage for the sake of energy wastage. Bitcoin, in particular, is voracious in its appetite for energy. Check this out:
Image Courtesy: Digicnomist
How about some more numbers (courtesy Digicmonist)

There are two numbers that you should focus on:

The annual global mining costs of bitcoin is $1,423,794,674.

Bitcoin alone annually consumes 28.48 TWh worth of electricity. The country of Ecuador consumed around 21 TWh!

In fact, let's compare bitcoin's energy consumption when compared to some countries:

Bitcoin consumes more power than Ireland, Bahrain and Slovak Republic!

Ok, let's even the playing field.

What if we compare Bitcoin to other payment systems? Say...Visa.

How does the power consumption of bitcoin compare to that of visa?

Yeah...not good.

So it is obvious that bitcoin eats a lot of power, and there is a lot of money spent on the resources. However, what about the external costs? The effect that this amount of power consumption has on the environment must be immense.

While there is no doubt that bitcoin and POW has made a lot of positive social changes, we should at least see what a large scale POS system can do and whether it work just as well without consuming so much power.

Economic Security

The biggest advantage that POS, and especially Casper, has is its economic security. Think about this, suppose you are a validator and you have your own money stored up as a stake in the network. It is in your own interests to act in the best interest of the network. Why would you act maliciously knowing that there is a huge part of your stake which can be slashed away and taken over if you do?

Why would you attack a network and harm the coin's value when you have so much of your currency locked up in it?

Also, this "slashing effect" removes the chance of a "spawn camping attack " as Vitalik coins it:
Image Courtesy: Vitalik Buterin Twitter.
Spawn attacks can be prevented in POS by the simple fact that just one attack will lead to the slashing and removal of the invested stake. And if you don't have any stake invested you cannot take part in POS validating.

Scaling

The most obvious way that POS is going to help scalability is by enabling sharding.

As Vlad Zamfir says, sharding with POW is not impossible, but it is hard.

What is sharding?

Sharding is a term that has been taken from database systems. Let's see what sharding means with respect to database. Suppose you have a huge bulky database for your website. Having a bulky database not only makes searching for data slower, but it also hinders your scalability. So, what do you do in this case?

What if you do a horizontal partition on your data and turn them into smaller tables and store them on different database servers?
Image courtesy: Dzone
Like so?

Now, you might be asking, why a horizontal partition and not a vertical partition? That is because of the way tables are designed:

Consider this. Suppose this is our main table:

Now, if we were to partition this table vertically:

You see what happens? When you vertically partition a table they tend to become two completely different tables altogether.

However, if we were to partition them horizontally:

You see? It is the same table/database but with lesser data. These smaller databases are known as shards of the larger database. Each shard should be identical with the same table structure.

So what will happen if we do implement sharding in a POW protocol?

Sharding will make processing faster by splitting a state into different shards. However, if we are using POW, the smaller shards will be in danger of being taken over by malicious miners because of its low hash rate. In fact, this is the biggest reason why POW blockchains can never implement sharding, any and all small shards can be easily taken over.

This risk is completely mitigated in POS since it doesn't have the concept of mining.

Ethereum Mining Conclusion

As you can see, things are going to change immensely once Proof of Stake is implemented. However, anyone who wants to enter the POW mining game in Ethereum still has ample of time to do so.

# data[].attributes.attachment_link.title
Ethereum Mining: Proof of Stake/Proof of Work Hybrid Model

# data[].attributes.attachment_link.description
Ethereum has announced that it will be making the move from a Proof of Work mining System to a Proof of Stake System. This in-depth guide gives readers a proper understanding of this revolutionary change and why it is a game changer! Ethereum Mining

# data[].attributes.body
45 min to read

# data[].attributes.attachment_link.readable_text
Social Media and forums are buzzing with news about EOS, and for very good reasons. Their year-long ICO smashed all the records by collection a staggering $4 billion. Plus, all the drama surrounding their mainnet release has definitely put them under the spotlight. EOSIO Dawn 4.0 brought along a lot of interesting innovations and talking points. In this guide, we are going to do a deep dive of all these interesting features.

So what is EOS?

EOS are aiming to become a decentralized operating system which can support industrial-scale decentralized applications.

That sounds pretty amazing but what has really captured the public's imagination is the following two claims:

They are claiming to have the ability to conduct millions of transactions per second.

They are planning to completely remove transaction fees.

So, how are they planning to bring along all these innovations? You can check out our in-depth guide to get all the details, however, we will glance over them briefly here.

The Team Behind EOS

The core team behind EOS is "Block.one", which is based in the Cayman Islands. Brendon Blumer, the CEO, has been involved in blockchain since 2014. He has previously been involved in companies which dealt with currency exchanges in MMORPGs and in the real estate.

Dan Larimer, is the CTO. He is the creator of delegated proof-of-stake and decentralized autonomous organizations aka DAOs. He is the also the man behind BitShares and Steem.

Now that we know about the team behind the project, let's look at how it plans to achieve its two biggest claims.

Millions of Transactions per Second

EOS achieves its scalability via the utilization of the delegated proof-of-stake (DPOS) consensus mechanism , which is a variation of the traditional proof-of-stake.

This is how traditional proof-of-stake (POS) works:

The validators participate by locking up some of their coins as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

So, how is DPOS different from traditional POS?

Firstly, anyone who holds tokens on a blockchain integrated into the EOS software can select the block producers through a continuous approval voting system. Anyone can participate in the block producer election and they will be given an opportunity to produce blocks proportional to the total votes they receive relative to all other producers.

How does it work?

Blocks are produced in the rounds of 21.

At the start of every round 21 block producers are chosen. Top 20 are automatically chosen while the 21st one is chosen proportional to the number of their votes relative to the other producers.

The producers are then shuffled around using a pseudorandom number derived from the block time. This is done to ensure that a balance connectivity to all other producers is maintained.

To ensure that regular block production is maintained and that block time is kept to 3 seconds, producers are punished for not participating by being removed from consideration. A producer has to produce at least one block every 24 hours to be in consideration.

The DPOS system doesn't experience a fork because instead of competing to find blocks, the producers will have to co-operate instead. In the event of a fork, the consensus switches automatically to the longest chain.

Removing Transaction Fees

EOS works on an ownership model whereby users own and are entitled to use resources proportional to their stake, rather than having to pay for every transaction. So, in essence, if you hold N tokens of EOS then you are entitled to N*k transactions. This, in essence, eliminates transaction fees.

The costs of running and hosting applications on Ethereum can be high for a developer who wants to test their application on the blockchain. The gas price involved in the early stages of development can be enough to turn off new developers.

The fundamental difference between the way Ethereum and EOS operate is that while Ethereum rents out their computational power to the developers, EOS gives ownership of their resources. So, in essence, if you own 1/1000th of the stake in EOS then you will have ownership of 1/1000th of the total computational power and resources in EOS.

As ico-reviews states in their article:

"EOS's ownership model provides DAPP developers with predictable hosting costs, requiring them only to maintain a certain percentage or level of stake, and makes it possible to create freemium applications. Furthermore, since EOS token holders will be able to rent / delegate their share of resources to other developers, the ownership model ties the value of EOS tokens to the supply and demand of bandwidth and storage."

So, these two are the biggest USP of EOS. Now that we have gained a bit of understanding of what EOS plans to do, let's look at some of the features that Dawn 4.0 plans to bring along.

EOS Dawn 4.0

EOS Dawn 4.0 is the latest testnet version that was released by Block. One prior to the launch of their mainnet. There are a lot of interesting talking points that have come to light thanks to the launch. One of the biggest changes that Dawn 4.0 is bringing along is changing the current time from "time of head block" to "time of current block". With this change, all time-related issues are rectified at once.

Along with that, some of the other exciting features that EOSIO is bringing along or improving upon are:

Last Irreversible Block Algorithm

As you can imagine, there is a lot of content to cover and that's why we felt it was prudent to split up this guide into two parts. That way, we can give your proper value without compromising because of content length. So, without any further ado, let's begin!

#1 The RAM Marketplace

Like we have mentioned before when you stake your EOS tokens, you are entitled to own resources like RAM, Network Bandwidth, and CPU Bandwidth in return. So, in essence, not only can you use EOS tokens as a simple payment token, you can use it as a toll both which entitles you to certain resources. Having said that, these resources are very scarce and that is why you can only hold on to the EOS tokens, without using them, for a period of 3 years. Holders who use their tokens will get their account terminated.

Now, when it comes to resources like CPU and Network Bandwidth, the interchange is pretty straightforward. If you plan to sell them and take back your staked tokens, you will get exactly the same amount of tokens back.

However, when it comes to RAM, it is not that simple.

You see, even though these resources are scarce, RAM happens to be even more scarce and precious. Here's the kicker, even though RAM is scarce, there is always going to be a high demand for RAM.

High performance and scalability are two of the hottest topics in the blockchain space. Because of this, RAM is an extremely powerful and critical resource for blockchains. Before we go any further, let's acquaint ourselves with one of the most basic concepts in microeconomics, supply, and demand.

Basically, more the demand and lessen the supply, more will be the price of the product. The supply-demand graph looks sorta like this:

The sweet spot where both the curves intersect is the equilibrium.

So, let's look at what we have here, a scarce asset which will always be high in demand. That is definitely going to affect the price, to be more exact, it will definitely increase the price of the asset, i.e. RAM.

However, in EOS, if you staked a certain amount of and obtained a proportionate amount of resources, you can sell them back and get the exact amount of staked tokens back. This is where we hit our first road bump. This mechanism won't work economically for RAM.

Think about this, early EOS adopters will obviously get the RAM for pretty cheap, however as the network grows and more and more developers enter the blockchain to build their Dapps on top of it, the demand for RAM will shoot through the roof. Now, remember two things:

RAM is already a scarce resource, so the supply will be low.

With the increased demand, the price of RAM will go up.

In an ecosystem where the cryptoeconomics needs are perfectly aligned, early movers should be able to sell their RAM for an increased price, however, EOS until recently, treated RAM as any other resource.

Now, if you remember, EOS holders can't just hold onto their tokens and do nothing for more than 3 years, so at one point, these people would have to sell their tokens and resources without having any economic incentive of doing so.

Along with this, another obstacle was recognized by Block.One. Various tests concluded that the way the EOSIO System Contract was allocating RAM to stakeholders would inevitably lead to shortages down the road.

A solution was needed.

Enter, the RAM Marketplace.

By utilizing the Bancor algorithm, EOSIO is using a market-based approach for RAM allocation. This is how it is going to work:

Suppose someone wants to buy or sell RAM, a 0.5% fee is going to be charged on both the buyer and seller's side. By introducing this fee, it gives a proper economic incentive to RAM sellers. Plus, EOS also plans on curbing speculative marketing and inflation as the fees that are collected burnt.

Dan Larimer showed how the calculation will work on his medium post:

"Our math indicates that if 1TB of RAM was allocated on a pro-rata basis to token holders then the cost-per-byte would be $0.018 (assuming $20/token). The reality is that most token-holders don't actually have an active need to use the RAM they might be entitled to; therefore, we are initially pricing RAM at $0.000018 per byte (assuming $20/token). New accounts require about 4KB of RAM which means they will cost about $0.10. As RAM is reserved the price will automatically increase so that the price approaches infinity before the system runs out of RAM."
Note: He was working with a 1% fee on both seller and buyer side in his calculations and not 0.5%.
Also keep in mind, the other problem that Block.One wanted to solve was the availability problem. A marketplace will go a long way in making sure that there is a steady availability of RAM. The price of RAM will also be based on the currently available supply and it will be set by the system.

The marketplace also introduces another way to curb speculation. Any block producer can simply add more RAM to the marketplace and increase the supply. With the increased supply the value of RAM will go down.

Future Expansion

In order to understand how an asset will behave in the long run, one must know about the Moore's law. According to Investopedia:

" Moore's law refers to an observation made by Intel co-founder Gordon Moore in 1965. He noticed that the number of transistors per square inch on integrated circuits had doubled every year since their invention. Moore's law predicts that this trend will continue into the foreseeable future. Although the pace has slowed, the number of transistors per square inch has since doubled approximately every 18 months. This is used as the current definition of Moore's law."

According to Larimer, in accordance with Moore's law, EOS block producers should be able to upgrade to 4TB or even 16TB of RAM. This increase in supply will decrease the price of RAM in the marketplace

#2 Future Parallelism

One of the more interesting features that EOSIO Dawn 4.0 hopes to bring along is parallelism. Scalability is the name of the game nowadays, and everyone who is anyone in the crypto-community is knee deep in research.

EOSIO realized that for their Dapps to scale properly, they need to maximize their RAM usage. An intriguing way that they are approaching this is by using side chains with independent memory regions.

Sidechains

Sidechain as a concept has been in the crypto circles for quite some time now. The idea is very straightforward; you have a parallel chain which runs along with the main chain. The side chain will be attached to the main chain via a two-way peg

The EOS developers are planning to use side-chains to kill two birds with one stone:

To create a sense of competition between the side chains.

So, how is this going work?

The EOS block producers work on the side-chain of their choice and use the token to buy RAM from the side-chain. The side-chains will follow the governance protocols that have been laid down by the main EOS blockchain. Each of these sidechains can potentially have >1 TB of their own RAM.
NOTE: Dan Larimer said the following his Medium Post:
"Some community members expressed concern that some people will derive unjustified profits by buying up cheap RAM before anyone else can get on the chain. To mitigate this, we recommend that those who launch a chain start out with a very limited supply of RAM and then gradually increase the RAM over the first couple of months. If the RAM supply starts out at 32GB and then grows to 1TB over a period of months then the price of RAM may rapidly drop over time to 3% of its initial pricing. Only those who really need RAM or who factor in future RAM supply when bidding will buy the initial RAM. Either way, no one will get "cheap" RAM or "free profits". "

These sidechains will gain interoperability by having the ability to "talk" to each other via Inter-Blockchain Communication (IBC). Using IBC, Daps will have the ability to buy unused RAM from the other sidechains, which will result in the scaling of RAM usage.

Now remember how we said that EOS is also planning to integrate a sense of competition between all these sidechains? Want to know how it achieves that?

The price of RAM is not fixed across all the side chains. So, a Dapp developer can choose to operate on a sidechain where they are getting the cheapest RAM. This will help incentivize the sidechains to offer the best value proposition.

Inter Blockchain Communication (IBC)

Block.One firmly believes that upgrading from a single-threaded execution to a multi-threaded one is the path to scalability. In order to do so, a new chain with multi-threaded support executed by the same block producers needs to be launched. By doing so, ay number of tests and upgrades can be done to the new chain without any risks to the live main chain.

This is why IBC is so critical. It will allow these chains to communicate with each other and lay down the foundations for exponential scalability. It will enable EOS to scale the use of all its available resources.

In order to understand how it works, you should be clear about Merkle Roofs.

What is a Merkle Tree?
Image Courtesy: Wikipedia
The above diagram shows what a Merkle tree looks like. In a Merkle tree, each non-leaf node is the hash of the values of their child nodes.

Leaf Node: The leaf nodes are the nodes in the lowest tier of the tree. So wrt the diagram above, the leaf nodes will be L1, L2, L3, and L4.

Child Nodes: For a node, the nodes below its tier which are feeding into it are its child nodes. Wrt the diagram, the nodes labeled "Hash 0-0" and "Hash 0-1" are the child nodes of the node labeled "Hash 0".

Root Node: The single node on the highest tier labeled "Top Hash" is the root node.

So what does a Merkle Tree have to do with blockchains?

Each block contains thousands and thousands of transactions. It will be very time inefficient to store all the data inside each block as a series. Doing so will make finding any particular transaction extremely cumbersome and time-consuming. If you use a Merkle tree, however, you will greatly cut down the time required to find out whether a particular transaction belongs in that block or not.

Let's see this in an example. Consider the following Merkle tree:
Image courtesy: Coursera
Now suppose I want to find out whether this particular data belongs in the block or not:

Instead of going through the cumbersome process of looking at each individual hash and seeing whether it belongs to the data or not, you can simply track it down by following the trail of hashes leading up to the data:

Doing this significantly reduces the time taken.

Back to IBC

So, as we have seen, Merkle Trees are a very useful indicator of showing proofs of user actions to lightweight clients (via Merkle Roots). In IBC, one blockchain acts as a lightweight client to the other. Imagine there are two chains A and B. If Chain A accepts and logs in a transaction, then by using IBC, Chain B can confirm the occurrence of that event. It does so by receiving messages from Chain A and following its block headers and processing all the Merkle proofs. The proofs have certain sequence numbers which Chain B can use to make sure that there have been no gaps in processing.

IBC involves validation of Merkle proofs from both the chains, which are 1KB+ in size and involve loads of cryptographic hash functions and/or >15 signature verifications. As such, the cost of validation for one single IBC 15X and sometimes even 30X higher than that or normal transactions.

Now you are probably wondering, the whole point of doing this was to scale up, however, this doesn't really seem pretty scalable now, does it? Thankfully, it turns out that these proofs are pretty simple to parallelize since they are independent of blockchain state.

Instead of the state, EOS generates Merkle tree over sequenced action, in other words, instead of going through each individual actions, a light client can simply check to see the completion and verification of each proof.

Think of it like this. Suppose you have a huge account balance sheet in front of you. Instead of painstakingly going through the details of each and every transaction all you are checking is whether the transaction went through or not.

Since this means that IBC's are only effective when one can guarantee the completeness and order of the transactions, the EOS protocol has created a TCP like communication channel between the chains. Using this simple innovation one can easily detect missing and out of order proofs. To prove completeness to the exact present moment, one must generate a transaction and then get a proof to show that the transaction was confirmed with the proper sequence number.

Regarding parallelization, Dan Larimer said,

"Under EOSIO Dawn 3.0 we made a lot of design decisions around the potential for future multi-threaded WASM execution. Unfortunately, until you actually implement a full multi-threaded implementation it is impossible to know whether we have all the corner cases covered. This means that EOSIO Dawn 3.0 had a lot of architecture complexity that was not giving any immediate benefit."

Basically, a lot of things are needed to be ironed out for this to be fully effective.

#3 Header Only Validation

The last feature that we are going to be covering in this part is "Header Only Validation." Earlier it was impossible to validate a single block-header without using the whole block. As you can imagine, this ate up a lot of unnecessary time and resources.

To speed up the process and make it more efficient, EOS Dawn 4.0 will now support header-only validation. This feature is extremely important because:

Allows block propagation across the network without waiting for full verification through each node.

Allows simple IBC execution

Prevents a lot of attack vectors

We will continue with the rest of the updates in part 2!

# data[].attributes.attachment_link.title
What is EOS? (Beginner's Guide) Part 1 - Blockgeeks

# data[].attributes.attachment_link.description
Social Media and forums are buzzing with news about EOS, and for very good reasons. Their year-long ICO smashed all the records by collection a staggering $4 billion. Plus, all the drama surrounding their mainnet release has definitely put them under the spotlight. EOSIO Dawn 4.0 brought along a lot of interesting innovations and talking points.

# data[].attributes.headline
Blockchain Battle: Ethereum vs Cosmos vs Cardano vs EOS vs Hyperledger

# data[].attributes.subject
Blockchain Battle: Ethereum vs Cosmos vs Cardano vs EOS vs Hyperledger

# data[].attributes.body
45 min to read

# data[].attributes.attachment_link.readable_text
Smart contracts and the blockchain technology are all the rage right now. More and more people are trying to get into this amazing space for one reason or another. If you are new to this technology and are looking for a quick primer on blockchain-based developing platforms then this guide is perfect for you. The platforms that we are going to be focussing on and comparing are:

Blockchain Battle: Ethereum vs Cosmos vs Cardano vs EOS vs Hyperledger

So, why have we decided to focus on these 5? We feel that this group gives a healthy mixture of usability and functionality. Yes, we know that some of these projects are not exactly live, but we still feel that the potential of the projects is enough to warrant a place on our list. We are going to go through each and every platform and then compare them at the end.

Ethereum

Ethereum is, without a doubt, the big daddy of smart contract platforms. The main man behind Ethereum is Vitalik Buterin. Buterin was fascinated with Bitcoin, but he realized that the blockchain technology had far more use than being a mere facilitator of a payment protocol. He realized that one can use the blockchain technology to create decentralized applications. That was when he was inspired to create Ethereum.

Ethereum, like Bitcoin, was a cryptocurrency, however, that's where the similarity ends. Because while Bitcoin is a "first-generation" blockchain, Ethereum broke the mold by becoming the first ever second-generation blockchain. Ethereum revolutionized the crypto-space by bringing in smart contracts on the blockchain.

Smart contracts were first conceptualized by Nick Szabo. The idea is simple, have a set of self-executing instructions between two parties which don't need to be supervised or enforced by a third-party. The idea seems pretty straightforward, right? However, smart contracts enabled Ethereum to create an environment wherein developers from around the world could create their own decentralized application aka Dapps.

Dapps and Smart Contracts

Dapp creation is one of the most important features of Ethereum. Along with being decentralized, there are certain other features that a Dapp must have:

The source code of the Dapp should be open to all

The application must have some sort of tokens to fuel itself

The App must be able to generate its own tokens and have an inbuilt consensus mechanism

Sounds pretty awesome right? So, how exactly can you build them? You need to code smart contracts using solidity.

Developers use a programming language called Solidity which is a purposefully slimmed down, loosely-typed language with a syntax very similar to ECMAScript (Javascript).

Along with creating the smart contract, you must have an environment where you can execute it. However, there are some properties that this execution environment must have. These properties are:
Property #1: Deterministic
A program is deterministic if it gives the same output to a given input every single time. Eg. If 3+1 = 4 then 3+1 will ALWAYS be 4 (assuming the same base). So when a program gives the same output to the same set of inputs in different computers, the program is called deterministic. The environment must make sure that execution of the smart contract is always deterministic.
Property #2: Terminable
In mathematical logic, we have an error called "halting problem". Basically, it states that there is an inability to know whether or not a given program can execute its function within a time limit. In 1936, Alan Turing deduced, using Cantor's Diagonal Problem, that there is no way to know whether a given program can finish in a time limit or not.

This is obviously a problem with smart contracts because, contracts by definition, must be capable of termination in a given time limit. So the environment must be able to halt the operation of the smart contract.
Property #3: Isolated
In a blockchain, anyone and everyone can upload a smart contract. However, because of this the contracts may, knowingly and unknowingly contain virus and bugs.

If the contract is not isolated, this may hamper the whole system. Hence, it is critical for a contract to be kept isolated in a sandbox to save the entire environment from any negative effects.

Ethereum executes its smart contracts using a virtual machine called Ethereum Virtual Machine (EVM).

The next core Ethereum concept that one must understand is gas.

What is Ethereum Gas?

Remember the "Terminable" property of smart contract environments? Well, Ethereum smart contract achieves this property by utilizing gas. Each and every line that is coded in the smart contract requires a certain amount of gas to execute. So, when a developer submits a smart contract for execution, they also specify the maximum gas limit.

Think of the gas limit as the fuel you fill up in your car before going for a drive, the moment the fuel runs out, the car stops working. Each and every line in the smart contract requires a certain amount of gas to execute. Once the gas runs out, the smart contract stops executing.

Ethereum and ICOs

We have covered this topic at length before so we will just go over this very briefly. One of the most alluring features of Ethereum is initial coin offering or ICO s. Developers around the world can use Ethereum's virtual machine to power their smart contracts and use the platform to raise lots of money in a crowded sale with relative ease. Because of this very feature, Ethereum's adoption has gone through the roof.

Ethereum Mining

Ethereum as of right now is using the Proof-of-Work mining, i.e. the same mining process used by Bitcoin. Basically, miners compete to find the next block in the chain by using their processing power to solve complex cryptographic puzzles.

Ethereum is eventually going to move on to Proof-of-Stake by utilizing the Casper protocol. POS is far more environmentally friendly than POW and is a lot more scalable.

Main Problems

There is no doubt of the impact that Ethereum has had on the crypto-space, however, there are some major problems surrounding its performance. As of right now, Ethereum fails when it comes to scalability. They can only manage 25 transactions per second, which is not ideal for Dapps who want mainstream adoption. On top of that, Ethereum can be expensive for developers. The gas prices for the execution of Dapps can go through the roof.

Along with these, there is one more problem that affects Ethereum and other cryptocurrencies. This problem is interoperability. As of right now, if Alice owns Bitcoin and Bob owns Ethereum, then there is no easy and direct way for the two to interact with each other. This is a really big issue because in the future, there may be thousands of blockchains running in parallel and there should be a way for them to interact seamlessly with each other.

One project that is aiming to solve this interoperability problem is Cosmos.

Cosmos

Token: ATOM

Cosmos aims to become an "internet of blockchains" which is going to solve these problems once and for all. Cosmos's architecture consists of several independent blockchains called "Zones" attached to a central blockchain called "Hub".
Image Credit: Cosmos Video

According to the Cosmos whitepaper, "The zones are powered by Tendermint Core, which provides a high-performance, consistent, secure PBFT-like consensus engine, where strict fork-accountability guarantees hold over the behavior of malicious actors. Tendermint Core's BFT consensus algorithm is well suited for scaling public proof-of-stake blockchains."

The brains behind this project are CEO Jae Kwon and CTO Ethan Buchman and the Interchain Foundation team.

What is Tendermint?

Tendermint is a variant of PBFT i.e. Practical Byzantine Fault Tolerance. A Byzantine Fault Tolerance, or BFT, the system is a system which has successfully answered the Byzantine Generals Problem. We have covered the Byzantine Generals Problem in detail here. To keep things short, for a decentralized peer-to-peer system to function in a trustless manner, it is imperative for them to find the solution to the Byzantine's Generals Problem.

As the cosmos whitepaper states:

"Tendermint provides exceptional performance. In benchmarks of 64 nodes distributed across 7 data centers on 5 continents, on commodity cloud instances, Tendermint consensus can process thousands of transactions per second, with commit latencies on the order of one to two seconds. Notably, the performance of well over a thousand transactions per second is maintained even in harsh adversarial conditions, with validators crashing or broadcasting maliciously crafted votes."

The graph below support the claim made above:
Image Credit: Cosmos Whitepaper
Benefits of Tendermint

Tendermint can handle transaction volume at the rate of 10,000 transactions per second for 250byte transactions.

Better and simple light client security which makes it ideal for mobile and IoT use cases. In contrast, Bitcoin light clients require a lot more work and have lots of demands which makes it impractical for certain use cases.

Tendermint has fork-accountability which stops attacks such as long-range-nothing-at-stake double spends and censorship.

Tendermint is implemented via Tendermint core which is an "application-agnostic consensus engine." It can basically turn any deterministic blackbox application into a distributedly replicated blockchain.

Tendermint Core connects to blockchain applications via the Application Blockchain Interface (ABCI).

Inter-Blockchain Communication

As we have mentioned before, Cosmos's architecture will follow the Hub and Zones method. There will be multiple parallel blockchains connected to one central Hub blockchain. Think of the Sun and the solar system.

The Cosmos hub is a distributed ledger where individual users or the Zones themselves can hold their tokens. The zones can interact with each other through the Hub using IBC or Inter Blockchain Communication.

See the diagram above?

This is a very simplified version of how two Zones communicate with each other via IBC.

Cosmos Use Cases

The interoperability achieved by Cosmos has some extremely interesting use-cases:

DEX: Since Cosmos is linking so many blockchains with each other, it goes without saying that it can easily enable different ecosystems to interact with one another. This a perfect setting for a decentralized exchange.

Cross chain transactions: Similarly, one zone can avail the services of another zone through the Cosmos hub.

Ethereum Scaling: This is one of the more use cases. Any EVM based zone which is connected to the Cosmos hub will be, as per the architecture, powered by the Tendermint consensus system as well. This will enable these zones to scale up faster.

Cardano

Token: ADA

The brainchild of Ethereum co-founder Charles Hoskinson, Cardano is a smart contract platform however, Cardano offers scalability and security through layered architecture. Cardano's approach is unique in the space itself since it is built on scientific philosophy and peer-reviewed academic research.

Cardano is a third-generation blockchain which is focussed on bringing scalability and interoperability to the blockchain space. There are three organizations which work full time to develop and take care of Cardano:

These three organizations work in synergy to make sure that Cardano development is going on at a good pace.

Functional Programming

There is one really interesting quality that makes Cardano unique as compared to the other smart contract platforms. Majority of the other smart contract platforms are coded via imperial programming language. Cardano uses Haskell for its source code, which is a functional programming language. For its smart contracts, Cardano uses Plutus, which is also a functional language.

Let us explain the difference between the two types of languages in a straightforward way.

In imperative languages, addition works like this:

As you can see, it takes a lot of steps. Now, how will that work in a functional language?

Suppose there is a function f(x) that we want to use to calculate a function g(x) and then we want to use that to work with a function h(x). Instead of solving all of those in a sequence, we can simply club all of them together in a single function like this:

h(g(f(x)))

This makes the functional approach easier to reason mathematically.

Functional languages helps with scalability and it also helps in making the program far more precise.

Scalability

Cardano uses a new proof of stake algorithm called Ouroboros, which determines how individual nodes reach consensus about the network. The protocol has been designed by a team led by OHK Chief Scientist, Professor Aggelos Kiayias.

Ouroboros is the first proof of stake protocol that has mathematically been shown to be provably secure, and the first to have gone through peer review through its acceptance to Crypto 2017, the leading cryptography conference.

Interoperability

The way Cardano plans to execute interoperability is by implementing sidechains.

Sidechain as a concept has been in the crypto circles for quite some time now. The idea is very straightforward; you have a parallel chain which runs along with the main chain. The side chain will be attached to the main chain via a two-way peg.

Cardano will support sidechains based on the research by Kiayias, Miller, and Zindros (KMZ) involving "non-interactive proofs of proofs of work".

According to Hoskinson, the idea of sidechains comes from two things:

Getting a compressed version of a blockchain.

Creating interoperability between chains.

EOS

Token: EOS

EOS are aiming to become a decentralized operating system which can support industrial-scale decentralized applications. The driving force behind EOS is Dan Larimer (the creator of BitShares and Steemit) and Block.One. EOS recently came into the spotlight for their year-long ICO which raised a record-breaking $4 billion.

That sounds pretty amazing but what has really captured the public's imagination is the following two claims:

They are claiming to have the ability to conduct millions of transactions per second.

They are planning to completely remove transaction fees.

Scalability Through DPOS

EOS achieves its scalability via the utilization of the delegated proof-of-stake (DPOS) consensus mechanism, which is a variation of the traditional proof-of-stake. It can theoretically do millions of transactions per second.

So, how is DPOS different from traditional POS? While in POS the entire network will have to take care of the consensus, in DPOS all the EOS holders will elect 21 block producers who will be in charge of taking care of the consensus and general network health. Anyone can participate in the block producer election and they will be given an opportunity to produce blocks proportional to the total votes they receive relative to all other producers.

The DPOS system doesn't experience a fork because instead of competing to find blocks, the producers will have to co-operate instead. In the event of a fork, the consensus switches automatically to the longest chain.

As you can imagine, the importance of these block producers definitely can't be underestimated. Not only do they take care of consensus, but they take care of overall network health as well. This is why it is extremely important that each and every single vote that has been cast has proper weightage.

This is why, Larimer introduced the idea of Voter Decay, which will reduce the weightage of old votes over time. The only way that one can maintain the strength of votes is by regular voting.

The Voter Decay mechanism leads to two great advantages:

Firstly, as we have seen time and again, elected officials may become corrupt and change their tune after getting elected. The vote decay system gives the voters a chance to reconsider their vote every week. This keeps the block producers accountable and on their toes.

Secondly, people simply change over time. Maybe the political beliefs and ideologies that someone has today is completely different than what they had a year ago. The vote decay system will allow people to vote for someone who is more congruent with their newly evolved ideologies.

This has the potential to be a truly revolutionary concept and can change decentralized voting (maybe even voting) forever.

Removal of Transaction Fees

EOS works on an ownership model where users own and are entitled to use resources proportional to their stake, rather than having to pay for every transaction. So, in essence, if you hold N tokens of EOS then you are entitled to N*k transactions. This, in essence, eliminates transaction fees.

On staking EOS tokens you get certain computational resources in exchange. You will get:

RAM

Network Bandwidth

Computational Bandwidth.

EOS tokens, along with payment coins, can also be used as a toll to get all these resources.

Hyperledger

Finally, we have Hyperledger.

Hyperledger, to be very frank, is extremely different from all the platforms that we have talked about so far. While Ethereum, Cardano, and EOS are proper cryptocurrencies and have their own blockchains, Hyperledger is not a cryptocurrency, and nor does it have its own blockchain. Hyperledger is an open-sourced project by the Linux Foundation. On their website, Hyperledger describes itself as

"an open source collaborative effort created to advance cross-industry blockchain technologies. It is a global collaboration, hosted by The Linux Foundation, including leaders in finance, banking, Internet of Things, supply chains, manufacturing, and Technology."

The Need For Permissioned Blockchain

Platforms like Ethereum, EOS etc. are all public blockchains, meaning, anyone can choose to join the network. However, for big enterprises who need their own blockchain infrastructure, this is highly undesirable.

Think of a blockchain conglomerate of banks.

Banks need to deal with sensitive data every single day. From their internal transactional records to KYC data, there are lots of items which they simply can't reveal to the public. Plus, only banks that have been vetted by the other banks present in the network should be allowed inside the network.

Also, as we have already covered before, public blockchains are slow and have performance issues, which is again a big no-no for large-scale companies.

Hyperledger allows these companies to create their own high-performance permissioned blockchain (aka blockchains where each and every node must be vetted properly before entering).

Interesting Projects Under Hyperledger

Maybe the most interesting project in the Hyperledger family is IBM's Fabric. Rather than a single blockchain Fabric is a base for the development of blockchain based solutions with a modular architecture.

With Fabric different components of Blockchains, like consensus and membership services can become plug-and-play. Fabric is designed to provide a framework with which enterprises can put together their own, individual blockchain network that can quickly scale to more than 1,000 transactions per second.

Along with Fabric you also have:

Sawtooth: Developed by Intel and uses Proof-of-Elapsed time consensus mechanism

Iroha: Asn easy-to-use blockchain framework developed by a couple of Japanese companies.

Burrow: Creates a permissible smart contract machine along the specification of Ethereum.

Comparing all the Platforms

Alright, so now that we have somewhat familiarized ourselves with these platforms, let's compare all of them.

# data[].attributes.attachment_link.title
Blockchain Battle: Ethereum vs Cosmos vs Cardano vs EOS vs Hyperledger - Blockgeeks

# data[].attributes.attachment_link.description
Smart contracts and the blockchain technology are all the rage right now. More and more people are trying to get into this amazing space for one reason or another. If you are new to this technology and are looking for a quick primer on blockchain-based developing platforms then this guide is perfect for you.

# data[].attributes.headline
Why You Should Care about Decentralized Exchanges

# data[].attributes.subject
Why You Should Care about Decentralized Exchanges

# data[].attributes.body
40 min to read

# data[].attributes.attachment_link.readable_text
Here we discuss decentralized exchanges, as transactions are the backbone of the cryptocurrency market, and current exchanges present a weak link in the philosophy of decentralization.

The four core functions of any exchange are capital deposits, order books, order matching, and asset exchange. In order to create a fully decentralized exchange (DEX), each of these functions must be decentralized. In most exchanges, only the asset exchange is decentralized, as the assets are cryptocurrencies deployed on the blockchain that no central entity controls. However, the other three functions, and especially capital deposits, are usually centralized. Due to KYC (know your customer) and AML (Anti-Money Laundering) regulations, exchanges are often required to seek users' identities for capital deposits, creating centralized record-collection and data-storage of personal information. Effectively, centralized exchanges give users permission to transact currencies, rather than creating a permissionless ecosystem.

On an architectural level, decentralization means that there is no centrally-controlled server(s), and the networks' nodes are distributed. Currently, perhaps the only truly decentralized exchange is the Blocknet "BlockDX", as other attempts do not decentralize all four functions.

The Two Types of Decentralized Exchanges

As exchanges revolve around transacting currencies, there are two fundamental exchange models: currency-centric and currency-neutral. Either of these models can be centralized or decentralized, depending on how the four key functions of the exchange are handled.

Currency-centric exchanges are built on top of singular blockchain platforms, such as Ethereum. A currency-centric exchange is limited to escrowing only the currency of the platform it is built on, such as ERC20 assets and other contracts if the exchange is built on top of Ethereum. This is the way traditional exchanges are built.

The newer model is currency-neutral, which is architected to connect different native cryptocurrencies, meaning that users do not have to adhere to any specific currency ecosystem. These systems allow users to trade cryptocurrencies without a coin underlying that exchange, which acts as a sort of additional "middleman" to go through since it is no longer fully peer-to-peer. Examples of these models include Bisq, altcoin.io, and flyp.me.

These newer projects allow for securely matching and handling order books, and not just asset exchange, in a decentralized manner, which is done using the blockchain. Because an exchange is a community of users, there has to be a way to broadcast and match orders. One way of trustless trading is through "atomic swaps" for order matching, but atomic swaps alone cannot create a trustless marketplace, as it is done from one specific peer to another, rather than as a broadcast to anyone on the network. An atomic swap is when a trade is done in a single, or atomic, operation, as opposed to two separate transactions (such as first sending one coin, then waiting for the receiver to send their coin). This is facilitated through smart contracts that act as a trustless escrow holding onto one currency until the other user sends their currency as well when both currencies can be released.

The Pros and Cons of Decentralized Exchanges

The most obvious benefit of a DEX is the same as with any decentralized application, which revolves around the philosophy of cutting out the middlemen and returning interactions to peer-to-peer, permissionless models without central authorities. More specifically, decentralization creates censorship-resistance, which in the case of decentralized exchanges means that no central authority could forcefully impose regulations, or even ban currencies and/or the exchange itself. This is especially important considering that many countries are clamping down on cryptocurrency trading. For example, the two most populous countries on earth, China, and India, have banned cryptocurrency exchanges, while countries including Mexico, Russia, Saudi Arabia, and Brazil have restricted cryptocurrencies.

Without Decentralized Exchanges, the peoples' ability to invest in crypto is subject to governments, so cryptocurrency becomes hardly more democratic than traditional asset markets. Governments can exert control over centralized exchanges, and users are subject to authorities who may at any moment track and tax users, or ban currencies.

Other merits of a DEX include heightened security. Massive security attacks, such as the roughly $470 million that was stolen from Mt. Gox, were only possible because the centralized hot wallets of the exchange were targeted, which presented a single point of failure. In a DEX, each user is in private control of their own funds, so there is no central point of attack. However, as we'll get to later, many exchanges claim to be decentralized, such as Bancor, but are truly hybrid, and their centralized aspects present vulnerabilities. For instance, around $23 million was recently stolen from Bancor, and Bancor responded with a freeze attempt built into their protocol, which is only possible with at least a partially-centralized architecture.

As we'll see, DEXs use Smart Contracts to facilitate transactions, such as using contracts as an escrow for peer-to-peer transactions. If the contracts themselves are highly secure, then the exchange benefits from the cryptographic security of the underlying blockchain. However, this is often not the case, and Smart Contracts can contain many vulnerabilities, including underflows, overflows, reentrancy attacks, and many more. In fact, studies have found over 34,000 contracts with known vulnerabilities. These facts, alongside recent hacks such as the Bancor attack, reflect the need for Smart Contract Auditing to validate the security of the contract code and find any back-door vulnerabilities.

Further, a DEX could facilitate faster and cheaper transactions than a centralized exchange, since there is no third party authenticator. Currently, this is just theoretical and has yet to be proven by exchanges on a large scale, as DEXs have not achieved the "network effect" of reaching enough users for critical mass.

The largest drawback of current DEXs is the lack of functionality, relative to centralized exchanges. Most DEXs only support basic market functions, and not even features such as margin trading and stop loss. The technology has simply not yet caught up with the ambitions of most decentralized exchanges, though DEXs like BlockDX are planning to support additional functionality.

Lastly, because of the KYC and AML regulations mentioned earlier, Decentralized Exchanges do not support fiat conversions, as this would introduce a point of centralization. Instead, users must use cryptocurrency deposits.

Comparing Decentralized Exchanges

Currently, Decentralized Exchanges are still far off from achieving the liquidity, scalability, and functionality needed for mass adoption. However, current attempts built for Ethereum-based tokens include 0x Protocol, Kyber Network, EtherDelta, BlockDX by Blocknet, and Radex. One unique DAO-based platform is IDEX. Decentralized Exchanges in early development include the Waves Platform, Binance Chain, and OasisDEX, which is built by MakerDAO.

0x Protocol and Kyber Network are considered serious contenders for the future of Decentralized Exchanges. Both use their own internal tokens (KNC for Kyber and ZRX for 0x). The largest difference between the two is in how order matching is done:

0x solves this problem with a hybrid method where order matching is done off-chain with an intermediate party and then using the blockchain for the actual trade.

Anyone can be an off-chain matchmaker by maintaining an order book

Programmable Smart Contracts allow market makers to set fees for managing the transaction (accepting an order and posting it in the order books)

EtherDelta was initially breached and the exchange never fully recovered to work properly

Their ICO was launched before the exchange was working properly

Cancellation orders are mined on-chain, and waiting for the next mined block means that real-time trading becomes impossible

Order processing is not done on-chain, yet EtherDelta does not experience the speed benefits of off-chain order processing, and users report very slow functionality

Kyber solves this problem by using Smart Contracts and reserves.

Unlike 0x, Kyber does not use off-chain matchmakers, and instead, all reserve transactions are managed by Smart Contracts.

Reserves provide liquidity, and a singular reserve is held by Kyber.

They've developed a multi-token structure through the DAO, with IDXM, AURA, and Boreal tokens

IDXM is used as a membership fee token

AURA is the Snowglobe staking token that supports the multi-exchange protocol

Oasis does not aim to have the same token support as IDEX, and is meant for assets in the Maker registry (currently MKR, DAI, and ETH)

Market makers are rewarded with AURA while takers pay gas fees

The use of Radex requires you to use the centralized Saturn Wallet plugin in your web browser

The handling of the order book is not ideal in Radex, as it is not stored in a decentralized fashion, but is instead dynamically recreated by reading the events that Radex creates

Boreal is the stablecoin, also enabling decentralized P2P lending

The Decentralized Capital aspect of IDEX provides users with free banking and loans through Boreals

Snowglobe, which uses the AURA token above, is the protocol that creates a secondary network of child-chains that link exchanges to improve liquidity

IDEX is not fully decentralized, as IDEX itself is the only authority that may submit signed trades to Ethereum

This provides the speed and UX of centralized exchanges, forming a hybrid model

Additional reserves can be public or private.

Private reserves are private coin holders who choose to act as a source of crypto for the exchange and set their own rates

Public reserves can receive contributions from the public, and the public benefits by sharing in the profits

Looking at the above two (very strong) platforms, EtherDelta is very weak in comparison:

With EtherDelta, the order book matching (one of the four key functions) is handled by centralized EtherDelta servers. Due to this centralization, orders in the order book can be censored, meaning that the censorship-resistance philosophy is made moot, but the security benefit of controlling your own funds remains. The 0x project is similar to EtherDelta, with the key difference being that 0x provides a multi-national chain, where many exchanges can collaborate to build a larger order book taking advantage of a shared liquidity pool. 0x has the same centralization concern of EtherDelta, whereby the centralized servers of an individual exchange handle order matching.

The IDEX platform lies in a category of its own, as it runs on top of the Aurora DAO (Decentralized Autonomous Organization), which is inspired by free banking:

OasisDEX is a competitor to IDEX, as it is built by MakerDAO and aims for similar levels of decentralized interactions alongside decentralized governance. However, OasisDEX is only in alpha stage and their GitHub is not seeing any recent developments.

Radex is similar to IDEX in the fashion that market makers earn rebates for the liquidity they provide. This is the unique value proposition that Radex provided until IDEX came along, and now IDEX is a more developed and decentralized platform:

Soon, the "Binance Chain" will be released, which claims to provide a DEX. Once Binance Chain is live, Binance Coin (BNB) will be swapped with a new coin based on the Binance blockchain at a 1:1 ratio. Since the plans were announced in March 2018, there have been no updates, though Binance Chain is unlikely to be fully decentralized, since capital deposits will be made to Binance, and Binance itself will not convert to a decentralized model. Further, as Binance practices freezing funds to comply with regulations and prevent theft, this means that there is centralized control over funds.

To our knowledge, BlockDX is the most decentralized platform, as all four functions of the exchange are decentralized. Further benefits include a partnership with 0x that enable interoperability with Ethereum tokens. For peer-to-peer trades without a central escrow, Blocknet uses atomic swaps, discussed earlier, in a technology called XChat. Blocknet also creates an inter-chain overlay using XBridge, which provides a DHT-based peer-to-peer network. Importantly, BlockDX comes with a decentralized API that you can connect to over localhost without permission, allowing for truly decentralized trading.

Initiator creates secret X and hashes it to create H(X).

Hurdles Toward DEX Adoption

Without central processing of the exchange functions, authorities such as taxation and regulation bodies have no power over a DEX. If DEX's were to be massively adopted and replace centralized exchanges, that would mean hundreds of billions of dollars escaping the purview of taxation and regulation bodies. In effect, this would mean that the platform users, rather than rent-seeking authorities, would control the funds.

Initiator shares H(X) and pubkey i2 with responder.

These rent-seeking authorities have already exerted massive efforts to stop the blockchain revolution and maintain their control, such as India and China banning crypto. Other attempts of maintaining control include government-run cryptocurrencies without much transparency, such as the asset-backed petro cryptocurrency of Venezuela. Further, traditional mega-corporations are creating permission blockchain ecosystems, such as IBM.

Many exchanges claim to be moving towards a decentralized model, defending their current centralization by saying that centralization speeds up development. Whether or not this is true is up for debate, as entire protocols will now have to be re-written to shift to decentralization.

Creating a DEX

Responder confirms TxAb. Responder creates TxBb. TxBb can be redeemed after T1 time with privkey r2. At any time TxBb can be redeemed with signature from privkey i2 and reveal of secret X.

The ideal model for a DEX would be a Decentralized Autonomous Organization (a transparent, shareholder controlled, computer-represented organization that is a more complex version of a ÐApp). This would ensure full decentralization of all aspects of the exchange, and users would have the decision-making power instead of any central body.

Initiator creates TxBp which spends TxBb using privkey i2 and secret X. With the revealed secret, responder can create TxAp which spends TxAb with privkey r1.

Proof-of-identity becomes a non-trivial problem with a DEX, and especially a DAO exchange. One solution is with Decentralized Identities (DIDs), which make identifiers and names self-sovereign to their owning entity. Existing DIDs include NuID, Identity.foundation, and Sovrin. The current identity handling that many supposed DEXs are using is through email sign-ups - the same as most sites (i.e. sign up with your Gmail). However, any service that requires your email, or any asset running on centralized servers, is not fully decentralized.

First off, creating a crypto exchange requires that the four fundamental functions discussed earlier are built: capital deposits, order books, order matching, and asset exchange. These include allowing users to control their own funds, running the network on multiple nodes, not revealing a user's identity, and integration with existing wallets. Then, a front-end is built that matches user input, such as clicking a "buy" button, to the Smart Contract functionality in the back-end.

The above is fundamentally how any DEX is built, though even a single point of centralization introduces new vulnerabilities. Besides the technical creation of the DEX, it requires a governance model, which can be up to the creators, or up to the users, as in a DAO. Further, the exchange has to achieve "network effect" to become scalable and maintain high enough liquidity for serious use.

1. Guide to Atomic Swaps and Trustless Cross-Chain Trading

2. Blocknet White Paper

3. "The Trouble With Centralized Exchanges" by Blocknet

4. "Decentralized Cryptocurrency Exchanges" on Hackernoon

5. "Decentralized Exchanges: Three Types That Will Be Essential For The Crypto Economy" by Totle

6. "Analyzing Activities on Decentralized Exchanges" by ConsenSys

7. "70% of Value in Tech is Driven by Network Effects" by NFX

BlockDX describes their order system as a "decentralized state machine", where the first step is placing an order, which will be canceled or accepted depending on service node polls, market makers, whether the broadcast was received, and whether the recipient accepts or cancels the order.

As an example of a how a DEX may operate, let's look at the BlockDX algorithm summary, inspired by the Blocknet GitHub, which describes order matching via atomic swap:

The initiator also creates public/private key pair (pubkey i1, i2 / privkey i2, i2).

Responder creates public/private key pair (pubkey r1, r2 / privkey r1, r2).

Responder shares pubkey r1 with initiator.

TxAb can be redeemed after time T2 with privkey i1. At any time TxAb can be redeemed with signature from privkey r1 and reveal of secret X.

Initiator broadcasts TxAb onto the network.

Responder broadcasts TxBb onto the network.

To simplify the above: Users are in control of their own funds and broadcast orders to the network from their end. The security and encryption aspects of this process are handled on the user-end, as there is no centralized server.

With the framework and definitions presented in this guide, you'll be able to make the distinctions between a true DEX and a centralized exchange for more informed decision-making.

References

# data[].attributes.attachment_link.title
Why You Should Care about Decentralized Exchanges - Blockgeeks

# data[].attributes.attachment_link.description
Here we discuss decentralized exchanges, as transactions are the backbone of the cryptocurrency market, and current exchanges present a weak link in the philosophy of decentralization. The four core functions of any exchange are capital deposits, order books, order matching, and asset exchange.

# data[].attributes.body
50 min to read

# data[].attributes.attachment_link.readable_text
It is hard to put into words the sheer impact that ERC20 tokens have had on the crypto-world. They are single-handedly responsible for the billion-dollar ICO industries and they have played a big role in making cryptocurrencies more mainstream. Before we get into what they are and how they have impacted, a little history lesson is in order.

The Road to Smart Contracts

The blockchain technology and cryptocurrencies came to the forefront when an anonymous developer calling himself/herself/themselves Satoshi Nakamoto created Bitcoin. Bitcoin was revolutionary for a number of reasons. For the first time ever we had a currency system which was owned by the people. You can send a Bitcoin to anyone with a Bitcoin wallet without having to go through a bank.

For introducing the world to the blockchain technology, Bitcoin is commonly known as a "First-Generation Blockchain." However, there is a huge restriction in the way Bitcoin conducts its transactions.

Turns out, that transactions need not always be so simple.

If you want to send some money to your friend in a simple one-on-one transaction, then Bitcoin will be ideal in this scenario. However, what if you want to send some money to your friend only when he finishes a certain amount of tasks in a particular deadline. How can you manipulate the transaction code to account for such complex transactions?

This is the question that Vitalik Buterin provided a solution to by creating Ethereum.

Ethereum and Smart Contracts

Vitalik Buterin realized that the blockchain technology had far more utility than just being a payment system. According to their website.

"Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference. These apps run on a custom built blockchain, an enormously powerful shared global infrastructure that can move value around and represent the ownership of property."

In simpler terms, Ethereum is planning to become a decentralized super-computer wherein anyone, anywhere can rent out some computational power and create decentralized applications (Dapps) which can run on top of the Ethereum platform.

So, how do you make these Dapps? For that, we need to look into Smart Contracts

Smart contracts are automated contracts. They are self-executing with specific instructions written on its code which get executed when certain conditions are made.

You can learn more about smart contracts in our in-depth guide here.

Smart contracts are how things get done in the Ethereum ecosystem. When someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people.

Let's go back to our previous section.

Smart Contracts help you code complicated transactional details in a simplified format, and they were conceptualized by Nick Szabo. According to him, the best real-life working example of the smart contract is a vending machine.

When you want something from the vending machine, you simply deposit your cash into the machine, then you choose what you want, and the machine gives it to you. You are directly interacting with the machine without any involvement from a third person. As long as you follow the process which is:

You will get what you ask for.

Suppose you and your friend Alice want to interact with each other using a smart contract.

The smart contract also works in the same way. You lock up some of your Ether (the Ethereum token) inside the smart contract, the condition being that as soon as Alice finishes up some tasks, the contract will unlock the funds and send it to her wallet.

Smart Contracts and ICOs

Smart contracts opened a whole new world for developers to create and innovate. However, these developers needed a way to finance their projects.

ICOs or Initial Coin Offerings are the cryptocurrency version of the Initial Public Offerings or IPOs. However, when compared to IPOs, ICOs are a lot more entrepreneur-friendly than IPOs for the following reasons

Firstly, it is far simpler to present your project in ICOs. All that you have to do is to present a whitepaper of your project.

Anyone can become invested in a project they are interested in by purchasing the tokens of that particular DAPP and become a part of the project themselves.

There is one more thing that you need to know before we get into how an ICO works. The developers need to give something in return for the investments. This "something" is called tokens.

To give you a very wide, non-generalized definition, a token is a representation of something in its particular ecosystem. It could value, stake, voting right, or anything. A token is not limited to one particular role; it can fulfill a lot of roles in its native ecosystem.

So, what are these "roles" that the tokens can take?

Toll: A token can act as a gateway to the Dapp. Basically, in order to access the Dapp, you will need to hold the tokens.

Voting Rights: The tokens may also qualify the holders to have certain voting rights. Think of EOS, holding EOS tokens will allow you to vote for block producers.

Value Exchange: This is one of the more common roles of tokens within the ecosystem. Tokens can help create an internal economic system within the application.

User Experience Enhancement: The token can also enable the holders to enrich the user experience inside the confines of the particular environment. Eg. In Brave (a web browser), holders of BAT (tokens used in Brave) will get the rights to enrich customer experience by using their tokens to add advertisements or other attention based services on the Brave platform.

Currency: Can be used as a store of value which can be used to conduct transactions both inside and outside the given ecosystem.

Ok, so till now we have told you how smart contracts, ICOs, and tokens work. However, here is where we hit out the first obstacle. Let us take an example of an arcade.

The Video Game Arcade

Think of an old-school video game arcade. What are all the steps that you need to take before you get to play your game:

1. You take your fiat money and convert them into the arcade coins.

2. You use the arcade coins to play games in the machines by inserting them inside the slot. The slots are designed to accept circular shaped coins.

3. After you are done, you take the leftover coins, if any, and convert them to fiat money.

So, can you make the parallels between the arcade and smart contract platform?

The video game arcade machines are the Dapp while the arcade coins issued are your native tokens. You will need to be in possession of those coins in order to access the services of your Dapp.

There is one problem area of this system though.

In order the fit into the slot of the machine, the coins need to be of a specific dimension. Now, what if certain machines came about who didn't accept the circular coin designs and instead preferred a squarish coin shape?

In order to run the business smoothly, the arcade owner must lay down a ground rule. All machines must be built to accept circular arcade coins. No other shape must be accepted.

That, in essence, is what ERC20 guideline does.

The Problem with Different Token Design

In the early days, it seemed that each and every ICO token was trying to "re-invent the wheel" as far as the execution was concerned. Each one of those tokens had their own list of functions. Now, this led to a whole host of new problems.

To create a healthy ecosystem on top of Ethereum, it is absolutely essential that the Dapps built on top of it can interact with one another seamlessly. However, what will happen if we have two tokens, say Token Alpha and Token Beta, and both of them have different smart contract structures?

For that to happen, the developers will need carefully study both these contracts and map out exactly how these tokens are going to interact with each other.

Now, this doesn't really bode well for scalability now, does it?

If there are 100 different tokens with 100 different contracts, then to narrow down on all the qualifications and conditions required to make sure that transfers can go through between all these tokens will need a humongous amount of complex calculations. Which is not an ideal scenario at all.

Something needed to be done and on November 19, 2015, Fabian Vogelsteller came up with an ingenious solution.

Enter ERC20

" list of rules that an Ethereum token has to implement, giving developers the ability to program how new tokens will function within the Ethereum ecosystem. The ERC-20 token standard became popular with crowdfunding companies working on initial coin offering (ICO) cases due to the simplicity of deployment, together with its potential for interoperability with other Ethereum token standards."

To keep it simple, ERC20 is a guide of rules and regulations that will help create a blueprint for Ethereum-based smart contracts to create their tokens. The "ERC" stands for to Ethereum Request for Comment, while the number '20' is the number assigned to this request.

Anatomy of ERC20

They follow a list of rules so that they can be shared, exchanged for other tokens, or transferred to a crypto-wallet. The ERC20 standard consists of 3 optional rules and 6 mandatory rules.

The mandatory rules are as follows:

On the other hand, the optional rules are:

Let's expand into the optional rules first before looking into the 6 mandatory rules.

The 3 Optional Rules

Even though it is not necessary to name your tokens, it is still important to give it an identity. The name is declared like this:
string public constant name = "Token Name";
Up next we have symbols. We simply cannot understate their importance. The perfect example of this is OmiseGO. People are far more familiar with OMG than OmiseGO. A catchy symbol helps with better branding. The way they are declared is:
string public constant symbol = "SYM";
Finally, we have the divisibility which will help us determine the lowest possible value of the token. A divisibility of 0 will mean that the lowest value of the token is 1. A divisibility of 2, on the other hand, means its lowest value will be 0.01. The maximum number of decimal places allowed is 18. It is declared like this:
uint8 public constant decimals = 18;
Alright, now let's go into the 6 rules.

The 6 Mandatory Rules

#1 totalSupply

[totalSupply] identifies the total number of ERC-20 tokens created. The purpose of this method is to determine the total number of tokens floating around the ecosystem.

The code looks like this:

contract MyERCToken {

uint256 _totalSupply = 1000000;



 function totalSupply() constant returns (uint256 theTotalSupply) {

    theTotalSupply = _totalSupply;

   return theTotalSupply;

 }

}

#2 balanceOf

The balanceOf function returns the number of tokens that a particular address, in this case, the contract owner, has in their account.

Code looks like this:

contract MyERCToken {

// Create a table so that we can map addresses

 // to the balances associated with them

mapping(address => uint256) balances;



 // Owner of this contract



 address public owner;



 function balanceOf(address _owner) constant returns (uint256 balance) {



 // Return the balance for the specific address



   return balances[_owner];

 }

}

Once the balance has been checked, the contract owner can give their approval to the user to collect the required number of tokens from the contract's address. The approve function also checks the transaction against the total supply of tokens to make sure that there are none missing or extra. In other words, it makes sure that counterfeiting is impossible.
Note: "msg.sender" is the address of the contract owner.
So, now that all the checking has been done and the contract knows that the user has the required amount of tokens needed to fulfill the transaction, the contract owner can send them tokens using the transfer() function.

This function lets the owner of the contract send a given amount of the token to another address just like a conventional cryptocurrency transaction., allows a certain number of tokens to be transferred from the total supply to a user account. Before the game can start, the players must receive their BLU from the dealer.

#5 transferFrom()

We have already covered the transfer function, why do we have another?

Well, let's take an example to see why transferFrom is such a brilliant addition to the ERC20 contract.

We all have to pay some amount of money every month like clockwork. It could be your rent, the bills, etc. You don't really need to pay all these amounts hands-on by yourself. You can always set up an automatic payment system with your banks to take care of these payments.

That's what transferFrom() allows you to do. It helps you automate payment transfers to a specific account.
Note: Even though it is one of the most popular tokens out there, the golem GNT token is not considered ERC20 because it doesn't have the approve() and transferFrom() functions in its contract.
#6 allowance()

In order to carry out a transaction one of the most important data that the contract should know is the balance of the user. After all, the user should have the minimum amount of tokens required to do the transaction.

This is why, the ERC20 contract also includes the allowance() function. If the user doesn't have the minimum required number of tokens, the function cancels the transaction.

function allowance(address _owner, address _spender) constant returns (uint256 remaining) {

   return allowed[_owner][_spender];

 }

Bringing The Code Together

So, now that we have seen how the individual functions work, let's take a peek at the ERC20 token contract.

Benefits of ERC20

Firstly, the convenience. As we have already stated earlier, if everyone was creating their own tokens with its own functions then it would have been an interoperability nightmare. Plus, saving those tokens in wallets and listing them on exchanges would have been a pain. Transfer of tokens could have broken contracts and made them vulnerable to hackers.

Since the ERC20 regulations present a proper blueprint for developers to follow. It is easy for them to come up with tokens instead of working from scratch.

An important factor that is critical for the overall valuation of the Ethereum network is the liquidity of these ERC20 tokens. If the projects on top of Ethereum are active and interacting with each other, then that is going to invariably bring more projects and more users to the Ethereum network.

Now that we know what ERC20 is, what are the main benefits of using it?

Flaws of ERC20

Flaw #1: The transfer() bug

Even though ERC20 tokens have a lot of good qualities, they have garnered plenty of criticisms as well. In Ethereum, there are two kinds of accounts, externally owned accounts (EOA), controlled by private keys, and contract accounts, controlled by their contract code.

If you want to interact with another EOA account then you can use the transfer() function to send the required tokens. However, if you want to send the tokens to a contract account using the transfer() function, then you will be facing a bug which has led to the loss of nearly millions of dollars.

The big problem with the transfer() function is that once it is executed the recipient will not be notified of the transfer even if the transaction goes through successfully

"Transaction of a token is a change in the internal variables of the contract (the `balance` of the sender will be decreased and the `balance` of the recipient will be increased). As a result, if the recipient is a contract, users must transfer their tokens using the `approve` +` transferFrom` mechanism, and if the recipient is an externally owned account address, users must transfer their tokens via the `transfer` function. If a user will make a mistake and choose a wrong function then the token will get stuck inside contract (contract will not recognize a transaction). There will be no way to extract stuck tokens. Does anyone of ERC20 token developers believe that users will never make such mistakes when developing their tokens?"

So, this makes a pretty good case for the approval() and transferFrom() combination right? However, there lies a problem as well.

It is an insecure operation and hence leads to the possibility of a double spent attack.

Flaw #2: The Entry Point is Too Low

Another big criticism is that ERC20 has made it too easy for people to create their own tokens. As a result of this, the market is flooded with needless and, even worse, scammy ICOs and tokens.

Future of ERC20 Tokens

Because of the criminal irresponsibility of token developers for their deeds.

Because Ethereum Foundation is still promoting the ERC20 token standard even when it is known to contains bugs. The same situation as it was with TheDAO previously. They need to say "Stop this now" but they will not.

Because the main reason for token development is fund grabbing, rather than product creation.

Because using a different standard will lead to higher network effects. This is not what we really need given that the Ethereum network already has scalability issues.

While it is true that ERC20 tokens have been important for the growth of the crypto ecosystem, the fact remains that they may have overstayed their welcome. People are already experimenting with newer standards like ERC223, ERC 777 etc. but, as of right now, ERC20 isn't going anywhere.

Change is always slow and it looks like we will definitely need to wait a little bit more before we can move onto other standards. However, let's not make the mistake of "criminalizing" the ERC20 standard. It certainly deserves all the respect for the profound impact it has had on the crypto-space.

# data[].attributes.attachment_link.title
ERC20 Tokens: The Origin Story (Blockgeeks Guide)

# data[].attributes.attachment_link.description
ERC20 Tokens are single-handedly responsible for the billion-dollar ICO industries we know today and helped launched cryptocurrencies into the mainstream. This guide teaches you how these tokens work, as well as the benefits and the fallbacks of this amazing tool!

# data[].attributes.body
40 min to read

# data[].attributes.attachment_link.readable_text
Go on YouTube right now and search for Security Tokens.

You will probably get results like:

So, it seems like there is a lot of hype behind security tokens nowadays. In this guide, we are going to learn everything about security tokens and see if they are worth your time or not.

However, as always, let's start with the basics first.

What are Tokens?

It can be a little complicated to pinpoint on an exact definition of a " token ". To give you a very wide, non-generalized definition, a token is a representation of something in its particular ecosystem. It could value, stake, voting right, or anything. A token is not limited to one particular role; it can fulfill a lot of roles in its native ecosystem.

Before we go any further, however, we must make one more difference clear. The difference between a cryptocurrency coin and a token.

A cryptocurrency coin, like Bitcoin, Bitcoin Cash, Ethereum etc. can be is independent of a platform. They can be used as a form of currency outside their native environment. Basically, these are the " cryptocurrencies " that we are all familiar with.

However, on the other hand, OmiseGO, Golem etc. are examples of tokens which exist on a particular platform, in this case, Ethereum.

A token, represent an asset or utility that a company has and they usually give it away to their investors during a public sale called ICO (Initial Coin Offering).'

What Are ICOs?

ICOs or Initial Coin Offerings are basically crowd sales, the cryptocurrency version of crowdfunding. The ICOs have been truly revolutionary and have managed to accomplish amazing tasks:

They have provided the simplest path by which DAPP developers can get the required funding for their project.

Anyone can become invested in a project they are interested in by purchasing the tokens of that particular DAPP and become a part of the project themselves. (We are talking about Work Tokens here).

So, how does an ICO work?

Firstly, the developer issues a limited amount of tokens. By keeping a limited amount of tokens they are ensuring that the tokens itself have a value and the ICO has a goal to aim for. The tokens can either have a static pre-determined price or it may increase or decrease depending on how the crowd sale is going.

The transaction is a pretty simple one. If someone wants to buy the tokens they send a particular amount of ether to the crowd-sale address. When the contract acknowledges that this transaction is done, they receive their corresponding amount of tokens. Since everything on Ethereum is decentralized, an ICO is considered a success if it is properly well-distributed and a majority of its chunk is not owned by one entity.

The recently concluded EOS ICO which raised a whopping 4 billion dollars in a year is till date the biggest ICO ever.

How Does a Token Gain Value?

So, before we continue and classify our tokens, let's look at what functions a token can serve in order to gain value.

These three are locked up in a triangle and they look like this:

Each token role has its own set of features and purpose which are detailed in the following table:

Let's examine each of the roles that a token can take up:

By taking possession of a particular token, the holder gets a certain amount of rights within the ecosystem. Eg. by having DAO coins in your possession, you could have had voting rights inside the DAO to decide which projects get funding and which don't.

Value Exchange

The tokens create an internal economic system within the confines of the project itself. The tokens can help the buyers and sellers trade value within the ecosystem. This helps people gain rewards upon completion of particular tasks. This creation and maintenance of individual, internal economies are one of the most important tasks of Tokens.

It can also act as a toll gateway in order for you to use certain functionalities of a particular system. Eg. in Golem, you need to have GNT (golem tokens) to gain access to the benefits of the Golem supercomputer.

The token can also enable the holders to enrich the user experience inside the confines of the particular environment. Eg. In Brave (a web browser), holders of BAT (tokens used in Brave) will get the rights to enrich customer experience by using their tokens to add advertisements or other attention based services on the Brave platform.

Can be used as a store of value which can be used to conduct transactions both inside and outside the given ecosystem.

Helps in the equitable distribution of profits or other related financial benefits among investors in a particular project.

So, how does this all help in token valuation?

In order to become more valuable, a token must fulfill more than one of these properties. In fact, more properties that a token can have, higher its valuation

Alright, so now we know what a token is, how a company distributes token and where a token can gain value from.

Before we go any further, it is important to know what the Howey test is.

The Howey Test

In 1946, the Supreme Court handled a monumental case. The case was SEC vs Howey which would lay down the foundation for the, now infamous Howey Test. The case was about establishing a test of whether a particular arrangement involves an investment contract or not.

To keep a long story short, two Florida-based corporate defendants offered real estate contracts for tracts of land with citrus groves. The defendants offered buyers the option of leasing any purchased land back to the defendants, who would then tend to the land, and harvest, pool, and market the citrus. As most of the buyers were not farmers and did not have the agricultural expertise, they were happy to lease the land back to the defendants.

However, this was deemed illegal by the U.S. Securities and Exchange Commission (SEC) and the defendants were promptly sued.

According to the SEC, the defendants broke the law by not filing a securities registration statement. Upon investigating the defendant's leaseback and finding that it was indeed a security, the Supreme Court made a true landmark decision.

They developed a test which will be used to determine whether a certain transaction is an investment contract or not. If it is, then it will be subject to securities registration requirement.

The said transaction will be called an investment contract if it fulfills the following criteria:

It is an investment of money

The investment is in a common enterprise

There is an expectation of profit from the work of the promoters or the third party.

The term "common enterprise" is open to interpretation. However, many federal courts have defined a common enterprise as a horizontal enterprise where the investors pool in their money and assets to invest in a project.

Even though the original Howey Tests used the term "money", later cases expanded that to include other investments and assets other than money.

Plus, there is another important thing to consider while determining securities. The profits that come from the investment, is it in the investor's control or is it completely out of it? If it is not in the investor's control, then the asset has usually declared a security.

So, how is this relevant for ICO and tokens? If the token meets all the three aforementioned criteria, then it is regarded as a security.

All these three elements have to be met for a coin to classify as security.

Other Alternative Tests

Turns out that the Howey Test is not the only test that courts can use to find out whether a given investment is a security or not.

In 1990, the Supreme Court developed a family resemblance test which provided a way for contract creators to show that their contract has a "family resemblance" to other investments and hence cannot be called securities.

Certain states have their own securities registration requirements which are sometimes called "Blue Sky" laws.

"The first blue sky law was enacted in Kansas in 1911 at the urging of its banking commissioner, Joseph Norman Dolley, and served as a model for similar statutes in other states. Between 1911 and 1933, 47 states adopted blue-sky statutes (Nevada was the lone holdout). Today, the blue sky laws of 40 of the 50 states are patterned after the Uniform Securities Act of 1956. Historically, the federal securities laws and the state blue sky laws complemented and often duplicated one another."

The DAO and SEC

The Howey Test and securities have become a source of intense debate in the crypto-community after the DAO tokens failed to pass the Howey Test and were deemed securities by the SEC.
"Not so long ago, a group of developers started a DAO. The DAO developers said:
"There are all these decentralized projects and there's no way for them to get funding - because they need money to make money."
Tell you what. We're going to write code and sell a token and, in exchange, people who buy the token will get whatever profits are made from those projects. We'll work the code. They'll pick the projects. The projects will flourish and everyone will profit. The SEC said: "That's a security." The DAO developers said: "No, no. That's just selling tokens." Ultimately, the SEC said: "That's a security" - because of the application of the Howey Test: There was an investment of money. And a common enterprise. With the expectation of profit, primarily from the efforts of others."
So, why was this investigation and ruling done in the first place?

There was a flaw in the Dao smart contract

The hacker exploited that flaw to execute a re-entrancy attack.

Over $!50 million worth of ether was siphoned away.

Because a lot of people invested and got back nothing in return, the SEC intervened to "protect" the interest of the investors and deemed the tokens a security.

This decision was met with mixed reception in the Crypto community:

Brad Garlinghouse, Ripple Ceo, said,

"Regulators aren't going away - and shouldn't. For generations, they have protected from fraud (some is happening w/ the ICO market)."

Roger Ver, Bitcoin.com founder, however, disagreed with the decision,

" Call this what it is: A bunch of strangers in a far-off land threatening peaceful people all over the world with violence if they don't obey. "

Ok, so till now we know what tokens are and what the Howey Testis. So, now let's get into the two major classifications of tokens.

Types of Tokens

The SEC and FINMA have broken down tokens into two broad categories:

Utility Tokens

Because most of the ICOs are investment opportunities in the company itself, most tokens qualify as securities. However, if the token doesn't qualify according to the Howey test, then it classifies as utility tokens. These tokens simply provide users with a product and/or service. Think of them like gateway tokens.

As Jeremy Epstein, the CEO of Never Stop Marketing, explains, Utility tokens can:

Give holders a right to use the network

Give holders a right to take advantage of the network by voting

Since there is an upper cap on the maximum token availability, the value of the tokens may go up because of the supply-demand equation.

Security Tokens

Finally, we come to security tokens.

So what exactly are they?

A crypto token that passes the Howey Test is deemed a security token. These usually derive their value from an external, tradable asset. Because the tokens are deemed a security, they are subject to federal securities and regulations. If the ICO doesn't follow the regulations, then they could be subject to penalties.

However, if all the regulations are properly met, then these tokens have immensely powerful use-cases.

What Regulations Are Security Tokens Subjected to?

Anthony Pompliano does an admirable job of explaining the kind of regulations that security tokens will be subjected to in this article.

According to him, because Security Tokens are subject to federal security regulations, they are compliant from the first day itself. So, in USA, security tokens need to follow these regulations:

Regulation D

Regulation D will allow a particular offering to avoid being registered by the SEC provided "Form D" has been filled by the creators after the securities have been sold. The individual who is offering this security may solicit offerings from investors in compliance with Section 506C.

So what does Section 506C require?

It requires a verification that the investors are indeed accredited and the information which has been providing during the solicitation is "free from false or misleading statements.

Regulation A+

This exemption will allow the creator to offer SEC-approved security to non-accredited investors through a general solicitation for up to $50 million in investment.

In order for the requirement to register the security, the issuance of Regulation A+ can take a lot more time compared to other options. For the same reason, Regulation A+ issuance will be more expensive than any other option.

Regulation S

This happens when a security offering is executed in a country apart from the US and is therefore not subjected to the registration requirement under section 5 of the 1993 Act. The creators are still required to follow the security regulations of the country where they are supposed to be executed.
NOTE: As Anthony Pompliano notes in his article, the above summaries are merely his interpretation. They should not be construed as legal or investment advice and you should consult a lawyer for any and all questions you have.
Why are Security Tokens Important?

Since the assets which are represented by the security tokens already exist in the "real world", they act like a bridge between legacy finance and the blockchain world. So what are the exact changes that security tokens are bringing along with them?

#1 Bringing Credibility Back

As of right now, the ICO space is a little dicey, to say the least. There is a real deficit of accountability in the space because of a lack of regulation for utility tokens. In order for the ICO space to regain some credibility, it should make sense to somehow amalgamate the crypto space and the legacy finance space together.

#2 Improving Traditional Finance

Traditional financial transactions can be a little expensive because of all the fees associated with the middlemen like bankers. Security tokens remove the need for middlemen which reduces fees. In the future, smart contracts may reduce the complexity, costs, and paper works.

#3 Speeding up Execution

Traditional finance institutions have a lot of middlemen involved which simply increases the execution time. By removing these middlemen, securities allow for faster execution time for successful issuance of security tokens. Because of this increased speed, the security tokens are bound to become attractive investments.

#4 Exposure to Free Market

Investment transactions today are extremely localized.

What do we mean by that?

Chinese investors find it extremely hard to invest in private US companies and vice-versa. So, how are security tokens going to help here?

Well, by using security tokens, creators can market their deals to anyone on the internet. This exposure to free market helps in increasing asset valuation. Also, this increased exposure leads to....

#5 Huge Number of Investors

Since creators can now present their deals to anyone on the internet, the investor base increases exponentially.

This is another huge incentive for creators.

#6 Reducing Lawyer Service

In the future, there security token projects will use smart contracts which will automate service provider functions through software. These functions are currently provided by players such as lawyers which add on to the potential middlemen involved in the project.

#7 Lack of Institution Manipulation

Because the number of middlemen decreases the drastically, the chances of corruption and manipulation by financial institutions decrease drastically and may even be removed from the investment process.

#8 Easier Liquidation

Secondary trading on security tokens will be made simple through licensed security token trading platforms and it will be extremely easy for investors to liquidate security tokens.

Having said that, not everything is sunshine and rainbows, there are some disadvantages of security tokens.

Do Security Tokens have a Weakness?

The removal of the middlemen is usually seen as a huge advantage. However, you can't have your cake and eat it as well. There are some disadvantages which will invariably come along with security tokens. Removal of middlemen leads to the shifting of responsibilities onto the buyer or the seller in the transaction.

These middlemen i.e. financial institutions serve a lot of important functions in the ecosystem such deal underwriting, preparation of marketing materials, solicitation of investor interest, insurance of high levels of security, and compliance regulation.

Many critics feel that the creators won't be able to successfully execute these functions without traditional financial institutions. We need to wait and watch if these fears have any basis or not.

Conclusion

The crypto community breath a sigh of relief when SEC has ruled Bitcoin and Ethereum to not be securities. As of right now, security tokens has a far less share of the market as compared to utility tokens, however, security tokens are something which can become huge in 2018 and needs to be embraced by everyone soon. It is believed that tons of capital is going to flow from Wall Street to security tokens instead of utility tokens.

This shift is happening because security tokens are considered to be safer because of the strict regulations.

"It's inevitable that security tokens will transform equity just as bitcoin has transformed currency, because they afford the owner a direct, liquid economic interest and the expedited delivery of proceeds. Every type of ownership can be tokenized, which is a massive multi-trillion dollar addressable market."

# data[].attributes.attachment_link.title
What are Security Tokens? (Fully Comprehensive Guide)

# data[].attributes.attachment_link.description
Go on YouTube right now and search for Security Tokens. You will probably get results like: So, it seems like there is a lot of hype behind security tokens nowadays. In this guide, we are going to learn everything about security tokens and see if they are worth your time or not.