Blockchain Beyond Currency: Smart Contracts and Decentralized Applications

How Networks can Takeover Business

Could a company run without employees? Imagine: No corporate headquarters to make decisions or call the shots. Revenue for the sake of upkeep, no salaries to be paid. These types of companies, if you can even call them that, are being developed right now. They are entities that exist on the blockchain, using smart contracts and decentralized applications.

To further paint the picture, here is an example. Imagine a car insurance company that had no employees. This company is made up of a network of users facilitated by the blockchain. The users’ package and payment is determined by an algorithm run by a decentralized application on the blockchain. The users pay into a pool. When a policy holder experiences an accident, they make a claim to the network. The network receives the police report and fault is determined. Payment is allocated immediately and according to the terms laid out in the contract. Smart contract technology makes this possible. The whole business is structured through a network of transparent smart contracts that are automatically fulfilled when their conditions are met. If the business is to ever change rules, it will require a consensus amongst its users. The company is decentralized and runs far more efficiently. While this is a very simple example of how a business can run autonomously on the blockchain, it is a good starting point to gain an understanding.

Decentralized Applications (dApps)

So, what exactly are decentralized applications, or dApps, and how are they different from run-of-the-mill applications? dApps are simply applications that run on the blockchain. Standard applications run on the internet. The apps that we are familiar with use application programming interfaces (API) to connect to the internet, and decentralized applications use smart contracts to link in to the blockchain. The front ends of these applications can look exactly the same. However, their capabilities are far different.  Cryptocurrency is considered to be the original decentralized application.

After the development of Ethereum, the development of dApps, finance and beyond, took off. Ethereum was built with dApp developers in mind, and the entire blockchain project revolves around facilitating them. The platform makes it easy for developers to bring their ideas for dApps to life through Solidity, the network’s dApp programming language. It focuses on simplicity for developers to connect their dApps to the blockchain. Check out the Ethereum White Paper if you want more information straight from the horse’s mouth.

Insert a photo of Internet Applications vs. dApps

To qualify as a decentralized application, a program must meet some specific criteria. The program must be distributed across the blockchain, meaning that it will take on all the standard traits that the blockchain offers. The data from the dApp is cryptographically stored on the ledger, it uses and generates tokens, and it is open source. For example, Twitter is a centralized application. It is run by a company that calls the shots. Twitter can choose what they censor, how the rules work, and what features are added and removed. All the application’s data are stored on centralized servers, to which Twitter and limited others have access. Twitter can choose to exploit this data, sell it, etc. It is also vulnerable to attack, as there is a single point of failure.

Now imagine a similar social network facilitated by the blockchain. This dApp is self-governed by its network of users. There is no autonomous power that can censor content. No one can access our data. Once a publication is posted on the network, it is in the blockchain ledger forever. If a feature is to be added or removed, it is decided through consensus. The blockchain protects the new social network from attack, and the users can rest assured of the integrity of the operation.

 

Smart Contracts

Insert smart contract graphic

Smart contracts are the future of deal enforcement.

If there are no employees that handle how a dApp runs, then how are the rules structured? The most interesting part of dApps is that they use smart contracts to carry out their operations. Previously, a contract was physically signed by two parties, and each party was expected to uphold their end of the deal. If the contract conditions were met, the participants in the contract had the option to fulfill said contract, or deal with legal proceedings. With smart contracts, agreements are drawn up, signed, and stored on the blockchain. These smart contracts monitor whether the agreed upon conditions have been met, and automatically fulfill each end.

For example, if I sign a contract saying that I will pay my friend Logan $200 if the Broncos win the Super Bowl, he must trust that I will fulfill the contract, else he proceed with litigation. If the Broncos win the super bowl, I still have a choice as to whether or not I will pay, despite having already made the agreement. If I decided not to pay, I could destroy the contract and claim ignorance. If Logan and I entered into a smart contract, the agreement would be captured on the blockchain ledger and could not be tampered with. The evidence of the contract would be available for the world to see, and the cost of trying to destroy it would be infinitely more than the $200 I owe. Once the Broncos win the Super Bowl, the smart contract realizes that the condition has been met, and it automatically transfers $200 worth of my funds to Logan. I no longer have a choice in the matter.

