<?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 Sachin Tomar on Medium]]></title>
        <description><![CDATA[Stories by Sachin Tomar on Medium]]></description>
        <link>https://medium.com/@sachin.arox?source=rss-6bc144ae187f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*rQ__0SCi0UErJwF-.</url>
            <title>Stories by Sachin Tomar on Medium</title>
            <link>https://medium.com/@sachin.arox?source=rss-6bc144ae187f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:54:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sachin.arox/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[How I Used the Deepseek Model to Run a ChatGPT-like Interface Locally for Free]]></title>
            <link>https://medium.com/@sachin.arox/how-i-used-the-deepseek-model-to-run-a-chatgpt-like-interface-locally-for-free-814f8170af85?source=rss-6bc144ae187f------2</link>
            <guid isPermaLink="false">https://medium.com/p/814f8170af85</guid>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[local]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Sachin Tomar]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 09:21:10 GMT</pubDate>
            <atom:updated>2025-01-27T09:25:00.059Z</atom:updated>
            <content:encoded><![CDATA[<p>As a developer, I’m always on the lookout for ways to optimize workflows and experiment with new tools. When it comes to large language models (LLMs), most solutions are cloud-hosted, which often comes with concerns around privacy, costs, and internet dependency. This inspired me to explore running a ChatGPT-like interface locally — and here’s how I did it, step by step, using the Deepseek model.</p><p>Let’s dive straight into the process:</p><h3>Step 1: Install the Ollama App</h3><p>Start by downloading the Ollama app. Ollama makes running LLMs locally straightforward and lightweight.</p><ul><li><strong>Go to</strong>: <a href="https://ollama.com/">https://ollama.com/</a></li><li><strong>Download and install the app</strong>: This application allows you to install and run LLMs on your local machine without relying on cloud services.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FdytlNQbLMeByhNPR8Kq9w.png" /></figure><h3>Step 2: Select and Download the Deepseek Model</h3><p>Once you’ve installed the Ollama app, it’s time to choose the Deepseek model. Here’s how:</p><ul><li><strong>Visit</strong>: <a href="https://ollama.com/search">https://ollama.com/search</a></li><li><strong>Find the Deepseek model</strong>: Choose the model version suited for your local system (I used 32b model but you can use the deepseek-r1:7b model based on your system configuration). I’m using a Macbook Pro M4 Max, 64 GB RAM, 1 TB storage running Sequoia 15.2.</li></ul><p>To install and run the model, use the following command in your terminal:</p><pre>ollama run deepseek-r1:7b</pre><p>After downloading, you can chat with Deepseek directly in your terminal. Note that the model’s knowledge cutoff date is July 2024, so it’s fairly up-to-date for general use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G1XgWxCJgOeg5AZ2QR-tWw.png" /></figure><h3>Step 3: Set Up a ChatGPT-like Interface</h3><p>The terminal is functional, but let’s face it — most developers prefer a user-friendly interface. To replicate a ChatGPT-like UI, I used Open WebUI. Here’s how you can set it up:</p><ul><li><strong>Go to</strong>: <a href="https://github.com/open-webui/open-webui">https://github.com/open-webui/open-webui</a></li><li><strong>Follow the installation steps</strong>: Under the “Installation with Default Configuration” section in the README, download the Docker images required for running the WebUI.</li></ul><p>Once the images are downloaded, you’re ready to access the interface.</p><h3>Step 4: Configure Open WebUI</h3><p>Open your browser and navigate to <a href="http://localhost:3000/auth">http://localhost:3000/auth</a>. You’ll need to:</p><ol><li>Enter a provider name (e.g., “local”), an email, and an admin password.</li><li>Complete the setup process.</li></ol><blockquote><em>Note: All your data remains local. You can even turn off your internet connection to verify that nothing is sent to external servers.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ifRGfvqmk0RToBqKPsQRw.png" /></figure><h3>Step 5: Chat Locally with Privacy</h3><p>Once setup is complete, you’ll see a fully functional ChatGPT-like interface running on your local machine. Congratulations — you’ve just built a privacy-first AI assistant, free of cost!</p><h3>Step 6: Extend Functionality</h3><p>The WebUI allows you to:</p><ul><li><strong>Integrate tools</strong>: Provide the model access to external data sources.</li><li><strong>Add knowledge documents</strong>: Enhance the model’s capabilities by uploading your own datasets.</li></ul><p>This lets you create a personalized assistant tailored to your needs without worrying about sensitive data being exposed online.</p><h3>Why This Matters</h3><p>Running LLMs locally is a game-changer for developers who value privacy and control over their tools. With Deepseek and Open WebUI, you can:</p><ul><li>Save costs by avoiding subscription fees.</li><li>Maintain complete control of your data.</li><li>Experiment with LLMs in a secure, offline environment.</li></ul><p>No more worrying about privacy breaches or internet outages — just pure AI-powered productivity, locally.</p><p>With so much open source power given in the hands of developers, what we imagined will happen after 50 yrs, now can happen in next 10 years.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=814f8170af85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moving Forward, save your ETH. Pay gas in ERC20 tokens.]]></title>
            <link>https://medium.com/biconomy/moving-forward-save-your-eth-pay-gas-in-erc20-tokens-7fcd9969d9ff?source=rss-6bc144ae187f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fcd9969d9ff</guid>
            <category><![CDATA[erc20]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[biconomy]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Sachin Tomar]]></dc:creator>
            <pubDate>Thu, 25 Mar 2021 16:18:11 GMT</pubDate>
            <atom:updated>2021-03-25T16:18:11.215Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a technical breakdown of how we enable Ethereum gas payments in ERC20 tokens for Biconomy Forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*gsixFURw142wk3e8.png" /></figure><h3>The Problem</h3><p>In the grand scheme of things, ETH is a world away from the minds of the consumer market. Having to hold ETH to interact with Dapps is a completely alien concept.</p><p>More than that, it’s a huge inconvenience. Imagine the pain of going through KYC to use an exchange only to have your bank decline the charge; or paying ridiculous amounts of gas on Uniswap, just to top up your ETH reserves.</p><p><em>At Biconomy we’ve realised these pain points users have to go through and developed meta transaction relayer infrastructure that enables developers to pay the gas for their users, as well managing transaction fulfilment (</em><a href="https://medium.com/biconomy/saving-gas-fees-on-ethereum-using-biconomy-6e52db257bfc"><em>no more stuck transactions</em></a><em>).</em></p><p>Biconomy’s gasless meta transactions make <a href="https://decentral.games/">on-chain gaming more fun and seamless</a>, <a href="https://medium.com/biconomy/frictionless-trading-experience-on-perpetual-protocol-case-study-a4cb227c64e1">L2 DeFi</a> viable and bringing valid use cases to life with more and more non crypto savvy users. However, with gas fees being ridiculously high on L1 there’s no way a Dapp could cover the bill. We work with <a href="http://curve.fi/">Curve.fi</a> and <a href="http://cryptofees.info/">their users pay more than $40,000 per day in gas!! (as of 14/01/21)</a></p><p><a href="https://fees.wtf/">Fees.wtf</a> has really made people conscious about the opportunity cost of using their ETH to pay gas. However, users on L1 now are seemingly comfortable paying gas fees no matter how much they complain about it.</p><p>With ETH prices headed to the moon, paying gas fees with Dai (with a slight markup) makes more sense. Borrowing Dai against your Ether to pay for gas fees, and then using flash loans to repay your debt is much more capital efficient than losing thousands of dollars of lost gains!!</p><h3>Introducing “Forward”</h3><p>Solving all of these problems is the goal of our latest offering, <strong>Forward</strong> : a toolset you can integrate into your dApp to enable your users to be able to pay their gas fees using their ERC20 tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-NmMdPY5amc3kKyI8xZpQ.png" /></figure><p>Overview of Forward</p><blockquote><em>Forward is a simple way for your end users to pay gas fees in ERC 20 tokens.</em></blockquote><p>It forwards meta transactions in a secure way, compliant with EIP 2771, and processes gas fee payments in a way which prevents overcharging the end user. We do this by sourcing token price data from transparent on-chain oracles, and charging users based on the amount of gas used for transaction execution.</p><p>We’ve also added functionality which will enable Biconomy powered dApps to customise their offering in the future. Including revenue sharing, adding custom tokens, lower fees for regular users, transaction batching etc.</p><p>Considering gas optimisation concerns on Mainnet, the fact that certain tokens may lack sufficient liquidity, client requests and edge cases — we’ve decided to begin with a general purpose solution. Our smart contracts could support any token in theory, however, we’re beginning with reliable stablecoins (USDT, USDC, DAI, etc).</p><p>Our contracts are open source and on our Github, feel free to take a look.</p><p><a href="https://github.com/bcnmy/mexa">bcnmy/mexa</a></p><h3>Fulfilling Forward Meta Transactions</h3><h4><a href="https://eips.ethereum.org/EIPS/eip-2771">EIP-2771</a></h4><p>Secure Protocol for Native Meta Transactions (AKA EIP-2771), is a meta transaction standard proposed collaboratively by a large group of developers in the gasless transaction space — including Open GSN contributors and our CTO <a href="https://twitter.com/schin_tomar">Sachin Tomar</a>.</p><p>The main idea here is to abstract the verification of meta transaction signatures from the logic of the target contract. A trusted forwarder will handle the verification of the signatures, and append the user address to the call data sent to the target contract.</p><p>This gives developers the flexibility to switch out forwarder implementations. Reasons for this may include security/efficiency updates, and <a href="https://en.wikipedia.org/wiki/Post-quantum_cryptography">supporting new types of signatures that may exist in the future</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*Ir6a0bvzWn7R5mO1" /><figcaption>Sequence Diagram for EIP-2771</figcaption></figure><p>To support EIP-2771 based meta transactions, all developers need to do is inherit <a href="https://github.com/opengsn/gsn/blob/master/contracts/BaseRelayRecipient.sol">BaseRelayRecipient.sol</a> from Open GSN &amp; replace msg.sender with _msgSender().</p><p>While Biconomy’s relay infrastructure is currently centralised, we support open source standards and look to decentralise our relay infrastructure at some point in the future.</p><h3>ERC20ForwardRequest</h3><pre>struct <strong>ERC20ForwardRequest</strong> {<br>  address <strong>from</strong>;<br>  address <strong>to</strong>;<br>  address <strong>token</strong>;<br>  uint256 <strong>txGas</strong>;<br>  uint256 <strong>tokenGasPrice</strong>;<br>  uint256 <strong>batchId</strong>;<br>  uint256 <strong>batchNonce</strong>;<br>  uint256 <strong>deadline</strong>;<br>  bytes <strong>data</strong>;<br>}</pre><p>Every meta transaction going via Forward will be formatted as shown above.</p><p><strong><em>The main points to takeaway include :</em></strong></p><blockquote><strong><em>The Obvious</em></strong></blockquote><p>If you have experience with Ethereum transactions, you should already be familiar with the <strong>from</strong>, <strong>to, txGas </strong>and<strong> data </strong>fields.</p><p>They do the exact same thing as their non meta transaction counterparts : <strong>from</strong> is the end user’s address, <strong>to </strong>is the recipient contract’s address, <strong>txGas</strong> is the gas limit passed for making the recipient contract call, and <strong>data </strong>is the call data.</p><blockquote><strong><em>Deadlines</em></strong></blockquote><p>Transaction deadlines are designed to protect the end user from slow relayers and changes in market conditions. The transaction will simply revert if it’s being called after the <strong>deadline</strong>. For example, <a href="https://uniswap.org/docs/v2/smart-contracts/router02/#swapexacttokensfortokens">Uniswap use them to protect users from volatile market conditions</a>. They are also used in <a href="https://eips.ethereum.org/EIPS/eip-2612">USDC’s permit function</a>.</p><p>This <strong>deadline</strong> is a unix timestamp, our SDK will automatically handle this for you. However, if you do NOT want to use it, set it to zero.</p><blockquote><strong><em>Batched Transactions / 2D Nonces</em></strong></blockquote><p>One dimensional nonces prevent the replay of transactions. 2D nonces enable batching of transactions, by assigning a sequence of order dependent transactions the same “<strong>batchId</strong>”. (Use <strong>batchNonce</strong> like a standard nonce)</p><p>This means you could hypothetically convert WBTC into USDC using <a href="https://www.curve.fi/">Curve.fi </a>&amp; <a href="https://www.synthetix.io/">Synthetix</a>, &amp; then deposit into <a href="https://idle.finance/#/">Idle.finance</a>. All of this without having to use a special contract, or having to do each step 1 by 1… Without waiting for those transactions to confirm, you could go to the Metaverse Casino at <a href="https://decentral.games/">Decentral.games</a>, immediately — without having your wallet blocked!!</p><p>Batches don’t need to be executed in order of ID, further adding flexibility.</p><p>While this may not be the most useful feature now, in the near future, we expect batching to become vital. We predict a world where hardware and phone wallets are used for a wide range of daily applications, like e-commerce, identity management and even <a href="https://www.sapien.network/">social media</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*ecFYofp9kyI6e_Ly" /></figure><p>Batched meta transactions also serve as a practical alternative to using <a href="https://medium.com/defi-saver/a-short-introduction-to-makers-dsproxy-and-why-we-l-it-c88932595be">DSProxy</a>, especially with gas prices spiralling out of control. We see this feature being used as a tool in the dApp developer’s toolkit to speed up development, and improve UX depending on the use case.</p><p>However, 2D nonces increase gas usage if used for single transactions, so if you’re only executing a single transaction, we’d recommend not using it and setting batchId to zero (this is the default in our SDK).</p><blockquote><strong><em>Token Specifics</em></strong></blockquote><p>The fields <strong>token</strong> &amp; <strong>tokenGasPrice </strong>are used to denote the token that the user will pay in and what gas price to charge (on a token unit level).</p><p>To begin with, Biconomy will only support a handful of tokens (see our <a href="https://docs.biconomy.io/">documentation</a> for more information).</p><p>The token gas price will be determined by combining the price feed of the token with our gas price estimates, to calculate a figure denominated in the given token.</p><p>For more detailed information, see our section on <strong>Charging Users</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bnB8HlY8P4AyU7j6pEhPjg.png" /><figcaption>The Algorithm we use to process Forward meta transactions</figcaption></figure><h3>BiconomyForwarder (Trusted Forwarder)</h3><p><a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/forwarder/BiconomyForwarder.sol"><strong><em>(View Contract Code Here)</em></strong></a></p><p>The trusted forwarder verifies that all aspects of the call, including details of fee payment, have been approved/signed by the message sender. The trusted forwarder then calls the target contract (an Open GSN Base Relay Recipient), appending the message sender data — in a way compliant with EIP-2771.</p><p>This contract is intended to be deployed once per network and used by multiple projects (and potentially their customised ERC20Forwarders).</p><p><strong>It supports two types of meta transaction signatures : EIP712 &amp; personalSign.</strong></p><blockquote><strong><em>EIP712</em></strong></blockquote><p>EIP712 is an official standard for the display and signing of meta transaction messages.</p><p>Endorsed by popular wallets such as Metamask (<a href="https://medium.com/metamask/our-metatransaction-hackathon-winner-a620551ccb9b">which even hosted a hackathon encouraging EIP712 usage</a>) and Trust wallet — it aims to serve as a “peer-reviewed well-tested method” for hashing and signing of “complex meaningful messages”.</p><p><a href="https://eips.ethereum.org/EIPS/eip-712">Read more about EIP 712 here</a></p><p>A key point to note is that EIP712 requires each dApp to have a domain (a struct representing the identity of the verifying contract).</p><pre>string name,<br>string version,<br>address verifyingContract,<br>bytes32 salt</pre><p><em>“salt”</em> here contains the bytes32 representation of chainId value.</p><p>Within Forward, BiconomyForwarder is the verifying contract. However, a customisation feature we support is setting your own domain. <strong>registerDomainSeparator(string calldata name, string calldata version) </strong>can be called by Biconomy to give our clients the ability to “white label” the experience when users go to sign EIP712 messages via Metamask.</p><blockquote><strong><em>PersonalSign</em></strong></blockquote><p>Some wallets may not support EIP712 for your dApp, due to not adhering to the latest standards.</p><p>To solve this issue, we created the personalSign solution (also referred to as basicMetaTransaction in our metaTx-standard codebase). It uses a similar encoding to EIP712, however, is designed such that messages can be signed using the <strong>eth_sign </strong>&amp;<strong> personal_sign</strong> functions.</p><h3>ERC20Forwarder</h3><p><a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/forwarder/ERC20Forwarder.sol"><strong><em>(View Contract Code Here)</em></strong></a></p><p>The ERC20Forwarder serves an important role holding information needed by Biconomy’s Mexa client SDK. The contract stores the addresses of other contracts that Biconomy’s client libraries need to calculate charges for users before transactions are signed. These include the Fee Manager &amp; Oracle Aggregator. In addition, it stores the fee offsets of using certain tokens (how much extra gas is required for token X) — we refer to this as transferHandlerGas.</p><p>User’s gas payments are transferred to a <strong>feeReceiver</strong> address, this address is set by the owner of the ERC20Forwarder contract deployed. In our current iteration, we operate a single deployment on each network, where Biconomy owns the feeReceiver address.</p><p>While Biconomy’s Forward product is currently entirely managed, this design choice opens the door to advanced client customizations in the near future. This may include scenarios where developers use a single ERC20Forwarder for their dApp and build a revenue model around their user experience.</p><p>In the meta transaction execution flow, the main purpose of the contract is to initiate the forwarding process and then charge users after the target call is complete. Calling executeEIP712() or executePersonalSign() will call the methods of the same name within our BiconomyForwarder (trusted forwarder). A key point to note is that the ERC20Forwarder contract logs all gas usage required to call BiconomyForwarder.execute__() — this data is used to charge the user.</p><p>The BiconomyForwarder will handle the validation and execution of meta transactions. Once the call is run successfully, the ERC20FeeProxy contract will call the transferFrom method on the specified ERC20 token contract address — charging the user’s wallet.</p><p>The tokenGasPrice is calculated off-chain, using Biconomy’s recommended gas price and price feed data stored on-chain.</p><p>The fee multiplier figure is fetched on-chain from the feeManager during the contract call execution. Again, this maximises developer options in the near future.</p><p><strong>Main Points About ERC20Forwarder</strong></p><ul><li>Stores addresses of contracts needed by Biconomy’s client SDKs</li><li>Initiates meta transaction forwarding process</li><li>Charges users after execution is successful</li><li>FeeReceiver address collects fees charged</li></ul><h3>Charging Users in ERC20 Tokens</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*JpiQf9W5AZaAq2Ch" /></figure><p>External calls needed to generate a price quote in the Mexa Client SDK</p><p>Charging users is a two step process, producing a quote and a tokenGasPrice, and actually charging the user at the end of a transaction. The actual charge and the quote may differ due to the difference between the txGas field, and the real amount of gas used for the call.</p><p><strong><em>TokenGasPrice Formula:</em></strong></p><blockquote><em>GasPriceInNativeToken * NativeTokenToPaymentTokenPrice</em></blockquote><p><strong><em>Quote Formula:</em></strong></p><blockquote><strong><em>TokenGasPrice</em></strong><em> * FeeMultiplier * ( txGas + transferHandlerGas + additionalOffset )</em></blockquote><p><strong><em>Real Charge Formula:</em></strong></p><blockquote><strong><em>TokenGasPrice</em></strong><em> * FeeMultiplier * ( gasUsedCallingBiconomyForwarder + transferHandlerGas )</em></blockquote><p>All the required data for a quote is fetched by <a href="https://docs.biconomy.io/biconomy-sdk-mexa"><strong><em>Biconomy’s Mexa SDK</em></strong></a>. However, only the tokenGasPrice is passed into the meta transaction, as the other elements of the charge are fetched and calculated on-chain.</p><h3>Biconomy’s Gas Price</h3><p>To prevent opportunities for erroneous pricing, we ensure the client and Biconomy’s servers have matching gas price data. To see how we select what gas price to use, <a href="https://medium.com/biconomy/saving-gas-fees-on-ethereum-using-biconomy-6e52db257bfc">read this article</a>.</p><h3>Fee Manager</h3><p>The fee manager contract is responsible for giving fee multipliers for a given user/token combination — getFeeMultiplier(address user, address token). A fee multiplier essentially serves as a way of setting a markup over the base tokenGasPrice. Biconomy may choose to implement a fee multiplier for a given token to mitigate risk factors, or to generate added revenue.</p><p>Biconomy’s default implementation is CentralisedFeeManager.sol, however, any contract implementing <a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/interfaces/IFeeManager.sol">IFeeManager.sol</a> can serve as a fee manager. This opens the door to customisation.</p><p>A fee multiplier can be between 0 and 6.5535 — expressed as uint16 basis points from 0 to 65535. However, for customisation options in the future, we may impose a minimum &gt;1.</p><h3>Oracle Aggregator</h3><p><a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/forwarder/OracleAggregator.sol"><strong><em>(View Contract Code Here)</em></strong></a></p><p>Biconomy intends to support a large range of tokens, over time, on a wide range of networks. Different tokens have varying levels of liquidity and differing tokenomics — this will affect how we source their price data.</p><p>Due to security reasons and ease of integration, it makes more sense to source this data from data sources available on-chain.</p><p>For popular tokens, such as Dai and USDC, we can use Chainlink’s price feeds. For more niche tokens with AMM liquidity, we can use a Uniswap TWAP price feed, for example. We may need a completely bespoke arrangement for some tokens, for example, where pricing data is sourced from another DeFi protocol.</p><p>Interfaces differ with oracle implementations, and it may be preferable to switch oracles being used in the future. Thus, the best solution is to create an <a href="https://sourcemaking.com/design_patterns/adapter">adapter</a>, where for each token, we specify what to call and how to call it. Using this approach, we can support any price feed that returns integers (both signed and unsigned).</p><h3>TransferHandlerGas</h3><p>The actual charging of users takes up gas, there’s no way to account for it within the call itself, as the charge must be calculated before it is levied. This means we need to add an additional constant to the fee charged.</p><p>Additionally, the way in which tokens implement transferFrom() is not consistent, this can be due to factors such as varying levels of efficiency and protocol specific logic. This produces different gas usage figures we must account for.</p><p>We add this figure for every token that we support. It can be queried by calling transferHandlerGas(token).</p><h3>Future Customisation Options</h3><h4>Dedicated ERC20Forwarder</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*lKyBRCQt3ptNqqci.png" /><figcaption>This will be available in the near future</figcaption></figure><p>Biconomy aims to eventually give dApp developers the power to roll their own ERC20Forwarder setups — while still benefiting from our infrastructure.</p><p>This will give you the ability to do the following :</p><ul><li>Take fees directly from your users (be the fee receiver)</li><li>Set custom fee multiplier rules</li><li>Support any token you want</li></ul><p>However, this comes with the risk of needing to repay Biconomy (especially with volatile tokens), and the added responsibility of maintenance for any custom logic implemented on-chain.</p><p><em>Think of this like ejecting in Create React App.</em></p><h3>Adding Custom Tokens</h3><p>In a situation where your dApp is using Forward with a standard setup, adding a custom token would require Biconomy’s approval. We’re currently working on criteria for approving new tokens.</p><p>If you’re operating using a dedicated ERC20Forwarder, you could add a new token yourself with little effort. However, you would also need to deploy your own OracleAggregator and FeeManager.</p><p>In order to onboard a new token, the following steps need to be completed :</p><ul><li>Sourcing/development of on-chain price feed</li><li>Adding of price feed calls to OracleAggregator</li><li>Setting up of fee manager logic</li></ul><h3>Building Custom Fee Managers</h3><p><strong><em>(This is only possible if you have a dedicated ERC20Forwarder)</em></strong></p><p>There are a handful of reasons to deploy a custom fee manager, a good example is to reward certain users of your dApp/protocol with lower fees.</p><p>There are two ways to implement this : deploying a CentralisedFeeManager and continually updating its state; or, making a custom fee manager contract.</p><p><a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/feeManager/CentralisedFeeManager.sol">CentralisedFeeManager</a> enables developers to set fee multipliers for each user/token combination. This might be ideal if your conditions for varying fees are not very dynamic: e.g you want to reward user X with discounted fees because they bought a special non transferable NFT.</p><p>However, if you want to impose more dynamic rules, such as <em>all users holding above 1000 tokens get a discount </em>— it may be a pain to continually update the fee manager. For these kinds of scenarios, we’d recommend making your own fee manager, by implementing <a href="https://github.com/bcnmy/mexa/blob/master/contracts/6/interfaces/IFeeManager.sol">IFeeManager</a>.</p><h3>Gas Usage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/0*i3cyMM3jSRjdrgS0.png" /></figure><p>Using Forward does add an overhead to your dApps as it requires both validating meta transactions and also charging users at the end of the transaction call.</p><p>For this reason, on Ethereum Mainnet, we’d recommend using Forward for high gas transactions, where there is a significant UX benefit to not need Ether.</p><p><em>On layer 2 networks, the costs of using Forward are negligible, making it a no-brainer.</em></p><p>The gas overhead typically varies between 65–75K when using EIP-712 signatures.</p><p><strong><em>We yielded the following overheads for typical scenarios* (with EIP-712) :</em></strong></p><ul><li>USDC : 71170</li><li>USDT : 68603</li><li>DAI : 65876</li></ul><p><strong><em>However, using personalSign reduces gas usage by an average of 1600 units. </em></strong>The downside is that<strong><em> </em></strong>the in-wallet UX benefits, of using the widely accepted standard, are lost.</p><p><em>*A typical scenario is a non batching transaction with a non-zero batchNonce</em></p><h3>Gas Token Integration</h3><p><a href="https://medium.com/biconomy/gas-saving-by-biconomy-ea67d7e64d0c">Biconomy has developed a technique of using CHI tokens to ease the pain of gas price spikes. </a>We’re offering the same feature with Forward, to lower costs. Using gas tokens enables us to reduce the total overhead of a transaction by up to 50% (including the actual recipient call). Special logic in our contracts enables us to pass this discount onto end users. This means with gas tokens enabled, users could be paying for e.g. 100,000 units instead of 180,000–200,000.</p><h3>Costed Scenario</h3><p>The following costs are for a scenario where :</p><ul><li>Ether price at ATH (currently $1424)</li><li>Gas Price = 100 Gwei</li><li>Fee Multiplier of 105%</li><li>Recipient Call Gas = 200,000 (Imagine a multi path swap or withdrawing lent ERC20 tokens)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*vPOHjT-xZqB5TEsl.png" /></figure><p>Without CHI being used, these transactions costs are typically a third more expensive. However, this is much cheaper than getting users to acquire new Ether and less time consuming. When CHI is enabled, the costs fall $5 below the cost of a traditional transaction. This makes paying with ERC20 tokens using Forward/Biconomy the most practical option for end users, when gas prices are high.</p><h3>Forward Swap testnet live! — DEX with gas payments in stablecoins</h3><p><a href="https://medium.com/biconomy/save-eth-by-paying-defi-gas-in-stablecoins-say-hello-to-forward-swap-a736f1cef3a4"><strong>Swap is the first use case built on Biconomy Forward.</strong></a><strong> </strong>The decentralized exchange sources its liquidity from Uniswap, but provides the option to pay gas in a variety of stablecoins. This vastly improves the user experience for both crypto newbies &amp; seasoned traders.</p><p>Try it out here: <a href="http://forwardswap.io/">forwardswap.io</a></p><h3>Conclusion</h3><p>Forward enables developers to give their users the option to pay for their transactions using ERC20, in a secure and robust manner. We hope this will pave the way for improved UX — with end users never having to hold Ether again to do DeFi with other tokens.</p><p>Paying gas in ERC20 tokens will help fight the deflationary economic problem of paying gas in Ether, only to have thousands (or millions) of dollars worth of gains lost forever.</p><p>We’re rolling out Forward in a highly managed beta — only supporting a handful of stablecoins. Options that give more flexibility will be released in the near future.</p><p><a href="https://docs.biconomy.io/">If you want to learn how to integrate Forward in your dApp, please read our documentation.</a></p><p>Special Thanks to <a href="https://medium.com/u/55d0be7c95e">Kiran Fernando</a> for his contribution to this article.</p><p><a href="http://biconomy.io/">Check out our website</a></p><p><a href="https://twitter.com/biconomy">Follow us on Twitter</a></p><p>Join our gang on <a href="https://t.me/biconomy">telegram</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fcd9969d9ff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/biconomy/moving-forward-save-your-eth-pay-gas-in-erc20-tokens-7fcd9969d9ff">Moving Forward, save your ETH. Pay gas in ERC20 tokens.</a> was originally published in <a href="https://medium.com/biconomy">Biconomy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Saving gas fees on Ethereum using Biconomy!]]></title>
            <link>https://medium.com/biconomy/saving-gas-fees-on-ethereum-using-biconomy-6e52db257bfc?source=rss-6bc144ae187f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e52db257bfc</guid>
            <category><![CDATA[high-gas-price]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[gas]]></category>
            <category><![CDATA[biconomy]]></category>
            <category><![CDATA[meta-transactions]]></category>
            <dc:creator><![CDATA[Sachin Tomar]]></dc:creator>
            <pubDate>Sat, 29 Aug 2020 17:46:18 GMT</pubDate>
            <atom:updated>2020-08-29T17:46:18.684Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Biconomy is saving gas fees on Ethereum</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*oQdGUiY9_hBXoofJDsJf8w.jpeg" /></figure><p>Other than Defi, by far the most talked-about topic in the space currently is transaction fees on Ethereum. Just by looking at the chart, the spike in fees in the past month makes the CryptoKitties surge of 2017 look like nothing. So much so, that total revenue to Ethereum miners increased over 1,400% this quarter, and miners netted a total of $6 million in transaction fees on August 13th alone!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HtYDLCLyHAfmY1Pl" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*HTwTtDkDUwalUu-Jw9zs3g.jpeg" /></figure><p>While the market is waiting for solutions namely, Eth 2.0 and potentially EIP 1559, which allows for more predictable gas fees — Layer 2 solutions are one of the main ways to reduce the gas fee burden. At Biconomy, we deploy and manage scalable meta transaction relayer infrastructure that is compatible with any Layer 1 and Layer 2, and since we support Ethereum and experiencing the high gas fees that come along with it, we took it upon ourselves to tackle this issue!</p><p>Within our relayer infrastructure, we have been integrating the following strategies to optimise for gas:</p><ol><li>Relaying multiple transactions together in batches</li><li>Implementing strategies to buy gas futures via gas token that can result in upto 50% saving in gas when prices go insane</li><li>Play the system, i.e. pay the minimum optimal gas price to get your transaction included in the next block</li></ol><p>We make heavy use of the latter and feel it’s an underappreciated technique, especially as most people just use the fastest gas price or even overpay in terms of gas price to get their transactions to settle faster on the blockchain.</p><p>We believe you should never overpay for your transactions and we are implementing the above measures to save gas on all Biconomy enabled transactions.</p><h3><strong>Just the right gas</strong></h3><p>Over the past three months since our beta launch, we’ve been honing in our strategy on how to optimally pay gas fees whilst ensuring they settle quickly on-chain. We’ve been mainly supporting high profile projects such as Curve Finance and Idle Finance where these applications have been benefiting from an efficient transaction highway that sets optimal gas prices that do not overcharge developers for their meta transactions.</p><p>Our gas price optimisation algorithm got battle-tested when #Yam farmers went ham. We were able to set gas prices 109 gwei lower than the average during this period — saving tons of Ether. Most overpaid transactions came largely from well known and influential exchanges — who would pay anything to have their transactions mined.</p><p>At Biconomy, we decide the gas price in a simple yet more efficient way. We send the transaction with the medium speed gas price taken from multiple gas oracles and monitor it. If the transaction is not included in a block within a certain time period, we bump up gas price. We strive to ensure transactions are included within 2 minutes once initiated (more data on this below).</p><p>This approach allows us to save some gas when compared to other transactions which always tend to overpay. More importantly, it really alleviates the impacts of gas wars on-chain. We are continuously improving our gas optimisation algorithm by looking at new ways of doing it. For example, through various machine learning models built on historical transaction data.</p><h3>Beating fast gas prices 💪</h3><p>The data below compares Biconomy transactions with the 2nd, 3rd, and 4th highest gas price transactions within the same block.</p><p>Here are our findings which you can verify on-chain too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*7XyfKpjPeMgmArJxJA5qZg.png" /></figure><p>We did not compare with the highest gas price transaction in the block as there are some transactions with an exceptionally high gas price, like this transaction <a href="https://etherscan.io/tx/0x5570cdb6fd4eb3a5376936c334d2b03e300aa99550a1e0f3fa2af22f6ec8514d">https://etherscan.io/tx/0x5570cdb6fd4eb3a5376936c334d2b03e300aa99550a1e0f3fa2af22f6ec8514d</a> This transaction paid 2431 Gwei 😳 which would not be fair for the comparison.</p><h4>And How about transaction confirmation times?</h4><p>On average, transactions relayed by Biconomy in the 99th percentile take 65 seconds and transactions in the 90th percentile take 23 seconds to get included in the block.</p><h3>Why is all this important?</h3><p>Not only are we saving tons of money, our techniques reduce the amount of stuck transactions during highly congested periods. Getting it right both ways is crucial, both for seasoned DeFi experts trading on time-critical opportunities and low margins; and new users, who’d be put off by high fees.</p><p>We’ve all been there, when we’ve been frustrated with setting low gas fees and having to deal with a stuck transaction. With Biconomy we do not only guarantee transactions won’t get stuck but guarantee they’ll settle within our predefined intervals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*le3Q_KGE-64xdPlykB2Bpw.jpeg" /><figcaption>An user transactions got stuck and ultimately reverted because of deadline and price change</figcaption></figure><p>Ultimately, sending transactions quickly and at a reasonable price has become quite difficult even making wallets such as Argent who recently announced that they will be stopping the subsidization of user gas fees. This is a problem because meta transactions have proven to increase users on a platform, increase retention, and ultimately provide seamless experiences.</p><p><strong>How much further can Biconomy save gas fees?</strong></p><p>Although we believe gas prices will be super low in the future, we have been increasingly fine-tuning various gas optimization methods to not just enable meta transactions at scale, but also reduce gas fees in general — as usage and demand of the network grows. What is important to note is that with Biconomy’s relayers, there is no gas overhead, making it extremely efficient.</p><p>Optimally picking the right gas fee and bumping up the gas is one piece of a bigger puzzle. Through some cool techniques we’re currently testing internally, we reckon we could increase gas cost savings to up to 50%.</p><p>Next in our pipeline is transaction batching on smart contracts where we leverage our relayer infrastructure to significantly reduce the gas cost for ERC 20 transactions. We have been continuously performing internal tests and finding gas fees can be saved up 50% using batching. Here are some of the stats:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58PH5zbQB3yJ7Sz-9I8x9w.png" /></figure><p>We’re super excited to be rolling out these additional savings in the coming weeks/months — so watch this space! We definitely do not want to see these gas prices again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oElYoa8Yx1vk4YE9UlxCFg.jpeg" /></figure><p>Follow us on <a href="https://twitter.com/biconomy">twitter</a> and join our <a href="https://t.me/biconomy">telegram</a> channel to get the latest updates.</p><h3>Appendix</h3><p>We extracted above data from the following ethereum blocks:</p><p>10654896, 10654819, 10654724, 10654648, 10640807, 10637791, 10637315, 10636740, 10635266, 10634287, 10655918, 10655194, 10655059, 10654907, 10654735, 10654565, 10654012,10628824, 10655002, 10654977, 10654957, 10654931, 10654923, 10654895, 10654722, 10654720, 10654695, 10661223, 10661168, 10656895, 10654924, 10654886, 10654447</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e52db257bfc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/biconomy/saving-gas-fees-on-ethereum-using-biconomy-6e52db257bfc">Saving gas fees on Ethereum using Biconomy!</a> was originally published in <a href="https://medium.com/biconomy">Biconomy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>