BLOCKCHAIN

In simplest terms, blockchain is a continuously expanding list of records (blocks) that are joined together (chained) and secured using cryptography. Blockchain is the backbone of Bitcoin and cryptocurrencies. In blockchain, each block points to its previous block using a cryptographic hash function. This hash function is a very complicated method but for our purposes, it basically takes in an input value (message) and outputs a hash value which is a random set of numbers and letters that have nothing in common with the input value. A cryptographic hash function is extremely difficult to reverse. The slightest change to the input value would generate a completely different hash value (output message). This is ideal for blockchain because each hash value must match the previous one in order for it to be authenticated and added to the chain.

In blockchain, every computer connected to the system is called a node. Every node keeps a copy of each transaction and confirms each transaction that gets added to the system. This is called a distributed ledger system. This is a decentralized system which eliminates the need for a central location that would control or change any information passing through. This brilliant combination of the distributed ledger and cryptographic hash is what is known as the blockchain. It is practically impossible to manipulate or change any information in the blockchain since every node connected to the system has a copy of all the records. In order to hack into this system, one would have to change every copy at every connected node. This simply cannot be done since the nodes connected to the system are distributed around the globe. Every piece of information, whether a financial transaction, someone’s identity, or any other data is controlled by people (nodes) around the world. This in my opinion is the definition of true democracy. If you are still confused, here is a great video that visually explains these topics.

Bitcoin

After the 2008 market crash, an anonymous individual or group of individuals by alias name Satoshi Nakamoto released a document in which he introduced Bitcoin: a peer-to-peer electronic cash system. In this document, also known as a white paper, he stated the flaws of the current financial system and a solution (Bitcoin) that would be the birth of cryptocurrencies, Bitcoin being the first one.

“Commerce on the Internet has come to rely almost exclusively on financial institutions serving as trusted third parties to process electronic payments. While the system works well enough for most transactions, it still suffers from the inherent weaknesses of the trust based model. What is needed is an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted

third party”. Satoshi Nakamoto

The first Bitcoin was created (mined) in January 2009. Using computer processing power, Bitcoin is generated by solving extremely complex mathematical equations. In blockchain, mining is basically the process of keeping records. It is hardcoded in the Bitcoin software that only 21 million Bitcoins will ever be created. Therefore, as the word suggests, just like mining for a scare precious metal (gold for example), the process of creating Bitcoin is also called mining. As more people join the mining network, the difficulty level of mining increases. The system adjusts the difficulty level every often to count for the mining power of the overall network. Because of this difficulty level increasing day by day, nowadays Bitcoin is mined by connecting hundreds and thousands of computer graphic cards together (also known as mining pools) to solve these mathematical problems faster. Here is a simple demonstration of Bitcoin mining.

Proof-of-Work

Bitcoins and many other cryptocurrencies are mined using a Proof-of-Work (PoW) system (algorithm). Before cryptocurrencies came into the picture, PoW system was used to protect clients from denial of service (DoS) or spam attacks. For example, let’s explore what happens when you visit a website. Every time you visit a website, you are requesting some piece of information from the servers that the website’s content is hosted on. Now the website you are demanding information from can handle only a certain amount of requests per second and if it gets overloaded, the system crashes causing the website to become irresponsive. Hackers take advantage of this vulnerability by programming a DoS attack that sends thousands of requests which causes the system to overload and not respond to any requests. On a very simple level, a similar example is when you sometimes visit a website and you have proof you are not a robot by clicking on a check box or solving a small puzzle (CAPTCHA). This process is applied in sending spam emails as well. To combat this issue, in a PoW system, the requester is required to perform some computations that require processing power before they are granted access to the website. Or in our in our spam email scenario, the sender of the email must solve a small puzzle that uses a small amount of processing power before the email is sent. This process is known as Hashcash. If you are a legit requester (one or group of small individuals requesting some information), your computer will solve the requested puzzle without you even noticing it. But if you are a spammer who is sending millions of emails at once, or you are a hacker that is trying to send millions of requests to a website, you will need an extremely high amount of processing power to perform that request. Obviously high amounts of processing power mean extremely costly operation. The PoW system used in Bitcoin and Ethereum mining is similar but uses other cryptographic functionality to avoid the double-spending problem. As the name suggests, double-spending is when one digital cash is spent more than once.