Now apply this concept to a bank and how they loan money. Or to property ownership. Or to a roommate utility agreement. Or to any other industry that you can think of. This is where the real power of the blockchain is discovered. The exciting part is that this technology is only in its infancy. The combination of dApps and smart contracts are known as “the middleman killer” for a reason. They have the power to completely disrupt the way that the world does business.

But do these exist in the real world?

This sounds like a great idea in theory, but almost too good to be true. Some real world evidence would be helpful to show that the ideal dApps really exist. So here are a few:

In support of my Twitter example, a real world dApp clone is in existence. It is known as EthTweet. You can check out its source code on Github if you want to see the nuts and bolts. This aims to accomplish what was laid out in the example – a decentral, self-censoring, Twitter with integrity.

Weifund is a decentralized crowdfunding platform, connecting entrepreneurs directly to investors without the need for a middleman. This system keeps all parties in check and allows for the seamless transfer of funding. Weifund uses Ethereum’s Ether currency, and the interface is similar to that of popular crowdfunding sites, GoFundMe and Kickstarter.

Some might consider it useless, some might consider it funny, but Cryptokitties can’t be ignored. This is a game that exists as a dApp on Ethereum’s network, allowing users to “collect and breed digital cats” on the blockchain. I suppose there is utility in hosting this application on the blockchain, as each asset (or, cat…) is a unique token, so the rarity of specific cats can be assured. This is a very simple example of how the blockchain can be used for less serious endeavors. Although, this project alone brought forth some serious scalability issues with the Ethereum network…

And the list would not be complete without mentioning the infamous DAO, a humbling reminder that there are still some issues to work through, both with dApps/Smart contracts and blockchain technology in general. The DAO stands for Decentralized (or democratic, depends on who you are talking to) Autonomous Organization. The infamous DAO was a venture capital fund that was run autonomously on the Ethereum network. There was no central control – the network was responsible for funding and guiding the organization.

Normally, a person trusts their investment with a venture capital firm to call the shots for them. Once the money is in the hands of the venture capitalist, they are free to invest however they see fit. Sometimes, these funds are mismanaged and pissed away by incompetent or unchecked managers. The DAO sought to bring transparency to the process, and DAO token holders were responsible for reaching a consensus on where the funds were allocated. By May of 2016, 14% of all of the issued Ether tokens were held by the DAO. It was generating a lot of hype and some great returns. Unfortunately, there was a hole in the dApp’s security. Note that the hole was not in the blockchain‘s security but in the dApp’s code. This security hole was exploited and the account was drained. This is a tragic example of one of the earliest decentralized apps, but works as a foundation to build off of. It also hammers home the importance of security proofing apps – the blockchain can’t fix bad programming within the application.

Conclusion

The world still has a long way to go before it comes anywhere close to realizing the potential that exists within web 3.0, dApps and Smart Contracts. Educating the population on how they work is a good start. Learning to trust these autonomous organizations will take some time, especially after exploits like the DAO. However, once the utility is realized by the majority, progress will take off. The middlemen will be eliminated, and the world will operate a lot differently.

For more reading on the subject, I recommend checking out some of these publications:

The Beginner’s Guide to Smart Contracts – Blockgeeks

 

What is a Decentralized Application? – A Short Read, Coindesk

 

An Analysis of the Current State of dApps – A little bit about how far we have left to go

 

More on dApps – Blockchain Hub

 

A Brief History of the DAO – Medium

 

Again, the Ethereum White Paper just in case you missed it.

 

 

 

 

Blockchain’s Myth of Immutability: Understanding Forks

Forks and the Myth of Immutability

 

Introduction

Imagine that Facebook decided to do away with the profile picture feature. The company would have the power to make the decision on its own, regardless of the users’ sentiments. Would Facebook ever decide to do such a thing? Not likely. Yet, the option is available. As a centralized entity, it has the power to act autonomously. How about a more realistic example. Imagine that a bureaucracy decided to bypass the legislative process and enact a policy that fined drivers of fossil-fueled vehicles. The ability for this bureaucracy to change or impose policy proves that the laws are not immutable. Many blockchain proponents try to sell immutability as a feature. While it is very difficult to change the information, features and rules of a blockchain, it can be done. As previously mentioned, if an entity or colluding group takes control of the majority of the validation process, the control becomes centralized. Thus, the controlling parties have the ability to enact changes to the way that the blockchain operates. However, this is not the only way that changes can take place.

 

