<?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 Ibad Siddiqui on Medium]]></title>
        <description><![CDATA[Stories by Ibad Siddiqui on Medium]]></description>
        <link>https://medium.com/@ibadsiddiqui?source=rss-fbbc785892ee------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lP45u5DqdlHQAT2Inu-3Zw.jpeg</url>
            <title>Stories by Ibad Siddiqui on Medium</title>
            <link>https://medium.com/@ibadsiddiqui?source=rss-fbbc785892ee------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:09:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ibadsiddiqui/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[Getting Started With Expo (React-Native)]]></title>
            <link>https://ibadsiddiqui.medium.com/getting-started-with-expo-react-native-fc9123e90ee8?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc9123e90ee8</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Mon, 19 Aug 2019 05:29:44 GMT</pubDate>
            <atom:updated>2019-08-19T05:29:44.142Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OwTgC3_fZg3lUg7Nc17F8Q.png" /></figure><p>Expo is a set of tools, libraries and services you can use to build native iOS and Android apps faster than ever before.</p><p>The Expo SDK is a set of libraries written natively for each platform which provides access to the device’s system functionality (things like the camera, push notifications, contacts, local storage, and other hardware and operating system APIs) from JavaScript. The SDK is designed to smooth out differences in platforms as much as possible, which makes your project very portable because it can run in any native environment containing the Expo SDK.</p><h3>Local Development Tool: Expo CLI</h3><p>You’ll need <strong>Expo CLI</strong> — a command line interface <strong>(CLI)</strong>. You’ll need to have Node.js (version 10 or newer) installed on your computer. <a href="https://nodejs.org/en/">Download the latest version of Node.js</a>.</p><p>Install Expo CLI using following command:</p><blockquote>npm install -g expo-cli</blockquote><h3>Mobile Client: Expo for iOS and Android</h3><p>To test the app on actual physical device, you will need an expo client app for Android and iPhone. It can be found the play store for Android and in the app store for iPhone. You can get them from here:</p><blockquote>For Android: <a href="https://play.google.com/store/apps/details?id=host.exp.exponent&amp;hl=en"><em>https://play.google.com/store/apps/details?id=host.exp.exponent&amp;hl=en</em></a></blockquote><blockquote>For iPhone: <a href="https://itunes.apple.com/us/app/expo-client/id982107779?mt=8">https://itunes.apple.com/us/app/expo-client/id982107779?mt=8</a></blockquote><h3>Using Emulators:</h3><p>If you do not want to use physical device, you can use emulators for Android and iOS. Some Android emulators names are GenyMotion and Blue Stack. You can also use the default emulator of Android that comes with Android Studio. There are no emulators available for iPhone on Windows, only Android emulators are available. iPhone emulators are available on Mac only.</p><p><strong><em>Note: Android Studio requires at least 9GB of RAM to run smoothly.</em></strong></p><h3>UP AND RUNNING:</h3><p>Now, time to create our first project. Enter the follow command:</p><blockquote>expo init app_name</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*VNRarCgu1_Id5ytFdx7KHA.png" /><figcaption>Initializing expo app</figcaption></figure><p>In <em>app_name,</em> you can enter app’s name that you want to create. After entering the above command, you’ll be asked to enter the type of template that you want. You can select any type that you want, but for now we will keep it simple and select “<em>blank workflow” </em>by using arrows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*vW9QuNgj0cJoGp9HtELB4w.png" /><figcaption>Workflow Selection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*3J4DSFgLUfX51G4KCMEcQg.png" /></figure><p>After selecting you’ll be asked to enter App Name. Please type name of the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*BfI8OcgQVD6Y9lql7MIxBA.png" /></figure><p>After selecting you’ll be asked to install the template using <a href="https://yarnpkg.com/en/">Yarn,</a> if have already have Yarn installed in your system, enter <em>yes </em>else you’ll move on<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*qqYUvKcy07OYYXhT7P5M-w.png" /></figure><p>Now the app will download the template for blank app<em>. </em>Please wait for a while…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*XtPwrwmr5_BQylHE0bVMtw.png" /></figure><p>Now the template and app is ready for working.</p><p>Just follow the commands and start the project:</p><blockquote>cd &lt;app_name&gt; <br>npm start “or” yarn start</blockquote><p>After successful following the above commands, you’ll have the QR code that can be scanned from the Expo App in android and from the Camera App in the iOS. You can scan the QR code to get the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*kguMUvoPhs0wkGI-1WCBYw.png" /></figure><p>You are all set now.!!<br>Start editing the <strong>App.js </strong>file to see the changes.</p><p>For more details, follow the expo and react native documentation:</p><blockquote><a href="https://docs.expo.io/">https://docs.expo.io/</a><br><a href="https://facebook.github.io/">https://facebook.github.io/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc9123e90ee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction To MongoDB]]></title>
            <link>https://ibadsiddiqui.medium.com/introduction-to-mongodb-154abdec874b?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/154abdec874b</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 19:35:27 GMT</pubDate>
            <atom:updated>2018-09-21T19:35:27.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*WhwtDlgacSNFuFoWspjM9g.jpeg" /><figcaption>MongoDB Inc.</figcaption></figure><blockquote>MongoDB is an open-source database developed by MongoDB Inc. that’s scalable and flexible. MongoDB stores data in JSON-like documents that can vary in structure.</blockquote><p>MongoDB is a document-oriented database system. It has a JSON-like document structure that is flexible and easy to work with. Here’s an example of what a MongoDB document looks like:</p><pre>{<br>   &quot;_id&quot;: ObjectId(1234567),<br>   &quot;type&quot;: &quot;Article&quot;,<br>   &quot;title&quot;: &quot;MongoDB Tutorial Part One&quot;,<br>   &quot;description&quot;: &quot;First document&quot;,<br>   &quot;author&quot;: &quot;Ibad Siddiqui&quot;,<br>   &quot;content&quot;: &quot;This is the content&quot;<br>}<br>{<br>   &quot;_id&quot;: ObjectId(8910111213),<br>   &quot;type&quot;: &quot;Article&quot;,<br>   &quot;title&quot;: &quot;MongoDB Tutorial Part Two&quot;,<br>   &quot;description&quot;: &quot;Second document&quot;,<br>   &quot;author&quot;: &quot;Ibad Siddiqui&quot;,<br>   &quot;content&quot;: &quot;In the second article, we have...&quot;<br>}</pre><p>A document in a NoSQL database corresponds to a row in an SQL database. A group of documents together is known as a <strong>collection</strong>, which is roughly synonymous with a table in a relational database.</p><p>A part from being a NoSQL database, MongoDB has a few qualities of its own. I’ve listed some of its key features below:</p><ul><li>It’s easy to install and set up</li><li>It uses a BSON (a JSON-like format) to store data</li><li>It’s easy to map the document objects to your application code</li><li>It claims to be highly scalable and available, and includes support for out-of-the-box replication</li><li>It supports MapReduce operations for condensing a large volume of data into useful aggregated results</li><li>It’s free and open source.</li></ul><p>MongoDB appears to overcome the limitations of the age-old relational databases and NoSQL databases.</p><p>Let’s go ahead and install MongoDB.</p><h3>Installing MongoDB:</h3><p>Installing MongoDB is easy and it doesn’t require much configuration or setup. MongoDB is supported by all major platforms and distributions, and you can check out their documentation if you’re in doubt.</p><p>I’ve covered the instructions for installing MongoDB on Windows below. For Linux, MongoDB recommends installing the software with the help of your <a href="https://docs.mongodb.com/manual/administration/install-on-linux/">distribution’s package manager</a>.</p><h3>Downloading &amp; Installing MongoDB on Windows:</h3><p>You can download MongoDB (.msi or .exe)using the following link: <a href="https://www.mongodb.com/download-center?jmp=nav#community">https://www.mongodb.com/download-center?jmp=nav#community</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pq0N1ixbjEAH30HvgvuDAA.png" /><figcaption>MongoDB Download Center.</figcaption></figure><p>After installing it, create a data directory so that the mongod process will be able to write data. By default, the directory is C:\data\db:</p><pre>C:\&gt;mkdir data<br>C:\&gt;cd data<br>C:\&gt;mkdir db</pre><p>Initiate the MongoDB server. Run the mongod command to start the server. Now to start the Mongo shell, open up another terminal window and run: mongo. The mongo shell will attempt to connect to the mongo daemon that we initiated earlier. Once you’re successfully connected, you can use the shell as a playground to safely run all your commands.</p><p>Exit the Mongo shell by running quit() and the mongo daemon by pressing control + C.</p><p>Now that we have the mongo daemon up and running, let’s get acquainted with the MongoDB basics.</p><h3>Basic Database Operations:</h3><p>Enter mongo shell, keep the server running:</p><pre>C:\Users\IBAD SIDDIQUI&gt;mongo<br>MongoDB shell version v4.0.2<br>connecting to: mongodb://127.0.0.1:27017<br>MongoDB server version: 4.0.2<br>&gt;</pre><p>You can see my version of MongoDB shell. By default, you’re connected to a <strong>test</strong> database. You can verify the name of the current database by running db:</p><pre>&gt;db<br>test<br>&gt;</pre><p>That’s awesome, but what if we want a new database? To create a database, MongoDB has a use DATABASE_NAME command:</p><pre>&gt;use example<br>switched to db example</pre><p>To display all the existing databases, try show dbs:</p><pre>&gt; show dbs<br>admin 0.000GB<br>config 0.000GB<br>local 0.000GB</pre><p>The example isn’t in the list because we need to insert at least one document into the database. To insert a document, you can do db.COLLECTION_NAME.insertOne({&quot;key&quot;:&quot;value&quot;}). Here’s an example:</p><pre>&gt; db.users.insertOne({&#39;name&#39;:&#39;Ibad&#39;})<br>{<br>   &quot;acknowledged&quot; : true,<br>   &quot;insertedId&quot; : ObjectId(&quot;5a52c53b223039ee9c2daaec&quot;)<br>}</pre><p>MongoDB automatically creates a new users collection and inserts a document with the key-value pair &#39;name&#39;:&#39;Ibad&#39;. The ObjectId returned is the id of document inserted. MongoDB creates a unique ObjectId for each document on creation and it becomes the default value of the _id field:</p><pre>&gt; show dbs<br>admin    0.000GB<br>config   0.000GB<br>example  0.000GB<br>local    0.000GB<br>&gt;</pre><p>Similarly, you can confirm that the collection was created using the show collections command:</p><pre>&gt; show collections<br>user</pre><p>We’ve created a database, added a collection named user and inserted a document into it. Now let’s try dropping it. To drop an existing database, use the dropDatabase() command as exemplified below:</p><pre>&gt; db.dropDatabase()<br>{ &quot;dropped&quot; : &quot;example&quot;, &quot;ok&quot; : 1 }</pre><p>show dbs confirms that the database was indeed dropped.</p><pre>&gt; show dbs<br>admin 0.000GB<br>config 0.000GB<br>local 0.000GB</pre><h3>MongoDB CRUD Operations:</h3><p>The <strong>CRUD</strong> acronym stands for <strong>Create</strong>,<strong> Read</strong>, <strong>Update</strong>, and <strong>Delete</strong>. These are the four basic database operations that you can’t avoid while building an application. For instance, any modern application will have the ability to create a new user, read the user data, update the user information and, if needed, delete the user account. Let’s accomplish this at the database level using MongoDB.</p><h4>Create Operation:</h4><p>Creation is the same as <a href="https://docs.mongodb.com/manual/tutorial/insert-documents/">inserting a document</a> into a collection. In the previous section, we had inserted a single document using the db.collection.insertOne() syntax. There’s another method called db.collection.insertMany() that lets you insert multiple documents at once. Here’s the syntax:</p><pre>&gt; db.COLLECTION_NAME.insertMany(<br>   [ &lt;document 1&gt;; , &lt;document 2&gt;, ... ]<br>   )</pre><p>Let’s create a users collection and populate it with some actual users:</p><pre>&gt; db.users.insertMany([<br>   { &quot;name&quot;: &quot;Ibad&quot;,&quot;age&quot;:22, &quot;email&quot;: &quot;ibadsiddiqui01@gmail.com&quot; },<br>   { &quot;name&quot;:&quot;Tim&quot;, &quot;age&quot;:25, &quot;email&quot;:&quot;Tim@example.com&quot; },<br>   { &quot;name&quot;: &quot;Shane&quot;, &quot;age&quot;: 27, &quot;email&quot;: &quot;Shane@example.com&quot; },<br>   { &quot;name&quot;: &quot;Lili&quot;, &quot;age&quot;:15, &quot;email&quot;:&quot;lili@example.com&quot;}<br>])<br><br>{<br>   &quot;acknowledged&quot; : true,<br>   &quot;insertedIds&quot; : [<br>      ObjectId(&quot;5a52cb2451dd8b08d5a22cf5&quot;),<br>      ObjectId(&quot;5a52cb2451dd8b08d5a22cf6&quot;),<br>      ObjectId(&quot;5a52cb2451dd8b08d5a22cf7&quot;),<br>      ObjectId(&quot;5a52cb2451dd8b08d5a22cf8&quot;)<br>   ]<br>}</pre><p>The insertMany method accepts an array of objects and, in return, we get an array of ObjectIds.</p><h4>Read Operation:</h4><p>R ead operation is used to <a href="https://docs.mongodb.com/manual/tutorial/query-documents/">retrieve a document</a> or multiple documents from a collection. The syntax for the read operation is as follows:</p><pre>&gt; db.[collection_name].find(query, projection)</pre><p>To retrieve all user documents, you can do this:</p><pre>&gt; db.users.find().pretty()<br>{<br>   &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf5&quot;),<br>   &quot;name&quot; : &quot;Ibad&quot;,<br>   &quot;age&quot; : 22,<br>   &quot;email&quot; : &quot;ibadsiddiqui01@gmail.com&quot;<br>}<br>{<br>   &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf6&quot;),<br>   &quot;name&quot; : &quot;Tim&quot;,<br>   &quot;age&quot; : 25,<br>   &quot;email&quot; : &quot;Tim@example.com&quot;<br>}<br>{<br>   &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf7&quot;),<br>   &quot;name&quot; : &quot;Shane&quot;,<br>   &quot;age&quot; : 27,<br>   &quot;email&quot; : &quot;Shane@example.com&quot;<br>}<br>{<br>   &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf8&quot;),<br>   &quot;name&quot; : &quot;Lili&quot;,<br>   &quot;age&quot; : 15,<br>   &quot;email&quot; : &quot;lili@example.com&quot;<br>}</pre><p>This corresponds to the SELECT * FROM USERS query from an SQL database.</p><p>The pretty method is a cursor method, and there are many others too. You can chain these methods to modify your query and the documents that are returned by the query.</p><p>What if you need to filter queries and return a subset of the collection? Say, find all users who are below 30. You can modify the query like this:</p><pre>&gt; db.users.find({ &quot;age&quot;: { $lt: 25 } })<br>{ &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf5&quot;), &quot;name&quot; : &quot;Ibad&quot;, &quot;age&quot; : 22, &quot;email&quot; : &quot;ibadsiddiqui01@gmail.com&quot; }<br>{ &quot;_id&quot; : ObjectId(&quot;5a52cb2451dd8b08d5a22cf8&quot;), &quot;name&quot; : &quot;Lili&quot;, &quot;age&quot; : 15, &quot;email&quot; : &quot;lili@example.com&quot; }</pre><p>$lt is a query filter operator that selects documents whose age field value is less than 25. There are many comparison and logical query filters available, and you see the entire list in the <a href="https://docs.mongodb.com/manual/reference/operator/query/#query-selectors">Query Selector documentation</a>.</p><h4>Update Operation:</h4><p>The <a href="https://docs.mongodb.com/manual/tutorial/update-documents/">update operation</a> modifies the document in a collection. Similar to the create operation, MongoDB offers two methods for updating a document. They are:</p><ol><li>db.collection.updateMany(filter, update, options)</li><li>db.collection.updateMany(filter, update, options)</li></ol><p>If you need to add an extra field, say registration, to all the existing documents in a collection, you can do something like this:</p><pre>&gt; db.users.updateMany({}, {$set: { &#39;registration&#39;: &#39;incomplete&#39;}})<br>{ &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 4, &quot;modifiedCount&quot; : 4 }</pre><p>The first argument is an empty object because we want to update all documents in the collection. The $set is an update operator that sets the value of a field with the specified value. You can verify that the extra field was added using db.users.find().</p><p>To update the value of documents that match certain criteria, updateMany() accepts a filter object as the first argument. For instance, you might want to overwrite the value of registration to complete for all users who are aged 18+. Here is what you can do:</p><pre>&gt; db.users.updateMany(<br>  {&#39;age&#39;:{ $gt: 18} },<br>  {$set: { &#39;registration&#39;: &#39;complete&#39;}<br>})</pre><pre>{ &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 3, &quot;modifiedCount&quot; : 3 }</pre><p>To update the registration details of a single user, you can do this:</p><pre>&gt; db.users.updateOne(<br> {&#39;email&#39;: &#39;lili@example.com&#39; },<br> {$set: { &#39;registration&#39;: &#39;complete&#39;}<br>})</pre><pre>{ &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 1, &quot;modifiedCount&quot; : 1 }</pre><h4>Delete Operation:</h4><p><a href="https://docs.mongodb.com/manual/tutorial/remove-documents/">Delete operation</a> removes a document from the collection. To delete a document, you can use the db.collection.deleteOne(filter, options) method, and to delete multiple documents, you can use the db.collection.deleteMany(filter, options) method.</p><p>To delete documents based on certain criteria, you can use the filter operators that we used for the read and update operation:</p><pre>db.users.deleteMany( { status: { $in: [&quot;dormant&quot;, &quot;inactive&quot; ]}})<br><br>{ &quot;acknowledged&quot; : true, &quot;deletedCount&quot; : 1 }</pre><p>This deletes all documents with a status of “dormant” or “inactive”.</p><p>That’s it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=154abdec874b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using MySQL with NodeJS]]></title>
            <link>https://ibadsiddiqui.medium.com/using-mysql-with-nodejs-657b63b9f794?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/657b63b9f794</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Sun, 16 Sep 2018 15:44:28 GMT</pubDate>
            <atom:updated>2018-09-16T15:44:28.857Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we’ll have a look at getting started with the mysql module — a Node.js driver for MySQL, written in JavaScript. I’ll explain how to use the module to connect to a MySQL database, perform the usual CRUD operations, before examining stored procedures and escaping user input.</p><h4>Installing the “mysql” Module:</h4><p>Now let’s take a closer look at each of those steps. First of all, we’re using the command line to create a new directory and navigate to it. Then we’re creating a package.json file using the command npm init –y. The -y flag means that npm will use only defaults and not prompt you for any options. This step also assumes that you have Node and npm installed on your system.</p><p>After that, we’re installing the <a href="https://www.npmjs.com/package/mysql">mysql module</a> from npm and saving it as a project dependency.</p><pre>mkdir mysql-test<br>cd mysql-test<br>npm install mysql -y</pre><h4>Getting Started:</h4><p>Before we get on to connecting to a database, it’s important that you have MySQL installed and configured on your machine.</p><p>The next thing we need to do is to create a database and a database table to work with. I’ll be using <a href="https://www.mysql.com/products/workbench/"><strong><em>MySQL Workbench</em></strong></a><em> </em>as it provides good graphical user interface (GUI), you can use that or you can use <a href="https://www.phpmyadmin.net/"><strong>phpMyAdmin</strong></a>. For this article I’ll be using a database called company and a table called employees. Here’s a dump of the database, so that you can get up and running quickly, if you wish to follow along:</p><pre>CREATE DATABASE company;<br>USE company;</pre><pre>CREATE TABLE employees (<br>  id int(11) NOT NULL AUTO_INCREMENT,<br>  name varchar(50),<br>  location varchar(50),<br>  PRIMARY KEY (id)<br>) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;<br><br>INSERT INTO employees (id, name, location) VALUES<br>(1, &#39;Ibad&#39;, &#39;Pakistan&#39;),<br>(2, &#39;Jay&#39;, &#39;India&#39;),<br>(3, &#39;Jade&#39;, &#39;Germany&#39;),<br>(4, &#39;Lesley&#39;, &#39;Scotland&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*zmUDUueqqZmJvHs526NsWw.png" /><figcaption>SQL-Query for MySQL Workbench</figcaption></figure><h4>Connecting to the Database:</h4><p>Now, let’s create a file called app.js in our mysql-test directory and see how to connect to MySQL from Node.js.</p><pre>// app.js<br>const mysql = require(&#39;mysql&#39;);<br><br>// First you need to create a connection to the db<br>const connection = mysql.createConnection({<br>  host: &#39;localhost&#39;,<br>  user: &#39;root&#39;,<br>  password: &#39;123456789&#39;,<br>});<br><br>connection.connect((err) =&gt; {<br>  if(err){<br>    console.log(&#39;Error connecting to Db&#39;);<br>    return;<br>  }<br>  console.log(&#39;Connection established&#39;);<br>});<br><br>connection.end((err) =&gt; {<br>  // The connection is terminated gracefully<br>  // Ensures all previously enqueued queries are still<br>  // before sending a COM_QUIT packet to the MySQL server.<br>});</pre><p>Now open up a terminal and enter node app.js. Once the connection is successfully established you should be able to see the ‘Connection established’ message in the console. If something goes wrong (for example you enter the wrong password), a callback is fired, which is passed an instance of the JavaScript Error object (err). Try logging this to the console to see what additional useful information it contains.</p><h3>Executing Queries:</h3><h4>Reading:</h4><p>Now that you know how to establish a connection to MySQL from Node.js, let’s see how to execute SQL queries. We’ll start by specifying the database name (company) in the createConnection command.</p><pre>const connection = mysql.createConnection({<br>  host: &#39;localhost&#39;,<br>  user: &#39;root&#39;,<br>  password: &#39;123456789&#39;,<br>  database: &#39;company&#39;,<br>});</pre><p>Once the connection is established we’ll use the connection variable to execute a query against the database table employees.</p><pre>connection.query(&#39;SELECT * FROM employees&#39;, (err,rows) =&gt; {<br>  if(err) throw err;<br><br>  console.log(&#39;Data received from Db:\n&#39;);<br>  console.log(rows);<br>});</pre><p>When you run app.js, you should be able to see the data returned from database logged to the terminal.</p><pre>[ { id: 1, name: &#39;Ibad&#39;, location: &#39;Australia&#39; },<br>  { id: 2, name: &#39;Jay&#39;, location: &#39;India&#39; },<br>  { id: 3, name: &#39;Jade&#39;, location: &#39;Germany&#39; },<br>  { id: 4, name: &#39;Lesley&#39;, location: &#39;Scotland&#39; } ]</pre><p>Data returned from the MySQL database can be parsed by simply lopping over the rows object.</p><pre>rows.forEach( (row) =&gt; {<br>  console.log(`${row.name} is in ${row.location}`);<br>});</pre><h4>Creating:</h4><p>You can execute an insert query against a database, like so:</p><pre>const employee = { name: &#39;siddiqui&#39;, location: &#39;Canada&#39; };<br>connection.query(&#39;INSERT INTO employees SET ?&#39;, employee, (err, res) =&gt; {<br>  if(err) throw err;<br><br>  console.log(&#39;Last insert ID:&#39;, res.insertId);<br>});</pre><p><strong>Note:</strong> how we can get the ID of the inserted record using the callback parameter.</p><h4>Updating:</h4><p>Similarly, when executing an update query, the number of rows affected can be retrieved using result.affectedRows:</p><pre>connection.query(<br>  &#39;UPDATE employees SET location = ? Where ID = ?&#39;,<br>  [&#39;South Africa&#39;, 5],<br>  (err, result) =&gt; {<br>    if (err) throw err;<br><br>    console.log(`Changed ${result.changedRows} row(s)`);<br>  }<br>);</pre><h4>Destroying:</h4><p>Same thing goes for a delete query:</p><pre>connection.query(<br>  &#39;DELETE FROM employees WHERE id = ?&#39;, [5], (err, result) =&gt; {<br>    if (err) throw err;<br><br>    console.log(`Deleted ${result.affectedRows} row(s)`);<br>  }<br>);</pre><h3>Conclusion:</h3><p>In this tutorial, we’ve performed the CRUD operations using NodeJS and MySQL client. For more detailed information, I would recommend reading the <a href="https://github.com/mysqljs/mysql">official documentation</a>. There are other options too, such as <a href="https://github.com/sidorares/node-mysql2">node-mysql2</a> and <a href="https://github.com/Sannis/node-mysql-libmysqlclient">node-mysql-libmysqlclient</a>.</p><p>Have you used any of these options for connecting to MySQL from Node.js? I would love hear them. Do let us know your thoughts, suggestions and corrections in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=657b63b9f794" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solution To Extract Data From Ethereum]]></title>
            <link>https://medium.com/coinmonks/solution-to-extract-data-from-ethereum-52d0b8007d1b?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/52d0b8007d1b</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[dapps]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Mon, 27 Aug 2018 05:52:15 GMT</pubDate>
            <atom:updated>2020-09-01T14:36:13.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViRNQldP-tLoAe3_twkJJQ.jpeg" /><figcaption>Source: Ethereum.org</figcaption></figure><p><strong>Ethereum </strong>is easy and fun, but it is also relatively new. The developer solutions today are going through the teething stage — so, it’s new and cool but also slightly painful. As an example, take data extraction from the Ethereum blockchain. I’ve been keeping an eye out on solutions to access smart contract data in a decentralized way. In this article, I also include centralized data query companies and centralized analytics dashboards.</p><p>Ethereum started in 2013, which became a DE-facto standard to develop and run smart contracts. Data is either value transfer in Ether, ERC-20 (think of all the <a href="https://icodrops.com/">ICOs</a>), crypto-collectibles a.k.a. non-fungible tokens (NFTs, e.g. digital kittens in <a href="https://www.cryptokitties.co/"><strong>CryptoKitties</strong></a>, virtual land property in <a href="https://decentraland.org/"><strong>Decentraland</strong></a>) or custom smart contract calls. <a href="https://www.stateofthedapps.com/rankings"><strong>State of the DApps</strong></a> is counting 1,822 DApps on Ethereum. Another good resource is <a href="https://dappradar.com/dapps"><strong>DAppRadar</strong></a>.</p><p>If you want to extract data from an already deployed smart contract — or right after deployment — one might <strong>shop for monitoring and analytics tools</strong> similar to Google Analytics or MixPanel. However, there’s <strong>no established player yet</strong>. Monitoring and analytics are just two use cases, further use cases for data follow after the list. Since <strong>decentralization and open source go hand in hand</strong>, I’ll start with it:</p><h4>Open Source:</h4><ul><li><a href="https://github.com/ConsenSys/ethql"><strong>EthQL</strong></a>: ConsenSys project, GraphQL endpoint to the public Ethereum ledger.</li><li><a href="https://github.com/Great-Hill-Corporation/quickBlocks"><strong>QuickBlocks</strong></a>: collection of tools to retrieve Ethereum data.</li><li><a href="http://ethslurp.com/"><strong>EthSlurp</strong></a>: Extracting TXs for specific address or smart contract to CSV or text file.</li><li><a href="https://github.com/brainbot-com/ethevents"><strong>EthEvents</strong></a>: Indexing transactions, events into ElasticSearch, <a href="https://www.youtube.com/watch?v=zoNlF4MfHVg">talk</a>.</li><li><a href="https://github.com/Impetus/Kundera"><strong>Kundera</strong></a>: JPA to extract data from nodes and ingest them into a variety of sinks.</li><li><a href="https://github.com/xiaoyao1991/presto-ethereum"><strong>Presto-Ethereum</strong></a>: Presto Connector to Ethereum clients.</li><li><a href="https://www.thegraph.com/"><strong>The Graph</strong></a>: Decentralized scalable queries for blockchain data (ICO stage).</li><li><a href="https://github.com/Neufund/smart-contract-watch"><strong>Smart Contract Watch</strong></a>: A smart contract monitoring tool.</li><li><a href="https://github.com/ConsenSys/eventeum"><strong>Eventeum</strong></a>: Event-bridge between Ethereum and microservices.</li><li><a href="https://github.com/dapphub/dapptools/tree/master/src/seth"><strong>Seth</strong></a>: MetaMask for the command-line.</li></ul><h4>Data Query Companies:</h4><ul><li><a href="https://aleth.io/"><strong>Alethio</strong></a>: ConsenSys-backed, Working on semantic lifting of data, <a href="https://www.youtube.com/watch?v=KzfEDNuNFi8&amp;t=21s">talk</a>.</li><li><a href="https://www.chainalysis.com/"><strong>Chainalysis</strong></a>: KYC and AML services for exchanges and governments.</li><li><a href="https://zapier.com/apps/dagger-for-ethereum/integrations"><strong>Zapier</strong></a>: Ethereum integration into Zapier.</li></ul><h4>Analytics Dashboards:</h4><ul><li><a href="https://bloxy.info/analytics"><strong>Bloxy</strong></a>: Analytics Dashboard for Ethereum.</li><li><a href="https://etherscan.io/"><strong>Etherscan</strong></a>: De-facto standard block explorer for Ethereum.</li><li><a href="https://amberdata.io/"><strong>Amberdata</strong></a>: Analytics for ERC-20 tokens, <a href="https://www.youtube.com/watch?v=IhugJ__ickM">talk</a>.</li><li><a href="https://www.tokenanalyst.io/"><strong>TokenAnalyst</strong></a>: Analytics for ERC-20 tokens and ICOs, <a href="https://www.youtube.com/watch?v=JopYHeEetC8">talk</a>.</li><li><a href="http://rufflet.cryptokitties.co/"><strong>Rufflet</strong></a>: Mixpanel for smart contracts hack by Axiom Zen, creators of CryptoKitties.</li><li><a href="https://supermax.cool/"><strong>Supermax</strong></a>: Another smart contract dashboard.</li><li><a href="https://blockspur.com/"><strong>Blockspur</strong></a>: Another smart contract dashboard.</li><li><a href="https://trivial.co/"><strong>Trivial</strong></a>: Another smart contract dashboard.</li></ul><h4>Use Cases:</h4><p>Here are five use cases for getting data out:</p><ol><li><strong>Providing transparency</strong> and accountability for governance of e.g. DAOs or companies e.g. <a href="https://www.dacs.org.uk/"><strong>DACs</strong></a>.</li><li><strong>Automated tax returns</strong> for smart contracts</li><li><strong>Smart contract monitoring</strong> e.g. getting notifications when things happen e.g. anomaly detection</li><li><strong>Smart contract reporting</strong> e.g like website reports, sales resports</li><li><strong>Auditing support</strong> e.g. for <a href="https://www.investopedia.com/terms/i/initial-coin-offering-ico.asp"><strong>ICOs </strong></a>(distribution of token holders).</li></ol><h4>Missed Any?</h4><p>This article should serve as a list of resources for solutions in the smart contract analytics and monitoring space. Please let me know if I missed one, or important references. And also if there are tools you know.</p><blockquote><a href="https://coincodecap.com/?utm_source=coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52d0b8007d1b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/solution-to-extract-data-from-ethereum-52d0b8007d1b">Solution To Extract Data From Ethereum</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum Smart Contract Security Best Practices]]></title>
            <link>https://ibadsiddiqui.medium.com/ethereum-smart-contract-security-best-practices-43dc8f65a39d?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/43dc8f65a39d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Mon, 20 Aug 2018 09:47:05 GMT</pubDate>
            <atom:updated>2018-08-22T04:12:01.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV1VRZJ13jSZGsUMTJNMzQ.png" /><figcaption>Source: “Ethereum: The Worlds Computer”</figcaption></figure><h3>Where to start?</h3><ul><li><a href="https://consensys.github.io/smart-contract-best-practices/general_philosophy/">General Philosophy</a> describes the smart contract security mindset.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/recommendations/">Solidity Recommendations</a> contains examples of good code patterns.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/known_attacks/">Known Attacks</a> describes the different classes of vulnerabilities to avoid.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/software_engineering/">Software Engineering</a> outlines some architectural and design approaches for risk mitigation.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/documentation_procedures/">Documentation and Procedures</a> outlines best practices for documenting your system for other developers and auditors.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/security_tools/">Security Tools</a> lists tools for improving code quality, and detecting vulnerabilities.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/security_notifications/">Security Notifications</a> lists sources of information for staying up to date.</li><li><a href="https://consensys.github.io/smart-contract-best-practices/tokens/">Tokens</a> outlines best practices specifically related to Tokens.</li></ul><h4>Let me know if there are more…! :)</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43dc8f65a39d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Smart Contract?]]></title>
            <link>https://medium.com/coinmonks/what-are-smart-contract-and-whats-so-smart-about-them-a-beginners-guide-4228999305b?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/4228999305b</guid>
            <category><![CDATA[dlt]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Fri, 27 Apr 2018 21:09:52 GMT</pubDate>
            <atom:updated>2018-05-01T17:51:00.252Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>“On the Blockchain, no one knows you’re a fridge” — </em></strong>Richard Brown</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*UfevdL18gMyZPSRVG0XTyw.png" /></figure><p>Oh, so you’re here. It means you must have heard about <strong>blockchain</strong> and the buzz in the world going around about it. if you have heard about it, but don’t know how it works. Learn about blockchain and how it works <a href="https://medium.com/@ibadsiddiqui/what-the-hell-is-blockchain-and-how-does-it-works-simplified-b9372ecc26ef"><strong><em>here</em></strong></a><strong><em>.</em></strong></p><p><strong>Okay, so let’s get it on.</strong></p><p>One of the best thing about blockchain is it’s decentralization concept of the system, which removes the need for the intermediaries like <strong>banks a</strong>nd other <strong>third-parties</strong>, needed for transferring of money/value, and also saves time. It also proved to be more secure, faster and cheaper in comparison to the <strong>traditional systems </strong>currently running in mostly every part of the world.</p><p>In 1994, <a href="https://en.wikipedia.org/wiki/Nick_Szabo"><strong>Nick Szabo</strong></a><strong> (Scholar and Cryptographer)</strong>, was the one who proposed <strong>Smart Contract </strong>to be a contract just like any other, but it existed virtually in computers (in a decentralized ledger) which will be <strong>self-execute contract</strong>, according to the <em>rules </em>defined in it; as we all know that’s normally how a contract works (on rules).</p><h3><em>So What Are Smart Contract Exactly?</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*lZhYyhAFa_7RLXKY65sd0A.png" /><figcaption>A digital contract among different entities.</figcaption></figure><p>Smart Contracts helps you in exchanging money, property, shares, assets of any kind or anything of that has some value to it in a very easy, transparent and conflict-free manner while removing the need of middleman (e.g. banks, third-parties).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*IUPQ-bfa1lxj0A-609oHmg.jpeg" /></figure><p>Describing it in best way is to compare the technology with current on trend going on in traditional system of the world. Here, we will be discussing a real-world scenario of <strong>ownership transfer </strong>of a <strong>House </strong>using <strong>smart contract </strong>technology and the <strong>traditional way</strong>.</p><h4><strong>The Traditional Way:</strong></h4><p>You are buying a house. We have a thing called <strong>Ledger, </strong>like book-keeping (entries, debits, credit). The ledger is the fundamental element of storing information of transactions ever committed up to today. Take example of the house below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*NzUl8OCI6cA76N5Et1upoA.jpeg" /></figure><p>If we needed to get a record of who owns this house and what it amount or material did it took to build this house, then we would need that ledger of information from a <strong>Title company</strong>. And Know this; if you want to get a record from the title company, it would take at least <strong>10 days</strong> to get that information.</p><p>The ledger we want to get of the house, before we want to buy, somewhat looks like the one on the left. Most of the <strong>title companies </strong>have errors in the ledgers we use today. Today we depend on one critical thing, that is <strong>TRUST. </strong>You best know this that, as easily as someone can write an information in the ledger, they can also delete some information in it or, better they can tamper with the existing information in the ledger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*RfXMdE9TY2hWPJDUyKyoHA.png" /><figcaption>Ledger of House</figcaption></figure><p>Can you image buying a house and go to the house owner and they say; “ Yes, I have kept all the record of the titles. Please have it”. <br><strong>Would you trust them?</strong></p><p><strong>NOO!! Because the information might be tampered with. </strong>And You’ll be paying for something that wasn’t even there. <br>we can improve all of this thing using <strong>smart contract.</strong></p><h4>Smart Contract Way:</h4><p>Now let’s reconsider the above example of transfer of ownership of the house. The contract works by executing itself on the blockchain, where it has been deployed. We can get the previous title information of the house using the blockchain, as the data in it is not tamper-able, for the smart contract to see if the all the things are in proper manner and everything is on point as described in the blockchain ledger.</p><p>Now if the house’s ownership is set to be <strong>transferred </strong>to you against some value, (<strong>money</strong>/<strong>asset</strong>) that will be held inside our <strong>virtual contract</strong>, in 2 weeks, then the smart contract will keep a time-check from the time of creation to the <strong>date of transfer </strong>of <strong>ownership</strong>. If it was <strong>not</strong> transferred on time as described in the contract, then it will release the funds giving it back to it’s rightful owner according to the rules defined in the contract. All parties will be alerted.</p><p>The system works on the If-Then premises and is witnessed by hundreds of people, on and off the blockchain, so you can expect a faultless delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*SpHOjZ_esOJs46IIQ4vrfw.png" /></figure><p>You can use smart contracts for all sort of situations that range from financial derivatives to insurance premiums, breach contracts, property law, credit enforcement, financial services, legal processes and crowdfunding agreements.</p><h3>And What’s So Smart About Them?</h3><p>To be honest, almost <strong>Everything</strong>.! <strong>Here’s what smart contracts give you:</strong></p><h4><strong>Autonomy:</strong></h4><p>You’re the one making the agreement; there’s no need to rely on a broker, lawyer or other intermediaries to confirm. Incidentally, this also knocks out the danger of manipulation by a third party, since execution is managed automatically by the network, rather than by one or more, possibly biased, individuals who may err.</p><h4><strong>Trust:</strong></h4><p>Your documents are encrypted on a shared ledger. There’s no way that someone can say they lost it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*lD6kqMzZaJMorBbcxNFpvg.jpeg" /></figure><h4><strong>Backup:</strong></h4><p>Imagine if your bank lost your savings account. On the blockchain, each and every one of your friends has your back. Your documents are duplicated many times over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pi-Mu4b8nBqq0qmJTyrNEg.jpeg" /></figure><h4><strong>Safety:</strong></h4><p><a href="https://blockgeeks.com/guides/cryptocurrencies-cryptography/">Cryptography</a>, the encryption of websites, keeps your documents safe. There is no hacking. In fact, it would take an abnormally smart hacker to crack the code and infiltrate.</p><h4><strong>Speed:</strong></h4><p>You’d ordinarily have to spend chunks of time and paperwork to manually process documents. Smart contracts use software code to automate tasks, thereby shaving hours off a range of business processes.</p><h4><strong>Savings:</strong></h4><p>Smart contracts save you money since they knock out the presence of an intermediary. You would, for instance, have to pay a notary to witness your transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*mEK18DDSKNRgOndEV6m1MQ.jpeg" /></figure><h4><strong>Accuracy:</strong></h4><p>Automated contracts are not only faster and cheaper but also avoid the errors that come from manually filling out heaps of forms</p><blockquote><strong><em>“Smart-contracts are a way for people all across the globe to do business with each other even if they don’t speak the same language or use the same currency.” — </em></strong>Mihai Alisie</blockquote><p>Like it??? Please Follow.. More are coming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4228999305b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/what-are-smart-contract-and-whats-so-smart-about-them-a-beginners-guide-4228999305b">What is Smart Contract?</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What The Hell Is Blockchain And How Does It Works? (Simplified)]]></title>
            <link>https://medium.com/coinmonks/what-the-hell-is-blockchain-and-how-does-it-works-simplified-b9372ecc26ef?source=rss-fbbc785892ee------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9372ecc26ef</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[dlt]]></category>
            <category><![CDATA[consensus]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <dc:creator><![CDATA[Ibad Siddiqui]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 19:40:16 GMT</pubDate>
            <atom:updated>2022-06-24T17:42:01.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*kk-XAI_G8RhfGxM6aFF6XA.gif" /></figure><p><strong><em>“On the Internet, nobody knows that you’re a dog” — </em></strong>Peter Steiner</p><p>Unless you have been living under a rock, you might probably have heard of the word <strong>“Blockchain” </strong>being thrown around recently. It seems to be one of the buzzwords of the year. But many people seem to know what blockchain is or how does it work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*RUljT90LEhRfyxyV9T0h0A.jpeg" /></figure><p>Imagine you and your friend are transacting/transferring money from one account to another. You would first reach the bank and ask them to transfer the money to the account address of your friend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Xf1XiDPhyArwtBXaweYqCA.png" /><figcaption>Image by: Exchange IQ</figcaption></figure><p>On transferring the money from your account to your friend’s account, the bank keeps an entry on the register of transactions. The entry needs to be updated on both, receiver and sender, accounts. But there is one problem:</p><h3><strong>It is Tamper-able</strong>. Entries of transactions can be manipulated easily or change.</h3><p>People who know how the banking system works are trying to avoid them because of this problem. <strong>This is where Blockchain comes in.</strong></p><h3><strong>What is Blockchain?</strong></h3><p>Let’s take an example of a Google spreadsheet or MS Excel (Windows). This spreadsheet is shared among different networks of computers, where everyone has a copy of it. The spreadsheet contains information about the transactions committed by real people.</p><p>Anyone can access that spreadsheet but no one can edit it.</p><blockquote><a href="https://coincodecap.com/">Discover and review Blockchain products every day.</a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed%2Fshow%2F3AyIsTfyKpnso0BXM9Yqge%3Futm_source%3Doembed&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fshow%2F3AyIsTfyKpnso0BXM9Yqge&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2Fab67656300005f1f2144c1d84b10bd5c3159107e&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=spotify" width="456" height="152" frameborder="0" scrolling="no"><a href="https://medium.com/media/91487a8ce1e7ba726930fa627338f40f/href">https://medium.com/media/91487a8ce1e7ba726930fa627338f40f/href</a></iframe><h4>This is Blockchain.</h4><p>It works with Blocks, whereas the spreadsheet works with “rows” and “columns”.</p><p>A block in a blockchain is a collection of data. The data is added to the block in the blockchain, by connecting it with other blocks in chronological others creating a chain of blocks linked together. The first block in the Blockchain is called Genesis Block.</p><p>Blockchain is a <em>distributed ledger</em>, which simply means that a ledger is spread across the network among all peers in the network, and each peer holds a copy of the complete ledger.</p><p>Some key attributes of Blockchain are which proves that blockchain is better than traditional systems of ledger information keeping:</p><ol><li><strong>Peer-To-Peer</strong>: No central authority to control or manipulate it. All participant talks to each other directly. This allows for data exchange to be made directly with third-parties involvement.</li><li><strong>Distributed</strong>: The ledger is spread across the whole network which makes tampering not so easy.</li><li><strong>Cryptographically Secured: </strong>Cryptography is used for the security services to make the ledger tamper-proof.</li><li><strong>Add-Only: </strong>Data can only be added in the blockchain with time-sequential order. This property implies that once data is added to the blockchain, it is almost impossible to change that data and can be considered practically immutable. We can say it has: <br>“<em>The right to be forgotten</em> or <em>right to erasure” </em>defined <a href="https://gdpr-info.eu/art-17-gdpr/)">here</a>.</li><li><strong>Consensus</strong>: This is the most critical attribute of all. This gives blockchain the ability to update the ledger via consensus. This is what gives it the power of decentralization. No central authority is in control of updating the ledger. Instead, any update made to the blockchain is validated against strict criteria defined by the blockchain protocol and added to the blockchain only after a consensus has been reached among all participating peers/nodes on the network.</li></ol><p>Now, next:</p><h3>How Does It Work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ETtQ4VA0DoPXTE7b6XEing.jpeg" /></figure><ol><li>A node starts a transaction by first creating and then digitally signing it with its private key (created via cryptography). A transaction can represent various actions in a blockchain. Most commonly this is a data structure that represents the transfer of value between users on the blockchain network. Transaction data structure usually consists of some logic of transfer of value, relevant rules, source and destination addresses, and other validation information.</li><li>A transaction is propagated (flooded) by using a flooding protocol, called Gossip protocol, to peers that validate the transaction based on preset criteria. Usually, more than one node is required to verify the transaction.</li><li>Once the transaction is validated, it is included in a block, which is then propagated onto the network. At this point, the transaction is considered confirmed.</li><li>The newly-created block now becomes part of the ledger, and the next block links itself cryptographically back to this block. This link is a hash pointer. At this stage, the transaction gets its second confirmation and the block gets its first confirmation.</li><li>Transactions are then reconfirmed every time a new block is created. Usually, six confirmations in a network are required to consider the transaction final.</li></ol><figure><a href="https://coincodecap.com/"><img alt="" src="https://cdn-images-1.medium.com/max/128/1*MYTAz12AEFTxUhfcBILc3w.png" /></a></figure><p>Transactions are then reconfirmed every time a new block is created. Usually, six confirmations in the Bitcoin network are required to consider the transaction final.</p><blockquote>Join Coinmonks<a href="https://t.me/coincodecap"> Telegram Channel</a> and<a href="https://www.youtube.com/c/coinmonks/videos"> Youtube Channel</a> get daily <a href="http://coincodecap.com/">Crypto News</a></blockquote><h4>Also, Read</h4><ul><li><a href="http://Top 4 Telegram Channels for Crypto Traders">Crypto Telegram Signals</a> | <a href="https://medium.com/coinmonks/crypto-trading-bot-c2ffce8acb2a">Crypto Trading Bot</a></li><li><a href="https://medium.com/coinmonks/top-10-crypto-copy-trading-platforms-for-beginners-d0c37c7d698c">Copy Trading</a> | <a href="https://medium.com/coinmonks/crypto-tax-software-ed4b4810e338">Crypto Tax Software</a></li><li><a href="https://coincodecap.com/grid-trading">Grid Trading</a> | <a href="https://medium.com/coinmonks/the-best-cryptocurrency-hardware-wallets-of-2020-e28b1c124069">Crypto Hardware Wallet</a></li><li><a href="https://medium.com/coinmonks/crypto-exchange-dd2f9d6f3769">Crypto Exchange</a> | <a href="https://medium.com/coinmonks/buy-bitcoin-in-india-feb50ddfef94">Crypto Apps in India</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9372ecc26ef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/what-the-hell-is-blockchain-and-how-does-it-works-simplified-b9372ecc26ef">What The Hell Is Blockchain And How Does It Works? (Simplified)</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>