<?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 Saphal Ghimire on Medium]]></title>
        <description><![CDATA[Stories by Saphal Ghimire on Medium]]></description>
        <link>https://medium.com/@gsaphal?source=rss-2784ece641ce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nQJSpJjQU-j9qQUfT0DGMw.jpeg</url>
            <title>Stories by Saphal Ghimire on Medium</title>
            <link>https://medium.com/@gsaphal?source=rss-2784ece641ce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:00:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gsaphal/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[Airdropping Tokens in Zilliqa]]></title>
            <link>https://medium.com/@gsaphal/airdropping-tokens-in-zilliqa-49cd2f15246c?source=rss-2784ece641ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/49cd2f15246c</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[airdrop]]></category>
            <category><![CDATA[zilliqa]]></category>
            <category><![CDATA[merkle-tree]]></category>
            <dc:creator><![CDATA[Saphal Ghimire]]></dc:creator>
            <pubDate>Fri, 24 Dec 2021 13:20:25 GMT</pubDate>
            <atom:updated>2021-12-24T13:20:25.324Z</atom:updated>
            <content:encoded><![CDATA[<p>Airdrop is the distribution of tokens to a mass of wallets. It can be used for distributions of monthly rewards, some token rewards as gifts for some events, or rewards for token holders or liquidity providers. The main challenge of Airdrop is to ensure that the only chosen peoples can claim their reward.</p><p>One of the approaches for distributing the token to the community is sending tokens directly to them. For this, mapping on a contract can be created with all the allowed wallets. This approach is expensive for someone deploying the contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FODZSGKtMDEKWOAJUL3qrQ.jpeg" /><figcaption>Image from <a href="https://coinsutra.com/what-is-airdrop/">CoinSutra</a></figcaption></figure><p>Another approach for token distribution is with the help of the Merkle Tree. Merkle Tree is a tree in which every leaf node represents the hash of the data block and every non-leaf node is the hash of its child node. We will not be going on the in-depth of Merkle root distributor and how it works. We can refer to <a href="https://medium.com/builders-of-zilliqa/merkle-tree-and-proofs-for-distributor-e9c54f737e9"><strong>this article</strong></a> for understanding in depth of Merkle Tree Distributors.</p><p>In Merkle Tree Distributor, we have the root of the tree and proof of all the addresses, that are used to build the Merkle Tree. So, the address can use their proofs to claim the reward from the contract. The address which was not used while generating the tree will not be able to claim from the root. So the main question will be how we are going to generate the Merkle root and proof for any airdrop.</p><p>For this, we have created a simple package named <a href="https://www.npmjs.com/package/merkle-tree-zilliqa-js"><strong>merkle-tree-zilliqa-js</strong></a>. This package consists of several helper functions, that help us to generate the root and proof for the given wallet address and amount without any additional work.</p><p>Let’s look at the procedures in the detailed form:</p><ol><li>Firstly, we need to install the package. For that, we can simply install the package using npm.</li></ol><pre>npm i merkle-tree-zilliqa-js</pre><p>2. Then, there are two simple methods on the package i.e. <strong>generateTreeforBech32</strong> and <strong>generateTreeforBase16. </strong>Both the function accepts the array of data in the following format:</p><pre>const airdropData=[<br>  {<br>  &quot;wallet&quot;:[WALLET_ADDRESS],<br>  &quot;amount&quot;:&quot;[AMOUNT]<br>  },<br> {<br>  &quot;wallet&quot;:[WALLET_ADDRESS],<br>  &quot;amount&quot;:[AMOUNT]<br>  },<br>  ....<br>]</pre><p>The value of<strong> WALLET_ADDRESS</strong> can be in either bech32 or base16 address. So, if we are using base 16, use the function <strong>generateTreeforBase16 </strong>and similar for the bech32 address. Then, we simply pass the data into either of the function:</p><pre>const distributor=generateTreeforBase16(airdropData)</pre><p>And that’s all! The variable <strong>distributor </strong>will have root and proof for all the wallets, that can be used to claim the rewards.</p><p>3. Now, the next step will be setting the Merkle root on the smart contract. If we are planning to airdrop or distributions multiple times, we can use the <a href="https://twitter.com/ZilSwap">Zilswap</a> Distributor Contract by managing the epochs. We can find more about it on their repository:</p><p><a href="https://github.com/Switcheo/zwap-token/blob/master/contracts/v1/ZWAPDistributor.scilla">zwap-token/ZWAPDistributor.scilla at master · Switcheo/zwap-token</a></p><p>If we are planning to do the airdrop for one time only, we can use this contract developed by the <a href="https://twitter.com/RedChilliesLabs">RedChillies</a> team with slight modification on <a href="https://twitter.com/ZilSwap">ZilSwap</a> Distributor Contract.</p><p><a href="https://github.com/RedChillies-Core/Public-Contracts/blob/main/Airdrop.scilla">Public-Contracts/Airdrop.scilla at main · RedChillies-Core/Public-Contracts</a></p><p>4. Now, we can call the transition Claim on the smart contract using the proof generated by the library from the frontend application. We can find the sample claim script from <a href="https://twitter.com/ZilSwap">ZilSwap</a> repository.</p><p><a href="https://github.com/Switcheo/zwap-token/blob/master/scripts/claim.js">zwap-token/claim.js at master · Switcheo/zwap-token</a></p><p>And the airdrop is complete. 🚀🚀🚀</p><p><strong>About the Package:</strong></p><p>The package is developed and maintained by RedChillies Team. The main aim of the package is to simplify the tree generation process while doing any kind of Merkle Tree distribution. You can check out their Website over <a href="https://redchillies.org/">here</a>. It is still in the initial version and will be constantly improvised in the upcoming days.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49cd2f15246c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Web3 Js and Ethereum Blockchain]]></title>
            <link>https://medium.com/@gsaphal/basics-of-web3-js-and-ethereum-blockchain-503d388aec9b?source=rss-2784ece641ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/503d388aec9b</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[etherum]]></category>
            <dc:creator><![CDATA[Saphal Ghimire]]></dc:creator>
            <pubDate>Sun, 03 Oct 2021 08:04:52 GMT</pubDate>
            <atom:updated>2021-10-03T08:04:52.603Z</atom:updated>
            <content:encoded><![CDATA[<p>In my previous article, I mentioned the evolution of Web 3.0 and its impacts on modern web applications. Decentralization, Transparency, Secure — that’s where the concept of Blockchain emerges. If you are not familiar with these terminologies, refer to my previous article <a href="https://medium.com/@gsaphal/getting-started-with-web-3-the-internet-of-future-206dddb4140a">here</a>.</p><p>In this article, we will see how to get started with <a href="https://web3js.readthedocs.io/en/v1.5.2/">web3.js</a> and use it to interact with <a href="https://ethereum.org/en/">Ethereum Blockchain</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YXZDVtTxO0PnrNjn0yS7ZA.jpeg" /><figcaption>The Architecture of Dapps on Ethereum</figcaption></figure><p>Let’s get started with understanding the terminologies first.</p><p><strong>web3.js</strong> is a collection of libraries that enables you to communicate with a local or remote ethereum node using HTTP, IPC, or Websocket.</p><p><strong>Ethereum, </strong>as a blockchain network<strong>, </strong>is a decentralized public ledger for verifying and recording transactions. The users in the network can create, publish, use and monetize decentralized applications. Ethereum has its own cryptocurrency called Ether (ETH) and programming language called Solidity.</p><p><strong>Smart Contract</strong> is a program that runs on the Ethereum blockchain. It’s a collection of <strong>code</strong> (its functions) and <strong>data</strong> (its state) that resides at a specific address on the Ethereum blockchain. They are deployed on the network and run as programmed without any user involvement. Functions in Smart Contracts can be executed by transacting from the user wallet. Smart Contracts cannot be altered or deleted once deployed.</p><p>Let’s take a short moment to consider how all these pieces come together as an application. <strong>Ethereum</strong> itself is a huge network providing all the transactional functions — consider it as a large bank network that is transparent and public, that is run by people all over the world. Those people, contributing to the network by running Ethereum nodes on their own hardware, are paid through the “gas” fee generated from each transaction. You can consider gas as the transaction fee we pay for transferring money from one bank to another bank but are less in the amount in comparison to the transaction fee. <strong>Smart Contracts</strong> are deployed on the blockchain network by the user paying some gas fees. The blockchain contains the contract code and acts as the storage device for the data structures the contract uses. On the user side, we can use libraries such as <strong>Web3.js</strong> to initiate requests to the contracts using a web browser. It can be considered as a bridge that connects your application and the blockchain network.</p><p>We can multiple ways to connect to the Ethereum Blockchain using Web3.js. The connection is possible to remote or local instances of Ethereum Client like GETH, OpenEthereum, or using a third-party plugin using <a href="https://metamask.io/">Metamask.</a></p><p><strong>A. First Method</strong></p><p>Let&#39;s see how we can use Web3.js to connect to the Ethereum Blockchain using Ethereum Clients, which communicates with<a href="https://github.com/ethereum/wiki/wiki/JSON-RPC"> Ethereum Blockchain JSON RPC</a>. It can be used by Frontend as well as Backend applications.</p><p><strong>Installing Web3.js</strong></p><p>Before installing Web3.js, make sure you have node js and npm installed on your machine. Find more about Web3.js over <a href="https://web3js.readthedocs.io/en/v1.5.2/getting-started.html">here</a>.</p><pre>npm install web3</pre><p><strong>Setting up Ethereum Client</strong></p><p>Depending upon our purpose, we could use pretty much use any Ethereum client. For this article, we are going to use <a href="https://infura.io/">Infura</a>. Infura provides the tools and infrastructure that allow developers to easily take their blockchain application from testing to scaled deployment — with simple, reliable access to Ethereum and IPFS. Blockchain applications need connections to peer-to-peer networks which can require long initialization times. It can take hours or days to sync a node with the Ethereum blockchain and can use more bandwidth and storage than you had planned. It can get expensive to store the full Ethereum blockchain and these costs will scale as you add more nodes to expand your infrastructure. As your infrastructure becomes more complex, you may need full-time site reliability engineers and DevOps teams to help you maintain it. Infura solves all of these problems by providing infrastructure and tools that make it quick, easy, and cost-effective for developers to connect to Ethereum and IPFS and start building awesome decentralized applications. No syncing is required. No complex setups. Just your decentralized app, live and functioning, right now. Register and generate an endpoint that you can use to communicate with the network. You can generate unique endpoints for any available network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYEwO2eL72_kX58-p8t9Gg.png" /><figcaption>Infura Endpoint for Communication</figcaption></figure><p>Save the Infura endpoints. You will need these endpoints later on.</p><p><strong>Connecting via Web3</strong></p><p>Now, we create an index.js file and paste the following code. Replace ADD_YOUR_ENDPOINT with your endpoint.</p><pre>var Web3 = require(&#39;web3&#39;);<br>var provider = &#39;ADD_YOUR_ENDPOINT&#39;;<br>var web3Provider = new Web3.providers.HttpProvider(provider);<br>var web3 = new Web3(web3Provider);</pre><p>Let&#39;s break down the process into a simpler form:</p><ol><li>We import the Web3 from the web.js package, which was installed in the previous step.</li><li>We created a provider variable, that consists of your Infura endpoint.</li><li>Then, we initialize a web3Provider using Web3.providers.HttpProvider method of Web3. Here, we can use any provider that provides services for Ethereum Networks.</li><li>Finally, we created an object by passing the provider created on Step 3. Now, the object can be used to access various web3 functions.</li></ol><p>Now, your application is connected to Web3, now you can interact with the Ethereum Networks easily.</p><p><strong>B. Second Method</strong></p><p>We can easily use third-party plugins like Metamask to communicate with Ethereum Network. <a href="https://metamask.io/"><strong>Metamask</strong></a> is a crypto wallet- it allows you to store and transact Ethereum or any other Ethereum-based (ERC- 20) tokens. You do not register it on a website, but rather install it as an extension to your Chrome or Firefox browser. MetaMask equips you with a key vault, secure login, token wallet, and token exchange — everything you need to manage your digital assets. MetaMask generates passwords and keys on your device, so only you have access to your accounts and data. You always choose what to share and what to keep private. Follow this <a href="https://metamask.io/download.html">link</a> to install Metamask for your web browser.</p><p>Once you have installed Metamask, follow the steps to create an account on Metamask. You can follow <a href="https://metamask.zendesk.com/hc/en-us/articles/360015489531-Getting-started-with-MetaMask">this</a> article to install it. After completing the steps, now let&#39;s jump into the coding part. Metamask is available to any frontend application with the help of a <strong><em>window.ethereum</em> </strong>object.</p><pre>var Web3 = require(&#39;web3&#39;);</pre><pre>var web3 = new Web3(window.web3.currentProvider);</pre><p>Let’s break down the process into a simpler form:</p><ol><li>We import the Web3 from the web.js package, which was installed in the previous step.</li><li>Then, we passed in <strong><em>window.web3.currentProvider</em></strong>, while creating the object for Web3. This will basically take the network, that you have currently selected on your Metamask wallet.</li></ol><p>Now, your application is connected to Web3, now you can interact with the Ethereum Networks easily. Note that, this method is applicable from the frontend side of the application only.</p><p>Hurray! We have now installed Web3.js and created a foundation for interacting with the Ethereum Networks. In my next article, we will be discussing more functionalities of Web3.js and how we can interact with real-time smart contracts.</p><p>If you find this article helpful, please shower me with some claps 👏 👏</p><p>References:</p><ul><li><a href="https://web3js.readthedocs.io/en/v1.5.2/getting-started.html">Getting Started - web3.js 1.0.0 documentation</a></li><li><a href="https://infura.io/">Ethereum API | IPFS API &amp; Gateway | ETH Nodes as a Service</a></li></ul><p><a href="https://metamask.io/">https://metamask.io/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=503d388aec9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Web 3— The Internet of Future]]></title>
            <link>https://medium.com/@gsaphal/getting-started-with-web-3-the-internet-of-future-206dddb4140a?source=rss-2784ece641ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/206dddb4140a</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[dapps]]></category>
            <dc:creator><![CDATA[Saphal Ghimire]]></dc:creator>
            <pubDate>Fri, 03 Sep 2021 18:38:38 GMT</pubDate>
            <atom:updated>2021-09-03T21:14:21.577Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>If you have been on the internet, you must have heard of the word Web at least once. The Internet acts as a bedrock to bring impacts on the world and it is always evolving.</em></strong></p><p>The web is the common name for World Wide Web. Simply, the Web is the collection of pages, that can be accessed from the Web Browser. People often use the words Web and Internet interchangeably but these two have completely different meanings. Internet is a global network that facilitates sharing of information over the Web and the Web is the subset of the Internet, that covers the major portion of the Internet.</p><h4><strong>Evolution of the Internet</strong></h4><blockquote>The Internet, in its initial days, was about opportunity, decentralization, and sharing thoughts.</blockquote><p>These early standards infused the Internet with a sensation of expectation and fervor. The migration from the corporate office space to the open and creative space, a new hope that existed beyond the corporate organizations without any governance and immense freedom made the technology more popular. However, in recent years, the Internet has been moving to centralization. Instead of making data and services widely spread throughout the world worldwide, the content and connectivity are concentrated into a small set of hands. One of the ways which enable users to take back control from the centralized corporations that currently dominate the web is Web 3. It is a new way for individuals to use the Internet without giving up their privacy and valuable data.</p><p>Before diving more into Web 3, let’s discuss previous iterations of the Web i.e. Web 1 and Web 2. There are no scientific definitions to define these versions but are defined on the way how they are used. Web 1 was basically used to read content from the Internet. It can be easily termed as a read-only web. This was changed in Web 2 that emerged the concept of intractability and social web. Most of the Internet now is covered with Web 2 that helped in the rising of platforms such as Youtube, Facebook, Twitter, etc. It helped in making the Internet more collaborative and social on the cost of providing personal data and information allowing certain corporations to centralize the Internet. To overcome the problems of Web 2, the new version of Web was introduced i.e Web 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rF8SbdLTbP9PAeIzDY58Uw.jpeg" /><figcaption><a href="https://blockcast.cc/news/what-is-the-driving-force-for-us-to-actively-embrace-web3-0/">The Evolution of Web</a></figcaption></figure><h4>What is Web 3?</h4><p>Web 3 is the future of the Internet. The core concept of Web 3 is Decentralization. In Web 3, the developer doesn&#39;t build and deploy applications that run on a single server or store the data on a single database that handles all the data of the application. Instead, Web3 runs the application on Blockchain, a decentralized network of peer-to-peer nodes. A Blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems on the blockchain. Some of the examples of Blockchain platforms are Ethereum, EOS, Zilliqa, etc. Generally, these applications are called decentralized applications <strong>(Dapps)</strong>. It empathizes on building a network that is not controlled by any single entity and can be trusted by everyone. A question may arise in your mind, how it can be trusted? It’s because all the entities on these networks must follow some hardcoded rules known as the <a href="https://www.investopedia.com/terms/c/consensus-mechanism-cryptocurrency.asp">consensus protocol</a>.</p><h4>Why does Web 3.0 Matter?</h4><p>The first and foremost thing is that Web 3 gives individuals ownership and control over the content that they create. By saying that, it solves the major problem of Web 2 i.e collection of data by corporate companies. Since the network is decentralized and no entity controls it, everyone can build their own Dapps without any permission from the central authority.</p><p>The next important thing in Web3 enables cryptocurrency, which provides financial incentives (tokens) for anyone who wants to create, govern and participate in these projects. Tokens also introduce a native payment layer that is completely borderless and frictionless. Currently,to participate in the transaction, the platforms such as Paypal, Stripe etc requires you to hand over your sensitive information and personal data to use them. On other hand, Crypto wallets and Blockchain Gateways like <a href="https://metamask.io/">MetaMask</a> and <a href="https://zilpay.io/">Zilpay</a> enable you to integrate easy, anonymous, and secure international payments and transactions into Web3 applications.</p><p>Another important thing is the participants who run the node on the network are incentivized. As of now, there are various platforms like Youtube, Medium, etc, that have a huge volume of content but the content creators have not been incentivized in a deserving way and the ownership of content remains with the platform. Web 3.0 solves this by allowing the creators to create an equivalent digital representation ( like a Non-Fungible Token), which they can sell and collect a lifetime royalty from it. An NFT is a blockchain token representing any unique item that can be any photo, video, image, etc.</p><h4>How do you use Web 3?</h4><p>There are various Dapps available based on Web 3. To use those Dapps, firstly you need to make a connection through your crypto wallet and you can participate in those Dapps. Enormous Dapps are now available on different blockchain platforms. Playing Games, Gambling, etc are the various way to use Web 3.</p><h4><strong>How to build applications on Web 3?</strong></h4><p>I made my move into the world of Dapps a year ago and every day has been a new learning day for me. The transition of being a traditional developer into the world of blockchain is more exciting than a roller coaster ride.</p><p>So, I will be continuing the topic in my next article. In the whole series, I will be discussing how to get started with Web 3, develop various Dapps on multiple blockchain platforms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=206dddb4140a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>