Public blockchains are open source, meaning that the source code is available to anyone. This is key to both transparency and rapid development. When a problem arises with a blockchain network like slow transaction time, scalability issues, or compromised security, anyone has the ability to develop a solution. This also allows for changes over time. It is similar to changing the constitution. When a change is developed, the developer brings it forward to the community. If the community finds it useful, they have the ability to vote on whether or not to adopt. If the network decides to adopt the solution, the development is added and the network nodes must update their software. Solutions that overcome critical issues and daunting challenges have a history of near ubiquitous adoption. However, there are also changes that are not favored by all.  Sometimes developers create features that cause a rift within a community, and nodes are forced to pick sides. Thus, forking occurs.

 

Forks as a Blockchain Byproduct

Before discussing intentional forks, it is important to understand the general concept. Forking does not only occur when changes are made to the code; they also happen naturally. When forking happens naturally or “accidentally” it is automatically resolved by the network. The general concept is that when two blocks are added to the blockchain at the same approximate time, or at the same “block height,” there is a split in the chain. At this point, there are two blocks of transactions attempting to be added simultaneously to the next spot in what could be considered a single file line. While these two blocks are fighting for position, the next blocks in the sequence come along behind them. Whichever block the next block attaches to determines which gets the spot in line.  This is known as a “chain length” determination. The block that loses the spot is known as an “orphan block,” and is rejected by the network. The blockchain continues on following the block with the longer length.

 

Insert photo of forking blockchain

 

Hard Forks

When an intentional fork occurs through a software change, it can either be a hard fork or a soft fork. A hard fork is a fork that is not compatible with the old rules of the blockchain. A network that experiences a hard fork requires the participant nodes to update their software in order to remain a part of the network. Otherwise, they will not be able to validate any of the new transactions on the chain. When nodes refuse to update their software to reflect the new changes, they cause a split in the network. If a majority of the network (majority holds a different meaning depending on the network, PoW being hashing power, PoS being stake, etc) adopts the change and the minority refuses, the minority splits from the network and creates a new chain with a new token. These different networks all try to improve upon or add features to bitcoin’s existing infrastructure.

 

Ethereum and Ethereum Classic

One famous example of a network split is the Ethereum fork in 2016. Ethereum hosted an application on its network known simply as the DAO. DAO stands for Decentralized Autonomous Organization, more on this in a later post. For now, a brief explanation. This application was used as an automated, decentralized investment vehicle that was able to operate on its own through consensus network decisions. It managed a lot of money for a lot of investors. It was later found that this application had a security loophole that a hacker was able to exploit. Money drained from the account and millions of dollars worth of ether were lost. The founder of Ethereum and the users spoke out about the injustice and demanded a way to return the funds that were stolen. Eventually, the network decided to hold a vote that would reverse transactions back to the point in time in which the DAO was hacked. The Ether would return to its original owners, and the blockchain would be tampered with. This proved to be contentious within the community, as many took issue with compromising the integrity of the network. A divide formed between the community. The majority of users voted to adopt the change and turn the dial back on the blockchain. Thus, the Ethereum network “corrected” the issue. The minority, who still comprised a large chunk of the network, refused to adopt the change. They split from the network, forming Ethereum classic. Ethereum classic became a completely new blockchain entity with a completely new token. On the Ethereum classic network, the users who lost their DAO investment would not receive it back as they did on the original Ethereum network. Since Ethereum and Ethereum classic are basically clones of one another at different points in time, those who held Ether in the original network at the time of the split received the same amount of Ethereum classic token when that network was formed. The blockchain ledger on each network was the same up until the split, thus, currency already existed and was allocated across the Ethereum classic network at its creation.

 

Bitcoin has also experienced several splits. A couple of well-known examples, Bitcoin Cash and Bitcoin Gold, generated a lot of media buzz around splits. What resulted was a byproduct of misinformation and confusion. Many saw the technology as illegitimate since some arbitrary split could just generate new currency out of thin air. What many failed to realize first is that these splits have a purpose. As illustrated in the Ethereum example, these splits come about for legitimate reasons and are the result of critical decisions. The original network hardly ever emerges unscathed; the rift in the community is a burden on the blockchain’s value. The hope is that in the long run the benefit that the change to the network accomplishes through the software update will more than compensate for the value lost in the network split.

 

Soft Forks