Now that you have a basic understanding of PoW, let’s start exploring how a block is mined and added to the blockchain using PoW. PoW is a very complicated system so if you get lost, don’t be discouraged. I will do my best to keep things a simple as possible.

A block, among other things, consists of a block header that includes a cryptographic hash of the previous block, a hashMerkelRoot, the block version, a difficulty number, nonce, and a timestamp.

When a transaction is announced into the network (for example, Alex sends 2 Bitcoins to Jamie), miners bundle these transactions into a block and try to solve a very complicated math problem or a puzzle using massive amounts of computer processing power. In order for the block to be added to the network, it must include the proof-of-work. Each block contains the SHA-256 (Secret Hash Algorithm with a 256-bit hash value) cryptographic hash of the previous block (think of this as each block securely pointing to the previous block in the blockchain). The network announces a difficulty rate with approximately (currently) 42–43 zeros as its prefix. Miners have to combine the cryptographic hash with a number called nonce to come up with the answer to the puzzle (difficulty level). Since cryptographic hash functions are used (see above cryptography section), the only way to solve this puzzle is using a method called the brute-force search method. In this method, the miners keep changing (guessing) the nonce to come up with a solution to this puzzle. To simply explain this, imagine if you had a formula with the answer and one of the two inputs 786 + X == 346734873. In this formula, in order to find X, you would have to keep guessing a different X value (starting from 0 and incrementing by 1) that would give you 346734873 when added to 786. Similarly in mining, nonce would be our X and the difficulty level would be 346734873. As you can imagine with 42–43 zeros as the prefix, the computation would require trillions of tries to come up with the solution. This is why so much processing power is required to mine a Bitcoin. Therefore the more processing power you have, the faster you would solve the puzzle. The mining network adjusts the difficulty level approximately every 2 weeks to maintain the average time between blocks to ten minutes. Once the miner solves the puzzle, they announce it to the network. The nodes connected to the network then check to make sure the block is valid. The validation process is a lot quicker and easier since the nodes are only doing the verification, not the proof. For example, let’s say you want to open a 3-combination lock. To come up (guess by trial and error) with the combination of the lock, it would take a lot of time. However, once you have the combination, it is very is easy to check whether the combination is valid or not (lock opens or not). This is the same idea behind block validation in Bitcoin. Once the block is validated, it is added to the blockchain and the miner who came up with the solution for the puzzle gets rewarded with 12.5 newly minted Bitcoins (as of today) and the transaction fees. Every 4 years, the Bitcoin reward decreases by half until all the 21 million Bitcoins are mined. Once all the Bitcoins are mined, miners will only be rewarded with the transaction fees.

Since bitcoin transactions and verifications are done through nodes, the entire ledger is available for anyone to download. The entire ledger is simply the record of each transaction ever made in the bitcoin network, starting from the first transaction. If you want to run a full node, the ledger might take several hours to download, but you only need to do it once because once a transaction is verified by all the nodes, it can longer be duplicated or changed. For instance, If Bob wants to send two Bitcoins to Lisa, all the nodes connected to the system must verify that two Bitcoins were subtracted from Bob’s stack, and got added to Lisa’s stack. This verification process is done by all the nodes connected to the network. Once all the nodes come to a unanimous agreement (consensus), the transaction is processed and the ledger of all the connected nodes get updated.

Wallets

