<?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 Pran B. on Medium]]></title>
        <description><![CDATA[Stories by Pran B. on Medium]]></description>
        <link>https://medium.com/@heypran?source=rss-d2511c602370------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6jszf7hIe0jtOkbpHN9aOw.jpeg</url>
            <title>Stories by Pran B. on Medium</title>
            <link>https://medium.com/@heypran?source=rss-d2511c602370------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:54:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@heypran/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[5 Mental Model for Writing Gas-Efficient Contracts]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/coinmonks/5-mental-model-for-writing-gas-efficient-contracts-c13acbae1749?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*vembARRcVlnl6_v_" width="3600"></a></p><p class="medium-feed-snippet">In this article, we will think in terms of gas and explore some thought patterns hat can be used while designing smart contracts.</p><p class="medium-feed-link"><a href="https://medium.com/coinmonks/5-mental-model-for-writing-gas-efficient-contracts-c13acbae1749?source=rss-d2511c602370------2">Continue reading on Coinmonks »</a></p></div>]]></description>
            <link>https://medium.com/coinmonks/5-mental-model-for-writing-gas-efficient-contracts-c13acbae1749?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/c13acbae1749</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 20:16:01 GMT</pubDate>
            <atom:updated>2024-06-07T06:51:13.227Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Enter Migration Transaction- Deploy contract on EOA address]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/coinmonks/enter-migration-transaction-deploy-contract-on-eoa-address-8af80fef3c7e?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*MFeq6OFl_HpcowWX" width="4160"></a></p><p class="medium-feed-snippet">Is it possible to deploy a contract on your externally owned account? Let&#x2019;s find out in this article.</p><p class="medium-feed-link"><a href="https://medium.com/coinmonks/enter-migration-transaction-deploy-contract-on-eoa-address-8af80fef3c7e?source=rss-d2511c602370------2">Continue reading on Coinmonks »</a></p></div>]]></description>
            <link>https://medium.com/coinmonks/enter-migration-transaction-deploy-contract-on-eoa-address-8af80fef3c7e?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af80fef3c7e</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[nfts-in-gaming]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Tue, 01 Aug 2023 19:47:45 GMT</pubDate>
            <atom:updated>2024-06-07T06:51:52.283Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding Storage Gas Costs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@heypran/understanding-storage-gas-costs-435675b2e245?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*jMFtDC9Rd6kLJkHC" width="5372"></a></p><p class="medium-feed-snippet">Lets learn how to structure the read-and-write storage operations appropriately to save more gas.</p><p class="medium-feed-link"><a href="https://medium.com/@heypran/understanding-storage-gas-costs-435675b2e245?source=rss-d2511c602370------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@heypran/understanding-storage-gas-costs-435675b2e245?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/435675b2e245</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[erc721]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[erc20]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Tue, 25 Jul 2023 18:10:28 GMT</pubDate>
            <atom:updated>2024-06-07T06:52:17.222Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Safely Manage Smart Contract Ownership]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://coinsbench.com/how-to-safely-manage-smart-contract-ownership-cc6acbbfcc8f?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*DD1KRCASU1yHp6iI" width="4831"></a></p><p class="medium-feed-snippet">Photo by John Schnobrich on Unsplash</p><p class="medium-feed-link"><a href="https://coinsbench.com/how-to-safely-manage-smart-contract-ownership-cc6acbbfcc8f?source=rss-d2511c602370------2">Continue reading on CoinsBench »</a></p></div>]]></description>
            <link>https://coinsbench.com/how-to-safely-manage-smart-contract-ownership-cc6acbbfcc8f?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc6acbbfcc8f</guid>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Wed, 19 Jul 2023 16:16:57 GMT</pubDate>
            <atom:updated>2023-07-21T22:53:28.919Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to be sure that an address is a contract?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://coinsbench.com/how-to-be-sure-that-an-address-is-a-contract-2925533b0ad5?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*9vEBdB4JLpuq6pWq" width="6240"></a></p><p class="medium-feed-snippet">There is no definite way to determine an address is a contract, but surely there are ways that may suit your use-case, let&#x2019;s explore</p><p class="medium-feed-link"><a href="https://coinsbench.com/how-to-be-sure-that-an-address-is-a-contract-2925533b0ad5?source=rss-d2511c602370------2">Continue reading on CoinsBench »</a></p></div>]]></description>
            <link>https://coinsbench.com/how-to-be-sure-that-an-address-is-a-contract-2925533b0ad5?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/2925533b0ad5</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Sat, 15 Jul 2023 08:12:40 GMT</pubDate>
            <atom:updated>2024-06-07T06:52:58.670Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How Transient Storage Reduces Gas Cost]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://coinsbench.com/how-transient-storage-reduces-gas-cost-c585215f9c7b?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*Wyf4tQOiXpUEWcDb" width="4592"></a></p><p class="medium-feed-snippet">Transient storage will allow the value to persist (like storage) but just for the lifetime of the transaction. Lets learn more..</p><p class="medium-feed-link"><a href="https://coinsbench.com/how-transient-storage-reduces-gas-cost-c585215f9c7b?source=rss-d2511c602370------2">Continue reading on CoinsBench »</a></p></div>]]></description>
            <link>https://coinsbench.com/how-transient-storage-reduces-gas-cost-c585215f9c7b?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/c585215f9c7b</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[smart-contract-security]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[web3]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 21:30:46 GMT</pubDate>
            <atom:updated>2024-01-22T21:49:26.613Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Deterministic addresses using Create & Create2]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@heypran/deterministic-addresses-using-create-create2-59623f2ffdae?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*xLyFxUo4LULy8Yq0" width="5472"></a></p><p class="medium-feed-snippet">How to derive the same address on multiple chains? Lets learn how to use create and create2 to derive contract addresses before deploying</p><p class="medium-feed-link"><a href="https://medium.com/@heypran/deterministic-addresses-using-create-create2-59623f2ffdae?source=rss-d2511c602370------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@heypran/deterministic-addresses-using-create-create2-59623f2ffdae?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/59623f2ffdae</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Tue, 04 Jul 2023 20:11:05 GMT</pubDate>
            <atom:updated>2024-06-07T06:56:19.262Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Use Zero Knowledge Dapp Boilerplate]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@heypran/how-to-use-zero-knowledge-dapp-boilerplate-6da73f6ef8ea?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/2600/0*X-Cy9k6bp5Hg6w1G" width="7804"></a></p><p class="medium-feed-snippet">We will be building a simple zk dapp for age verification using snarks, circom, and solidity.</p><p class="medium-feed-link"><a href="https://medium.com/@heypran/how-to-use-zero-knowledge-dapp-boilerplate-6da73f6ef8ea?source=rss-d2511c602370------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@heypran/how-to-use-zero-knowledge-dapp-boilerplate-6da73f6ef8ea?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/6da73f6ef8ea</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[zkrollup]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <category><![CDATA[zksnark]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Sun, 02 Jul 2023 12:37:07 GMT</pubDate>
            <atom:updated>2023-07-02T12:37:07.648Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[On Recursion and Trampolining]]></title>
            <link>https://medium.com/@heypran/on-recursion-and-trampolining-3ac2f1ba420b?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ac2f1ba420b</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Sat, 01 Jul 2023 10:57:41 GMT</pubDate>
            <atom:updated>2023-07-01T10:57:41.137Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*At-aU-YCEd8IMdG5" /><figcaption>Photo by <a href="https://unsplash.com/@aginsbrook?utm_source=medium&amp;utm_medium=referral">Anthony Fomin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Did you know that recursion can be optimized using a concept which works similar to the way how we jump on a trampoline.</p><p>Let me elaborate, in recursion a function calls itself without finishing its own execution. As execution cannot be finished until the next function call returns (or finished execution) and this goes on for further function calls. This creates a stack of unfinished function calls and due to memory constraints there can only be a certain limit of function calls allowed in a stack. But situations with a large number of recursion calls in javascript does not lead to stack overflow, javascript prevents from reaching that limit by throwing a range error.</p><p>Consider this example,</p><pre>function increment(test) {<br>  try {<br>    if (test &gt; 1000000) return test;<br><br>    return increment(++test);<br>  } catch {<br>    console.log(&quot;test===&gt;&quot;, test);<br>  }<br>}</pre><p>If you run the above code, it will go into the catch block pretty soon. On a macbook air 2k19, it maxed out around 10K. That means there was a stack overflow.</p><p>Well in the above example the <em>increment </em>function calls itself in the return statement, this adds on to the stack one more function call to <em>increment </em>and this call will again add on to the stack one more function call to <em>increment </em>and this keeps going on until it reaches the base condition, when <em>initialValue </em>becomes greater than <em>1000000</em>, but that never happens.</p><p>But here if you notice that recursion call is a tail call. A tail call is when a recursion call only happens at the end of the function in a return statement.</p><h4>Why do we need to concern ourselves with the tail call and how does it matter?</h4><p>The trampoline technique that we are about to learn only works when we have recursion defined as a tail call. This will become more clear once we look at the trampoline, let’s hop on to it.</p><p><em>Tramploine of recursion’ is given by Kyle Simpson. A trampoline is nothing but a wrapper around our recursive function. In recursion, we call a function from within a function. In a trampolined recursion, we call a function that in turn returns a function ( not a function call &amp; therefore completing the current function execution) and this returned function again calls our recursive function.</em></p><p>That is a bit confusing, I know but read it again I am sure you will get it. Here’s how the trampoline wrapper looks like,</p><pre>function trampoline(f) {<br>  return function enclose(...args) {<br>    let result = f(...args);<br>    while (typeof result === &quot;function&quot;) {<br>      result = result();<br>    }<br>    return result;<br>  };<br>}</pre><p>The above trampoline function, takes a function as an argument and returns a function called <em>enclose</em>, you can call it anything you want.</p><p>In order to use the above wrapper, we need to modify our recursive function a little bit.</p><pre>function increment(test) {<br>  try {<br>    if (test &gt; 1000000000) return test;<br><br>    return () =&gt; increment(++test);<br>  } catch {<br>    console.log(&quot;test===&gt;&quot;, test);<br>  }<br>}</pre><p>Did you notice the difference, we modified our tail call by returning an anonymous function instead. So that its not a function call anymore, but it returns a function that calls our recursive function which is <em>increment </em>in this case.</p><p>Now, if we pass in the above function to our trampoline wrapper, our code will look like this.</p><pre>const trampolinedIncrement = trampoline(function increment(test) {<br>  try {<br>    if (test &gt; 1000000000) return test;<br><br>    return () =&gt; increment(++test);<br>  } catch {<br>    console.log(&quot;test===&gt;&quot;, test);<br>  }<br>});<br><br>console.log(trampolinedIncrement(1));</pre><p>When you run the above code, there will be no range error, and you will get <em>1000000001 </em>as output. The above code took around <strong>20 sec</strong> on a Macbook Air.</p><p>But what just happened?</p><p>Our code just got on a trampoline, LOL! Here is the whole code,</p><pre>function trampoline(f) {<br>  return function enclose(...args) {<br>    let result = f(...args);<br>    while (typeof result === &quot;function&quot;) {<br>      result = result();<br>    }<br>    return result;<br>  };<br>}<br><br>const trampolinedIncrement = trampoline(function increment(test) {<br>  try {<br>    if (test &gt; 1000000000) return test;<br><br>    return () =&gt; increment(++test);<br>  } catch {<br>    console.log(&quot;test===&gt;&quot;, test);<br>  }<br>});<br><br>console.log(trampolinedIncrement(1));</pre><p>When we trampolined the <strong><em>increment</em></strong><em> </em>function, we got the definition of <em>enclose </em>function in <strong><em>trampolinedIncrement</em></strong><em> </em>with <strong><em>f </em></strong>being the <strong><em>increment </em></strong>function. So now, when we call the <strong><em>trampolinedIncrement</em></strong></p><p>function with initial arguments, it calls <strong><em>f </em></strong>and the output of that execution is an anonymous function which is stored in the <strong><em>result</em></strong>. Then we keep on calling <strong><em>result </em></strong>function until it returns a <strong><em>typeof </em></strong>function and at the end will return the result.</p><p>If you are still confused just ask in the comments, I will clarify. You can reach out to me on twitter on <a href="https://twitter.com/heypran?ref=hackernoon.com">@heypran</a></p><p>Just to wrap it up, in a normal recursion the stack size keeps on increasing because the current function call has not finished its execution and yet it calls another function. This function again calls another function and this keeps on repeating. This leads to stack overflow.</p><p>In a trampolined scenario, we are not calling the recursive function directly, instead we are finishing the current function call by returning a function, that in turn calls our recursive function. This makes our stack size always increase only by one and when it finishes it again reduces by one. This jumping between the functions is referred as <strong><em>trampoline</em></strong>. I find it pretty cool!</p><p>Cheers!</p><p>Happy Day!</p><p><a href="https://twitter.com/heypran?ref=hackernoon.com">@heypran</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ac2f1ba420b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unburdening Effect of Forgiveness]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/pran-levitates/unburdening-effect-of-forgiveness-3ffb4e5341d9?source=rss-d2511c602370------2"><img src="https://cdn-images-1.medium.com/max/1920/1*xQHaoH7IABBHC7AJ5cQgvg.jpeg" width="1920"></a></p><p class="medium-feed-snippet">Research has shown that unforgiveness can act as a physical burden and may slow you down in your life. Forgiveness can make you lighter.</p><p class="medium-feed-link"><a href="https://medium.com/pran-levitates/unburdening-effect-of-forgiveness-3ffb4e5341d9?source=rss-d2511c602370------2">Continue reading on Pran Levitates »</a></p></div>]]></description>
            <link>https://medium.com/pran-levitates/unburdening-effect-of-forgiveness-3ffb4e5341d9?source=rss-d2511c602370------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ffb4e5341d9</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[meditation]]></category>
            <category><![CDATA[healthy-lifestyle]]></category>
            <category><![CDATA[forgiveness]]></category>
            <category><![CDATA[yoga]]></category>
            <dc:creator><![CDATA[Pran B.]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 13:59:06 GMT</pubDate>
            <atom:updated>2021-02-12T13:59:06.425Z</atom:updated>
        </item>
    </channel>
</rss>