Not every fork results in a split – sometimes forks occur that still allow nodes to validate new transactions despite whether or not they have updated their software. These types of forks are backward compatible, meaning that the changes that were made to the protocol remain inside the scope of the old rules. This is known as a soft fork. This concept can be hard to grasp, so here is an example.

 

When the Nintendo Wii was released in the mid-2000s, it boasted “backward compatibility” with the games released for the previous generation console, the Nintendo Gamecube. The Wii could run games that could previously only be run by the Nintendo Gamecube. The same concept applies to the updates that cause soft forks. The nodes running the updated version of the software can still validate blocks adhering to the old rules, because there is nothing in their new rules that say otherwise. Say there is an update that allows for an increase in block size. Now blocks can reach up to two megabytes in size, an increase from the previous limit of one megabyte. The network can still interact seamlessly without a hard fork since all of the old blocks are within the scope of the new rules, less than two megabytes in size.

 

Conclusion

Forks are misunderstood. They are one of the reasons that the blockchain is confusing or mistrusted by crowds of people. Lots of rumors, speculation and pontification revolve around forks and splits. Understanding why forks happen and what results will shield you from the rumor mill that revolves around splits. The information is also critical to understand if you are holding a token on a network undergoing a fork. Instead of letting the confusion guide you toward an irrational decision, you will be able to choose whether or not you agree with the changes being made and determine how you value the network accordingly.

The Backbone of Blockchain: Incentives and Consensus

“Incentives drive blockchain node participation, just like they do for every other market, network and economy.”

Distributed Consensus Models

Introduction

Would you work for no pay? Or invest in the market with no chance of a return? No, and nodes would not consistently support a blockchain network without a proper incentive structure. Incentives drive blockchain node participation, just like they do for every other market, network and economy. So, how are these incentives structured? This has proven to be a contentious issue throughout the short life of blockchain technology. Every blockchain needs a network comprised of decentralized nodes in order to provide integrity and security, but the way that each blockchain rewards their nodes for their participation depend on the philosophy and the needs of the project.

These differing incentive structures are known as distributed consensus models, or consensus algorithms. The purpose of this post is not to provide an exhaustive list of distributed consensus models; it is not to get deep into the technical weeds of how they work. The purpose is to provide a general overview to the necessity of these protocols and to gain an understanding as to how and why they are constructed.

This technology is in its infancy. It is being improved upon rapidly, and new consensus algorithms are being introduced constantly. In order to ensure that this post remains timeless in nature, two of the earliest and most widely observed consensus models will be observed. Understanding these two structures will provide a base for further knowledge on the subject and will hopefully inspire you to think up a few of your own solutions.

Proof of Work

Proof of work is a concept that predates blockchain and cryptocurrency. One of its first use cases was preventing spam email. It made its way into the blockchain space by way of bitcoin as the first distributed consensus model. This consensus algorithm has protected the bitcoin network from a slew of some of the worlds most accomplished hackers and has ensured bitcoin’s juggernaut status.

This topic has potential to get fairly complex and technical, but a general understanding is simple. Compare this proof of work algorithm to a padlock. Imagine that you and several others are competing to guess the combination to the padlock through trial and error. The competitors that can enter more numbers faster and complete more attempts per minute have a statistically higher chance of finding the solution first. Once a competitor solves the lock, each of the other competitors must verify that the solution to the lock is correct. This is very easy now that the combination has been found, still all of the competitors must ensure that the code is correct for validation purpose. Once the combination is validated by the other competitors, the winner who first solved the combination is given a cash reward. Then the process repeats itself, over and over.

This analogy is simply how the proof of work consensus algorithm works. Each node is a competitor, racing to solve a complex math problem through a guess and check method. This process is known as “mining” (this process will be discussed further in a later post, where we will discuss mining, the profitability, and how to get started). The nodes are computers on the blockchain network, each deploying different levels of computing power. More computing power allows a node to guess more times per second, thus increasing its chances at solving the puzzle. Once the winner solves the puzzle, the other nodes check to make sure that there was no cheating involved and that the solution was achieved by legitimate means. Once this solution is validated, the winner is awarded tokens for their work. The solution allows a new block of transactions to be added permanently to the blockchain, and the process starts all over.