You might be wondering at this point, how does one store Bitcoins? Since Bitcoin is a digital currency, it’s only ideal to imagine the storage will happen digitally. Storage of Bitcoins can be done by the usage of digital wallets. Since you can’t really separate Bitcoins from the blockchain, digital wallets are technically a storage of reference or credentials to your Bitcoins in the distributed ledger system that give you the ability to spend them. As mentioned above, Bitcoin and cryptocurrencies use asymmetric or public key cryptography. Therefore, in its simplest form, digital wallets are a combination of these public and private keys, which give you access to spend your Bitcoins. Since Bitcoins are all part of the distributed public ledger, anyone can see which address (public) owns how many Bitcoins. This is a topic of confusion to a lot of people because technically the Bitcoin amount shown in your wallet is not stored inside that wallet but is merely a reference to that address in the ledger and whoever owns the corresponding private key to that public address (key), have access to spend those coins. Let’s say Jack has acquired 5 Bitcoins and he has stored it in a digital wallet with the public address of 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2. Anyone can see the public address but since Jack is the only one with the corresponding private key, he is the only one who can spend those bitcoins. Here is a quick video explaining how wallets work.

Altcoins

Alternative coins or altcoins are other forms of cryptocurrencies that use the same underlying technology as Bitcoin. As mentioned before, blockchain is the backbone of cryptocurrencies. It is extremely important to understand that not every altcoin or cryptocurrency that use blockchain is used as a form of digital cash. In my opinion, the blockchain technology is as revolutionary as the internet itself and its use cases are increasing on a daily basis. Any industry that would improve by being decentralized, can be incorporated through blockchain. A few examples of industries that I think have a desperate need for blockchain usage would be banking, crowdfunding, advertising, retail, medicine (e.g. medical record information), travel, insurance, real estate, government and voting, credit (private personal data), cloud computing (storage and processing power), forecasting, cybersecurity, charity and many more. I could go on for several pages for each of the mentioned industries of why it is beneficial for them to use blockchain. I must mention, that most of the industries I described above and much more have already been tapped into by blockchain. There are hundreds of new startups in the cryptocurrency market that are targeting these spaces. These startups create decentralized applications (DApps) on smart contract platforms to come up solutions for these problems using the blockchain technology.



SMART CONTRACTS

Simply put, a smart contract is a digital contract based on computer code that has unalterable predetermined terms. In smart contracts, all the predefined terms are verified and forced digitally without the presence of a third party facilitator. Since smart contracts are performed in the blockchain, all the parties (nodes) will have a copy of the contract including its predetermined terms signed and agreed upon by everyone. This process reduces cost, fraud, inefficiency, and arguments that happen constantly with our current system. In smart contracts, one can put forth a triggering event for execution of the contract in the code. Once this event is triggered or the set condition is met, the contract would automatically execute. For example, let’s say, John and Mark, who are Patriots and Eagles fans accordingly, are planning to watch the Superbowl game this year. To make things interesting, they each bet $50 before the game starts on their own teams. They transfer their money to a smart contract on the blockchain and hard code the agreed terms by both parties and a triggering event beforehand. The terms would be that whoever wins the bet, the total amount of $100 would be automatically transferred to that person’s bank account. The triggering event, in this case, would be the moment the game is complete and the final scores are announced. As soon as the game finishes, it is announced that the Eagles have won. The smart contract triggering event is met and therefore the smart contract executes at that moment, sending $100 to Mark’s account without any arguments or third party involvement. Obviously, this a simple example on a very small scale, but the idea is to show the simplicity and potential of smart contracts. Now imagine if the amount increases and more parties get involved, in our traditional system, we would need lawyers, court cases, accountants, banks and many others to make sure all parties involved in the contract follow the terms. Smart contracts completely remove all these additional costs and headaches since everything is set in advance and executed the moment the triggering event is met. If you are still confused, here is a quick video further explaining smart contracts.

