<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nasir Hussain on Medium]]></title>
        <description><![CDATA[Stories by Nasir Hussain on Medium]]></description>
        <link>https://medium.com/@nasirhm?source=rss-cc4278a88177------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*SuySebv260aN_5uXfhVzzA.jpeg</url>
            <title>Stories by Nasir Hussain on Medium</title>
            <link>https://medium.com/@nasirhm?source=rss-cc4278a88177------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 12:52:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nasirhm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing a Web Scraper in NodeJS]]></title>
            <link>https://medium.com/@nasirhm/writing-a-web-scraper-in-nodejs-67c3ba2bcb52?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/67c3ba2bcb52</guid>
            <category><![CDATA[web-scrapers]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Mon, 17 Jun 2019 05:54:39 GMT</pubDate>
            <atom:updated>2019-06-17T05:54:39.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*-AzYMEutFrmzptGxbxZZUg.png" /><figcaption>Web Scraping Technology — I don’t own this Image.</figcaption></figure><p>Writing something in NodeJS is pretty easy for someone who understands Server Side Scripting and JavaScript. Writing a web scraper in NodeJS is a simple example of using NodeJS and npm (to fetch some Packages)</p><h3>What is a Web Scraper</h3><p><strong>Web Scraper: </strong>It can be Defined as a Tool used to gather data from the World Wide Web by using the HTTP (Hyper Text Transfer Protocol). It can be done a user on a Computer but the goal we are trying to achieve is to do the same with a bot or web crawler. The data gathered can be used further in Analysis and can be saved in form of Spread Sheet or any other format you would like to have.</p><p><strong>Below are Some of the Most Famous use cases :<br></strong>1. For Research<br>2. For Businesses/eCommerce — Market Analysis and Price Comparison<br>3. For Marketing — Lead Generation</p><p>After a Small introduction about Web Scraping here arises a question that :<br><em>Is Web Scraping Legal?<br></em>The answer to this simple question is very simple which is If you fetch the accessible data which is allowed to be seen by the uploader of that specific content and it depends upon how much copyrights do you have on that data. You can probably use that data for your personal analysis as it is available to the would.<br>Link : <a href="https://resources.distilnetworks.com/all-blog-posts/is-web-scraping-illegal-depends-on-what-the-meaning-of-the-word-is-is">https://resources.distilnetworks.com/all-blog-posts/is-web-scraping-illegal-depends-on-what-the-meaning-of-the-word-is-is</a></p><p>So now lets move on towards Writing a Web Scraper in NodeJS</p><p>We would be making a Web Scraper to fetch data from the the Wikipedia Page about the Presidents of United States</p><p>Things You need to have installed:<br>1. Node and npm Installed if not you can install from the <a href="https://nodejs.org/en/download/">Link</a><br>2. A Text Editor</p><p>Now Lets Start.</p><ol><li>Create a Folder</li><li>Open terminal/command prompt in that folder and write the following command. It may take some time. Please be patient</li></ol><pre>npm install request-promise cheerio</pre><p>3. The reason for doing it in request promise is that its pretty easy for beginners to understand. Cheerio is a Fast, flexible and lean implementation of JQuery specifically for server. We would be using cheerio as a selector for the data</p><p>In that folder when you run the above commands you will have files as <em>package.json </em>and <em>package-lock.json</em> and a folder as <em>node_modules </em>these are generated by npm (Node Package Manager) .</p><p>Now Lets Start to Code.</p><p>In that Directory Create a file named <em>simpleScraper.js </em>and edit it with any text editor you have. Write the Code in the File</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22cc5bc04be5fa602ac9e28e987d6569/href">https://medium.com/media/22cc5bc04be5fa602ac9e28e987d6569/href</a></iframe><p>Thats it you have wrote it but now let me try to explain it down.</p><p>First two lines are making object to use them in the file further as <em>rp </em>and <em>cheer </em>.</p><p>Third Line is saving the Wikipedia URL in a variable <em>url</em>.</p><p>We are passing the url in request-promise which will be responsible for making a HTTP request on that URL and after that we will save the response in a Variable named data<em> . </em>If we get some error it would be caught by the .catch and we have logged them in Console.</p><p>Now lets get into the function which will have data . In that we dont want the whole Web page we just want to have the names of the Presidents. So for that we are using cheer as a Selector . Those lines say, the first one find how many elements are there in ‘&lt;big&gt;&lt;a&gt;’ the first line would ensure that we are getting the amount of data we want; Second, we are using the same expression but this time we are having the data.</p><p>To execute it run :</p><pre>node &lt;fileName&gt; //In our case simpleScraper.js</pre><p>Result :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WIZrrax8jhT6dc3gdjeBoQ.png" /><figcaption>Execution of the simpleScraper.js in Linux Terminal</figcaption></figure><p>As you can see in the image the length is 45 and all the data is stored in Objects starting from 0 to 44. You can use the data which would be the names of the Presidents in further if you want to .</p><p>Its ends here, If you want to do the same with other http request tools such as <em>fetch </em>I appreciate you to go for it and try to scrape other data from websited which you can see in your Web Browser.</p><p>Good Luck =)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67c3ba2bcb52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generations of Blockchain]]></title>
            <link>https://medium.com/@nasirhm/generations-of-blockchain-2a973c21ce7e?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a973c21ce7e</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cardano]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Thu, 23 Aug 2018 21:07:39 GMT</pubDate>
            <atom:updated>2018-08-23T21:07:39.504Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.youtube.com/watch?v=Ja9D0kpksxw">According to Charles Hoskinson</a>, We have gone through three Generations of Blockchain.</p><h3><strong>1st Generation — Bitcoin</strong></h3><p>Bitcoin came into being because people were asking several question which were further answered by Satoshi Nakamoto. Several questions include the following ones.<br>1. Will it be possible to create a form of money which can be transferred between two people without any middleman?<br>2. Will it be possible to create a decentralized money which can function on something like the Blockchain?<br>Satoshi answered the question by creating Bitcoin, It had a Decentralized and P2P Monetary System which can transfer money between two Peers.</p><h3><strong>How the Bitcoin Works</strong></h3><h4>A small introduction to how the Bitcoin works.</h4><ol><li>Miners create Bitcoins by using computational power to solve mathematical functions. The same process also verifies previous transactions</li><li>Bitcoin exchanges will trade between conventional currencies and Bitcoin,offering a way into the market for non-miners, as well as a way to cash out for miners.</li><li>Businesses create a wallet to accept payments in the form of cryptocurrencies. Nowadays QR Codes can be used to let customers pay quickly and easily.</li><li>Users use Bitcoin wallet that provides them a unique identity in the network and a way to send, receive and store currency.</li></ol><h3>Problems with Bitcoin</h3><p>As Bitcoin is the first generation of Blockchain and had some problems and difficulties which were first observed and then were solved in further generations. The problems included the following:<br>1. They only allowed for monetary transactions, there was no way to add conditions to those transactions.<br>2. Bitcoin is slow and impractical for retail transactions, Bitcoin creates a block in 10 minutes and its estimated that it can only manage 7 TPS(Transactions per Second).<br>3. Bitcoin requires a huge amount of computational power to mine a block.<br>4. If 3–4 Big mining pools of Bitcoin unites, they can perform a 51% attack on the Bitcoin Network.</p><h3><strong>2nd Generation — Ethereum</strong> and Smart Contracts</h3><p>Bitcoin had lack of one major component which was Smart Contract. Which then was solved by Vitalik Buterin’s Ethereum and opened gate to a whole new world of Blockchain which was much more than Money transfer.</p><h4><strong>What is a Smart Contract?</strong></h4><p>Smart Contract’s help you to exchange money, property, shares or any type of asset in a transparent and fast way while avoiding the services of a middleman. The best way we can describe a Smart contract is its a Contract which was used to be written on a Paper with regulations and stuff. But, in this case the Contract is written in the form of code and stores in to the Blockchain and execute’s according to the code. We can define the rules, regulations and penalties in the contract as well so it work’s according as you want it to work. The best thing about a Smart contract is its you can not only define the rules and penalties around an agreement but also automatically enforce those obligations.</p><h4><strong>How a Smart Contract Works?</strong></h4><p>The Smart Contract works on the following steps :<br>1. An option contract between parties is written as code into the Blockchain, The individuals involved in this are anonymous and are known by their addresses, but the ledger in the contract is public.<br>2. A triggering event like an expiration date and strike price is hit and the contract executes itself according to the coded terms.<br>3. Regulators can use the Blockchain to understand the activity while maintaining the privacy of individual actors.</p><h4>Problems with Ethereum and Smart Contracts</h4><p>However this generation had problems too.<br>As more and more interesting use cases of Blockchain were coming out, they were getting more and more acceptance. The problem was though, this generation of Blockchain didn&#39;t had a good provision for Scalablity. Along with that, the Governance system of these Blockchains was not really well throughout. The Ethereum and Ethereum Classic’s split, According to Hoskinson, Is an example of bad Governance.</p><p>This is where the third generation comes in.</p><h3>3rd Generation — Cardano</h3><p>Hoskinson had a Belief in Blockchain and want it to evolve even more. He came up with an idea of Cardano which took the Positive elements from both of the generations and added some of his own and wanted to solve the major problems faced by both of the generations.</p><p>The three elements which Cardano wanted to solve are:<br>1. Scalability<br>2. Sustainability<br>3. Interoperability</p><p>Cardano is unique in a sense that it’s built on scientific research and peer reviewed academic research. All the engineering code that goes into the Cardano project has the ultimate goal of being “High Assurance Code”. This is done to make sure that there is higher belief in the quality of the code used in it. According to Hoskinson, This will prevent future cases like Ethereum and Ethereum Classic’s Split and to lower the chances of Hardfork.</p><p><strong>Thats all for Today !! Thanks for Reading Hope you Enjoyed it.!</strong></p><p>References:- <br><a href="https://blockgeeks.com/guides/smart-contracts/">https://blockgeeks.com/guides/smart-contracts/</a><br><a href="https://bitcoinexchangeguide.com/cardanos-ada-charles-hoskinson-shares-ethereum-classic-etc-hard-fork-thoughts/">https://bitcoinexchangeguide.com/cardanos-ada-charles-hoskinson-shares-ethereum-classic-etc-hard-fork-thoughts/</a><br><a href="https://vxcompany.com/2018/05/02/the-three-generations-of-blockchain/">https://vxcompany.com/2018/05/02/the-three-generations-of-blockchain/</a><br><a href="https://www.investopedia.com/tech/blockchain-technologys-three-generations/">https://www.investopedia.com/tech/blockchain-technologys-three-generations/</a></p><p><strong>Let me know if you have more :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a973c21ce7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An introduction to Cardano — The third Generation Blockchain]]></title>
            <link>https://medium.com/@nasirhm/an-introduction-to-cardano-the-third-generation-blockchain-3cf2df8a9947?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cf2df8a9947</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[introduction-to-cardano]]></category>
            <category><![CDATA[ada]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[cardano]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Mon, 20 Aug 2018 18:31:17 GMT</pubDate>
            <atom:updated>2018-08-20T18:31:17.016Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the most interesting projects to have come out is Cardano. Similar to Ethereum, Cardano is a smart contract platform however, Cardano offers scalability and security through layered architecture. Cardano is also the home to the Ada cryptocurrency, which can be used to send and receive digital funds. This digital cash represents the future of money, making possible fast, direct transfers that are guaranteed to be secure through the use of cryptography. It is a technological Platform aswell which will be capable of running secure and scalable financial application which are currently used everyday by individuals, organization and governments around the world.<br>As mentioned above it works on a layered architecture which makes it flexible and to be more easily maintained and allow the way of upgrades by the way of Soft forks. Cardano will also run decentralized applications, or dApps, services which would not be controlled by a single party but will be operated on a Blockchain.</p><p>Cardano is the first Blockchain project that is developed from a Scientific Philosophy. It is essential that the technology is secure, flexible and scalable for use by many millions of users. A major innovation of Cardano is that it will balance the needs of users with those of regulators, and in doing so combine privacy with regulation. The vision for Cardano is that its new style of regulated computing will bring greater financial inclusion by providing open access for all to fair financial services.</p><h3>References:-</h3><p><a href="https://www.cardano.org/en/what-is-cardano/">What is Cardano? - Cardano</a></p><h4>Let me know if there are more…! :)</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cf2df8a9947" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon Wants to Enter Pakistan Via a Partnership With a Local Online Store]]></title>
            <link>https://medium.com/@nasirhm/amazon-wants-to-enter-pakistan-via-a-partnership-with-a-local-online-store-9d645e9220e8?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d645e9220e8</guid>
            <category><![CDATA[business]]></category>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[alibaba]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[pakistan]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Fri, 13 Apr 2018 17:38:58 GMT</pubDate>
            <atom:updated>2018-04-13T17:38:58.913Z</atom:updated>
            <content:encoded><![CDATA[<p>Pakistan’s web based business advertise is on the ascent and expanding exponentially. As indicated by a report by Pakistan Telecommunication Authority (PTA), the online retail area will cross the $1 billion check by 2020.</p><p>On account of this ascent in the web based shopping pattern, worldwide online retail showcase pioneers are excited about putting resources into the nation’s internet business advertise.</p><p>Alibaba will be facing competition from the popular e-commerce platform Amazon to establish a firm foothold in the country’s growing IT and e-commerce market. Amazon is planning to invest in Pakistani e-commerce market with an aim to secure some share of the rapidly growing market.</p><p>The entrepreneur Adam Ghaznavi, who led Rocket Internet’s Easy Taxi and Kaymu.pk, told;</p><p>“The China Pakistan Economic Corridor is also bringing in a lot of Chinese investment to the country, which will attract investors. Both Alibaba and Amazon will be interested in Pakistan, which has 70% mobile phone penetration in its 220 million population.”</p><h4>Amazon in Pakistan</h4><p>Amazon doesn’t operate directly in Pakistan, however, it does own a fair stake of 33% in Clicky.pk through its acquisition of Souq, a Dubai-based online retailer. Clicky.pk competes with Daraz and other online stores in the fashion and home decoration sector.</p><p>Clicky.pk raised $1 million by selling its 33% stake to Souq in 2016. Amazon later acquired Souq for a reported amount of $580 million. The deal between Souq and Clicky was made public just now.</p><p>According to some sources, Amazon is looking to further increase its stake in Clicky.pk in order to lead the competition in the region. If the deal between Alibaba and Daraz goes through, Amazon and Alibaba will enter a direct competition. The source told;</p><p>“These three geographical locations — India, Dubai, and Pakistan — makes sense for Amazon to scale up. Amazon will make entry into multiple Asian countries, a new strategy to increase its volume, optimize its sourcing and reduce single-country dependence for revenue flow.”</p><p>Amazon’s entry in Pakistan, directly or indirectly, will surely prove beneficial for country’s IT and online retail market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d645e9220e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Facebook Offering $40,000 on Finding an evidence of Data Leaks]]></title>
            <link>https://medium.com/@nasirhm/facebook-offering-40-000-on-finding-an-evidence-of-data-leaks-7a95e39da4b6?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a95e39da4b6</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[data-leak]]></category>
            <category><![CDATA[facebook-marketing]]></category>
            <category><![CDATA[facebook]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Wed, 11 Apr 2018 18:51:33 GMT</pubDate>
            <atom:updated>2018-04-11T18:51:33.263Z</atom:updated>
            <content:encoded><![CDATA[<p>Facebook pays a great many dollars every year to specialists and bug seekers to wipe out security openings in their items and framework, however after the Cambridge Analytica embarrassment, the organization today propelled a prizes program to compensate clients for announcing “mishandle of information “on your stage.</p><p>The choice comes as Facebook CEO Mark Zuckerberg gets ready to affirm before Congress this week in the midst of investigation over the information sharing discussion encompassing Cambridge Analytica, a political counseling firm that acquired and utilized inaccurate information on 87 million of its clients.</p><p>Through its new “Information Abuse Bounty” program, Facebook will”ask clients to help the”social media giant”discover that application engineers are abusing the information, Facebook reported on Tuesday.</p><p>Like your current mistake rewards program, the Data Abuse Bounty program will grant an entirety of cash to any individual who reports substantial information gathering occasions that disregard Facebook’s reestablished information strategies.</p><p>“This program is”complementary to”our existing project of prizes for mistakes, since it ‘takes after the”data’ regardless of whether the root”cause isn’t a security”flaw in the Facebook code,” clarifies the organization.”</p><p>“Awful performers can maliciously”collect and abuse”the information of Facebook clients, notwithstanding when there are no security”vulnerabilities, this program”is planned to”protect against that”abuse.”</p><p>The effect of each report”will decide the”sum of cash that Facebook”would pay.”High affect blunder reports” could enable clients to win up to $40,000, despite the fact that the organization says there is no greatest installment, and can even get more than $40,000 for big”discoveries.</p><p>Then, if you find an application that violates Facebook’s terms of”service by collecting”and sharing user”data with third parties, whether for”money, scams or political”influence, you”can simply inform “Facebook through the”Data Abuse Bounty” program”evidence.</p><p>If your advice on the application developer helps the social media giant catch the dishonest application, Facebook “will close the infringing application and take legal action”against the company that sells or buys the data, if necessary.“</p><p>The Data Abuse Bounty program is the first of its kind in the industry, in which the focus is on the misuse of user data by application developers.</p><p>To be eligible for”the program,”your report must include at least 10,000”Facebook users,”explain not only”how the data was”collected, but also how”it was abused, and social networks should not have known before that specific problem .</p><p>For more information, you can consult the <a href="https://www.facebook.com/data-abuse">Data Abuse Bounty</a> program on Facebook.</p><p>If you are not aware, you can easily”download and see”all the information that Facebook has”collected from you”in just a few”minutes.Here’s how you can download and discover what data Facebook”has collected over time,”including all your past”posts, messages, videos, photos and more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a95e39da4b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding The DAO Attack]]></title>
            <link>https://medium.com/@nasirhm/understanding-the-dao-attack-9328a230243?source=rss-cc4278a88177------2</link>
            <guid isPermaLink="false">https://medium.com/p/9328a230243</guid>
            <category><![CDATA[ethereum-dao-hack]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[decentralized-exchange]]></category>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[dao-hack]]></category>
            <dc:creator><![CDATA[Nasir Hussain]]></dc:creator>
            <pubDate>Wed, 11 Apr 2018 18:33:48 GMT</pubDate>
            <atom:updated>2018-04-11T18:33:48.723Z</atom:updated>
            <content:encoded><![CDATA[<h3>The basics</h3><p>The ethereum network is a network of computers all running the ethereum blockchain. The blockchain allows people to exchange tokens of value, called ether, which is currently the second most popular cryptocurrency behind bitcoin. ethereum also allows people to write and put on the network smart contracts — general-purpose code that executes on every computer in the network (currently over 6,000 computers). People then execute these programs by sending ether to them.</p><p>A DAO is a Decentralized Autonomous Organization. Its goal is to codify the rules and decisionmaking apparatus of an organization, eliminating the need for documents and people in governing, creating a structure with decentralized control.</p><p>Here’s how it works:</p><ul><li>A group of people writes the smart contracts (programs) that will run the organization</li><li>There is an initial funding period, in which people add funds to the DAO by purchasing tokens that represent ownership — this is called a crowdsale, or an initial coin offering (ICO) — to give it the resources it needs.</li><li>When the funding period is over, the DAO begins to operate.</li><li>People then can make proposals to the DAO on how to spend the money, and the members who have bought in can vote to approve these proposals.</li></ul><p>It’s important to understand that great care has been taken not to make these tokens into equity shares — they are more like contributions that give people voting rights but not ownership. In most cases, a DAO is not owned by anyone — it’s just software running on the ethereum network.</p><p>The very first DAO is bitcoin itself, which is governed by consensus among its core team and its mining network. All other DAOs have been launched on the ethereum platform.</p><p><a href="https://daohub.org/">“The DAO</a>” is the name of a particular DAO, conceived of and programmed by the team behind German startup Slock.it — a company building “smart locks” that let people share their things (cars, boats, apartments) in a decentralized version of Airbnb.</p><p>The DAO launched on 30th April, 2016, with a 28-day funding window.</p><p>For whatever reason, The DAO was popular, raising over $100m by 15th May, and by the end of the funding period, The DAO was the largest crowdfunding in history, having raised over $150m from more than 11,000 enthusiastic members. The DAO raised far more money than its creators expected.</p><p>It can be said that the marketing was better than the execution, for during the crowdsale, several people expressed concerns that the code was vulnerable to attack.</p><p>Once the crowdsale was over, there was much discussion of first addressing the vulnerabilities before starting to fund proposals. In particular, Stephan Tual, one of The DAO’s creators, announced on <a href="https://blog.slock.it/no-dao-funds-at-risk-following-the-ethereum-smart-contract-recursive-call-bug-discovery-29f482d348b#.mbfqikiyo">12th June</a> that a “recursive call bug” had been found in the software but that “no DAO funds [were] at risk”.</p><p>At the time, more than 50 project proposals were waiting for The DAO’s token holders to vote on them.</p><p>It’s important to reiterate that the ethereum network has no such bugs and has been working perfectly the entire time. All networked systems are vulnerable to various kinds of attacks. The ethereum network, which supports (depending on the price) around $1bn worth of ether, has not been hacked and is continuously executing many other smart contracts.</p><p>Everyone who writes a smart contract knows that if it can move a large amount of cash it will be subject to attack. This particular vulnerability was discovered recently in another system, called Maker DAO, and was neutralized quickly because that DAO was still in testing.</p><p>Many people feel that testing and certifying smart contracts will be an important part of keeping the ethereum ecosystem safe. You’ll find several smart-contract validation services listed at DecentralStation.com.</p><h3>The Hack</h3><p>Unfortunately, while programmers were working on fixing this and other problems, an unknown attacker began using this approach to start draining The DAO of ether collected from the sale of its tokens.</p><p>By Saturday, 18th June, the attacker managed to drain more than <a href="https://etherchain.org/account/0x304a554a310c7e546dfe434669c62820b7d83490">3.6m ether</a> into a “child DAO” that has the same structure as The DAO. The price of ether dropped from over $20 to under $13.</p><p>Several people made attempts to split The DAO to prevent more ether from being taken, but they couldn’t get the votes necessary in such a short time. Because the designers didn’t expect this much money, all the ether was in a single address (bad idea), and we believe the attacker stopped voluntarily after hearing about the fork proposal (see below). In fact, that attack, or another similar one, could continue at any time.</p><p>Smart contracts are meant to be stand-alone agreements — not subject to interpretation by outside entities or jurisdictions. The code itself is meant to be the ultimate arbiter of “the deal” it represents. But of course, that’s an idealist (crypto-anarchist) perspective.</p><p>Even before the attack, several lawyers raised concerns that The DAO overstepped its crowdfunding mandate and ran afoul of securities laws in several countries. Lawyers also pointed to its creators as potentially liable for any problems that may occur, and several expressed concern that token holders of The DAO were accepting responsibility they were likely unaware of. The DAO exists in a gray area of law and regulation.</p><p>Because the child DAO has the same structure, limitations, and vulnerabilities as the parent DAO, the ether in this newly created child DAO can’t be accessed for 28 days, as that is the initial funding period.</p><p>Everyone can see the ether in this child DAO — any attempts to cash it in will trigger alarms and investigations. It could be that the attacker will never get to cash or spend a single ether of it.</p><p>It’s entirely possible that the attacker had a large short position on ether at the time of the attack, which he or she then cashed out after ether had been cut roughly in half. The attacker may already have made his money, regardless of the ether sitting in the child DAO.</p><p>There are things the Ethereum Foundation could do that may be able to nullify the ether in this DAO. That’s where things get complicated.</p><h3>The Soft-Fork Proposal</h3><p>The DAO contains roughly 15% of all ether, so a failure of The DAO has a negative impact on the ethereum network and its cryptocurrency.</p><p>It’s worth noting that dozens of startups are working on DAO or governance products, many smart contracts have similar vulnerabilities and building complex software using smart contracts is still in its infancy. Everyone involved has a stake in what happens next.</p><p>All eyes are on The DAO and the Ethereum Foundation, hoping for a resolution that allows the ecosystem to continue to develop as it was before.</p><p>To understand what happens next, you will need to understand blockchain basics: A network of nodes puts transactions into blocks and blocks into a single chain that represents the “truth” of what has happened. If two competing transactions happen at about the same time, the network resolves this conflict by choosing one and rejecting the other, so all nodes have the exact same copy of the distributed ledger.</p><p>The only way to “rewrite history” would be to have at least 51% of all nodes agree to such a collusion — something that has never happened in the history of bitcoin or ethereum. The goal of a decentralized network is that no one has the power to do that, or the network itself becomes untrustworthy.</p><p>On <a href="https://blog.ethereum.org/2016/06/17/critical-update-re-dao-vulnerability/">17th June</a>, Vitalik Buterin of the Ethereum Foundation issued a critical update, saying that the DAO was under attack and that he had worked out a solution:</p><blockquote><em>A software fork has been proposed, (with NO ROLLBACK; no transactions or blocks will be “reversed”) which will make any transactions that make any calls/callcodes/delegatecalls that reduce the balance of an account with code hash0x7278d050619a624f84f51987149ddb439cdaadfba5966f7cfaea7ad44340a4ba (ie. the DAO and children) lead to the transaction (not just the call, the transaction) being invalid …</em></blockquote><p>In this, Buterin specifically states that he isn’t proposing to rewrite any blocks, but just to install a “switch” in the basic ethereum code that prevents moving any ether out of the DAO or its children.</p><p>Effectively, this is a one-time fix (called a “fork”) for a one-time event that seals those ether into that address for all time.</p><p>Buterin continued:</p><blockquote><em>“Miners and mining pools should resume allowing transactions as normal, wait for the soft fork code and stand ready to download and run it if they agree with this path forward for the Ethereum ecosystem. DAO token holders and ethereum users should sit tight and remain calm. Exchanges should feel safe in resuming trading ETH.”</em></blockquote><p>In other words, a blacklist will be built into the ethereum code to keep the bad guy from claiming his prize. In this “freezing of assets” scenario, Buterin calls for a discussion of how to help DAO token holders recover their initial investment.</p><p>This seemingly innocuous and well-meaning “Deus ex machina” proposal — which must still be adopted by a majority of ethereum network nodes to take effect — has opened a huge can of worms.</p><h3>The Attacker Responds — or Does He?</h3><p>I will call the attacker a lone male, even though I have no idea if he is one.</p><p>What happened next was interesting. In an <a href="https://pastebin.com/CcGUBgDG">open letter</a> to The DAO and ethereum Community, the attacker supposedly claimed that his “reward” was legal and threatened to take legal action against anyone who tried to invalidate his work. Several people pointed out that the cryptographic signature in this message wasn’t valid — it could be fake.</p><p>But it’s well written, and from a certain point of view, well reasoned: The premise of smart contracts is that they are their own arbiters and that nothing outside the code can “change the rules” of the transaction.</p><p>Later, through an intermediary, the attacker claimed that he would put a stop to the organized “theft” of his property by rewarding miners (nodes) who don’t go along with the proposed soft fork, saying:</p><blockquote><em>“[S]oon we will have a smart contract to reward miners who oppose the soft fork and mines the transaction. 1m ETH + 100 BTC will be shared with miners.”</em></blockquote><p>This is clearly a complex dynamic system.</p><p>These messages from “the attacker””cannot be verified, so we’ll have to wait and see what happens.</p><h3>The Hard-Fork Proposal</h3><p>Another proposal is more aggressive — to ask the miners to completely unwind the theft and return all ether to The DAO, where it can be redeemed by token holders automatically, thereby ending The DAO.</p><p>As Stephan Tual puts it <a href="https://blog.slock.it/a-fork-in-the-road-c3c267b9ff31#.czj4ma1q7">in his blog</a> …</p><blockquote><em>“By 4pm local time, </em><a href="https://blog.ethereum.org/2016/06/17/critical-update-re-dao-vulnerability/"><em>the consensus</em></a><em> was that should a soft fork be deployed within 27 days, the attacker would not be able to retrieve the funds he had stashed into a child DAO.</em></blockquote><blockquote><em>A subsequent hard fork could even return all ether, including the DAO’s ‘extraBalance’ and the stolen funds, back into a smart contract. That smart contract would contain a single function: withdraw().</em></blockquote><blockquote><em>This would make it possible for everyone who participated in the DAO to withdraw their funds: thanks to the support of the miners, and because nothing had been spent so far, nothing would be lost.”</em></blockquote><p>This has the effect of rewriting the rules by which the blockchain executes, which is supposed to be impossible. Should we let that rule slide just this one time, to put the ethereum project back on track?</p><p>The Slock.it guys and most DAO tokenholders would be grateful if we did.</p><h3>Responses to the soft fork</h3><p>Seen on its own, the proposal is reasonable. It’s a one-time fix to a one-time problem. But many people don’t see it that way.</p><p>You can read the <a href="https://www.reddit.com/r/ethereum/comments/4oiqj7/critical_update_re_dao_vulnerability/">massive response on Reddit</a>, which I will try to summarize:<br> Trustworthiness of the network is sacred.</p><p>As one person on Reddit put it:</p><blockquote><em>“The involvement of the ethereum foundation in the DAO has been and is a mistake. As I see it ethereum is supposed to be the foundational infrastructure upon which a flurry of projects and experiments are supposed to blossom, and in order for them to blossom they need a foundation that is strong, and that has integrity in the face of challenges. The hard fork proposal is a compromise that ruins that integrity and signals that projects like the DAO can influence the underlying foundation to their own advantage. To me that is totally unacceptable and is a departure from the principles that drew me to ethereum.”</em></blockquote><p>The hard fork is a valid option, but it should be kept for situations which require emergency modifications of the ethereum protocol itself, and not for projects that run on it.</p><p>The fact that the Ethereum Foundation has been involved in and promoted The DAO project has been an error and it only usurps the trust that people have in ethereum as a foundational infrastructure for other projects.</p><p>I hope they will correct this error.</p><p>Another one chimed in:</p><blockquote><em>“I made a bad contract in the first days ETH was online and lost 2K ETH with it, can I also get it back? Thanks!”</em></blockquote><p>And finally:</p><blockquote><em>“Ethereum worked exactly as intended. I don’t believe software should be updated when it works exactly as intended. You assume the risks of your investment. If you don’t understand your investment, you assume unknown risk. Anything else is a bailout by a central authority, i.e. the antithesis of the crypto world. In a related way, this is why Lehman Brothers was allowed to fail — because the deal is the deal, and if you bend the rules for a particular player, all other players will want special treatment, too.”</em></blockquote><h3>Too Big to Fail</h3><p>Just a month after Lehman Brothers, other banks did get special treatment, and you can decide for yourself whether that was a good idea — it’s quite analogous to the situation at hand. The DAO is not an island.</p><p>It is considered “too big to fail” from the point of view of the ethereum ecosystem. It may be noted that several people from the Ethereum Foundation are DAO token holders and also have advisory positions in The DAO. Even Gavin Wood, one of the original ethereum founders, supported the fork in a blog post.</p><p>In this view, then, it’s possible that some other large projects could need to be rescued and the Ethereum Foundation, having set a precedent once, may once again ask miners to rewrite history.</p><p>The analogy to the bank bailouts is remarkable: banks were able to take huge risks hoping for huge returns, and when those trades went south, the taxpayers bailed them out (except for poor Lehman Brothers). This risk asymmetry is generally thought of as a bad way to incentivize market participants.</p><p>Those are the two extremes, but most people fall into one or the other. The long arm of the law, not to mention the tax man</p><p>The above discussion assumes we are operating in a vacuum, in crypto-anarchy space, where laws don’t apply. But people have invested real money and real laws can and will apply to this case.</p><p>In fact, all parties here may have legitimate claims that could take years to settle out in courts around the world.</p><h3>Who’s at risk?</h3><p>Even though they took great care to not create securities and make sure people were aware of the risks, they still may be held liable. If the DAO token holders lose most of their $150m+ investment, a class-action suit against the originators seems likely.</p><p><strong>Other DAOs<br> </strong><br> Some people have taken The DAO smart contract word for word to implement other DAOs. In the case of a hard fork, all of the ether in any DAO that uses The DAO’s 1.0 smart contracts will forfeit their ether into a refund address, to be divided among DAO token holders. Thus, DAO token holders could end up getting more than they put in. This is sure to anger those who have put their own money into their own DAOs using The DAO 1.0 code.</p><p><strong>DAO tokenholders<br> </strong><br> As investors, and without the protection of a corporation, all 11,000+ DAO token holders may be seen as general partners in the fund. In that case, the attacker can sue individual DAO token holders in their own home jurisdictions, claiming that they represent the entity that seized his rightful property.</p><p><strong>The Exchanges<br> </strong><br> Not long after the initial funding period, several cryptocurrency exchanges began making markets in DAO tokens.</p><p>As part of the chain, anyone who bought DAO tokens from any exchange may sue the exchange for selling flawed investments. This could go very deep — to the level of securities law violations, or they could simply be liable for the profit they made on the tokens.</p><p>Given that several exchanges have plenty of cash, they could be among the first targets.</p><p><strong>The Ethereum Foundation<br> </strong><br> The Ethereum Foundation has a lot at stake here. They want the network to be rock solid, to support billions of dollars worth of commerce, and to be “the operating system of the future”.</p><p>But now they are between a rock and a hard place: if they do nothing, the ethereum network suffers a setback that could take years to recover from; if they intervene, they set a dangerous precedent that erodes the social contract they set up with their network of independent nodes.</p><p>They didn’t design the ethereum network to be the judge and jury in case one or more parties are injured.</p><p><strong>Miners and nodes<br> </strong><br> The 6,000+ full ethereum nodes may be liable for any forks they vote for.</p><p>If the attacker can be seen as having acquired his ether as a result of a “feature” of a smart contract, then he may (and has already threatened to) sue any of the miners that try to take what he feels is rightfully his away from him. He could also sue the Ethereum Foundation if they write the software that implements the fork.</p><p>On the other hand, DAO token holders could sue nodes that don’t vote for the fork, claiming that they aren’t doing the right thing. On the other hand, people running nodes like money, and they may get money from “the attacker” not to fork. It’s entirely possible that governments will step in here and try to make big changes in the governance of the Ethereum system.</p><p><strong>The attacker<br> </strong><br> The attacker may already have made a substantial sum via market manipulation — this is illegal in many jurisdictions. He also may have a huge tax liability. There is obviously a tremendous incentive for the community to learn his identity and “out” him.</p><p>There is probably enough information out there for people to figure out who he is — it may just be a matter of time before they do.</p><h3>The Aftermath</h3><p>It seems at this point that The DAO will die, and that DAO token holders will get somewhere between 0% and 100% of their ether back.</p><p>It’s safe to say that the Slock.it guys have their hands full for a while, they may not get their project funded (I’m told they put quite a bit of their own money into The DAO), and they may be talking with lawyers for months.</p><p>The DAO is still subject to another similar attack.</p><p>Vitalik can propose an ethereum-based solution, but the nodes must decide. It’s not clear which of these paths the nodes will take. Many people say that “doing nothing is perhaps the worst option”. It depends which side of various fences you’re on. There are slippery slopes everywhere.</p><p>There’s another wrinkle: The Ethereum Foundation is on track to switch to a new consensus mechanism called “proof of stake”, and in that scenario, anyone who owns 14% of all ether will have tremendous control over the future blockchain.</p><p>In fact, Vitalik has asked for projects to have a limit of $10m or so, to help contain the magnitude of unintended errors.</p><p>It’s also very likely that there will be lawsuits. We could see a total mess, with lawsuits extending for many years. Or we could see a fairly neat and tidy ending, ethereum goes on and “the attacker” never surfaces again.</p><p>Though I would bet 5 ether that the attacker will be found within a month or two. Even though the letter and the spirit of smart contracts is that “smart contracts rule,” and the rule of law doesn’t apply — in this case, most people would like to see a do-over. I’m guessing we will see various rules of law apply.</p><p>I have tried to stick with the facts, and now I will offer one simple opinion: This situation will resolve itself well if the attacker will simply buy a bunch of ether, then agree to work with The DAO people to return the money to all tokenholders and dissolve The DAO completely.</p><p>The attacker will have made some money, made his point, no lawyers will be involved, we will all have learned a hard lesson, and the Ethereum Foundation can start planning for a safer, more resilient future.</p><h3>Summary</h3><p>I believe we can say that this event marks the beginning of a new era of ethereum’s public blockchain.</p><p>While the agile approach of “ready, fire, aim” generally works best with new software, it can be dangerous when $150m gets loaded into the chamber.</p><p>Ethereum was billed as a general-purpose computer and the harbinger of a new decentralized model for computing and for society. We will see, a bit sooner than we may have wanted, how all this plays out in the real world.</p><p>Some resources:</p><p><a href="https://blog.ethereum.org/2014/05/06/daos-dacs-das-and-more-an-incomplete-terminology-guide/">DAOs, DACs, and More</a> — by Vitalik Buterin</p><p><a href="https://www.ethereum.org/dao">How to Build a Democracy on the Blockchain</a> — by the Ethereum Foundation</p><p><a href="https://www.youtube.com/watch?v=Swdb-Z_4JmI">The DAO, The Fork, The Fallout</a> — A group discussion</p><p><em>This post originally appeared on </em><a href="https://medium.com/@pullnews/understanding-the-dao-hack-for-journalists-2312dd43e993#.i6eydda9x"><em>Medium</em></a><em> and has been republished with the author’s permission.</em></p><p><a href="http://www.shutterstock.com/pic-143642815/stock-photo-vintage-typewriter-and-a-blank-sheet-of-paper-retouching-retro.html"><em>Typewriter image</em></a><em> via Shutterstock</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9328a230243" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>