In the bitcoin network, 12.5 bitcoin are currently awarded to the winning node. The network increases the difficulty of the problem as the blockchain matures to keep a consistent time to solution. The award also diminishes over time as the more coins are introduced to the market. For example, bitcoin only allows for 21 million total tokens in supply, and as this number is approached, the award value declines. It takes an average of 10 minutes to validate a block. After a certain number of blocks are mined, the reward is halved. This is known as controlled supply.

 

Makes sense, sounds smart… But it’s not perfect.

There are issues with Proof of Work that cause many to question its long term efficacy. While the purpose of this post is not to discuss or debate issues with proof of work, it is important to point out those often discussed for a basis as to why new models are introduced. One of the issues is the energy cost associated with the mining process. Employing this amount of computing power is very costly and translates to a waste of resources. Some consider this energy expenditure to be unnecessary, as complex computation is not critical to the security of the network. It is simply a means of proving that the nodes have skin in the game. Another issue with proof of work is the potential for nodes to become centralized. An individual with a considerable amount of capital could construct a facility with an enormous amount of computing power dedicated to mining. If this facility comprised more than 50 percent of the aggregate computing power, they would have the ability to control the network. Smaller networks could be controlled fairly easily, and the centralized power would have the ability to act maliciously. There is also a problem with miners who instantly sell their stake for fiat. This means that miners don’t have to have any skin in the game, which may bring about some ethical issues. Some people also complain that this dilutes the price of the currency, but that’s just the free market doing its thing.

Proof of Stake

Proof of stake was one of the first alternative consensus algorithms designed to solve the issues that proof of work presented. Proof of stake, first used by the Peercoin network, incentivized holding the network’s tokens instead of contributing raw computing power. Generally, the network requires that a certain amount of tokens are sent as stake, similar to a security deposit, in order to secure a spot as a node on the network. The tokens are locked up for a period of time while the network adds and validates blocks on the chain. The tokens are then returned to their owners, along with a percentage share of the transaction fees paid by network users during that amount of time. Participants with more at stake receive a larger share of the transaction fees. This system can be compared to securities that pay dividends. Holding is rewarded with a percentage payout at different intervals. There is no block reward like there is in proof of work networks. However, there is still a healthy margin to encourage participation, as there is no large energy expenditure in this system as there is in proof of work systems. There are no complex mathematical problems to solve or energy to “waste.” Only tokens that remain out of reach for a small amount of time.

This system uses far less energy than proof of work systems and is much more environmentally friendly. There is also a lack of incentive for malicious intent by nodes, as there is personal stake at play. Gaining more than 50 percent of a blockchain’s market share is very expensive and market prohibitive, therefor centralization is very unlikely. Even if a single entity owned over 50 percent stake and decided to start reversing transactions and acting maliciously, they would harm themselves more than they could possibly benefit due to their stake in the market. There are also extra safeguards that may exist within proof of stake systems that further secure the network, such as slashing. Slashing is a feature that prohibits nodes from cheating through the threat of destroying their stake or “safety deposit,” if they are found trying to tamper with the network or act dishonestly. This risk deters many foul actors from tampering with a proof of stake network.

Despite its benefits, the proof of stake model is still flawed. The main issue that many have with proof of stake networks is the fact that the model seems to encourage a wide disparity between stakeholders. Those who hold more of the market share are rewarded with more of the transaction fees, leading to a “wealth gap” in terms of the asset at play. Smaller actors do not have the capital to grow as quickly and are left in the dust over time. The thought is that this will eventually deter smaller investors from entering the market, and the network will be dominated by a central force of large investors. This could lead to collusion, market manipulation, etc. The incentive to hold also props up the market price since there is a lower relative volume traded. This is not much of an issue, but worth mentioning.

Conclusion

Hopefully understanding these two consensus algorithms is enough to get your wheels spinning and maybe inspire you to read further. If so, there are some links down below that get a bit farther into the weeds on the subject. Otherwise, you have still learned about a critical part of the way that blockchains work. If there weren’t consensus algorithms at play, it’d be reasonable to assume that nodes would only opt in sparingly and inconsistently like on torrent sites. That wouldn’t cut it for a blockchain network, so the incentives are rich and worthwhile. With time, better solutions will emerge; hopefully bulletproof solutions that don’t waste resources. Otherwise, we could see some real economic impact due to inefficient consensus models as blockchains continue to grow…

Further Reading

More on Proof of Work

 

Proof of Stake Wiki

A List of 30 Consensus Algorithms

 

Design a site like this with WordPress.com
Get started