<?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 Kunal Sagar on Medium]]></title>
        <description><![CDATA[Stories by Kunal Sagar on Medium]]></description>
        <link>https://medium.com/@kunalsagar?source=rss-651418fbeb3a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E9Mn57Y5U7_dR9cM_I2dvw.jpeg</url>
            <title>Stories by Kunal Sagar on Medium</title>
            <link>https://medium.com/@kunalsagar?source=rss-651418fbeb3a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:41:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kunalsagar/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[Deploy Solidity Contract using GoLang — Go-Simple-Storage-FCC]]></title>
            <link>https://medium.com/coinmonks/deploy-solidity-contract-using-golang-go-simple-storage-fcc-b247b29ffa18?source=rss-651418fbeb3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b247b29ffa18</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Kunal Sagar]]></dc:creator>
            <pubDate>Sat, 06 Aug 2022 10:26:39 GMT</pubDate>
            <atom:updated>2022-08-09T16:31:26.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploy Solidity Contract using GoLang — Go-Simple-Storage-FCC</h3><p>I recently started learning Blockchain from an amazing <a href="https://www.youtube.com/watch?v=gyMwXuJrbJQ">tutorial</a> By <a href="https://medium.com/u/8b318225c16a">freeCodeCamp</a> &amp; <a href="https://medium.com/u/589c510eb216">Patrick Collins</a>. I feel it&#39;s the best &amp; most up-to-date tutorial about blockchain &amp; Solidity available for free. It starts with blockchain basics and then explains solidity contracts and deploying using a NodeJS Backend.</p><p>Being a Golang developer I thought of using the same solidity contract using golang instead of nodeJs. And guess what there is great support for Ethereum golang client you can find it here <a href="https://geth.ethereum.org/">https://geth.ethereum.org/</a></p><p>I will use the contract from <a href="https://github.com/smartcontractkit/full-blockchain-solidity-course-js#lesson-5-ethersjs-simple-storage">Chapter 5 EtherJs Simple Storage</a>. Will reuse the same contract &amp; deploy it on the golang backend.</p><h3>Installation</h3><ul><li>Golang <a href="https://go.dev/dl/">https://go.dev/dl/</a></li><li>Solidity <a href="https://docs.soliditylang.org/en/v0.8.2/installing-solidity.html">https://docs.soliditylang.org/en/v0.8.2/installing-solidity.html</a></li><li>Go Ethereum client also known as geth <a href="https://geth.ethereum.org/docs/install-and-build/installing-geth">https://geth.ethereum.org/docs/install-and-build/installing-geth</a></li><li>Ganache to run local blockchain <a href="https://trufflesuite.com/ganache/">https://trufflesuite.com/ganache/</a></li></ul><h3><strong>Coding</strong></h3><p>Create a project directory and initialize it as a go module</p><pre>mkdir go-simple-storage-fcc<br>cd go-simple-storage-fcc</pre><p>Initialize the project using the go mod command</p><pre>go mod github.com/kunalrsagar/go-simple-storage-fcc</pre><p>Open the directory in your favorite IDE, create a new file name SimpleStorage.sol</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea05863165f1dcb0649702f3e5d98ef0/href">https://medium.com/media/ea05863165f1dcb0649702f3e5d98ef0/href</a></iframe><p>It&#39;s the same Solidity Contract explained by Patrick, that maintains a list of People and their favorite Number and also has a function to Store a single FavoriteNumber and retrieve it.</p><p>The major difference here is instead of Node &amp; npm ecosystem, we will use golang, Solidity &amp; Ethereum. This code is tested on golang 1.19, solidity 0.8.15 version.</p><h3><strong>Compiling</strong></h3><p>Once installation is successful we will use the solc command to compile the Solidity file and generate bin and abi</p><pre>solc --optimize --abi --bin ./SimpleStorage.sol -o build</pre><p>The --optimize flag is optional but helps to compile into gas-efficient binary. On successful completion, the abi and bin files should be generated in the build directory.</p><p>the major difference while using geth client is to provide an interface to manage a contract using the abigen command.</p><pre>mkdir api</pre><p>Create a directory name api</p><pre>abigen --abi=./build/SimpleStorage.abi --bin=./build/SimpleStorage.bin --pkg=api --out=./api/SimpleStorage.go</pre><p>The above command takes in the bin and abi file and generates a Go file SimpleStorage.gowith an interface defined to create, access, and manage functions of the contract. It&#39;s an auto-generated file and should not be edited.</p><p>Add below dependency</p><pre>go get github.com/ethereum/go-ethereum</pre><p>If you encounter some errors in related/indirect dependencies run the below command</p><pre>go get all</pre><h3><strong>Ganache</strong></h3><p>Let&#39;s make sure Ganache is running and copy the RPC Url &amp; Private Key of any wallet from it. Its explain in great detail by Patrick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRMXn10vKq80MT7ADC2Jkg.png" /><figcaption>Ganache Desktop app on macOS</figcaption></figure><h3><strong>Environment Variables</strong></h3><p>Set RPC_URL &amp; PRIVATE_KEY of wallet as environment variables in using the terminal.</p><pre>export RPC_URL=&lt;local_ganache_url:port&gt;</pre><pre>export PRIVATE_KEY=&lt;Wallet Private key&gt;</pre><p>The wallet private key can be retrieved by clicking on the key icon on any Wallet Address in the Ganache app</p><h3>deploy.go</h3><p>Here is where we create a Go-based backend, we will create a deploy.go . The file will have the main function as an entry point.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3cdd132f12733f08968962f316871fb/href">https://medium.com/media/f3cdd132f12733f08968962f316871fb/href</a></iframe><p>ethclient connects to the blockchain network using RPC_URL. We will create an ECDSA private key by passing it the actual PRIVATE_KEY value from environment variables.</p><p>The public key will be extracted from the private key using Public() function and we need it in ECSDA format for our geth.</p><p>In the same way, the address of the wallet and chainID are extracted.</p><p>Next, we will need to manually create a <strong>Transaction Opts that will have a collection of authorized data (signed by the author of the block) to create a valid Ethereum transaction</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/312693ef94575f68f76da81afea32a83/href">https://medium.com/media/312693ef94575f68f76da81afea32a83/href</a></iframe><p>We will then call GenNextTransaction() function in our main function right after chainID and deploy our contract.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd2e636ac2181ab62bfdb7b8e291f548/href">https://medium.com/media/dd2e636ac2181ab62bfdb7b8e291f548/href</a></iframe><p>Let&#39;s try and run deploy.go</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glx05PLGICvB1Jc13gnFpA.png" /></figure><p>If you see above 👏🏻 works! 🥳</p><p>Next, we will call our Retrieve and Store functions of the SimpleStorage Contract. you can access all contract functions as well as a few more using simpleStorageApi object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/765ffcd9157ad145585d4eabac2aa9fc/href">https://medium.com/media/765ffcd9157ad145585d4eabac2aa9fc/href</a></iframe><p>Let&#39;s run it once again, now you should see 0 as your favoriteNumber. Its a type of *big.Int in go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Y_ClzhYGPjoz7H6j7sjJw.png" /></figure><p>Lastly, let&#39;s set a new favorite number by calling the SimpleStorage contract’s Store function, Since it&#39;s <strong>not a Gas-free function</strong>, we will make a call to GetNextTransaction function to get an authorized transaction Ops.</p><p>we then call simpleStorageApi.Store function with big.NewInt(20)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9011e7c03ca300a90ae7382dd714f6b/href">https://medium.com/media/a9011e7c03ca300a90ae7382dd714f6b/href</a></iframe><p>You should see an output something like this and yeah! congratulations you just deployed a Smart Contract using golang</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kV7tXCJ6sAJ-AQpf-cjI0A.png" /></figure><p>Below is the full source code of deploy.go</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/046584ad8c1d10efaa1d2b49a15b0660/href">https://medium.com/media/046584ad8c1d10efaa1d2b49a15b0660/href</a></iframe><p>Github Repo👇🏻</p><p><a href="https://github.com/kunalrsagar/go-simple-storage-fcc">GitHub - kunalrsagar/go-simple-storage-fcc: GoLang based Simple Storage Contract developed in FreeCodeCamps tutorial.</a></p><p>References</p><ul><li>Go Ethereum Book — <a href="https://goethereumbook.org/en/">https://goethereumbook.org/en/</a></li><li>Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript — 32-Hour Course— <a href="https://www.youtube.com/watch?v=gyMwXuJrbJQ">https://www.youtube.com/watch?v=gyMwXuJrbJQ</a></li><li><a href="https://towardsdev.com/creating-a-simple-ethereum-smart-contract-in-golang-138b9439f64e">https://towardsdev.com/creating-a-simple-ethereum-smart-contract-in-golang-138b9439f64e</a></li></ul><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> learn about crypto trading and investing</blockquote><h3>Also, Read</h3><ul><li><a href="https://coincodecap.com/huobi-crypto-trading-signals">Crypto Trading Signals for Huobi</a> |<a href="https://medium.com/coinmonks/swapzone-review-crypto-exchange-data-aggregator-e0ad78e55ed7"> Swapzone Review</a></li><li><a href="https://medium.com/coinmonks/crypto-trading-bot-c2ffce8acb2a">Best Crypto Trading Bots</a> |<a href="https://coincodecap.com/buy-solana"> Buy Solana</a> |<a href="https://coincodecap.com/matrixport-review"> MatrixPort Review</a></li><li><a href="https://coincodecap.com/coldcard-review">Coldcard Review</a> |<a href="https://coincodecap.com/boxtradex-review"> BOXtradEX Review</a> |<a href="https://coincodecap.com/uniswap"> A Guide to Uniswap</a></li><li><a href="https://medium.com/coinmonks/coinbase-review-6ef4e0f56064">Coinbase Review</a>|<a href="https://medium.com/coinmonks/deribit-review-options-fees-apis-and-testnet-2ca16c4bbdb2"> Deribit Review</a> |<a href="https://medium.com/coinmonks/ftx-crypto-exchange-review-53664ac1198f">FTX Review</a></li><li><a href="https://coincodecap.com/coinmetro-review">Coinmetro Review</a> | <a href="https://coincodecap.com/virgocx-review">VirgoCX Review</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b247b29ffa18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/deploy-solidity-contract-using-golang-go-simple-storage-fcc-b247b29ffa18">Deploy Solidity Contract using GoLang — Go-Simple-Storage-FCC</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[Perfect .gitignore for Android Studio Projects]]></title>
            <link>https://medium.com/@kunalsagar/perfect-gitignore-for-android-studio-projects-5518b06bda09?source=rss-651418fbeb3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5518b06bda09</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Kunal Sagar]]></dc:creator>
            <pubDate>Wed, 19 Oct 2016 10:35:32 GMT</pubDate>
            <atom:updated>2016-10-19T10:35:32.951Z</atom:updated>
            <content:encoded><![CDATA[<p>I think below is the perfect .gitignore file for most of the android studio projects. It includes ignore files for android, Gradle &amp; IntelliJ</p><pre># Created by https://www.gitignore.io/api/android,intellij+iml,gradle<br><br>### Android ###<br># Built application files<br>*.apk<br>*.ap_<br><br># Files for the ART/Dalvik VM<br>*.dex<br><br># Java class files<br>*.class<br><br># Generated files<br>bin/<br>gen/<br>out/<br><br># Gradle files<br>.gradle/<br>build/<br><br># Local configuration file (sdk path, etc)<br>local.properties<br><br># Proguard folder generated by Eclipse<br>proguard/<br><br># Log Files<br>*.log<br><br># Android Studio Navigation editor temp files<br>.navigation/<br><br># Android Studio captures folder<br>captures/<br><br># Intellij<br>*.iml<br>.idea/workspace.xml<br>.idea/libraries<br><br># Keystore files<br>*.jks<br><br># External native build folder generated in Android Studio 2.2 and later<br>.externalNativeBuild<br><br>### Android Patch ###<br>gen-external-apklibs<br><br><br>### Intellij+iml ###<br># Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm<br># Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839<br><br># User-specific stuff:<br>.idea/tasks.xml<br><br># Sensitive or high-churn files:<br>.idea/dataSources.ids<br>.idea/dataSources.xml<br>.idea/dataSources.local.xml<br>.idea/sqlDataSources.xml<br>.idea/dynamic.xml<br>.idea/uiDesigner.xml<br><br># Gradle:<br>.idea/gradle.xml<br><br># Mongo Explorer plugin:<br>.idea/mongoSettings.xml<br><br>## File-based project format:<br>*.iws<br><br>## Plugin-specific files:<br><br># IntelliJ<br>/out/<br><br># mpeltonen/sbt-idea plugin<br>.idea_modules/<br><br># JIRA plugin<br>atlassian-ide-plugin.xml<br><br># Crashlytics plugin (for Android Studio and IntelliJ)<br>com_crashlytics_export_strings.xml<br>crashlytics.properties<br>crashlytics-build.properties<br>fabric.properties<br><br>### Intellij+iml Patch ###<br># Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 <br><br>modules.xml<br>.idea/misc.xml <br>*.ipr<br><br><br>### Gradle ###<br>.gradle<br>/build/<br><br># Ignore Gradle GUI config<br>gradle-app.setting<br><br># Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)<br>!gradle-wrapper.jar<br><br># Cache of project<br>.gradletasknamecache<br><br># # Work around https://youtrack.jetbrains.com/issue/IDEA-116898<br># gradle/wrapper/gradle-wrapper.properties</pre><p>Thanks to <a href="http://gitignore.io/">gitignore.io</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5518b06bda09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>