Monday, February 19, 2018

How do Block Chains work ? (Bitcoin/Ethereum/Neo)



I have invested some fiat in cryptocurrency and thought it would be best to get up to speed on how block chain and crypto works.






The article titled, Blockchain and the Journey toward a New Internet Architecture, makes parallels between the beginning of the internet and how it evolved to what it is today. He then makes bold claims on how blockchain will transform the internet, kind of like web 2.0.


In the beginning, the internet was decentralized. “In the early days, anyone could run his or her own server and connect to peers, creating an incredible, decentralized “web” of content” (Wang 5). But then the internet became centralized with big players like Google or your ISP or ICANN, the folks who sell out IP addresses. The author stresses that you did not have freedom anymore; you were no longer in control of your own data and the web but rather large corporations. This creates numerous security vulnerabilities because there is now one central target rather than millions of small nodes. The author stresses how NASA is trying to send people to the moon yet we still have DDOS attacks, malware, viruses… which only exist because they exploit outdated technology from the 80s (Wang 26). Some notorious examples include Dyn attack. In this attack, a savvy hacker summoned an army of botnets which shut down the internet for millions of people.






Botnets are malicious applications that run on an infected pc. In the Dyn attack, millions of botnets pinged Dyn’s servers. A ping is just an attempt to reach a particular server. Typically you ping a site by opening cmd and typing ping and the destination ip address. However when millions of botnets ping a server, the traffic can be extremely high, upwards of 100 Tb/s.


In the case of Dyn, they did not have the bandwidth to support this extreme traffic so the servers got overwhelmed and shutdown. However since Dyn owned the DNS servers this basically meant that you could not access Google or Fox News or anything unless you knew their IP address because DNS servers translate the domain name into the ip address of a website. This attack was catastrophic and an example of how our centralized web is very vulnerable. It also means that you should memorize the IP address of google. This way you can just bypass the DNS if it goes down by just typing in the IP.






The web as we know it, TCP/IP/DNS... was designed for ease of use and convenience rather than security. In stark contrast, blockchain was designed for security rather than ease of use and convenience. Maybe we could consult the help of blockchain to transform the web ?






The first concept of the blockchain was designed in 1992 to work as digital timestamp. Basically, it prevented people from forging or changing the time of important files or documents. In 2009, Satoshi Nakamoto, the founder of bitcoin used this concept to invent Bitcoin!






What is a blockchain and why are they so secure? Well, a Blockchain is actually a chain of blocks. The entire chain of blocks from the beginning of the blockchain (in the case of bitcoin it would be 2009) is referred to as a distributed ledger. As of 2016, the bitcoin ledger is about 1/10 of a Terabyte; with the bad wifi I have at home (5mb/s) it would take about 44 hours to download. I digress. Well anyways, each block has many different attributes. It has the Data attribute. This could be anything. If the particular blockchain wants to protect identity it might be the persons name and personal details. If it wants to store patient health records, it might be the patient's name, symptoms, etc. Another attribute is the hash value; A hash is a cryptographic function; it takes an input x, usually the data attribute, and creates an output f(x), something like this 0x929sdjhskd34294294sdksdff. These cryptographic hash functions are asymmetric; meaning that if you know the hash you can’t deduce the data while if you know the data you can deduce the hash. This is important because you sometimes don’t want people knowing the data values, for instance if the blockchain is trying to store patient health records.






Any slight change in the data attribute, the input will create a completely different output or hash. In the image above, we have an elliptic curve hash. You can see how a slight change in the input, just adding 1, yields a completely different output the shape/graph. You can also see how it is very hard to deduce the input function or data solely based on the graph. A hash is like a fingerprint; no 2 hashes are the same. A block also has the hashes of all of previous blocks in the chain.






Now why is a blockchain so secure. Consider the following image. A hacker decides to change the ip address of a dns, a bitcoin wallet address, a medical record, or someone's identity. This critical data was contained in block 2. Consequently the hash of block 2 would also change. In this example it changed from 6BQ1 to H62Y. However, block 3 says its 6BQ1. This discrepancy shows that block 2 was maliciously altered. So the hacker alters block 3’s previous hash to H62Y. Problem solved, right ? No, because then block 3’s hash wouldn’t agree with block 4 and then block 4 with 5 and then 6 with 7 all the way to block 1,000,000. But with more efficient graphics cards and ASIC machines hashes aren’t enough to secure the ledger. An ASIC (application specific integrated circuit) server farm can crank out trillions of hashes per second; more than enough computing power to change all the hashes up to block 1 million. Thus the founders invented PoW which is Proof of work to make it impossible to tamper with the ledger. In proof of work, it takes a lot of time to mine each block. In addition to just changing the hashes, you must also do some “busy work”, basically mining billions of accessory hashes that aren't really used for anything. The busy work slows mining down to a trickle of 1 block per few minutes and since you would have to mine all million blocks, that's 1 millions minutes.






Furthermore, blockchains are distributed (fig. B) and are a type of P2P network. This means that rather than one central server managing everything (fig. A) there are millions of nodes that when combined form the entire network . This creates reliability and robustness because if one node goes down, the network can still function. Now I am sure that you are convinced that blockchains are extremely secure and robust.








Why is this important ? We could have immense security at our fingertips, we don’t ever have to worry about malware and viruses and the internet shutting down. For instance, in the case of malware you might think you're downloading a minecraft or movie or OS file off a website and in reality it is infected with a virus. Well, if we have a blockchain of all the official minecraft versions or the hunger games releases you can just compare the hash of the malicious file in question to the one on the blockchain. If it matches, you know you are downloading the official file and if it doesn’t then it could be malicious. Another example is identity theft. Everyday millions of people are subject to identity theft. There are many blockchain identity services such as thekey, bridge protocol, etc…so that people can’t impersonate you. Imagine if the all the DNS tables were on the blockchain and every 10 seconds all the DNS servers would query the blockchain to make sure the domain name matched the IP address. Also blockchain is trying to replace ISP’s. In the case of Qlink, which runs on the Neo blockchain, their goal is to replace Internet Service Providers with millions of people who sign up as nodes. Basically, the nodes get rewarded for offering internet to the user with qlink tokens. These can be exchanged for bitcoin or fiat currencies. While the user can mine qlink tokens with spare computer resources and then pay back the node; it’s a win win situation. Blockchain is bigger than AI and the internet and its here to stay.

No comments:

Post a Comment