In my opinion, the real value of blockchain is in smart contracts. The possibilities of innovation in this field are endless. Currently, there are hundreds of new startups (DApps) that are taking advantage of smart contracts to target different industries. DApps are hosted on smart contract platforms. Although there are several new and upcoming smart contract platforms, Ethereum and NEO are the most popular ones so far. Instead of creating a new original blockchain for each DApp, Ethereum and NEO allow DApps to be built and deployed on top of their existing platforms. This allows developers to take advantage of the existing tools and resources that these smart contract platforms offer, which allows for faster and more efficient development of DApps.

Ethereum

Ethereum is the first and most popular open-source decentralized smart contract platform that was created by Vitalik Buterin in July of 2015. Currently, most of the DApps in the market are made on top of Ethereum’s platform. According to coinmarketcap.com, it has the second largest market capitalization behind Bitcoin. The main programming language used to create DApps on Ethereum’s platform is called Solidity. Developers have to learn this new programming language in order to create DApps and deploy them in Ethereum’s platform. DApps that are deployed on smart contract platforms, raise money in the form of a process called initial coin offerings (ICOs). Just like initial public offerings (IPOs) for a regular stock, during the ICO stage of a new DApp, one can participate to get the coins before they hit the exchanges. The coins created in Ethereum’s platform are referred to as the ERC20 tokens. ERC20 tokens are basically a set of rules and guidelines that must be met before a DApp is allowed to be part of the Ethereum network. As of now, Ethereum is mined using proof-of-work algorithm (same as Bitcoin). However, because of the high cost of power and resource using in the PoW system, Ethereum is working on switching a new system called Proof-of-Stake (PoS). I am not going to go into too much detail about the PoS system since it is still being researched on but simply put, in a PoS system, the more coins you hold, the more power you have in the system. Let’s say Amy owns 2% of the entire Ethereum coins, she can, therefore, mine or validate up to 2% of the entire network’s transactions. This not only solves the massive energy usage issue that a PoS system currently has, but also gives the miners an incentive to keep holding more coins and therefore increasing its value.

NEO

Another popular and promising smart contract platform is NEO (previously known as Antshares). It is also important to mention that NEO is not only a smart contract platform but it is aiming to digitize real-world assets with a digital identity on the blockchain. The combination of all three is known as the Smart Economy. NEO uses a completely different and very interesting algorithm called the delegated Byzantine Fault Tolerance (dBFT). While most of the cryptocurrencies today use PoW (few PoS), NEO is using the dBFT algorithm to reach consensus. I will quickly explain how it works but if you are interested to explore more please visit NEO’s documentation on their website neo.org. In a Byzantine-fault-tolerant system, a faulty component can show different implications to the detectors. This system is named after the Byzantine generals problem, where the Byzantine army generals would plan to attack a city but needed to have full consensus from all the general to have a successful and coordinated plan of attack or retreat. The plan of attack or retreat would rely on a 66% consensus from all the general. Similar idea is used in NEO’s block consensus algorithm (dBFT). In order for a block to be added to NEO’s blockchain, it must be validated and approved by 66% of the entire nodes in the system. This eliminates the effect of any faulty or malicious nodes that are connected to the system. A block is introduced to the system by a node known as the “speaker node”. If that block gets approved by the rest of the nodes, it gets added to the blockchain. However, If it is rejected by the other nodes, that speaker node is removed and another node is selected as the speaker. NEO’s ecosystem is divided into two tokens — NEO and GAS. The NEO token is used as a share of the system, while GAS is the utility token used to interact with NEO’s ecosystem. For example, if you want to create a new dAPP on NEO’s ecosystem, the fees and interactions are executed using GAS. If you hold NEO in an approved wallet (e.g. Neon wallet) or a participating exchange (e.g. Binance), GAS is generated automatically with the creation of each NEO block (just like a dividend). This gives the investors an incentive to hold the NEO tokens (similar to PoS) for a longer period of time causing the value of NEO to increase. Another advantage of NEO is that a smart contract (DApp) can be developed in many existing popular coding languages such as Java, Python, .NET, and others. dAPP tokens created on NEO’s platform are known as the NEP-5 (similar to Ethereum’s ERC20) tokens.