<?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 Hargobind Gupta on Medium]]></title>
        <description><![CDATA[Stories by Hargobind Gupta on Medium]]></description>
        <link>https://medium.com/@hargobindgupta?source=rss-3a3268561c9a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xYxv7oV5z60K_PrgBBllvA.jpeg</url>
            <title>Stories by Hargobind Gupta on Medium</title>
            <link>https://medium.com/@hargobindgupta?source=rss-3a3268561c9a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:07:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hargobindgupta/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[What is Decentralised finance? Complete DeFi Overview and outlook. ]]></title>
            <link>https://medium.com/blockchain-development-agency/what-is-decentralised-finance-complete-defi-overview-and-outlook-2ba8f628abfe?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ba8f628abfe</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Fri, 11 Dec 2020 18:28:05 GMT</pubDate>
            <atom:updated>2020-12-11T18:28:05.078Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is Decentralised finance? Complete DeFi Overview and outlook. </strong>😇</p><p>Decentralizing finance takes components of traditional finance and decentralized them by removing middlemen and replacing them with smart contracts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xes8zgvdFCzzFqRqSuUL1g.jpeg" /></figure><p><strong>Example of Decentralized finance?</strong></p><p>Decentralized loans and earning interest however giving you the impression that defi products and services are truly decentralized elements of the current defi ecosystem are heavily centralized the reason why is that many defi services or products have a central company behind them creating the smart contracts instead of the way I like to think about defi is that its non-custodial finance where you don’t need to trust a third party like a bank with your money.</p><p>The marketing department at defi projects would take issue with having to throw around the term non-custodial finance.</p><p><strong>How does interest work </strong>📈 📉</p><p>Generally two types of interest.</p><p>1.Simple interest💵</p><p>2.Compund interest 💵 💴</p><p>DeFi protocols usually depend on user actions to calculate the interest.</p><p><strong>What is non-custodial?</strong></p><p>non-custodial implies that you continue to hold the keys to your crypto and don’t trust them with a middleman sort of a banker. Decentralized finance is all concerning building additional complicated monetary systems on high of the blockchain and enabling them to figure therewith store important that currency that payment system the cool factor is that blockchains that support smarts contracts alter you to participate in things like loans collateralized debt and fundraising all this whereas being outside of the standard industry. the redistributed finance system well the foremost common use cases area unit borrowing cash and provision cash to earn interest the key factor to notice concerning confiscating a loan or borrowing cash in defi is that it is not constant as obtaining a loan from your bank wherever you primarily bring future money flows forward to nowadays loans among redistributed finance.</p><p><strong>Example of Defi:</strong></p><p>E.g Local pawnbroker: customers can take an item like a car musical instrument piece of jewelry or any item of value to the pawnbrokers and receive a loan based on the value of the item the pawnbroker might lend you 50% of the value of the item charge you interest and if you miss your repayments they might sell your item to recoup the value of the loan pawnbrokers will always lend you less than the value of the item you’re putting up for collateral and this is known as an over collateralized loan borrowing in defi is similar to this to get a loan you need to bring collateral. this case cryptocurrency and that’s locked up in a smart contract called a collateralized debt position or CDP the thing to know is that if you’re borrowing money in defi it will be over collateralized and if the value of your collateral falls too much you can have your crypto liquidated by the CDP to cover the loan. the thing about defi is that it essentially enables you to access many financial products or services without having to KYC or get approval from anyone it doesn’t use credit scores or discriminate based on the location you live in Short defi opens up financial products you’re interested in earning your interest on your crypto then a good place to start is compound finance with over 137 million dollars worth of crypto assets earning interest on the platform it’s one of the most popular lending platforms out there and after using it myself I can certainly give it two thumbs up in terms of defi trading platforms .you have the likes of the dy/dx exchange which offers non-custodial margin trading currently. You can only trade earth and die if you SDC and die USD trading pairs however more assets will probably be supported in the future what the platform enables you to do is short or long aethalium with a meta mask wallet that means that you can trade having full control over the keys to your crypto and does away with the need to trust a centralized exchange. That could run off with your fund’s token sets calm is a pretty interesting platform that offers Robo sets, in a nutshell, these automate your crypto portfolio management and you can select the trading strategy of your choice so let’s say that we’re bullish on Defi .we think will do well seeing that the vast majority of projects are built on anthurium we might want 75% of our portfolio in the earth and 25% in Bitcoin the problem, of course, is that it’s a pain to have to constantly rebalance your portfolio the cool thing with token sets is that you could just get the earth Bitcoin 75% 25% wait set and the token set would automatically rebalance the waiting every month for you a pretty nice solution to save crypto holders time and effort now that I’ve talked about a range of different products and services that make up the Defi ecosystem I’d like to move on to exploring the future of decentralized finance.</p><p><strong>Decentralized finance according to the bank</strong> 🏢<strong>:</strong></p><p>The decentralized finance movement is the possibility to completely democratize access to financial services according to the world bank an incredible 1.7 billion adults in the world don’t have access to a bank account in other words the world banks have excluded 1.7 billion adults from access to basic financial services like access to loans. currently, defi loans need to be over collateralized however it’s probably only a matter of time before some under collateralized loan alternatives will emerge. I do loan reputation system coming about in the near future one that’s recorded on the blockchain and which enables people to get access to under collateralized loans a bit like how a bank lends you money for a mortgage after you’ve put down a deposit for a house however the key thing here is that a bank account would not be needed the greedy banker would not cut out and the world’s unbanked population could get access to these financial services with just a few taps of their smartphone another major stumbling block to democratizing access to financial services is actually reducing the friction to transfer value into and out of the crypto universe how on earth is a non-banked person going to trade their local currency for crypto to participate in the defy ecosystem well one way is to use a service like local bitcoins and just do a real-world peer-to-peer exchange.</p><p><strong>Conclusion:</strong>🗣</p><p>DeFi systems make use of the codes and the protocols for process automation which distinguishes them from the traditional financial products. Thus decentralized finance could very well be the next emerging thing in the blockchain platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ba8f628abfe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/what-is-decentralised-finance-complete-defi-overview-and-outlook-2ba8f628abfe">What is Decentralised finance? Complete DeFi Overview and outlook. 😇</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Quit My Job At Accenture After Learning About Blockchain]]></title>
            <link>https://medium.com/@hargobindgupta/i-quit-my-job-at-accenture-after-learning-about-blockchain-d0f9df3120f?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0f9df3120f</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[accenture]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Thu, 02 Apr 2020 03:52:32 GMT</pubDate>
            <atom:updated>2020-04-02T10:55:34.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMvv5qxEPxF2SEq7KXbbFw.jpeg" /></figure><p><strong>Role:</strong> <a href="https://emurgo.in/">Blockchain Developer &amp; Trainer @ Emurgo</a></p><p><strong>Location:</strong> <a href="https://en.wikipedia.org/wiki/Hyderabad">Hyderabad, India</a></p><p>Hargobind is an early blockchain adopter, with 5+ years of product development experience. His routine entails providing architectural designs, consulting &amp; implementing solutions to leverage blockchain.</p><h3>1. What Was Your First Contact With Blockchain Technology?</h3><p>I was at a meet-up in late 2016 where a friend started talking about Bitcoin. I discussed it a little, but it was when I went home I really started digging into everything I could find about this thing called ‘Bitcoin’.</p><p>In fact, I made some Bitcoin playing games that night! I realised the real innovation blockchain, would be a revolutionary technology.</p><p>A month after I quit my job at Accenture, and co-founded Xyabot — a platform to revolutionise the relationship between gamers, and game devs.</p><h3>2. In Which Industry Are You Implementing Blockchain?</h3><p>Initially within the online gaming space. Since then I have contributed to DeFi, Healthcare, Real Estate &amp; FinTech projects. I’ve built dApps, and coded smart contracts for these particular projects.</p><h3>3. What Type Of Projects Have You Developed In Blockchain?</h3><ul><li>Peer To Peer Lending</li><li>Supply Chain For Healthcare</li><li>Land Registration</li><li>Tokenizing Equities For A FinTech Company</li></ul><h3>4. What Problems Can Be Solved With Blockchain?</h3><p>Without a question of a doubt, centralisation. Blockchain technology can disrupt all industries where an often unnecessary middle-man is present. The incentivising techniques will result in a whole new level of dApps.</p><h3>5. How Would You Describe Your Experience As A Developer?</h3><p>The lack of education was hard being an early adopter. However, both the Reddit &amp; StackOverflow communities have been a great help. I learned the hard-way (yet the most valuable) by experimenting with blockchain.</p><p>Today I’m a blockchain career coach with Upgrade &amp; Emurgo. I’m able to guide my students in a way I would’ve liked to have been shown.</p><p><em>Originally published at </em><a href="https://medium.com/solidity-weekly/i-quit-my-job-at-accenture-after-learning-about-blockchain-d0a394f2c9f8"><em>https://medium.com</em></a><em> on April 2, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0f9df3120f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Private Ethereum Network]]></title>
            <link>https://medium.com/blockchain-development-agency/setting-up-private-ethereum-network-d673d4ed1103?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d673d4ed1103</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[private-network]]></category>
            <category><![CDATA[wallet]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Fri, 13 Mar 2020 18:13:53 GMT</pubDate>
            <atom:updated>2021-04-18T20:09:08.154Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Ethereum Private Network?</h3><p>An Ethereum Private Network is an isolated distributed system where each node is running an ethereum client(geth). Private Networks are mainly hosted by enterprises to restrict entry permissions to the network. Only the nodes with the right permissions will be able to access this Blockchain. The nodes in this network are not connected to the Ethereum mainnet, so ethers have no value here.</p><h4>Installing Ethereum on Ubuntu</h4><p>To install Ethereum, run the following commands in a terminal:</p><pre>$ sudo apt-get install software-properties-common<br>$ sudo add-apt-repository -y ppa:ethereum/ethereum<br>$ sudo apt-get update<br>$ sudo apt-get install ethereum</pre><p>Now you have ethereum geth client in your system.</p><p>Create a new directory for private network</p><pre>$ mkdir private-ethereum<br>$ cd private-ethereum</pre><p>Now, create two EOA’s with the help of below command</p><pre>geth --datadir ./datadir account new</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*uGFsf-2-AwE0A8-cqjIUdw.png" /></figure><h4>Creating Genesis File</h4><p>It’s basically the config file for your Ethereum network.</p><p>create a file named genesis.json</p><pre>{<br>  &quot;config&quot;: {<br>    &quot;chainId&quot;: 15,<br>    &quot;homesteadBlock&quot;: 0<br>  },<br>  &quot;difficulty&quot;: &quot;1&quot;,<br>  &quot;gasLimit&quot;: &quot;9999999&quot;,<br>  &quot;alloc&quot;: {<br>    &quot;0xd5874ff2e27b5aa6ce3943803b5799a41c1b4f67&quot;: {<br>      &quot;balance&quot;: &quot;30000&quot;<br>    },<br>    &quot;0x104dc7d158c99c9a98a297ff82600eac99db7d02&quot;: {<br>      &quot;balance&quot;: &quot;40000&quot;<br>    }<br>  }<br>}</pre><p>The genesis file is a JSON file that contains config parameters that create a good base network.</p><p><strong>config: </strong>“config” block contains all the config parameters and thresholds that control the network&#39;s basic operations.</p><p><em>chainId: </em>Unique Id of the network.</p><p><strong><em>difficulty</em>: </strong>This number decides how difficult the blocks will be to mine. For Private networks, it’s good to set a lower number as it lets you mine blocks quickly, which results in fast transactions.</p><p><strong><em>gasLimit: </em></strong>This defines the limit of gas cost per block. Set this value high to avoid being limited when testing.</p><p><strong><em>alloc</em></strong>: This part is used to allocate ethers to already created accounts.</p><h4>Initialize the Node with genesis file</h4><pre>geth --datadir ./myDataDir init ./genesis.json</pre><p>On successful instantiation, you should see the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YqxsLFGL8jSL4aiadRx9ow.png" /></figure><h4>Start Node</h4><p>With the Data Directory instantiated, we can now start the Blockchain. Now start the node, using the command below.</p><pre>geth --datadir ./myDataDir --nodiscover --networkid 1114 console 2&gt;&gt; Eth.log</pre><p>Done! Your private Ethereum Blockchain is up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6e-e0IMWMo4M464oyCoV_g.png" /></figure><p>You can check the logs in a separate terminal</p><pre>tail -f Eth.log</pre><p><strong>Importing accounts to Private Network</strong></p><p>You need to copy the accounts keystore files from</p><p>path: ./datadir/keystore</p><p>path: ./myDataDir/keystore</p><h3><strong>Set up the second node</strong></h3><p>Now let’s set up a second node in the blockchain network. The process will be similar to setting up Node1.<br>Open a new terminal window and navigate to the project folder that contains the genesis.json file.<br>Initialize the new node with the following command:</p><pre>geth --datadir ./yourDataDir init ./genesis.json</pre><p>Note: Since we want this node to be part of the same blockchain, we use the same genesis block.</p><p>To get your node up and running with a Geth console, type in the following:</p><pre>geth --datadir ./yourDataDir --nodiscover --networkid 1114 console 2&gt;&gt; Eth2.log</pre><p>Your node is up and running.</p><pre>admin.nodeInfo</pre><p>Now we will connect both the nodes and form a blockchain network.</p><p>We will do this by adding one of the nodes to the other as a “peer”.</p><p>Run the following command on the Geth Consoles of both Node1 and Node2:</p><pre>&gt; admin.peers<br>&gt; admin.nodeInfo</pre><p>You can now add peers using the below command</p><pre>admin.addPeer(“//enode id”)</pre><p>All set, now you can use the console to use all sorts of geth commands like:</p><pre>eth.accounts<br>admin.nodeInfo<br>personal.newAccount()<br>eth.accounts[0]<br>eth.getBalance(eth.accounts[0])<br>eth.coinbase</pre><pre>web3.fromWei(eth.getBalance(eth.accounts[0]),&quot;ether&quot;)</pre><pre>personal.unlockAccount(eth.accounts[0], &quot;&lt;password&gt;&quot;)</pre><pre>web3.fromWei(eth.getBalance(&quot;0xd5874ff2e27b5aa6ce3943803b5799a41c1b4f67&quot;), &quot;wei&quot;)</pre><pre>eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(1000, &quot;ether&quot;)})</pre><pre>eth.sendTransaction({from:”0xd5874ff2e27b5aa6ce3943803b5799a41c1b4f67”, to:”0x104dc7d158c99c9a98a297ff82600eac99db7d02”, value: web3.toWei(20, &quot;wei&quot;)})</pre><p>remember you need to mine the transaction to see the state change.</p><pre>miner.start()<br>miner.stop()</pre><h3>Transaction Pool</h3><ol><li>shows transaction pool</li></ol><pre>txpool.status</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d673d4ed1103" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/setting-up-private-ethereum-network-d673d4ed1103">Setting up Private Ethereum Network</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Blockchain is not?]]></title>
            <link>https://medium.com/blockchain-development-agency/what-blockchain-is-not-e4afa0d603f2?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4afa0d603f2</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[decentralized]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[hyperledger]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Tue, 26 Mar 2019 16:42:49 GMT</pubDate>
            <atom:updated>2019-03-26T16:42:53.957Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fplay.ht%2Farticles%2Fe4afa0d603f2&amp;src=https%3A%2F%2Fplay.ht%2Fembed%2F%3Farticle_url%3Dhttps%3A%2F%2Fmedium.com%2F_p%2Fwhat-blockchain-is-not-e4afa0d603f2&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=play" width="700" height="185" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0d2cfbf7c79b8f1b87cb89c1a5cd496/href">https://medium.com/media/c0d2cfbf7c79b8f1b87cb89c1a5cd496/href</a></iframe><p>The blockchain is one among the hotcake in the latest technology that can disrupt entire industries and change the way business is done. It is an ingenious invention everyone is talking about! Maybe You, your friends, colleagues very eager to utilize its potential to the fullest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1qqnHq9KocK872aRBka8Q.png" /></figure><p>Well, as per definition, this cool technology can be defined as</p><p>“<em>a system in which a record of transactions made in bitcoin or another cryptocurrency is maintained across several computers that are linked in a peer-to-peer network.”</em></p><p>Folks exist who have not understood it completely or have misunderstood this stunning cool technology. Actually, blockchain is in the nascent stage so chances are likely that it could be misunderstood.</p><p>But take it easy. This article will explain the fallacies and myths associated with blockchain.</p><ol><li>Bitcoin — Blockchain is not Bitcoin. This has been a matter of intense confusion because whenever we hear the buzzword “Blockchain” we think in terms of bitcoin. In reality, Bitcoin is the cryptocurrency that is used to make payments and blockchain is the underlying technology made using combining principles of networking, cryptography and business philosophy. Various cryptocurrencies including bitcoin flow on top of blockchain technology.</li><li>Blockchain and cryptocurrency are made for each other — It is a matter of fact that the first use case of blockchain was Bitcoin. Again, it is a popular assumption that blockchain is leveraged by cryptocurrencies and finance industry. This technology is so powerful that it has utility in each and every industry from healthcare to politics and is soon gonna be ubiquitous.</li><li>It is a network with no transparency- All the activities of blockchain are traceable since an exact copy of data is replicated across nodes with the help of distributed ledger technology. It, of course, doesn’t imply that data is easy to tamper with. The blockchainAnonymous — Bitcoin is pseudonymous since it uses a public key to secure transactions. That doesn’t mean that all blockchains maintain anonymity. These days the government is trying for mapping of public address with the owner of Bitcoin so that crimes do not rise by using Blockchain. is world famous for its transparency along with security?</li><li>Anonymous — Bitcoin is pseudonymous since it uses a public key to secure transactions. That doesn’t mean that all blockchains maintain anonymity. These days the government is trying for mapping of public address with the owner of Bitcoin so that crimes do not rise by using Blockchain.</li><li>Replacement for the traditional database — Blockchain certainly secures database but it isn’t always required for all kinds of databases. The key area where trust and security is not an issue, blockchain won’t help. It has to be prudently decided whether Blockchain for storage purpose is actually required or not.</li><li>The blockchain is linked with criminals and fraud- There is no doubt in the fact that cryptocurrencies have been used by criminals and terrorists for illicit activities like human trafficking, corruption, money laundering etc. New policies and technologies are being implemented in order to get rid of this massive problem. The blockchain is a magical technology that would be of great use for law-abiding citizens.</li><li>Only meant for techie and finance people- As discussed earlier, the first use case of blockchain is Bitcoin. Probably that’s the reason people always associate it for finance and techie people. We can find various use cases of blockchain for medical records, voting, supply chain, real estate, social media, and blah blah blah…list continues…</li><li>Stores assets- Blockchain doesn’t store assets!!! It stores the records of the flow of assets across various parties. For example- As a use case for land registry; blockchain holds the record of transaction of land (instead of actual land LOL). Similarly, it doesn’t store files and physical information.</li><li>100% Immutable- Blockchain is a technology which is in the nascent stage of research and has not been fully developed yet. In fact, one must always keep in mind that every technology has some weak points. The blockchain is not fully resistant to all types of attacks. Recently, the occurrence of Sybil attack, routing attack has been in the picture.</li><li>The blockchain is a product- Blockchain is not a product, It is actually a network of nodes which is composed of continuous growing series of blocks. Various products like Dapps are built on top of blockchain technology. In fact, few products like QLDB are used to build Blockchains.</li><li>Only 1 Blockchain- It is thought that there exists an only single type of blockchain. Let’s have a look at categories of Blockchains — Public blockchains, private blockchains, and consortium blockchains. Even among public blockchain ethereum blockchains and bitcoin blockchains exist. Intensive research is going on to create hybrid blockchain that combines the best features of all Blockchains.</li><li>It is illegal- Well the regulatory status of Bitcoin varies across countries As of now cryptocurrencies are illegal in India but are likely to get legalized soon. It is widely recognized as illegal due to the fact that 44% of Bitcoin transactions were reported to be illegal. Probably this is the reason why Bitcoin is banned in a few countries.</li><li>The blockchain is a hardware- Blockchain doesn’t have a physical form and hence is not a tangible thing. Recently blockchain’s first hardware wallet called Lockbox has been launched.</li><li>Blockchain companies mean ICO’s — Well blockchain companies’ funding is not entirely dependent upon ICO’s. There are so many alternate ways to generate funding.</li></ol><p>Have any other myth about blockchain?</p><p>Try elaborating it….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4afa0d603f2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/what-blockchain-is-not-e4afa0d603f2">What Blockchain is not?</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop your ERC-20 Token — explained!]]></title>
            <link>https://medium.com/blockchain-development-agency/develop-your-erc-20-token-explained-7d5972581874?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d5972581874</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[decentralization]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Wed, 09 Jan 2019 11:49:32 GMT</pubDate>
            <atom:updated>2020-04-10T16:17:09.536Z</atom:updated>
            <content:encoded><![CDATA[<h3>Develop your ERC-20 Token — explained!</h3><p>ERC 20 Tokens are creating a rage in the cryptocurrency sector and you wouldn’t want to be left behind, would you? Anyone who is keen to know the functionality involved in an ERC-20 token creation and deployment is welcomed. Let’s get started.</p><p><strong>What is an ERC-20 Token?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4Xyvmrm-6uMzJcKkU7BMw.png" /></figure><p>Ethereum Request For Comments 20(ERC 20) is a protocol standard that defines certain rules and standards for issuing tokens on Ethereum’s network.</p><p>A Token developed on Ethereum Blockchain is said to be an ERC-20 compliant only if it includes the basic functions defined by the protocol in its smart contract. The functions defined in the protocol are :</p><pre>// ERC Token Standard #20 Interface<br>// <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md">https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md</a></pre><pre>contract ERC20Interface {<br>    function totalSupply() public constant returns (uint);<br>    function balanceOf(address tokenOwner) public constant returns (uint balance);<br>    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);<br>    function transfer(address to, uint tokens) public returns (bool success);<br>    function approve(address spender, uint tokens) public returns (bool success);<br>    function transferFrom(address from, address to, uint tokens) public returns (bool success);</pre><pre>    event Transfer(address indexed from, address indexed to, uint tokens);<br>    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);<br>}</pre><p>The Ethereum community created this protocol so that a token can be shared, exchanged for other tokens, or transferred to a crypto-wallet as effortlessly as possible.</p><p><strong>Things required to develop a Token.</strong></p><p>Proficiency in Solidity, the official language to write smart-contracts on Ethereum Blockchain. The only hackable module in your Blockchain Project is your smart contract, So one should give utmost importance to its development as we do at <a href="https://traceblocks.com/">traceblocks</a>.</p><p>Also this</p><ol><li>Ethereum Address (Ropsten Network)</li><li>Some Ethereum (Ropsten Network)</li><li>A text editor (I.e. Sublime / Atom)</li><li>Solidity contract</li></ol><p><strong>Let’s jump into the code.</strong></p><p>The Ethereum community created these standards with three optional rules, and six mandatory.</p><p><strong>Optional</strong></p><ul><li>Token Name</li><li>Symbol</li><li>Decimal (up to 18)</li></ul><p><strong>Mandatory</strong></p><ul><li>totalSupply:<em> identifies the total number of ERC-20 tokens created.</em></li><li>balanceOf: <em>it returns the number of tokens a given address has in its account.</em></li><li>transfer: <em>allows a certain number of tokens to be transferred from the total supply to a user account.</em></li><li>transferFrom: <em>is the function that allows a user to transfer tokens to another user.</em></li><li>approve : <em>checks a transaction against the total supply of tokens.</em></li><li>allowance: <em>function checks the balance of the user’s account and will cancel the transaction if there are insufficient tokens.</em></li></ul><p>A sample smart contract implementing all the protocol is defined here. The comments will guide you when you are inside.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c20c2f98799e2d1db17340d9c4ac01e/href">https://medium.com/media/7c20c2f98799e2d1db17340d9c4ac01e/href</a></iframe><p>If you find this useful, please share it with your crypto freaks in your network.</p><p>If you don’t want to take the burden of doing all this, reach out to me at <strong><em>hargobindgupta@gmail.com</em></strong></p><p><a href="https://medium.com/traceblocks/develop-your-erc-20-token-explained-90852c63b264">Develop your ERC-20 Token — explained!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d5972581874" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/develop-your-erc-20-token-explained-7d5972581874">Develop your ERC-20 Token — explained!</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop your ERC-20 Token — explained!]]></title>
            <link>https://medium.com/@hargobindgupta/develop-your-erc-20-token-explained-f2437ef8329b?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2437ef8329b</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[token-economy]]></category>
            <category><![CDATA[erc20]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Thu, 22 Nov 2018 20:07:15 GMT</pubDate>
            <atom:updated>2019-06-03T15:08:13.590Z</atom:updated>
            <content:encoded><![CDATA[<h3>Develop your ERC-20 Token — explained!</h3><p>ERC 20 Tokens are creating a rage in the cryptocurrency sector, and you wouldn’t want to be left behind, would you? Anyone who is keen to know the functionality involved in an ERC-20 token creation and deployment is welcomed. Let’s get started.</p><p><strong>What is an ERC-20 Token?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*N4Xyvmrm-6uMzJcKkU7BMw.png" /></figure><p>Ethereum Request For Comments 20(ERC 20) is a protocol standard that defines certain rules and standards for issuing tokens on Ethereum’s network.</p><p>A Token developed on Ethereum Blockchain is said to be an ERC-20 compliant only if it includes the basic functions defined by the protocol in its smart contract. The functions defined in the protocol are</p><p>The Ethereum community created this protocol so that a token can be shared, exchanged for other tokens, or transferred to a crypto-wallet as effortlessly as possible.</p><p><strong>Things required to develop a Token.</strong></p><p>Proficiency in Solidity, the official language to write smart-contracts on Ethereum Blockchain. The only hackable module in your Blockchain Project is your smart contract, So one should give utmost importance to its development as we do at <a href="https://www.unboxinnovations.com/">Unbox Innovation</a>.</p><p>Also this</p><ol><li>Ethereum Address (Ropsten Network)</li><li>Some Ethereum (Ropsten Network)</li><li>A text editor (I.e. ,Sublime / Atom)</li><li>Solidity contract</li></ol><p><strong>Let’s jump into the code.</strong></p><p>The Ethereum community created these standards with three optional rules, and six mandatory.</p><p><strong>Optional</strong></p><ul><li>Token Name</li><li>Symbol</li><li>Decimal (up to 18)</li></ul><p><strong>Mandatory</strong></p><ul><li>totalSupply:<em> identifies the total number of ERC-20 tokens created.</em></li><li>balanceOf: <em>it returns the number of tokens a given address has in its account.</em></li><li>transfer: <em>allows a certain number of tokens to be transferred from the total supply to a user account.</em></li><li>transferFrom: <em>is the function that allows a user to transfer tokens to another user.</em></li><li>approve : <em>checks a transaction against the total supply of tokens.</em></li><li>allowance: <em>function checks the balance of the user’s account and will cancel the transaction if there are insufficient tokens.</em></li></ul><p>A sample smart contract implementing all the protocol is defined here. The comments will guide you when you are inside.</p><p>If you find this useful, please share it with your crypto freaks in your network.</p><p>If you don’t want to take the burden of doing all this, reach out to us at <a href="/service/mailto:contact@unboxinnovations.com"><em>contact@unboxinnovations.com</em></a></p><p><em>Originally published at medium.com on November 22, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2437ef8329b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hyperledger Explorer with PostgreSQL]]></title>
            <link>https://medium.com/blockchain-development-agency/hyperledger-explorer-with-postgresql-20b6dc6d3312?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/20b6dc6d3312</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[hyperledger]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Fri, 16 Mar 2018 06:01:10 GMT</pubDate>
            <atom:updated>2018-05-20T15:40:02.921Z</atom:updated>
            <content:encoded><![CDATA[<p>Hyperledger Explorer is a simple, powerful, easy-to-use, highly maintainable, open source browser for viewing activity on the underlying blockchain network.</p><p>As per now Hyperledger provide MySQL implementation for Blockchain explorer.If for some reason you need to implement explorer with postgres,this blog is for you. :)</p><h3>Directory Structure</h3><pre>├── app                    fabric GRPC interface<br>├── db			   the postgres script and help class<br>├── explorer_client        Web Ui<br>├── first-network	   Basic fabric network setup<br>├── listener               websocket listener<br>├── metrics                metrics about tx count per minute and block count per minute<br>├── service                the service <br>├── socket		   push real time data to front end<br>├── timer                  Timer to post information periodically  <br>└── utils                  Various utility scripts</pre><h3>Requirements</h3><p>Following are the software dependencies required to install and run hyperledger explorer</p><ul><li>nodejs 6.9.x (Note that v7.x is not yet supported)</li><li>mysql 5.7 or greater</li></ul><p>Hyperledger Explorer works with Hyperledger Fabric 1.0. Install the following software dependencies to manage fabric network.</p><ul><li>docker 17.06.2-ce [<a href="https://www.docker.com/community-edition">https://www.docker.com/community-edition</a>]</li><li>docker-compose 1.14.0 [<a href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a>]</li></ul><h3>Clone Repository</h3><p>Clone this repository to get the latest using the following command.</p><ol><li>git clone <a href="https://github.com/hyperledger/blockchain-explorer.git">https://github.com/hyperledger/blockchain-explorer.git</a></li><li>cd blockchain-explorer</li></ol><h3>Database setup</h3><p>Install Postgres in your development enveronment with the help of below link:</p><ol><li><a href="https://www.postgresql.org/download/">https://www.postgresql.org/download/</a></li><li>Postgres for Ubntu 16.04(<a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-16-04</a>)</li></ol><h3>Creating and running postgres script.</h3><p>Clone this repository to get the latest using the following command.</p><ol><li>cd blockchain-explorer/db/</li><li>create a new file named &#39;explorer.sql&#39; and past in below script.</li></ol><blockquote><strong>explorerpg.sql</strong></blockquote><pre>CREATE USER hppoc with password &#39;password&#39;;</pre><pre>DROP DATABASE IF EXISTS fabricexplorer;</pre><pre>CREATE DATABASE fabricexplorer owner hppoc;</pre><pre>\c fabricexplorer;</pre><pre>--</pre><pre>-- ----------------------------</pre><pre>--  Table structure for `blocks`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS blocks;</pre><pre>CREATE TABLE blocks (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>blocknum integer DEFAULT NULL,</pre><pre>datahash character varying(256) DEFAULT NULL,</pre><pre>prehash character varying(256) DEFAULT NULL,</pre><pre>channelname character varying(128) DEFAULT NULL,</pre><pre>txcount integer DEFAULT NULL,</pre><pre>createdt Timestamp DEFAULT NULL</pre><pre>);</pre><pre>ALTER table blocks owner to hppoc;</pre><pre>-- ----------------------------</pre><pre>--  Table structure for `chaincodes`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS chaincodes;</pre><pre>CREATE TABLE chaincodes (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>name character varying(255) DEFAULT NULL,</pre><pre>version character varying(255) DEFAULT NULL,</pre><pre>path character varying(255) DEFAULT NULL,</pre><pre>channelname character varying(255) DEFAULT NULL,</pre><pre>txcount integer DEFAULT 0,</pre><pre>createdt Timestamp DEFAULT NULL</pre><pre>);</pre><pre>ALTER table chaincodes owner to hppoc;</pre><pre>Alter sequence chaincodes_id_seq restart with 10;</pre><pre>-- ----------------------------</pre><pre>--  Table structure for `channel`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS channel;</pre><pre>--   state character(1) NOT NULL DEFAULT &#39;A&#39; CHECK (state in (&#39;A&#39;, &#39;D&#39;, &#39;S&#39;))</pre><pre>CREATE TABLE channel (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>name varchar(64) DEFAULT NULL,</pre><pre>blocks integer DEFAULT NULL,</pre><pre>trans integer DEFAULT NULL,</pre><pre>createdt Timestamp DEFAULT NULL</pre><pre>);</pre><pre>ALTER table channel owner to hppoc;</pre><pre>Alter sequence channel_id_seq restart with 3;</pre><pre>-- ----------------------------</pre><pre>--  Table structure for `peer`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS peer;</pre><pre>--   state character(1) NOT NULL DEFAULT &#39;A&#39; CHECK (state in (&#39;A&#39;, &#39;D&#39;, &#39;S&#39;))</pre><pre>CREATE TABLE peer (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>org integer DEFAULT NULL,</pre><pre>name varchar(64) DEFAULT NULL,</pre><pre>mspid varchar(64) DEFAULT NULL,</pre><pre>requests varchar(64) DEFAULT NULL,</pre><pre>events varchar(64) DEFAULT NULL,</pre><pre>server_hostname varchar(64) DEFAULT NULL,</pre><pre>createdt timestamp DEFAULT NULL</pre><pre>);</pre><pre>ALTER table peer owner to hppoc;</pre><pre>-- ---------------------------</pre><pre>--  Table structure for `peer_ref_channel`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS peer_ref_channel;</pre><pre>CREATE TABLE peer_ref_channel (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>peerid integer DEFAULT NULL,</pre><pre>channelid integer DEFAULT NULL,</pre><pre>createdt Timestamp DEFAULT NULL</pre><pre>);</pre><pre>ALTER table peer_ref_channel owner to hppoc;</pre><pre>-- ----------------------------</pre><pre>--  Table structure for `transaction`</pre><pre>-- ----------------------------</pre><pre>DROP TABLE IF EXISTS transaction;</pre><pre>CREATE TABLE transaction (</pre><pre>id SERIAL PRIMARY KEY,</pre><pre>channelname varchar(64) DEFAULT NULL,</pre><pre>blockid integer DEFAULT NULL,</pre><pre>txhash character varying(256) DEFAULT NULL,</pre><pre>createdt timestamp DEFAULT NULL,</pre><pre>chaincodename character varying(255) DEFAULT NULL</pre><pre>);</pre><pre>ALTER table transaction owner to hppoc;</pre><pre>Alter sequence transaction_id_seq restart with 6;</pre><pre>DROP TABLE IF EXISTS write_lock;</pre><pre>CREATE TABLE write_lock (</pre><pre>write_lock SERIAl PRIMARY KEY</pre><pre>);</pre><pre>ALTER table write_lock owner to hppoc;</pre><pre>Alter sequence write_lock_write_lock_seq restart with 2;</pre><pre>GRANT SELECT, INSERT, UPDATE,DELETE ON ALL TABLES IN SCHEMA PUBLIC to hppoc;</pre><ol><li>create a new file named &#39;pgservices.js&#39; and past in below script.</li></ol><blockquote><strong>pgservice.js</strong></blockquote><pre>const { Client } = require(&#39;pg&#39;);</pre><pre>var config = require(&#39;../config.json&#39;);</pre><pre>var pgconfig = config.pg</pre><pre>var helper = require(&#39;../app/helper.js&#39;);</pre><pre>var logger = helper.getLogger(&#39;pgservice&#39;);</pre><pre>const connectionString = &#39;postgres://&#39; + pgconfig.username + &#39;:&#39; + pgconfig.passwd + &#39;@localhost:&#39; + pgconfig.port + &#39;/&#39; + pgconfig.database;</pre><pre>console.log(connectionString);</pre><pre>const client = new Client({</pre><pre>connectionString: connectionString,</pre><pre>});</pre><pre>function handleDisconnect() {</pre><pre>var port = pgconfig.port ? pgconfig.port : &quot;5432&quot;;</pre><pre>client.connect((err) =&gt; {</pre><pre>if (err) {</pre><pre>// We introduce a delay before attempting to reconnect,</pre><pre>// to avoid a hot loop, and to allow our node script to</pre><pre>// process asynchronous requests in the meantime.</pre><pre>console.log(&#39;error when connecting to db:&#39;, err);</pre><pre>setTimeout(handleDisconnect, 2000);</pre><pre>}</pre><pre>});</pre><pre>client.on(&#39;error&#39;, (err) =&gt; {</pre><pre>console.log(&#39;db error&#39;, err);</pre><pre>if (err.code === &#39;PROTOCOL_CONNECTION_LOST&#39;) {</pre><pre>handleDisconnect();</pre><pre>} else {</pre><pre>throw err;</pre><pre>}</pre><pre>});</pre><pre>}</pre><pre>handleDisconnect()</pre><pre>//open connection</pre><pre>function openconnection() {</pre><pre>client.connect();</pre><pre>}</pre><pre>//close connection</pre><pre>function closeconnection() {</pre><pre>client.end()</pre><pre>}</pre><pre>function saveRow(tablename, columnValues) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>var addSqlParams = []</pre><pre>var updatesqlcolumn = []</pre><pre>var updatesqlflag = []</pre><pre>var i = 1</pre><pre>Object.keys(columnValues).forEach((k) =&gt; {</pre><pre>let v = columnValues[k]</pre><pre>addSqlParams.push(v)</pre><pre>updatesqlcolumn.push(JSON.stringify(k))</pre><pre>updatesqlflag.push(&#39;$&#39; + i)</pre><pre>i = i + 1</pre><pre>})</pre><pre>var updatesqlparmstr = updatesqlcolumn.join(&#39;,&#39;)</pre><pre>var updatesqlflagstr = updatesqlflag.join(&#39;,&#39;)</pre><pre>var addSql = `INSERT INTO ${tablename}  ( ${updatesqlparmstr} ) VALUES( ${updatesqlflagstr}  ) RETURNING *;`;</pre><pre>logger.debug(`Insert sql is ${addSql}`)</pre><pre>console.log(`Insert sql is ${addSql}`)</pre><pre>client.query(addSql, addSqlParams, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>logger.error(&#39;[INSERT ERROR] - &#39;, err.message);</pre><pre>console.log(err.stack)</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(&#39;--------------------------INSERT----------------------------&#39;);</pre><pre>console.log(&#39;INSERT ID:&#39;, res.rows[0].id);</pre><pre>logger.debug(&#39;-----------------------------------------------------------------\n\n&#39;);</pre><pre>resolve(res.rows[0].id)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* Update table</pre><pre>*</pre><pre>* @param String        tablename  the table name.</pre><pre>* @param String array  columnAndValue  the table column and value Map.</pre><pre>* @param String        pkName   the primary key name.</pre><pre>* @param String        pkValue  the primary key value.</pre><pre>*</pre><pre>* @author robertfeng &lt;fx19800215@163.com&gt;</pre><pre>* @author vchinoy</pre><pre>*</pre><pre>*/</pre><pre>function updateRowByPk(tablename, columnAndValue, pkName, pkValue) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>var addSqlParams = []</pre><pre>var updateParms = []</pre><pre>var updateparm = &quot; set 1=1 &quot;</pre><pre>Object.keys(columnAndValue).forEach((k) =&gt; {</pre><pre>let v = columnAndValue[k]</pre><pre>addSqlParams.push(v)</pre><pre>//updateparm = updateparm + ` ,${k}=? `</pre><pre>updateParms.push(`${k} = ?`)</pre><pre>})</pre><pre>var updatewhereparm = &quot; (1=1)  &quot;</pre><pre>var searchparm = { pkName: pkValue }</pre><pre>Object.keys(searchparm).forEach((k) =&gt; {</pre><pre>let v = searchparm[k]</pre><pre>addSqlParams.push(v)</pre><pre>updatewhereparm = updatewhereparm + ` and ${k}=? `</pre><pre>})</pre><pre>var updateParmsStr = updateParms.join(&#39;,&#39;)</pre><pre>var addSql = ` UPDATE ${tablename} set ${updateParmsStr} WHERE ${pkName} = ${pkValue} RETURNING *`;</pre><pre>logger.debug(`update sql is ${addSql}`)</pre><pre>console.log(`update sql is ${addSql}`)</pre><pre>client.query(addSql, addSqlParams, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>logger.error(&#39;[INSERT ERROR] - &#39;, err.message);</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(&#39;--------------------------UPDATE----------------------------&#39;);</pre><pre>//logger.debug(&#39; update result :&#39;, result.affectedRows);</pre><pre>//console.log(res);</pre><pre>logger.debug(&#39;-----------------------------------------------------------------\n\n&#39;);</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* Update table</pre><pre>*</pre><pre>* @param String        tablename  the table name.</pre><pre>* @param String array  columnAndValue  the table column and value Map.</pre><pre>* @param String array  condition   the primary key name.</pre><pre>* @param db ojbect     DB          the sqllite private database visit object</pre><pre>*</pre><pre>* @author robertfeng &lt;fx19800215@163.com&gt;</pre><pre>* @author vchinoy</pre><pre>*</pre><pre>*/</pre><pre>function updateRow(tablename, columnAndValue, condition) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>var addSqlParams = []</pre><pre>var updateParms = []</pre><pre>var updateparm = &quot; set 1=1 &quot;</pre><pre>Object.keys(columnAndValue).forEach((k) =&gt; {</pre><pre>let v = columnAndValue[k]</pre><pre>addSqlParams.push(v)</pre><pre>//updateparm = updateparm + ` ,${k}=? `</pre><pre>updateParms.push(`${k} = ?`)</pre><pre>})</pre><pre>var updatewhereparm = &quot; (1=1)  &quot;</pre><pre>Object.keys(condition).forEach((k) =&gt; {</pre><pre>let v = condition[k]</pre><pre>addSqlParams.push(v)</pre><pre>updatewhereparm = updatewhereparm + ` and ${k}=? `</pre><pre>})</pre><pre>var updateParmsStr = updateParms.join(&#39;,&#39;)</pre><pre>var addSql = ` UPDATE ${tablename} set ${updateParmsStr} WHERE ${updatewhereparm} RETURNING * `;</pre><pre>logger.debug(`update sql is ${addSql}`)</pre><pre>console.log(`update sql is ${addSql}`)</pre><pre>client.query(addSql, addSqlParams, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>logger.error(&#39;[INSERT ERROR] - &#39;, err.message);</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(&#39;--------------------------UPDATE----------------------------&#39;);</pre><pre>logger.debug(&#39; update result :&#39;, res.rows);</pre><pre>logger.debug(&#39;-----------------------------------------------------------------\n\n&#39;);</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>*  excute update or delete  sql.</pre><pre>*  @param string  updateSql   the excute sql</pre><pre>*/</pre><pre>function updateBySql(updateSql) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>logger.debug(`update sql is :  ${updateSql}`)</pre><pre>client.query(updateSql, [], (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>logger.error(&#39;[INSERT ERROR] - &#39;, err.message);</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(&#39;--------------------------UPDATE----------------------------&#39;);</pre><pre>logger.debug(&#39; update result :&#39;, res.affectedRows);</pre><pre>logger.debug(&#39;-----------------------------------------------------------------\n\n&#39;);</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* get row by primary key</pre><pre>* @param String tablename   the table name.</pre><pre>* @param String column      the filed of search result.</pre><pre>* @param String pkColumn       the primary key column name.</pre><pre>* @param String value       the primary key value.</pre><pre>*</pre><pre>*</pre><pre>*/</pre><pre>function getRowByPk(tablename, column, pkColumn, value) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>if (column == &#39;&#39;)</pre><pre>column = &#39;*&#39;</pre><pre>var sql = ` select  ${column} from ${tablename} where ${pkColumn} = ${value} `</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// console.log(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(&#39; the getRowByPk &#39;)</pre><pre>if (!res.rows || res.rows.length == 0)</pre><pre>resolve(null)</pre><pre>else</pre><pre>resolve(res.rows[0])</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>*</pre><pre>*</pre><pre>* @param unknown_type sql</pre><pre>* @param unknown_type DB</pre><pre>* @return unknown</pre><pre>*/</pre><pre>function getRowByPkOne(sql) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>//var sql = ` select  ${column} from ${tablename} where ${pkColumn} = ${value} `</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// console.log(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(` the getRowByPkOne sql ${sql}`)</pre><pre>//(` the getRowByPkOne sql ${sql}`)</pre><pre>if (!res.rows || res.rows.length == 0)</pre><pre>resolve(null)</pre><pre>else</pre><pre>resolve(res.rows[0])</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* search table</pre><pre>* @param String tablename  the table name</pre><pre>* @param String columns    the field of seach result</pre><pre>* @param String ondtion    the search condition,it is sotre by array. exp condition = array(&quot;id&quot;=&gt;&quot;1&quot;);</pre><pre>* @param String orderBy    the order desc.</pre><pre>* @param String limit      the pagedtion.</pre><pre>*</pre><pre>*/</pre><pre>function getRowsByCondition(tablename, column, condtion, orderBy, limit) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>if (column == &#39;&#39;)</pre><pre>column = &#39;*&#39;</pre><pre>var updatewhereparm = &quot; (1=1)  &quot;</pre><pre>var searchparm = { pkName: pkValue }</pre><pre>var addSqlParams = []</pre><pre>Object.keys(condtion).forEach((k) =&gt; {</pre><pre>let v = condtion[k]</pre><pre>addSqlParams.push(v)</pre><pre>updatewhereparm = updatewhereparm + ` and ${k}=? `</pre><pre>})</pre><pre>var sql = ` select  ${column} from ${tablename} where ${updatewhereparm} ${orderBy} ${limit}`</pre><pre>logger.debug(` the search sql is : ${sql} `)</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// console.log(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(&#39; the getRowsByCondition &#39;)</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* search table by sql</pre><pre>* @param datatype sqlchareter   the table name</pre><pre>* @param datatype ondtion       the search condition,it is sotre by array. exp condition = array(&quot;id&quot;=&gt;&quot;1&quot;);</pre><pre>* @param datatype limit         the pagedtion.</pre><pre>*</pre><pre>*/</pre><pre>function getRowsBySQl(sqlcharacter, condition, limit) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>var updatewhereparm = &quot; (1=1)  &quot;</pre><pre>var addSqlParams = []</pre><pre>Object.keys(condition).forEach((k) =&gt; {</pre><pre>let v = condition[k]</pre><pre>addSqlParams.push(v)</pre><pre>updatewhereparm = updatewhereparm + ` and ${k}=? `</pre><pre>})</pre><pre>var sql = ` ${sqlcharacter} where ${updatewhereparm}   ${limit}`</pre><pre>logger.debug(` the search sql is : ${sql} `)</pre><pre>client.query(sql, addSqlParams, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>//console.log(` The solution is: ${res.rows.length}  `);</pre><pre>logger.debug(&#39; The getRowsBySQl  &#39;)</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>function getRowsBySQlQuery(sql) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(` the getRowsBySQlQuery ${sql}`)</pre><pre>//console.log(` the getRowsBySQlQuery ${sql}`)</pre><pre>if (!res.rows || res.rows.length == 0)</pre><pre>resolve(null)</pre><pre>else</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* search table by sql and it&#39;s not condtion</pre><pre>*</pre><pre>* @param datatype sqlchareter   the table name</pre><pre>* @param datatype ondtion       the search condition,it is sotre by array. exp condition = array(&quot;id&quot;=&gt;&quot;1&quot;);</pre><pre>* @param datatype limit         the pagedtion.</pre><pre>*</pre><pre>*/</pre><pre>function getRowsBySQlNoCondtion(sqlcharacter, limit) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>var sql = `${sqlcharacter} ${limit}`</pre><pre>client.query(sqlcharacter, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// console.log(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(` the getRowsBySQlNoCondtion ${sql}`)</pre><pre>if (!res.rows || res.rows.length == 0)</pre><pre>resolve(null)</pre><pre>else</pre><pre>resolve(res.rows)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>* 自动橱窗日志查找/评价历史记录查找</pre><pre>* @param unknown_type sql</pre><pre>* @param unknown_type DB</pre><pre>* @return unknown</pre><pre>*/</pre><pre>function getRowsBySQlCase(sql) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// console.log(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(` the getRowsBySQlCase ${sql}`)</pre><pre>if (!res.rows || res.rows.length == 0)</pre><pre>resolve(null)</pre><pre>else</pre><pre>resolve(res.rows[0])</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>*</pre><pre>* @param sql</pre><pre>* @param key</pre><pre>* @returns {Promise}</pre><pre>*</pre><pre>*/</pre><pre>function getSQL2Map(sql, key) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>client.query(sql, (err, res) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>logger.debug(`The solution is: ${res.rows.length}  `);</pre><pre>var keymap = new Map();</pre><pre>for (var ind = 0; ind &lt; res.rows.length; ind++) {</pre><pre>logger.debug(`The ind value is: ${res.rows[ind].id}  `);</pre><pre>keymap.set(res.rows[ind][key], rows[ind])</pre><pre>}</pre><pre>resolve(keymap)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>/**</pre><pre>*</pre><pre>*</pre><pre>* @param unknown_type sql</pre><pre>* @param unknown_type key</pre><pre>* @return unknown</pre><pre>*/</pre><pre>function getSQL2Map4Arr(sql, key) {</pre><pre>return new Promise(function (resolve, reject) {</pre><pre>client.query(sql, (err, rows) =&gt; {</pre><pre>if (err) {</pre><pre>reject(err)</pre><pre>}</pre><pre>// logger.debug(  `The solution is: ${rows.length }  `  );</pre><pre>logger.debug(&#39; the getSqlMap &#39;)</pre><pre>var keymap = new Map();</pre><pre>for (var ind = 0; ind &lt; res.rows.length; ind++) {</pre><pre>var keyvalue = res.rows[ind][key]</pre><pre>var arrvalue = [];</pre><pre>if (keymap.has(keyvalue)) {</pre><pre>arrvalue = keymap.get(keyvalue)</pre><pre>arrvalue.push(res.rows)</pre><pre>} else {</pre><pre>arrvalue.push(res.rows)</pre><pre>}</pre><pre>keymap.set(keyvalue, arrvalue)</pre><pre>}</pre><pre>resolve(keymap)</pre><pre>});</pre><pre>})</pre><pre>}</pre><pre>exports.saveRow = saveRow</pre><pre>exports.updateRowByPk = updateRowByPk</pre><pre>exports.updateRow = updateRow</pre><pre>exports.updateBySql = updateBySql</pre><pre>exports.getRowByPk = getRowByPk</pre><pre>exports.getRowByPkOne = getRowByPkOne</pre><pre>exports.getRowsByCondition = getRowsByCondition</pre><pre>exports.getRowsBySQl = getRowsBySQl</pre><pre>exports.getRowsBySQlQuery = getRowsBySQlQuery</pre><pre>exports.getRowsBySQlNoCondtion = getRowsBySQlNoCondtion</pre><pre>exports.getRowsBySQlCase = getRowsBySQlCase</pre><pre>exports.getSQL2Map = getSQL2Map</pre><pre>exports.getSQL2Map4Arr = getSQL2Map4Arr</pre><pre>exports.openconnection = openconnection</pre><pre>exports.closeconnection = closeconnection</pre><ol><li>Run the database setup scripts located under db/explorerpg.sql in your postgres window(pgadminIII for ununtu).</li><li>Modify config.json located in /blockchain-explorer to add below configurations for postgres.</li></ol><p><strong>config.json</strong></p><p>&quot;pg&quot;: {</p><p>&quot;host&quot;: &quot;127.0.0.1&quot;,</p><p>&quot;port&quot;: &quot;5432&quot;,</p><p>&quot;database&quot;: &quot;fabricexplorer&quot;,</p><p>&quot;username&quot;: &quot;hppoc&quot;,</p><p>&quot;passwd&quot;: &quot;password&quot;</p><p>}</p><h4>3.Modify variable &#39;sql&#39; in &#39;main.js&#39; in the same location to call &#39;pgservice.js&#39; instead of &#39;mysqlservices.js&#39;</h4><p>var sql=require(&#39;./db/pgservice.js&#39;)</p><ol><li>Repeat the above for all the below mentioned files.</li><li>blockchain-explorer/service/<strong>blockscanner.js</strong> blockchain-explorer/service/<strong>metricservice.js</strong></li><li>Install postgres npde module via below command</li><li>npm install pg</li></ol><h3>Fabric network setup</h3><p>Setup your own network using <a href="http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html">Build your network</a> tutorial from Fabric. Once you setup the network, please modify the values in config.json accordingly.</p><h3>Running blockchain-explorer</h3><p>On another terminal,</p><ol><li>cd blockchain-explorer</li><li>Modify config.json to update network-config Change “fabric-path” to your fabric network path, example “/home/user1/workspace/fabric-samples” for the following keys: “tls_cacerts”, “key”, “cert”. Final path for key “tls_cacerts” will be “/home/user1/workspace/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt”</li><li>npm install</li><li>./start.sh</li><li>Launch the URL <a href="http://localhost:8080/">http://localhost:8080</a> on a browser.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20b6dc6d3312" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/hyperledger-explorer-with-postgresql-20b6dc6d3312">Hyperledger Explorer with PostgreSQL</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flavors of Blockchain!]]></title>
            <link>https://medium.com/blockchain-development-agency/flavors-of-blockchain-e822c1e50622?source=rss-3a3268561c9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e822c1e50622</guid>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[distributed-ledgers]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Hargobind Gupta]]></dc:creator>
            <pubDate>Thu, 09 Nov 2017 12:16:21 GMT</pubDate>
            <atom:updated>2017-11-26T15:43:08.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*lqO4sZSoiPeK94KdjfLmwA.jpeg" /></figure><p>Many of you who is reading this woud probably know the history of bitcoin and its underlying tech The Blockchain.Yes the events of 2010 which led the discovery of blockchain is now a “history” in this fast growing tech world.</p><p>In this short note you will get acknowledged with differrent flavours in which blockchain comes .</p><p>Lets get Started :-</p><p><strong>Blockchain as a Distributed Ledger:</strong></p><p>This defination of blockchain states that a blockchain is a chain of blocks containing an ordered list of atomic transection.An atomic transection is an event whose sub-event parts make no sense in isolation.So this defination make sence for financial transctions. So a distributed ledger is suitable for a financial institutions like Banks.</p><p><em>Current System in Banks for handling finencial transections:</em></p><p>As each bank use their own set of SQL database for table of accounts,managing and updating differrent DBs for a single transaction is a time consuming tasks.That’s one reason why transactions between banks, especially if in different countries, take so long and is expensive too.</p><p>Blockchain on the otherhand offers the promise to optimize banking by consolidating the table of accounts of all participating banks.Therefore a single transaction can update tables of accounts for the whole network of participating banks.Banks view this technology, as an opportunity to reduce operational costs by using a distributed common ledger with their peers.</p><p><strong>Blockchain -A new way of Computing.</strong></p><p>A program or a set of statements runs in an ordered and deterministic fashion.The sequence of execution of the codes determines the state of the system.</p><p>The above statement is true for both Blockchain(Ethereum) and Non Blockchain System.The difference arises with the introduction of Smart Contracts in the Blockchain .Smart contracts are self-executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code.If a smart contract is deployed in a Blockchain there is noway to alter the codes unlike in traditional systems.If modification need to be made than one need to deploy another contract in accordance with the previous one.</p><p><strong>Data Storage on Blockchain.</strong></p><p>The concept of Distributed Databases are now been realised all because of the cryptographic encryption provided by the Blockchain.</p><p>.Follow if you feel like to get amazing content on Blockchain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e822c1e50622" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blockchain-development-agency/flavors-of-blockchain-e822c1e50622">Flavors of Blockchain!</a> was originally published in <a href="https://medium.com/blockchain-development-agency">Blockchain Development Agency</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>