<?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 Jelilat Anofiu on Medium]]></title>
        <description><![CDATA[Stories by Jelilat Anofiu on Medium]]></description>
        <link>https://medium.com/@jelilat?source=rss-f25d000d9167------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dEN-U6fHvlXxAB4WkAhfMQ.png</url>
            <title>Stories by Jelilat Anofiu on Medium</title>
            <link>https://medium.com/@jelilat?source=rss-f25d000d9167------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 14:16:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jelilat/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[Bridging Islamic Finance and DeFi: A Journey Toward Shariah-Compliant Crypto Solutions]]></title>
            <link>https://jelilat.medium.com/bridging-islamic-finance-and-defi-a-journey-toward-shariah-compliant-crypto-solutions-ad4e09c081cd?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad4e09c081cd</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[islamic-finance]]></category>
            <category><![CDATA[shariah-compliant]]></category>
            <category><![CDATA[halal]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 22:32:20 GMT</pubDate>
            <atom:updated>2025-01-30T22:32:20.995Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdEJ66fr9VF0bcWI5TcTxg.png" /></figure><p>Blockchain was meant to democratize finance — to create an open, transparent, and accessible system. Not just for a privileged few, or those whose beliefs happen to align with existing protocols, but for everyone irrespective of their faith or personal values. Yet, for millions of Muslims around the world, decentralized finance (DeFi) remains out of reach because many of today’s DeFi protocols conflict with the core principles of Islamic finance.</p><p>From interest-based lending (<em>riba</em>) to speculative trading (<em>gharar</em>), the mechanisms that power DeFi often fall short of being <em>halal</em> (permissible). This isn’t just a technical challenge — it’s a failure of imagination. With the global Islamic finance industry <a href="https://www.zawya.com/en/economy/islamic-reports/islamic-finance-development-report-2024-from-niche-to-norm-pwqeoqow">valued at over $4.9 trillion</a>, the question isn’t whether we should bridge this gap, but how.</p><h3>Why This Matters</h3><ul><li><a href="https://en.wikipedia.org/wiki/Muslim_world#:~:text=Demographics,-See%20also%3A%20Muslim&amp;text=More%20than%2024.1%25%20of%20the,Muslim%20population%20in%20the%20world."><strong>1.9 billion Muslims globally</strong></a> are underserved by DeFi.</li><li>The <strong>$4.9 trillion Islamic finance industry</strong> remains siloed in centralized systems.</li><li><strong>Ethical finance isn’t niche</strong> — it’s a universal demand.</li></ul><h3>The Conflict Between DeFi and Islamic Finance</h3><p>To build a truly inclusive financial system, we need to understand where existing DeFi protocols fall short from a Shariah perspective.</p><h4>1. Interest-Based Lending (Riba)</h4><p>Most DeFi lending platforms, like Aave and Compound, are built around interest-bearing loans. In Islamic finance, any guaranteed interest on a loan is considered exploitative and is strictly prohibited. Instead, financial agreements should be based on risk-sharing, where both parties benefit equitably from the success or failure of an investment.</p><h4>2. Speculative Trading (Gharar)</h4><p>Many DeFi platforms encourage speculation, whether through high-leverage derivatives, options, or algorithmic stablecoins. Gharar refers to excessive uncertainty or ambiguity in transactions, which can lead to unfair risks for one party. In contrast, Islamic finance requires transparency, fair terms, and asset-backed transactions.</p><h4>3. Haram Investments</h4><p>Many crypto assets are tied to industries prohibited in Islam, such as gambling, alcohol, or interest-based financial services. A truly Shariah-compliant DeFi system must ensure the ethical screening of assets and prevent investments in non-halal industries.</p><h3>Expanding Financial Inclusion Without Exclusion</h3><p>The goal is not to replace existing DeFi protocols but to expand them, ensuring that financial systems respect a broader range of values and ethics. This can be achieved through three core approaches:</p><h4>1. Existing Protocols Adding a Halal Option</h4><p>Just as some traditional banks offer no-interest loan options for Muslim customers, DeFi protocols could integrate halal financial models. For example, Aave could introduce a Mudarabah-based lending pool where lenders and borrowers share profits instead of interest-based returns.</p><h4>2. Building New Shariah-Compliant Protocols</h4><p>Beyond modifying existing protocols, there is an opportunity to create DeFi platforms explicitly designed from the ground up with Islamic finance principles. These protocols would natively support profit-and-loss sharing, asset-backed transactions, and ethical investing guidelines.</p><p><strong>Use Cases We Can Explore</strong></p><ul><li><strong>Halal Yield Farming/Staking:</strong> Platforms like<a href="https://inshallah.fi/"> Inshallah.fi</a> and<a href="https://www.haqq.network/"> Haqq Network</a> with their <strong>$ISLM Coin</strong> are pioneering halal staking and ethical finance in DeFi.</li><li><strong>Decentralized Takaful (Islamic Insurance):</strong> A community-based risk-sharing system on Ethereum, potentially governed by a DAO to ensure fair and transparent fund distribution.</li><li><strong>Asset-Backed Tokens (Sukuk):</strong> Tokenizing real-world assets like real estate or commodities to create Shariah-compliant investment opportunities.</li><li><strong>Shariah-Compliant Mortgages:</strong> A decentralized home financing system based on <strong>Murabaha</strong> (cost-plus financing) or <strong>Ijara</strong> (leasing) structures, allowing users to purchase homes in a compliant manner without interest. This could be achieved through tokenized real estate investments where homebuyers gradually acquire full ownership while making payments structured as rent or profit-sharing rather than interest.</li></ul><h4>3. Encouraging Islamic Finance Institutions to Integrate Crypto</h4><p>Islamic financial institutions, which already serve millions, could benefit from integrating blockchain for greater transparency and efficiency. Developing Shariah-compliant stablecoins, tokenized sukuk, and blockchain-based Takaful (Islamic insurance) could modernize and expand Islamic finance.</p><p>Another promising area is the development of on-chain tools that support Shariah-compliant financial products. For example, <a href="https://mrhb.network/">Marhaba Network’s</a><strong> Sahal Wallet Halal Screener</strong> helps Muslims identify which tokens are permissible. Similarly, AI-driven compliance checkers could make it easier for developers to ensure their smart contracts adhere to Islamic finance principles.</p><p>I also developed a <a href="https://crypto-zakat-calculator.vercel.app/">Crypto Zakat Calculator</a> to help Muslims accurately calculate and track their annual zakat obligations on crypto assets. Tools like these demonstrate how blockchain can facilitate transparency and automation in Islamic financial practices.</p><h3>Towards a Shariah-Compliant DeFi Future</h3><p>Designing DeFi protocols that respect Islamic finance isn’t just about tweaking existing models — it’s about rethinking financial structures entirely. We need:</p><ol><li><strong>Automated Shariah Compliance Checks</strong> — AI-driven tools that analyze smart contracts for compliance.</li><li><strong>New Protocols Designed for Profit-and-Loss Sharing</strong> — Moving away from debt-based systems.</li><li><strong>Community-Led Standards for Halal DeFi</strong> — Just like ERC-20 defined token standards, we need a framework for ethical, Shariah-compliant crypto assets.</li></ol><p>This is just the beginning of the conversation. If we get this right, we’re not just building DeFi for Muslims — we’re building a more ethical and inclusive financial future for all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad4e09c081cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[No-Loss Prediction Markets: Designing the Next Big Thing in Forecasting]]></title>
            <link>https://jelilat.medium.com/no-loss-prediction-markets-designing-the-next-big-thing-in-forecasting-945127326e5c?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/945127326e5c</guid>
            <category><![CDATA[sports-prediction-market]]></category>
            <category><![CDATA[crypto-trading]]></category>
            <category><![CDATA[staking]]></category>
            <category><![CDATA[prediction-markets]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 07 Nov 2024 09:31:04 GMT</pubDate>
            <atom:updated>2024-11-07T09:31:04.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrMq8XQ86n_4r16C4u-dbQ.png" /></figure><p>In the lead-up to the 2024 U.S. presidential election, platforms like Polymarket showcased the growing influence of prediction markets on major events. These markets attracted millions by allowing users to bet on outcomes with real-time odds, creating an intriguing way to measure public sentiment. The popularity of these platforms has sparked conversations around their potential to shape and democratize decision-making.</p><p>Inspired by this surge in adoption, I began exploring a different approach to prediction markets: <strong>a no-loss model</strong>. Imagine a platform where participants can place predictions without risking their own money, allowing broader engagement while removing financial risk. In this article, I’ll break down the core design and technical framework I propose for building a no-loss prediction market — a model I believe could make prediction markets accessible to everyone.</p><h3>Understanding Prediction Markets</h3><p>Prediction markets are exchange-traded platforms where individuals can buy and sell contracts based on the outcomes of future events.</p><h4>How Prediction Markets Work: A Step-by-Step Breakdown</h4><ul><li><strong>Creating a Prediction (or Market)</strong>: It all starts with someone creating a market for a specific event. This could be anything from “Will Team X win the championship?” to “Will Candidate Y win the election?” The market then offers two or more possible outcomes, such as “Yes” or “No,” and sometimes more options if the event is complex.</li><li><strong>Setting the Initial Market Price</strong>: When the market opens, an initial price (or odds) is assigned to each outcome, typically based on available data or public sentiment. For example, if the event is “Will it rain tomorrow?” and the chance is perceived as 60%, the “Yes” shares might be priced at $0.60 and the “No” shares at $0.40. Prices in prediction markets work like probabilities, summing up to 1 (or $1) for simplicity.</li><li><strong>Participants Place Their Bets</strong>: People (traders) can now buy shares in the outcome they believe will occur. If they think Team X will win, they buy “Yes” shares; if they doubt it, they buy “No” shares. As traders buy more shares on one side, the price for that outcome adjusts to reflect the increased confidence in it. So, if more people buy “Yes” shares, the price rises, signaling a higher perceived probability of Team X winning.</li><li><strong>Trading and Market Dynamics</strong>: Prediction markets are dynamic: the prices for “Yes” and “No” outcomes fluctuate based on buying and selling activity. If new information emerges, traders may buy or sell shares to match the latest sentiment or data, causing prices to shift in real-time. For example, a key player’s injury might lead to a drop in Team X’s “Yes” price.</li><li><strong>Market Close and Outcome Resolution</strong>: Once the event occurs, the market closes, and the outcome is confirmed. Traders who hold shares of the correct outcome (e.g., those who bought “Yes” shares for a Team X win) receive a payout based on their shares’ final price, typically $1 per share for the correct prediction. Those who bought shares in the incorrect outcome lose their investment, as their shares are now worthless.</li><li><strong>Payout</strong>: The platform distributes winnings based on the number of correct shares a trader holds. If you had bet $0.60 on “Yes” and it was correct, you’d get $1, making a $0.40 profit per share.</li></ul><h4>Traditional Limitations</h4><p>This system works well in many ways, but traditional prediction markets come with risks. Participants put their own money on the line, which can deter engagement. The model also faces challenges like market manipulation, where large bets can sway prices, and limited accessibility, as prediction markets often attract only seasoned speculators.</p><p>By eliminating financial loss, a no-loss prediction market model has the potential to broaden participation, creating a safer, more accessible environment for everyone interested in forecasting outcomes. This no-loss concept opens up exciting possibilities for wider adoption and engagement.</p><h3>The No-Loss Prediction Market Model</h3><p>While prediction markets span numerous fields, this design uses a <strong>niche-based approach</strong> allowing for sustainability and feasibility. By focusing on a specific niche, such as online gaming, we can develop a no-loss prediction model tailored to the needs and interests of a particular audience.</p><h4>Why Gaming as a Case Study?</h4><p>Gaming is an ideal environment for a no-loss prediction market for several reasons:</p><ul><li><strong>Engaged Spectators</strong>: Online gaming attracts millions of viewers, from casual fans to dedicated eSports followers, who actively engage with game outcomes.</li><li><strong>Natural Incentives</strong>: Gamers enjoy interactive experiences, and a prediction market adds a new layer of excitement and involvement without requiring them to risk money.</li><li><strong>Potential for Sponsorships</strong>: Gaming and eSports brands are often keen to sponsor tournaments and events, making it easier to fund prize pools.</li></ul><p>In this model, game spectators place predictions on the outcomes of matches or tournaments, leveraging either sponsorships or platform tokens to participate without financial risk.</p><h4>Mechanisms to Achieve No-Loss</h4><p>With gaming as our primary niche, let’s explore two core approaches for creating a no-loss market model that’s both sustainable and engaging for fans:</p><p><strong>Sponsorship-Based Funding</strong></p><ul><li><strong>Tournament Sponsorships</strong>: Sponsors like game publishers or blockchain platforms contribute to a prize pool, shared among spectators who accurately predict game outcomes.</li><li><strong>User Engagement without Financial Risk</strong>: Spectators can place predictions on game results (like who will win a championship) without risking personal funds. The sponsorships fund the prizes, making it a risk-free engagement for participants. Sponsor prizes may not be limited to financial incentives alone. It could extend to tickets, vouchers, and so on.</li><li><strong>Sponsor Benefits</strong>: Sponsors gain visibility within the gaming community and attract users to their brand or platform. For example, if Base sponsors a tournament prediction market, all the prediction transactions happen on Base, increasing the chain adoption which is the value sponsors get from this arrangement.</li></ul><p><strong>Native Platform Token</strong></p><ul><li><strong>Token-Based Predictions</strong>: Gamers and fans use a native platform token to participate in predictions, staking tokens without the risk of losing them. Winners receive additional tokens as rewards, while others retain their original stakes.</li><li><strong>Engagement-Driven Minting</strong>: The platform could mint new tokens based on metrics like the number of participants or staked tokens, ensuring that token rewards grow proportionally with engagement. This incentivizes more users to join the platform without creating inflationary pressure.</li><li><strong>In-Platform Utility</strong>: Tokens can hold value within the platform, such as for unlocking premium features or exclusive events, or they could be tradeable on exchanges for real-world value. This creates an added incentive for users to engage, boosting the token’s utility and liquidity.</li></ul><p><em>Interest-based liquidity pools are another option, but I won’t be diving into that here. I understand that these pools could potentially fund rewards through generated interest, reducing dependency on sponsorships or token inflation. However, this approach also introduces complexity around investment risk and liquidity management, which warrants a separate deep dive.</em></p><h3>Hybrid Approach: Combining Sponsorships and Tokens in Gaming</h3><p>A combined sponsorship and token approach is especially powerful in a gaming-focused market:</p><ul><li><strong>Draw Users in with Sponsorships</strong>: Initial tournaments or major game events could be entirely funded by sponsors, eliminating entry risk and generating hype around the no-loss model.</li><li><strong>Sustain Engagement with Token Rewards</strong>: As the market grows, the platform can transition to token rewards for predictions, reducing dependence on sponsorships while keeping users engaged. Tokens could even be used to access specific games or features.</li><li><strong>Scalability and Flexibility</strong>: Sponsorships and tokens offer flexibility for sustaining prize pools and broadening the user base, especially as more sponsors recognize the value of engaging with the gaming community.</li></ul><p>By starting with gaming as a niche, this no-loss prediction model demonstrates a practical use case with clear appeal to both sponsors and users. This case study offers insights into how other industries might adopt similar models, using specific audience interests to drive engagement while keeping financial risk at zero.</p><p>While a no-loss prediction market offers unique advantages, it also comes with notable challenges, especially regarding tokenomics, regulatory compliance, and user experience. The core design, which eliminates financial risk for participants, has the potential to make prediction markets accessible to a wider audience, transforming how people engage with forecasting and interactive entertainment.</p><p>I’m yet to fully figure out how to make this model sustainable long-term, and these challenges remain part of the puzzle. However, the goal of this article is to spur a discussion around the feasibility and potential of a no-loss prediction market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=945127326e5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to monitor Starknet wallets]]></title>
            <link>https://medium.com/nethermind-eth/how-to-monitor-starknet-wallets-f500845a1030?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/f500845a1030</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[layer-2]]></category>
            <category><![CDATA[starknet]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Fri, 18 Aug 2023 13:13:07 GMT</pubDate>
            <atom:updated>2023-08-18T13:26:20.047Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to build a Starknet wallet monitoring service with Juno. Set up real-time alerts on wallet activities like token transfers, contract interactions, whale trades, and more.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJb6WOCt4Js-9UeBDvQHuQ.png" /></figure><p><em>By </em><a href="https://twitter.com/tjelailah"><em>Jelilat Anofiu</em></a><em>.</em></p><p>Wallet monitoring is no doubt an important aspect of blockchain interaction. Whether it’s for keeping tabs on your transactions, getting notified about strange activities on specific addresses or even tracking whale trades, a robust wallet monitoring service is invaluable.</p><p>In this tutorial, I’ll guide you through the process of building a wallet monitoring service using Juno, our open-source Starknet node client. This step-by-step guide will cover everything from setting up your node to building the monitoring service itself.</p><h3>Setting up your Starknet node with Juno</h3><p>Before diving into the nitty-gritty of building the monitoring service, you need to first set up your Starknet node using the Juno client. The node enables you to access and interact with Starknet data in real-time.</p><p>To begin the setup process, check out our <a href="https://github.com/NethermindEth/juno">comprehensive documentation</a>. This will walk you through every step and provide additional insights into the functionalities that Juno offers.</p><h3>Building your wallet monitoring service</h3><p>In this section, we’ll build a wallet monitoring service that sends the user an email whenever a transaction is executed by their wallet. We’ll be using TypeScript, NodeJS, and the Mailjet API.</p><h4>Step 1: Setting up your project</h4><p>Start by ensuring you have Node.js and npm installed on your machine. If not, you can download and install them from <a href="https://nodejs.org/en/download/">here</a>.</p><p>Next, create a new directory for your project and navigate into it:</p><pre>mkdir starknet-wallet-monitor<br>cd starknet-wallet-monitor</pre><p>Then, initialize a new Node.js project with npm:</p><pre>npm init -y</pre><p>This will create a package.json file in your directory.</p><h4>Step 2: Installing dependencies</h4><p>We’ll use the <strong>starknet</strong> package to interact with Starknet and the <strong>node-mailjet</strong> package to send emails. Install them with npm:</p><pre>npm install starknet node-mailjet dotenv js-sha3</pre><h4>Step 3: Setting up environment variables</h4><p>We’ll be using environment variables to store sensitive information such as the node URL and Mailjet API keys. Create a new file named <strong>.env</strong> in your project directory and add the following line:</p><pre>STARKNET_NODE_URL=your_juno_node_url<br>MJ_APIKEY_PUBLIC=your_mailjet_public_key<br>MJ_APIKEY_PRIVATE=your_mailjet_secret_key</pre><p>Replace <strong>your_juno_node_url</strong>, <strong>your_mailjet_public_key</strong>, and <strong>your_mailjet_secret_key</strong> with your actual Juno node URL and Mailjet API keys.</p><h4>Step 4: Setting up the Email Notification</h4><p>We’ll use Mailjet to send email notifications whenever a transaction is detected. For that, create a new TypeScript file named <strong>email.ts</strong> in your project directory. This file will handle sending emails through Mailjet. Feel free to use any email provider of your choice.</p><p>In email.ts, paste the following code.</p><pre>import Mailjet from &#39;node-mailjet&#39;;<br><br>const mailjet = Mailjet.connect(<br>    process.env.MJ_APIKEY_PUBLIC!,<br>    process.env.MJ_APIKEY_PRIVATE!,<br>);<br>export const mailjetRequest = async (transactionHash: string) =&gt; {<br>    const response = await mailjet<br>        .post(&#39;send&#39;, { version: &#39;v3.1&#39; })<br>        .request({<br>            Messages: [<br>                {<br>                    From: {<br>                        Email: &quot;wallet-monitor@nethermind.io&quot;,<br>                        Name: &quot;Wallet Monitor&quot;<br>                    },<br>                    To: [<br>                        {<br>                            Email: &quot;user@starknet.com&quot;,<br>                            Name: &quot;user&quot;<br>                        }<br>                    ],<br>                    Subject: &quot;Alert: New Transaction Detected on Your Wallet&quot;,<br>                    TextPart: `Dear User, \\\\n\\\\nWe have detected a new transaction on your StarkNet wallet. You can view the details of this transaction on Voyager by following this link: \\\\n\\\\nhttps://voyager.online/tx/${transactionHash} \\\\n\\\\nPlease review this transaction carefully. If you did not initiate this transaction, it may indicate that your private keys have been compromised. Ensure that your keys are stored securely and consider moving your funds to a new wallet if you suspect any foul play. \\\\n\\\\nStay Safe, \\\\nWallet Monitor`,<br>                    HTMLPart: `&lt;p&gt;Dear User,&lt;/p&gt;&lt;p&gt;We have detected a new transaction on your StarkNet wallet. You can view the details of this transaction on &lt;a href=&quot;&lt;https://voyager.online/tx/${transactionHash}&gt;&quot;&gt;Voyager&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Please review this transaction carefully. If you did not initiate this transaction, it may indicate that your private keys have been compromised. Ensure that your keys are stored securely and consider moving your funds to a new wallet if you suspect any foul play.&lt;/p&gt;&lt;p&gt;Stay Safe,&lt;br/&gt;Wallet Monitor&lt;/p&gt;`<br>                }<br>            ]<br>        })<br>    return response;<br>}</pre><p>Don’t forget to replace &quot;wallet-monitor@nethermind.io&quot; with your actual email address and &quot;user@starknet.com&quot; with the email address you want to send alerts to. Also, make sure to replace process.env.MJ_APIKEY_PUBLIC! and process.env.MJ_APIKEY_PRIVATE! with your actual Mailjet API public and private keys.</p><p>Now, whenever mailjetRequest(transactionHash) is called, an email will be sent to the user with the details of the transaction on <a href="https://voyager.online/">Voyager</a>.</p><p>In the next step, we’ll put it all together and create the logic for the wallet monitoring service in index.ts.</p><h4>Step 5: Building the Wallet Monitoring Service</h4><p>Let’s go back to our index.ts file and import the mailjetRequest function from email.ts:</p><pre>import { mailjetRequest } from &#39;./email&#39;;<br>import { config } from &#39;dotenv&#39;;<br>config();</pre><p>Next, create a function stringToHexFelt that converts strings to <a href="https://docs.starknet.io/documentation/architecture_and_concepts/Hashing/hash-functions/"><em>sn_keccak</em></a><em>.</em></p><pre>const stringToHexFelt = (name: string): string =&gt; {<br>    // Compute the Keccak-256 hash of the name encoded in ASCII<br>    const nameHash = keccak256.array(name);<br>    // Get the last 250 bits of the hash<br>    const last250Bits = nameHash.slice(-31).reverse();<br>    // Convert the bytes to a bigint<br>    let selectorInt = 0n;<br>    for (let i = 0; i &lt; last250Bits.length; i++) {<br>        selectorInt |= BigInt(last250Bits[i]) &lt;&lt; BigInt(i * 8);<br>    }<br>    return &quot;0x&quot; + selectorInt.toString(16);<br>}</pre><p>Create listenToEvents(lastBlockNumber: number) that listens for new events from your Starknet node. If the function finds a new event, it sends an email to the user:</p><pre>const CONTRACT_ADDRESS = ADDRESS_YOU_WANT_TO_MONITOR;<br><br>export const provider = new RpcProvider({<br>  nodeUrl: process.env.STARKNET_NODE_URL!<br>})<br>const listenToEvents = async (lastBlockNumber: number) =&gt; {<br>    let continuationToken: string | undefined;<br>    let lastTransactionHash: string | undefined;<br>    while (true) {<br>        const event = await provider.getEvents({<br>            continuation_token: continuationToken,<br>            from_block: {<br>                block_number: lastBlockNumber,<br>            },<br>            to_block: &quot;latest&quot; as any,<br>            address: CONTRACT_ADDRESS,<br>            keys: [[stringToHexFelt(&quot;transaction_executed&quot;)]],<br>            chunk_size: 1000,<br>        })<br>        continuationToken = event.continuation_token;<br>        for await (const item of event.events) {<br>            const transactionHash = item.transaction_hash;<br>            if (transactionHash != lastTransactionHash) {<br>                // send transaction to email<br>                await mailjetRequest(transactionHash);<br>            }<br>            lastTransactionHash = transactionHash;<br>        }<br>        if (!continuationToken) {<br>            break;<br>        }<br>    }<br>}</pre><p>Lastly, create a loop that keeps checking for new blocks and listens for new events:</p><pre>const getLatestBlockNumber = async () =&gt; {<br>    const block = await provider.getBlock(&quot;latest&quot;);<br>    return block.block_number;<br>}<br><br>const main = async () =&gt; {<br>    let lastBlockNumber = 0<br>    while (true) {<br>        try {<br>            const latestBlockNumber = await getLatestBlockNumber()<br>            console.log(&#39;Latest block number:&#39;, latestBlockNumber)<br>            if (latestBlockNumber &gt; lastBlockNumber) {<br>                await listenToEvents(latestBlockNumber)<br>                // Update lastBlockNumber only after listenToEvents has executed successfully<br>                lastBlockNumber = latestBlockNumber<br>            }<br>        } catch (error) {<br>            console.error(&#39;Failed to fetch latest block number or listen to events:&#39;, error)<br>        }<br>        await new Promise(resolve =&gt; setTimeout(resolve, 30000));<br>    }<br>}<br>main().catch(console.error)</pre><h3>Step 6: Running the Wallet Monitoring Service</h3><p>To run your wallet monitoring service, compile your TypeScript files to JavaScript using the TypeScript compiler. If you haven’t already installed TypeScript, you can do so with the following command:</p><pre>npm install -g typescript</pre><p>Now, compile your TypeScript files to JavaScript:</p><pre>tsc index.ts email.ts</pre><p>Finally, run your service with Node.js:</p><pre>node index.js</pre><p>Alternatively, you can run</p><pre>npx ts-node index.ts</pre><p>Your wallet monitoring service is now running! It will send an email to the specified user whenever a new transaction is detected on the monitored wallet, and print the details of the transaction to the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wazETtrD4PkXBPvQfpdOhg.png" /></figure><p><em>Please note that the code provided in this tutorial is intended for educational purposes and is not suitable for production use.</em></p><p>Want to play a part in Juno’s evolution? Start contributing <a href="https://github.com/NethermindEth/juno">here</a> 😊</p><h3>About us</h3><p><em>Nethermind is a team of world-class builders and researchers. We empower enterprises and developers worldwide to access and build upon the decentralized web. Our work touches every part of the web3 ecosystem, from our Nethermind node to fundamental cryptography research and infrastructure for the Starknet ecosystem.</em></p><p><em>If you’re interested in solving some of blockchain’s most difficult problems, visit our </em><a href="https://nethermind.page.link/careers"><em>job board</em></a><em>!</em></p><h3>Disclaimer:</h3><p>This blogpost has been prepared for the general information and understanding of the readers. The views and strategies described may not be suitable for all readers. No third party should rely on this article in any way, including without limitation as financial, investment, tax, regulatory, legal, or other advice, or interpret this article as any form of recommendation.</p><p>This blogpost does not indicate Nethermind’s endorsement of any particular project or team, nor guarantee its security. Readers should use their best judgment and exercise caution where appropriate.</p><p>To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this blogpost, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f500845a1030" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nethermind-eth/how-to-monitor-starknet-wallets-f500845a1030">How to monitor Starknet wallets</a> was originally published in <a href="https://medium.com/nethermind-eth">Nethermind.eth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web3 Game Development With Lens Protocol and ChainSafe’s Unity SDK]]></title>
            <link>https://medium.com/better-programming/web3-game-development-with-lens-protocol-and-chainsafes-unity-sdk-f4b502bdfa02?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b502bdfa02</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 04:31:57 GMT</pubDate>
            <atom:updated>2022-09-06T17:40:18.266Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build Blockchain Games with Lens Protocol and Chainsafe’s Unity SDK</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yc0D_Eh4bUHsYEpRuUKBzQ.png" /></figure><p>A lot of people know Lens Protocol as a decentralized social graph that makes it easy for anyone to build a social network on the Blockchain. As a result, we’ve seen many developers build exciting social applications on Lens.</p><p>Some of the ones I find interesting are <a href="https://lenster.xyz/">Lenster</a> (a decentralized, and permissionless social media app), <a href="https://lenstube.xyz/">Lenstube</a> (a decentralized video-sharing social media platform), and <a href="https://www.lensdrop.xyz/">Lensdrop</a> (an app that lets you airdrop tokens to your followers and those who engage with your posts).</p><p>However, one cool use case that hasn’t really been explored by developers is Web3 gaming. I recently won a <a href="https://ethglobal.com/showcase/lensgame-w2yr6">prize</a> at EthGlobal’s HackFS 2022 Hackathon for building a <a href="https://lensgame-marketplace.vercel.app/">Web3 Game and Gaming Marketplace</a> on Lens Protocol. Therefore, I decided to create this tutorial for other developers to learn about how they can also build their own Blockchain Games on Lens.</p><p>At the end of this tutorial, you should have a basic understanding of how Chainsafe’s Unity SDK works and also be able to integrate Lens Protocol into your Unity Game.</p><h3>Project Initialisation and Installing Dependencies</h3><p>For this project, we’ll be building a token-gated game that can only be played by those who have collected our publication on Lens. In case you are not familiar with the Collect Module, here’s a simple explanation from the Lens documentation.</p><blockquote>Collects allow creators to monetize their content. Because creators own their content via the Lens Protocol, they are able to allow their followers to purchase that content.</blockquote><blockquote>When a user posts a <a href="https://docs.lens.xyz/docs/publication">publication</a> to their <a href="https://docs.lens.xyz/docs/profile">Profile NFT</a> they have the option to set a Collect Module. This module will allow other users to mint NFTs that link to the publication’s ContentURI. This module can contain any arbitrary logic to apply to the minting process and the resulting NFT.</blockquote><h4>Install the Chainsafe Unity SDK</h4><p>Chainsafe’s Unity SDK makes it easy for developers to build Blockchain-enabled games on Unity. Go through the following steps to install the SDK.</p><ol><li>Visit Chainsafe’s web3.unity <a href="https://github.com/ChainSafe/web3.unity/releases">release page</a>.</li><li>Click on the <strong>web3.unitypackage </strong>to install.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ox5z0pjnbZOL1vnGpVFlSg.png" /><figcaption>Chainsafe unity SDK installation</figcaption></figure><h4>Download the Game Asset</h4><p><em>You can skip this part if you’d like to build your game from scratch or already have a game that you’d like to integrate with Lens Protocol and Chainsafe.</em></p><p>To avoid building a game from scratch, we’ll be using a <a href="https://assetstore.unity.com/packages/templates/tutorials/adventure-sample-game-76216">Sample Game</a> from the Unity Asset Store. Go to the <a href="https://assetstore.unity.com/packages/templates/tutorials/adventure-sample-game-76216">Unity Asset Store</a>, then click on <strong>Add to My Assets </strong>to add the game kit to your assets on Unity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dp3pLVvUj4ua_e6sb3TYRw.png" /></figure><h4>Create your Unity Game</h4><p><em>You need to have Unity installed to go along with this tutorial. If you don’t already have it installed, you can do so </em><a href="https://unity3d.com/get-unity/download"><em>here</em></a><em>.</em></p><ol><li>Open the Unity Hub application on your computer.</li><li>Navigate to the <strong>Projects </strong>directory and click on <strong>New Project</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PK3JlASpmN2-5ac3se0ohA.png" /></figure><p>3. After that, name your project and click on <strong>Create project</strong>. This should open a new project for you in Unity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LEwko513hHd_FhZ-kFOplA.png" /></figure><h4>Import Game Assets</h4><p>1. In the Unity Editor, go to <strong>Window&gt;Package Manager</strong>. This should show the Package Manager modal.</p><p>2. Navigate to the <strong>My Assets </strong>section on the Package Manager to view your assets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGG1mNG3Oe5cWy8xua9DZA.png" /></figure><p>3. Click on the <strong>2D Game Kit</strong>, download the asset if you haven’t already done that, then click on <strong>Import </strong>to add it to your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*efs5CRTuaPgKJrp_NhsNKw.png" /></figure><p>4. Go to <strong>Assets&gt;Import Package&gt;Custom Package</strong>, then import the <strong>web3.unitypackage </strong>you installed earlier. This will import Chainsafe’s Unity SDK into your game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFuDISIj3VESym2zUMoI1g.png" /></figure><h3>Posting a Collectible Publication on Lens Protocol</h3><p>Since we’ll be building a game that can only be accessed by those who collected our publication, we need to create the collectible publication on Lens Protocol. There are a few ways to do this.</p><h4>Lens API</h4><p>You can post a collectible publication yourself using the Lens API. You can check the <a href="https://docs.lens.xyz/docs/publication-1">documentation</a> for more details.</p><h4>Lenster</h4><ol><li>Go to <a href="https://lenster.xyz/">Lenster</a>, then connect your wallet and sign in with Lens.</li><li>Enter a description and upload an image for your collectible. This image is what will be shown on OpenSea and other NFT Marketplaces.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHpqiZVcNnjhcNh1fHx_1g.png" /></figure><p>3. Click on the Collect icon to select a Collect Module. In case you’re not sure which module to choose, you can hover on the info icon or visit <a href="https://docs.lens.xyz/docs/icollectmodulesol">Lens docs</a> to learn more about each module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oflh4pT8p-eSTGO21YKu_g.png" /></figure><h4>Lensgame Marketplace</h4><ol><li>Go to <a href="https://lensgame-marketplace.vercel.app/list">Lensgame Marketplace</a>, then connect your wallet and sign in with Lens.</li><li>Enter a Title, Description, and upload an image for your collectible.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1XQ4cLogwh06-xZO1PrS7A.png" /></figure><p>4. Select a Collect module and go ahead to list your item after completing the form.</p><p><em>PS: The Lensgame Marketplace is still in development and the most effective way to post your publication at the moment is </em><strong><em>Lenster</em></strong><em>.</em></p><h3>Token-Gating your Unity Game</h3><h4>Collect Publication</h4><p>Open the publication on Lenster, then click on the Collect icon to collect the publication. After collecting the publication, it should appear on your OpenSea profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4a88Mh91XmM-eUbsQglHsw.png" /></figure><h4>Add Publication to Game</h4><ol><li>In the project directory, right-click on <strong>Assets </strong>and go to <strong>Create&gt;Scene </strong>to create a new scene. You can name the scene whatever you want, but I named mine <strong>BalanceVerification. </strong>Double-click on the new scene to view it.</li></ol><p>2. Go to Assets&gt;Web3Unity&gt;Prefabs&gt;ERC721, then drag and drop BalanceOf721<strong> </strong>into the scene. Double-click on the ERC721BalanceOfExample Script and it’ll automatically open the file in your code editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhpCasNRn654WZWOxscz_A.png" /></figure><p>You should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9n2bwJINchJGVkQzW-YKHw.png" /></figure><p>3. Now, go to your profile on OpenSea and click on the collected publication. For this tutorial, I’m using this <a href="https://lenster.xyz/posts/0x0d-0xd4">publication</a> posted by Yoginth.</p><p><em>In case you can’t find the collected publication on your OpenSea profile, go to </em><strong><em>More&gt;Hidden </em></strong><em>and you should find it there.</em></p><p>Go to Details on the NFT page and copy the contract address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwxTnWN5ru2A5Vb-Bo_hQw.png" /></figure><p>4. Go back to the ERC721BalanceOfExample<strong> </strong>Script on VSCode and edit it as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c55607bc084cfa8c59a0770fa6f74e2a/href">https://medium.com/media/c55607bc084cfa8c59a0770fa6f74e2a/href</a></iframe><p>5. Go to Web3GL Templates&gt;Web3GL-2020x, then open the network.js<strong> </strong>file in your code editor and change the chain id to 137, which is the id for the Polygon network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fdi04w58tMIvrWw1zmjCnw.png" /></figure><p>6. Add a Canvas with the text <strong>“Insufficient token balance” </strong>to your scene. Make sure to uncheck it so it’s not active by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*075Y0CBEenEnN_cQlVabMQ.png" /></figure><p>7. Go to Web3Unity&gt;Scenes<strong> </strong>and double-click on WebLogin<strong> </strong>to edit your login scene. You can modify it as much as you want, so it’s more visually appealing for your game.</p><h3>Publishing your Game</h3><p>Now that you’ve added the token-gating feature, it’s time to publish your game. In the menu, go to File&gt;Build Settings.</p><ol><li>Click on the “Add Open Scenes<strong>” </strong>button to add the WebLogin and BalanceVerification Scenes to your game. Once added, drag and drop the scenes to the top, so they’re at index 0 and 1 respectively.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vAIxmx3FY9EX6XLM_tyMg.png" /></figure><p>2. On the Platform menu, click on “WebGL”, then the “Switch Platform”<strong> </strong>button.</p><p>3. Go to “Player Settings”, then select Web3GL-2020x<strong> </strong>as the WebGL Template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVVIf3MnFFRSnADkbq90Fg.png" /></figure><p>In case you are getting any errors, go to “Other Settings<strong>”</strong>, then remove the depreciated WebGL 1.</p><p>4. Go back to your Build Settings and click on “Build and Run”<strong> </strong>to play your game.</p><p>Now that your game is ready, you can publish it on itch.io and other similar sites.</p><p>Voila! You have successfully built a Web3 Game on Lens Protocol. Share your game and receive feedback from players.</p><p><em>PS: The code associated with this tutorial can be found </em><a href="https://github.com/jelilat/Lens-Tutorial"><em>here</em></a><em>. If you prefer watching a video tutorial, you can check this out.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDKhO4cwKLDs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDKhO4cwKLDs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDKhO4cwKLDs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/21885cad3ec15b6b83133f1b6fcff1b1/href">https://medium.com/media/21885cad3ec15b6b83133f1b6fcff1b1/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b502bdfa02" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/web3-game-development-with-lens-protocol-and-chainsafes-unity-sdk-f4b502bdfa02">Web3 Game Development With Lens Protocol and ChainSafe’s Unity SDK</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending Static Calls to a Smart Contract With Ethers.js]]></title>
            <link>https://medium.com/better-programming/sending-static-calls-to-a-smart-contract-with-ethers-js-e2b4ceccc9ab?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2b4ceccc9ab</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[uniswap]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 17 Mar 2022 12:12:08 GMT</pubDate>
            <atom:updated>2023-05-07T11:29:29.430Z</atom:updated>
            <content:encoded><![CDATA[<h4>Save millions in gas fees by checking whether a transaction will fail before sending it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*HL6bWIWx1QW3tGa85FA2Fg.png" /><figcaption>Metamask Transaction confirmation screenshot</figcaption></figure><p>A few months ago, I got the above error message from Metamask while trying to confirm an Ethereum transaction. Metamask had just added the feature at the time, and I <a href="https://twitter.com/tjelailah/status/1481862406678716417">tweeted</a> about how it is a great UX improvement.</p><p>Apparently, I had entered invalid input variables on my dApp while testing an interaction with the Uniswap Smart Contract. Out of curiosity, I sent the transaction anyways to see if it’ll actually fail — and yes, it did.</p><p>But, how did Metamask know that the transaction was going to fail? This was a question that lingered in my mind for a while till I found an answer to it.</p><p>If you are also a curious mind like me, follow along with this article and I’ll answer the “how” by showing you how to use ethers.js to check the validity of a transaction before sending it.</p><h3>Blockchain Transactions</h3><p>Blockchain transactions are immutable by default, which means that there’s no way to reverse a transaction that has already been confirmed. For instance, if you send ETH to the wrong Ethereum address, there is no way you can recover it. Unless the address owner is nice enough to send you a refund.</p><p>A way to prevent this is by double-checking an address before confirming the transaction or using ENS names that can easily be read. But what about other kinds of transactions (e.g. Minting NFTs)?</p><p>According to the <a href="https://dune.xyz/BuycoinsR/Tubbycat-NFT-minting-analysis">Tubbycat NFT sale analysis</a> by <a href="https://twitter.com/BuycoinsR">Buycoins Research</a>, about 776 ETH (~2 million USD at the time) was spent on failed transaction fees. This is only a tiny fraction when it comes to how much is being lost by the entire ecosystem on failed transactions. Some of these transaction fees are burned, while others go to miners.</p><p>Although there are other factors like frontrunning attacks that could cause a pending transaction to eventually fail, some of the transaction failures can be prevented by checking its validity beforehand.</p><h3>Static Calls</h3><blockquote>Rather than executing the state-change of a transaction, it is possible to ask a node to <em>pretend</em> that a call is not state-changing and return the result.</blockquote><blockquote>This does not actually change any state, but is free. This, in some cases, can be used to determine if a transaction will fail or succeed.</blockquote><p>Let’s consider this example:</p><p>Alice wants to order a burger from Bob’s fast food restaurant but will have to drive down there to get it. Bob makes the best burgers in the County and he sells out really fast.</p><p>If Alice drives down to the restaurant after the burgers have sold out, she would have wasted her time, energy, and gas. Therefore, she needs to know if the burgers are still available before she heads to the restaurant.</p><p>Bob’s restaurant has a website where he updates the sales so that people can see how many burgers are left. If Alice checks the website and sees that the burgers have been sold out, she stays in and doesn’t waste her resources driving down.</p><p>Otherwise, she drives down to the restaurant and gets her favorite burger. This scenario is similar to how static calls are made to check whether a transaction may fail or not.</p><h3>Making a Static Call with NodeJS</h3><p>In this section, we’ll make a static call to the <a href="https://rinkeby.etherscan.io/address/0xc36442b4a4522e871399cd717abdd847ab11fe88">Uniswap V3 contract</a> and attempt to transfer a liquidity position we don’t own.</p><p>Before getting into the code, make sure you have ethers installed. If you don’t, install it with the following command:</p><pre>npm install --save ethers</pre><p>After successful installation, open the Uniswap contract <a href="https://rinkeby.etherscan.io/address/0xc36442b4a4522e871399cd717abdd847ab11fe88#code">code</a> on Etherscan. Scroll down to the contract ABI and copy it to the clipboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TiKv70uN2fSEUZ0C_P3OZQ.png" /><figcaption>Uniswap V3 ABI</figcaption></figure><ul><li>Create an abi.json file and paste the ABI into it.</li><li>Next, create a new file that’ll be used to make the statical call.</li><li>Import the ethers library and abi into your code.</li></ul><pre>const { ethers } = require(&#39;ethers&#39;);</pre><pre>require(&#39;dotenv&#39;).config()</pre><pre>const abi = require(&#39;./abi.json&#39;)</pre><ul><li>Define the contract address, signer, and initialize the contract.</li></ul><pre>const contractAddress = &quot;0xC36442b4a4522E871399CD717aBDD847Ab11FE88&quot;</pre><pre>const signer = new ethers.Wallet(</pre><pre>   process.env.PRIVATE_KEY,<br>   ethers.getDefaultProvider(&#39;mainnet&#39;)</pre><pre>);</pre><pre>const contract = new ethers.Contract(contractAddress, abi, signer);</pre><p>This example uses the default provider from ethers. However, when creating your app, make sure to sign up for your own provider on <a href="http://infura.io/">Infura</a> to increase your request rate/limit and have access to call metrics.</p><ul><li>Define the transaction variables.</li></ul><pre>const from = &quot;0x66fe4806cD41BcD308c9d2f6815AEf6b2e38f9a3&quot;</pre><pre>const to = &quot;0xC41672E349C3F6dAdf8e4031b6D2d3d09De276f9&quot;</pre><pre>const tokenId = 100</pre><p>The from address is neither the owner nor approved spender of token 100 and therefore, can’t transfer it to another address. But let’s try to transfer it with the callStatic method to see the outcome.</p><pre>const transaction = async () =&gt; {</pre><pre>const a = await contract.transferFrom.staticCall(from, to, tokenId)</pre><pre>   console.log(a)</pre><pre>}</pre><pre>transaction()</pre><p>When you try this, you should get an error similar to the one below.</p><pre>reason: &#39;ERC721: transfer caller is not owner nor approved&#39;,<br>  code: &#39;CALL_EXCEPTION&#39;,<br>  method: &#39;transferFrom(address,address,uint256)&#39;,<br>  errorArgs: [ &#39;ERC721: transfer caller is not owner nor approved&#39; ],<br>  errorName: &#39;Error&#39;,<br>  errorSignature: &#39;Error(string)&#39;,<br>  address: &#39;0xC36442b4a4522E871399CD717aBDD847Ab11FE88&#39;,<br>  args: [<br>    &#39;0x66fe4806cD41BcD308c9d2f6815AEf6b2e38f9a3&#39;,<br>    &#39;0xC41672E349C3F6dAdf8e4031b6D2d3d09De276f9&#39;,<br>    100<br>  ],<br>  transaction: {<br>    data: &#39;0x23b872dd00000000000000000000000066fe4806cd41bcd308c9d2f6815aef6b2e38f9a3000000000000000000000000c41672e349c3f6dadf8e4031b6d2d3d09de276f90000000000000000000000000000000000000000000000000000000000000064&#39;,<br>    to: &#39;0xC36442b4a4522E871399CD717aBDD847Ab11FE88&#39;,<br>    from: &#39;0xC41672E349C3F6dAdf8e4031b6D2d3d09De276f9&#39;<br>  }<br>}</pre><p>You can see the reason: ‘ERC721: transfer caller is not owner nor approved’ as the reason why this transaction will fail. The most important thing is that static call is a read-only function and is gasless.</p><p>By integrating a static call in your dApp, bots, etc., you will save a lot of money that could have been spent paying gas fees for failed transactions.</p><p>If you managed to follow through up till this point, then you must have successfully sent a static call to the Blockchain. Great job!</p><p>You can check out the full code below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c33e58c143d9f103e2aee0f917210cc/href">https://medium.com/media/1c33e58c143d9f103e2aee0f917210cc/href</a></iframe><p><strong>PS: This tutorial uses ethers v6.3. It may not be compatible with newer ethers versions</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2b4ceccc9ab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/sending-static-calls-to-a-smart-contract-with-ethers-js-e2b4ceccc9ab">Sending Static Calls to a Smart Contract With Ethers.js</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Add the Uniswap Swap Widget to your React dApp]]></title>
            <link>https://medium.com/geekculture/how-to-add-the-uniswap-swap-widget-to-your-react-dapp-9be353e2bd46?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/9be353e2bd46</guid>
            <category><![CDATA[uniswap-v3]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 14:03:00 GMT</pubDate>
            <atom:updated>2022-03-10T14:03:00.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNUwLJSv46HdFnUimSVXGA.png" /><figcaption><a href="https://docs.uniswap.org/sdk/widgets/swap-widget">Swap widget state</a></figcaption></figure><p>A few weeks ago, I attended the Polygon Guild Lagos event where <a href="https://twitter.com/TejuAdeyinka">Teju</a> gave a talk on <strong>People Over Protocols </strong>and how we can improve the User Experience in Web3 by anticipating users’ needs.</p><p>She spoke about her experience trying to stake on a dApp, but couldn’t do so because she didn’t have the required token. In addition to expressing her dissatisfaction, she touched on how we can make this experience better by making it easy for users to access the required token in-app.</p><p>This stuck with me, and I’ve since made it a thing to consider token accessibility when building any web3 product. Therefore, I decided to try my hands on the Uniswap Labs Swap Widget so that users can swap tokens on the Uniswap Protocol without leaving my dApp.</p><p>While working on this, I came across some minor roadblocks and also got to learn of the common issues others faced by combing the Uniswap discord server. So I decided to write a beginner-friendly guide so you don’t have to face the same issues we did.</p><h3>The Swap Widget</h3><p>In cases whereby you need your users to carry out transactions in a native token (e.g. ENS), you need to make it easy for them to get the token without leaving your dApp. Doing this will help improve your user experience and also reduce drop-off due to the inaccessibility of a native token.</p><p>Adding the Swap widget to your dApp is pretty straightforward, and can be done in just a few lines of code. But before we go into the implementation, here are a few things you need to get started.</p><h4>JSON-RPC Endpoint</h4><p>The JSON-RPC Endpoint is required to fetch on-chain data and submit transactions. If you already have one in your DApp, you can skip this step. But if you don’t, you can easily create one on services like <a href="http://infura.io/">Infura</a> or <a href="http://alchemy.com/">Alchemy</a>.</p><p>Here is a simple guide on how to create one on Infura:</p><p><strong>Step 1: </strong>Go to the Infura website, then sign up or log in to your account if you already have one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6TSRisoKQu_6dWg222I4w.png" /></figure><p><strong>Step 2: </strong>Navigate to your Dashboard and click on CREATE NEW PROJECT”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Km49mQ4dzABML-_5Onp8_A.png" /></figure><p><strong>Step 3: </strong>Select an applicable product, give your project a name and click on CREATE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wwait3NBarHt4-GeXEVmhA.png" /></figure><p><strong>Step 4: </strong>Scroll down to <strong>Keys </strong>and copy your endpoint URL or Project ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C726DlRK5Kc23kvS4jKTxw.png" /></figure><p>Great job! You’ve successfully generated a JSON-RPC Endpoint.</p><p><strong>Web3 Provider</strong></p><p>The Swap widget also needs a web3 provider to fetch balances and submit transactions through the user’s connected wallet. If you’re creating a DApp, then you’ll need a web3 provider.</p><p>There are various providers you can choose from. But in this article, we’ll be using <a href="https://docs.ethers.io/v5/api/providers/">ethers</a>.</p><pre>//install the ethers library</pre><pre>npm install --save ethers</pre><h4><strong>Wallet Connect Flow</strong></h4><p>You also need a wallet connect flow in your app so that users can connect their wallets to carry out transactions. There are various libraries you can use (e.g. web3-react, wagmi, etc.). For simplicity, we will be connecting to a user-installed browser wallet like metamask.</p><p>However, we can only do this if the user has a wallet installed. So, we will be checking for wallet installation using metamask’s, detect-provider library.</p><pre>//install metamask detect-provider</pre><pre>npm install --save @metamask/detect-provider</pre><p>Now that we’ve gotten our requirements ready, let’s get started.</p><h3>Adding the Widgets Library</h3><p>To get started, install the widgets library and react-redux if you don’t already have it installed.</p><pre>//install the swap widget</pre><pre>npm install --save @uniswap/widgets react-redux </pre><pre>or</pre><pre>yarn add @uniswap/widgets react-redux</pre><h4>Import App Dependencies</h4><pre>//Store some state variables.<br>import { useState } from &#39;react&#39;;</pre><pre>//connect to our infura endpoint<br>import { providers, ethers } from &#39;ethers&#39;;</pre><pre>//check if metamask is installed in the browser.<br>import detectEthereumProvider from &#39;@metamask/detect-provider&#39;;</pre><pre>//uniswap widgets library<br>import { SwapWidget } from &#39;@uniswap/widgets&#39;;</pre><h4>Define Constants</h4><pre>const infuraId = process.env.REACT_APP_INFURA_ID;<br>const jsonRpcEndpoint = `https://mainnet.infura.io/v3/${infuraId}`;<br>const jsonRpcProvider = new providers.JsonRpcProvider(jsonRpcEndpoint);<br>const provider = new ethers.providers.Web3Provider(jsonRpcProvider);</pre><h4>Define State Variables</h4><pre>function App() {</pre><pre>  const [account, setAccount] = useState({<br>      address: &#39;&#39;,<br>      provider: provider,<br>  })</pre><h4>Create connectWallet function</h4><pre>async function connectWallet() {</pre><pre>//check if Metamask is installed in the browser<br>const ethereumProvider = await detectEthereumProvider();</pre><pre>  if (ethereumProvider) {</pre><pre>  //prompt user to connect their wallet<br>  const accounts = await window.ethereum.request({<br>        method: &#39;eth_requestAccounts&#39;,<br>      })</pre><pre>     const address = accounts[0];</pre><pre>     setAccount({<br>        address: address,<br>        provider: ethereumProvider<br>     })<br>  }<br>}</pre><p>You might be wondering why we added a provider at all when it was going to be updated anyways. Here’s why 👇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOwnRJLj7CKCqj3TJ0JirQ.png" /></figure><p>If we don’t define a provider from the start, our widget is going to show up this way when we load our app.</p><h4>Add Return Elements</h4><p>Finally, we add our return elements. You can see here that the “Connect wallet” button calls the connectWallet function onClick. The SwapWidget also takes in 2 parameters; the provider and JsonRpcEndpoint.</p><pre>return (<br>  &lt;div className=&quot;App&quot;&gt;<br>    &lt;div&gt;<br>      &lt;button onClick={connectWallet}&gt;Connect Wallet&lt;/button&gt;<br>    &lt;/div&gt;</pre><pre>    &lt;div className=&quot;Uniswap&quot;&gt;<br>      &lt;SwapWidget<br>        provider={account.provider}<br>        JsonRpcEndpoint={jsonRpcEndpoint} /&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>  );<br>}</pre><p>Great job! You’ve successfully added the Swap Widget to your dApp. Now, you can run npm start to view your dApp.</p><p>You can check out the full code on <a href="https://github.com/jelilat/uniswap-widget">GitHub</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82899c914c8fbacfb388791d516f53d1/href">https://medium.com/media/82899c914c8fbacfb388791d516f53d1/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be353e2bd46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/how-to-add-the-uniswap-swap-widget-to-your-react-dapp-9be353e2bd46">How to Add the Uniswap Swap Widget to your React dApp</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum EIP Upgrade — Facts, Misconceptions, and Investment Implications]]></title>
            <link>https://jelilat.medium.com/ethereum-eip-upgrade-facts-misconceptions-and-investment-implications-19a531af3a50?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/19a531af3a50</guid>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[ethereum-mining]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 05 Aug 2021 13:26:01 GMT</pubDate>
            <atom:updated>2021-08-19T16:09:40.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ethereum EIP Upgrade — Facts, Misconceptions, and Investment Implications</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XIMfdFak5106XMA4" /><figcaption>Photo by <a href="https://unsplash.com/@executium?utm_source=medium&amp;utm_medium=referral">Executium</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ethereum is no doubt the most expensive blockchain to use in the world right now. Although taking the number 2 spot behind Bitcoin in market capitalisation, it takes a leading position as the most expensive blockchain in usage cost.</p><p>In June 2021 alone, users paid over $165 million in transaction fees to interact with the Ethereum blockchain. This is over 300% greater than Bitcoins’ $42 million+ transaction fees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*BCerkO6YHnpcMtjWonsuxg.png" /><figcaption>Chart: <a href="http://buycoins.africa/">Buycoins Research,</a> Source: Coin Metrics</figcaption></figure><p>To address the ridiculous market fees paid by Ethereum users, it is expected to undergo a radical change known as <a href="https://eips.ethereum.org/EIPS/eip-1559">Ethereum Improvement Proposal (EIP) 1559</a>. Starting from this August, Ethereum users will no longer have to participate in the blind auction-like process of determining transaction fees.</p><h3>What is EIP-1559?</h3><p>EIP-1559 is a proposal to make Ethereum transactions more efficient by using a hybrid system of base fees and tips to more evenly incentivise miners in high and low network congestion periods<em>.</em></p><p>With EIP-1559, the network will automatically calculate a base fee according to the current demand for block space. All users need to pay this base price to have their transactions processed. However, unlike before, the base transaction fee will be burned instead of going to the miners.</p><p>This will eliminate the practice whereby miners select which transactions to process first based on the bid price. However, users can still include an optional tip to speed up their transaction processing.</p><h3>How EIP-1559 Works</h3><p>Currently, Ethereum miners are rewarded for their computational power through a gas-bidding process that resembles an auction. EIP-1559 will replace this with a new transaction pricing mechanism that’s based on gas rates.</p><p>So, rather than users determining their gas price, Ethereum will introduce a base fee into its blockchain protocol. This base fee will be automatically calculated based on network activity.</p><h4>The Base Fee</h4><p>The base fee is the minimum gas price required to verify or process a transaction in the Ethereum Blockchain. This fee fluctuates based on how much space is being used by each block on Ethereum.</p><p>Although the maximum amount of gas on each Ethereum block is 15 million, EIP 1559 would allow a 2X increase during network congestion. When this happens, the base fee required to execute a transaction will increase by 12.5%.</p><p>On the other hand, if the number of transactions on the block is very low (way below 15 million), EIP 1559 would automatically reduce the base fee by 12.5%. This reduction will be made successively until it reaches a lower bound of almost zero.</p><p>It is important to note that users can only pay the base fee in ether (ETH).</p><h4>Burn Mechanism</h4><p>Once the user pays the base fee, it is burned and permanently removed from the total circulation of ether. This is done to discourage miners from artificially congesting the networks to keep the base fee high.</p><p>This used to be a common practice among miners during the auction-like fee bidding process.</p><h4>Inclusion Fee</h4><p>The inclusion fee is an optional fee that users can choose to pay in addition to the base fee. It can be regarded as a tip to encourage miners to handle their transactions above others.</p><p>This optional fee is intended only to be used by individuals and businesses that need the fastest network confirmation times.</p><h3>Importance of the EIP-1559 Upgrade</h3><p>One may wonder why there is a need to replace Ethereum’s auction-like fee system with the base fee. Here are a few reasons why it’s important to do so.</p><h4>1. Regulation of ether supply</h4><p>The supply of ether is unlimited, unlike Bitcoin that can only have a maximum of 21 million coins. Compared to bitcoin with only approx. 113% increase, the supply of ether has increased by over 351% since 2016. The economic impact of this is that ether holdings will become diluted over time as more of it is created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*JyxdViE7XaHIS62KR8zdCA.png" /><figcaption>Chart: <a href="http://buycoins.africa/">Buycoins Research</a>, Source: Coin Metrics</figcaption></figure><p>With EIP 1559’s burning mechanism, coins will be automatically taken out of circulation after being issued. This will help decrease the active supply rate on Ethereum.</p><h4>2. Prevents economic abstraction of ether</h4><p>This upgrade ensures that all transaction fees are paid in ether. Although most of the transaction fees are currently paid in ether, there is no requirement preventing users from doing otherwise.</p><p>Although uncommon, miners can receive transaction fees in other currency as seen <a href="https://www.notion.so/fa3277e743e5556c134de812605a6dde">here</a>.</p><p>With EIP-1559, the system automatically sets a base price that is paid by the user in ether. However, a miner may decide to receive a tip (inclusion fee) from the user outside the system to prioritise a transaction.</p><p>Similar to how nations make policies to increase the value of their currency, this upgrade with help increase the demand for ether and, by extension, its value.</p><h4>3. Reduces the volatility of transaction fees</h4><p>As seen over the years, average gas fees can get ridiculously high when left up to users. EIP-1559 can prevent this by ensuring that fees can only record a 1.125x increase or decrease on each block. This provides some form of stability in Ethereum’s ridiculously volatile market.</p><h3>Misconceptions About the EIP-1559 Upgrade</h3><h4>1. Decrease in transaction fees</h4><p>Contrary to what a lot of people believe, EIP 1559 will not help reduce the transaction fees on ETH. Rather, it will only provide transparency and stability to the base fee computation process. The upgrade still doesn’t change the fact that there’s a limit to the number of transactions that Ethereum can handle at a time.</p><h4>2. Miner attrition and sabotage</h4><p>Currently, Ethereum miners make about 50% of their revenue through transaction fees. But according to recent estimates, their revenue generation rate could reduce by 20 to 30%.</p><p>Some people believe that this may cause miners to quit mining on the blockchain. Therefore, if this happens and only a few miners are on the network, the network may become vulnerable to a 51% attack. However, this is very unlikely because it could mean that miners will have to sabotage their earnings on the network, which is a lot.</p><h3>Investment Implications of EIP-1559</h3><p>There are 3 main stakeholders on Ethereum that will be affected by the EIP upgrade, namely, investors, miners, and users. These stakeholders invest their time, money, and other resources to building the Ethereum ecosystem.</p><p>Here are a few ways this upgrade could affect them.</p><h4>1. Technology risk</h4><p>The activation of EIP-1559 could result in unforeseen bugs and malicious user behaviour. Although Ethereum adapts opensource audits to review security issues, this does not completely absolve it from vulnerabilities.</p><p>An example of such happened in January 2019 when ChainSecurity discovered a security vulnerability in EIP 1283 just 48 hours before its activation on the main Ethereum network. Such a dangerous occurrence could lead to huge monetary loss and affect investor’s confidence in Ethereum.</p><h4>2. Decrease in revenue</h4><p>Previously, miner revenue comes from 2 major sources, block rewards and transaction fees. With the burning mechanism introduced in EIP 1559, miners are left with block rewards and the optional inclusion fee.</p><p>Since the inclusion fee is optional, some users won’t pay it, and those who do may not pay enough to replace what was being earned on transaction fees. This means that miners may not make enough money to cover their computational costs. Even if it did, they likely wouldn’t make as much money as they used to.</p><h4>3. Stability and predictability</h4><p>One of the major impacts of EIP 1559 for users is the increased transparency into how Ethereum gas fees are determined. It prevents unnecessary wait time for users who underestimate how much gas fee is needed to perform a transaction and generally provides a great user experience.</p><h4>4. Economic value</h4><p>By regulating the supply of ether and increasing its demand through base fees payments in ether, we may record an upward movement of ETH’s price. It is expected that the EIP upgrade will push the value of ether towards an increase.</p><h3>Conclusion</h3><p>The major goal of the EIP 1559 upgrade is to reduce volatility and provide transparency into how Ethereum gas fees are determined.</p><p>The main beneficiaries of this upgrade are users who no longer have to pay ridiculous gas fees to have their transactions processed on the Ethereum blockchain. This is expected to increase the adoption of the decentralised apps built on Ethereum.</p><p>Also, ensuring that the base price is paid with ether and introducing the burning mechanism will help increase the economic value of ether. This is a win for investors because their assets will soar higher in value.</p><p>On the other hand, Miners may not find this upgrade pleasing because it largely affects their revenue. Hence, creating an unsettling possibility of a 51% attack.</p><p>However, if Ethereum can significantly increase its economic value due to the burning mechanism and increasing ether demand, the miners will be well compensated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19a531af3a50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum London Hard Fork — What Is It About?]]></title>
            <link>https://jelilat.medium.com/ethereum-london-hard-fork-what-is-it-about-9726b5a4e2ed?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/9726b5a4e2ed</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Thu, 05 Aug 2021 13:08:51 GMT</pubDate>
            <atom:updated>2021-08-05T13:27:44.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ethereum London Hard Fork — What Is It About?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r6Q0eTmPemeQydq5" /><figcaption>Photo by <a href="https://unsplash.com/@executium?utm_source=medium&amp;utm_medium=referral">Executium</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Just like companies upgrade their software to fix bugs and introduce new features, the Blockchain network also receives several upgrades to make it more efficient. The difference, however, is that blockchain upgrades are decentralised and can be proposed by anyone in the network.</p><p>In the case of Ethereum, anyone in the community can create an Ethereum Improvement Proposal (EIP) detailing any kind of improvement they’d like to see in the network. The EIPs agreed upon by a majority of the community members can be combined together to make up an upgrade.</p><p>One of these kinds of upgrades is the Ethereum London Hard Fork that is scheduled to launch at <a href="https://etherscan.io/block/countdown/12965000">block height 12,965,000</a>, which is approximately 5th of August 2021 at 13:23 (WAT).</p><h3>What Is a Hard Fork?</h3><p>A hard fork, in blockchain, is a new software upgrade that creates a separate network that is incompatible with the existing blockchain protocol and runs parallel with it. Unlike soft forks, hard forks introduce a permanent change in a blockchain protocol’s rules and are not backwards compatible.</p><p>Due to the fast-evolving nature of blockchain innovation, regular improvement is needed to aid efficiency and protect the network from security vulnerabilities. A notable example of such improvement was the creation of the new Ethereum chain after the original chain suffered a devastating $150 million hack in 2016 due to security vulnerabilities.</p><h3>The London Hard Fork</h3><p>The London Hard Fork is a network upgrade that contains five Ethereum Improvement Proposals. These EIPs are expected to improve the Ethereum network and are highlighted below:</p><h4><a href="https://jelilah.medium.com/ethereum-eip-upgrade-facts-misconceptions-and-investment-implications-19a531af3a50">1. EIP-1559</a></h4><p>EIP-1559 is trying to bring stability and predictability to network fees by introducing a hybrid system of base fees and tips to incentivise miners. Unlike the existing protocol that determines <a href="https://www.notion.so/Gas-Terminologies-in-Ethereum-and-Their-Meaning-8e6d4768110c47378e42c64942b56de4">gas fees</a> through an auction-like bid process, the system will automatically calculate a base fee based on network activity.</p><p>It prevents miners from artificially bumping up the miner fee by introducing a burn mechanism that burns the fee paid by users. However, users can pay an optional tip to miners as an incentive to get their transactions processed faster.</p><p>This proposal will also help regulate the amount of Ether in circulation and prevents its economic abstraction.</p><h4>2. <a href="https://eips.ethereum.org/EIPS/eip-3198">EIP-3198</a></h4><p>EIP-3198 is an extension of EIP-1559, which lets smart contracts know the base fee before executing the transaction. That way, Decentralised Apps (DApps) can improve their services and ensure that fees aren’t overpaid.</p><h4>3. <a href="https://eips.ethereum.org/EIPS/eip-3529">EIP-3529</a></h4><p>EIP-3529 reduces gas refund incentives for developers. Gas refund SSTORE and SELFDESTRUCT were originally introduced to incentivise developers to write applications that effectively use the storage and reduce redundant codes.</p><p>With this upgrade, the gas refund will be removed for SELFDESTRUCT and reduced for SSTORE.</p><h4>4. <a href="https://eips.ethereum.org/EIPS/eip-3541">EIP-3541</a></h4><p>EIP-3541 rejects new contracts starting with 0xEF byte. In order to prevent already deployed (and not validated) contracts from being recognised as valid, it will choose a byte sequence that doesn’t exist in any of the already deployed contracts.</p><p>However, already existing code starting with 0xEF byte is not affected semantically by this change.</p><h4>5. <a href="https://eips.ethereum.org/EIPS/eip-3554">EIP-3554</a></h4><p>Just like Bitcoin, Ethereum mining difficulty is expected to increase, making it ridiculously difficult to find new ETH. EIP-3554 will push this difficulty bomb to December 2021, giving miners more time to prepare.</p><p>Although Tim Beiko, an Ethereum Foundation developer has stressed that ether owners who use crypto exchanges or digital wallets won’t be affected by the London hard fork, the industry is still geared for eventualities. In fact, some crypto exchange providers have issued messages to their users telling them not to send or receive ETH &amp; USDC until the network upgrade has been completed.</p><p>On the other hand, those who run their own node will need to download the latest version of their Ethereum client after the upgrade.</p><blockquote><strong>Fun Fact: Hard forks are named after cities where conferences for developers have taken place.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9726b5a4e2ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum Gas Fees Record a YTD Low as Congestion Eases]]></title>
            <link>https://medium.com/buycoins-research/ethereum-gas-fees-record-a-ytd-low-as-congestion-eases-4539c0288314?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/4539c0288314</guid>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Tue, 03 Aug 2021 07:25:22 GMT</pubDate>
            <atom:updated>2021-08-03T09:18:22.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EJwA6UIaTuxOPaAe" /><figcaption>Photo by <a href="https://unsplash.com/@drawkit?utm_source=medium&amp;utm_medium=referral">DrawKit Illustrations</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In May 2021, Ethereum Gas Prices recorded an all-time high of approx 68.3USD per transaction. However, as of June 29th, the price had dropped to approximately 3.85USD — recording over a 94% decrease in less than 2 months.</p><p>Finally hitting close to the December 2020 low, this is one of the fastest rates Ethereum gas fees have dropped since it was introduced in 2015.</p><figure><img alt="ethereum gas fees hit a YTD low" src="https://cdn-images-1.medium.com/max/600/1*s-dw66fuY2gMI64xNynMHQ.png" /><figcaption>Chart: Buycoins Research, Source: Coin Metrics</figcaption></figure><h3>But hold on…what are gas fees?</h3><p>Gas fees refer to the cost of sending a transaction on the Ethereum network. Also known as transaction fees, it can equally be referred to as an estimate of the amount of computational effort needed to execute a transaction on the network.</p><p>As the name suggests, <strong>Gas</strong> models the characteristics of the petroleum gas needed to fuel a car. Imagine hiring a driver to help you move some goods from point A to B. In addition to paying the driver for the service, you’ll also have to buy some gas for the car so that the driver can move the goods.</p><p>Similarly, using the Ethereum Virtual Machine (EVM) incurs energy costs on miners, who are responsible for executing all code operations on the network. Gas is used to measure how much energy is required to execute these operations and the equivalent fee is paid to miners.</p><p>Sitting confidently as the second-largest blockchain network after bitcoin, Ethereum is recording an increasing usage which has led to congestions in the network. In order to have their codes and/or transactions processed faster, users bid higher gas-to-ETH exchange rates during times of network congestion. Therefore, leading to a spike in the Gas Fees.</p><p>A sudden decline in gas fees may be a result of many things, but an obvious factor, in this case, is a decline in the number of transactions requested on the network. As we pointed out earlier, the higher the number of transactions and/or congestions, the higher the gas fees and vice versa.</p><p>The comparison chart below shows a similar trend in Ethereum’s transaction volume and gas fees over the years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*xkoxJToOMh9anxCU137hfA.png" /><figcaption>Chart: Buycoins Research, Source: Coin Metrics</figcaption></figure><p>A further look into the activity on decentralized exchanges (DEX) data from Dune shows that the weekly DEX volume has dropped to below $10 billion on June 28 from above $40 billion on May 17.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DJGbqyBGWIVerFWJpdXcMw.png" /><figcaption>Chart: Buycoins Research, Source: Dune Analytics</figcaption></figure><h3>So, what is causing the sudden decline in transaction volume?</h3><p>First, we need to understand that Ethereum is a foundation layer for a lot of DEXs. Therefore, if there are few exchanges happening on these apps, then it will directly affect the number of transactions on Ethereum.</p><p>Recall that on the 18th of May, there was a massive devaluation of almost all the cryptocurrencies worldwide. Analysts say that the devaluation happened as a result of China’s Cryptocurrency ban which resulted in over <a href="https://www.bybt.com/LiquidationData">$7.5 billion liquidation</a>s in 24 hours, where the largest single liquidation order of $67 million happened on the Chinese-owned <a href="https://www.huobi.com/en-us/">Huobi-BTC</a>.</p><p>This generally affected the trust in cryptocurrencies, resulting in a decline in transactions since the 18th of May. But is it safe to say that this is solely what caused the massive 94% decline in Gas Fees? Let’s dig a little deeper by looking at Ethereum’s past data on transaction volume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*qlrgPSqxoDPP5-Y1LNv5Nw.png" /><figcaption>Chart: Buycoins Research, Source: Coin Metrics</figcaption></figure><p>From the above chart, there was approximately a 15.4% decline in transaction volume between the 9th of May and the 17th of May after which the massive devaluation happened. A further 16.2% decline was recorded between the 17th of May and the 30th of June.</p><p>This shows that there had been a decline in Ethereum transaction volume even before the devaluation. Therefore, it’s not sufficient to solely blame the sudden decline on the recent massive devaluation.</p><h3>What led to the initial 15.4% dip then?</h3><p>Besides the general crash in cryptocurrencies across the world, the growing adoption of Ethereum layer 2 solutions has also helped lower Ethereum’s gas fees. In fact, a large number of Ethereum users have turned to solutions like Binance Smart Chain (BSC), Polygon, etc., to house their Decentralized finance (DeFi) apps.</p><p>In May 2021, DeFi Oracle Umbrella Network announced that it was shifting its base from Ethereum to BSC. Also, Layer 2 platforms like <a href="https://dappradar.com/blog/polygon-defi-platforms-surpass-ethereum-versions">Polygon are increasing in popularity</a> due to their very low transaction fees.</p><p>As more users move to use these Layer 2 solutions, there is a reduction in the number of people on the Ethereum network. Hence, a reduction in transaction volume.</p><p>Another important factor that has helped reduce the gas fees is the rate at which traders are moving from using <a href="https://medium.com/keeperdao/gas-gambits-game-theory-example-of-incentivized-collaboration-9a42e9c9b867#:~:text=Priority%20Gas%20Auctions%20(PGAs)&amp;text=A%20PGA%20refers%20to%20the,gas%20price%20of%20their%20transactions.">Priority Gas Auctions (PGA)</a> to bid up gas prices to the usage of private channels.</p><p>With PGA, traders use bots to monitor average gas fees and bump up their bid a little higher than the average so that miners can prioritise it over other transactions. By moving to private channels like <a href="https://medium.com/flashbots/frontrunning-the-mev-crisis-40629a613752">Flashbots</a>, traders make their bids in private, making it difficult for a third party to see other traders’ bids.</p><p>In conclusion, it’s safe to say that the declining gas fees on Ethereum were caused by several factors — the decline in cryptocurrency trading across the world, the rise of layer 2 solutions, and the adoption of private bid channels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4539c0288314" width="1" height="1" alt=""><hr><p><a href="https://medium.com/buycoins-research/ethereum-gas-fees-record-a-ytd-low-as-congestion-eases-4539c0288314">Ethereum Gas Fees Record a YTD Low as Congestion Eases</a> was originally published in <a href="https://medium.com/buycoins-research">Buycoins Research</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Multiple Bots With a Single Twitter Developer Account]]></title>
            <link>https://medium.com/geekculture/how-to-create-multiple-bots-with-a-single-twitter-developer-account-529eaba6a576?source=rss-f25d000d9167------2</link>
            <guid isPermaLink="false">https://medium.com/p/529eaba6a576</guid>
            <category><![CDATA[twitter]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Jelilat Anofiu]]></dc:creator>
            <pubDate>Fri, 23 Apr 2021 11:02:44 GMT</pubDate>
            <atom:updated>2022-03-06T13:32:49.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2t5tOwAWGX-wEWkb" /><figcaption>Photo by <a href="https://unsplash.com/@agk42?utm_source=medium&amp;utm_medium=referral">Alex Knight</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One of the issues I encountered while building my first <a href="https://twitter.com/filtertrend">Twitter bot</a> was that the bot was tweeting from my personal account instead of my bot account. After doing some research, I realized that this is a common issue in the Developer Community.</p><p>But unfortunately, the Twitter Community <a href="https://twittercommunity.com/t/multiple-twitter-accounts-different-languages-how-do-can-i-use-a-single-dev-account/149272">answer</a> I came across wasn’t really explanatory for beginners. A few weeks after managing to figure this out on my own, someone asked a similar question on <a href="https://botmakers.org/">Botmaker’s</a> Slack Channel and that was my cue to write this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OeWNkEgnw5ZzYg7ZIemY3w.jpeg" /><figcaption>Screenshot by Jelilat Anofiu from <a href="https://botmakers.org/">Botmakers</a>’ Slack channel</figcaption></figure><p>The proposed solution from this screenshot was to apply for a new developer account for the bot, but you will come to know that this isn’t practical in the long run.</p><p><em>And why is that? 👇</em></p><p>As a hobbyist who wants to build many Twitter bots for fun or as a professional who creates Twitter bots for various organizations, applying for a new developer account with each bot you build is highly impractical and can be time and effort draining.</p><p>As some people have pointed out in the comments, it is also against Twitter’s rules and regulations to have multiple developer accounts.</p><blockquote><em>“</em><a href="https://developer.twitter.com/en/docs/developer-portal/faq#application-process-faq"><em>A single Twitter user can have a single developer account or can be a member of a team account</em></a><em>”</em>.</blockquote><p>To make things easier for developers who want to create multiple Twitter bots, I’ll be sharing a step-by-step guide on how to associate a single Twitter Developer account with multiple bots.</p><p><em>If you don’t already have a Twitter Developer account, I wrote a simple guide on how to create one in my </em><a href="https://blog.formpl.us/analyzing-tweeps-favorite-spotify-podcasts-a29ba6b11fbd"><em>previous article</em></a><em>.</em></p><h3>Terminologies</h3><p>To better understand the rest of this article, there are some Twitter developer terminologies you need to familiarize yourself with.</p><ol><li><a href="https://developer.twitter.com/en/docs/projects/overview"><strong>Projects</strong></a><strong>: </strong>They can be used to organize your work based on how you intend to use the Twitter API, manage your access to the API, and also monitor usage. Each Project contains an App, with which you can generate authentication credentials.</li><li><a href="https://developer.twitter.com/en/docs/apps/overview"><strong>App</strong></a><strong>: </strong>An App is any program, tool, or bot, that makes API calls. Twitter grants authentication credentials to apps, not accounts. Therefore, you need to create an app to be able to make API calls.</li><li><a href="https://developer.twitter.com/en/docs/authentication/oauth-2-0"><strong>Bearer Token</strong></a><strong>: </strong>This method is specifically for developers who need read-only access to the Twitter App. It is specific to an App, and it is used to authenticate requests on behalf of your App.</li><li><strong>Oauth Key &amp; Oauth Token Secret:</strong> Also called the Access Token and Access Secret respectively, they are user-specific credentials used to authenticate OAuth 1.0a API requests.</li><li><a href="https://developer.twitter.com/en/docs/authentication/oauth-1-0a"><strong>Consumer Key &amp; Consumer Secret</strong></a><strong>: </strong>Also called the API Key and API Secret,<strong> </strong>it is similar to your Twitter account’s email and password. With these two tokens, you can perform any read and write permission on an individual’s account. This is what we need to create a program that tweets from a bot’s account.</li></ol><p>You can generate your own consumer key and consumer secret if you would like your app to make requests on behalf of the same Twitter account associated with your developer account on the <a href="https://developer.twitter.com/en/docs/basics/apps/overview">Twitter developer app’s</a> details page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_rz5yuHSAWDUDMqqZk2gMA.png" /></figure><p>However, if you’d like to make requests on behalf of another account, you’ll need to follow the steps below.</p><ul><li>Visit the URL “https://twitter.com/oauth/request_token?oauth_consumer_key=&lt;YOUR CONSUMER KEY&gt;&amp;oauth_callback=oob” on the account associated with your Twitter Developer App. That is, the account used to request Twitter Developer access.</li></ul><p>Something like this should show up in your browser. It’s a temporary token and will expire after using it once. Copy the tokens and paste them somewhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiW338iHaxgt7owaluw97A.png" /></figure><ul><li>Now, log in to your bot account, then paste this URL in the browser “https://twitter.com/oauth/authenticate?oauth_token=&lt;NEWLY GENERATED TOKEN&gt;”. Replace the oauth_token in the link with the newly generated one you copied earlier.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*lU558-4VZ2ok1c6_5lknZw.png" /></figure><p>Now, click on <strong>Authorize app </strong>to grant access. After clicking on that, you should see an autogenerated 7 digit number. Copy that number somewhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*rJ9IBPmJis-ShwUELD2nRw.png" /></figure><p>Finally, visit the URL below on your browser, and you’ll get the OAuth tokens required to post via your bot account.</p><p>“<a href="https://twitter.com/oauth/access_token?oauth_token=UdsAfAAAAAABNoS-AAABeO5QSzw&amp;oauth_verifier=3364574">https://twitter.com/oauth/access_token?oauth_token=&lt;NEWLY GENERATED OAUTH TOKEN&gt;&amp;oauth_verifier=&lt;7 DIGIT PIN&gt;</a>”</p><p>All the steps we highlighted above are part of the <a href="https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens">3-legged OAuth flow</a> required to access a third-party Twitter account. Although slightly different, this method can also be used to receive read &amp; write permissions via a Web App.</p><blockquote><em>If you found this post helpful and would like to support me, you can some tokens to my Ethereum address tjelailah.eth (</em>0x66fe4806cD41BcD308c9d2f6815AEf6b2e38f9a3)</blockquote><h3>References</h3><p><a href="https://twitter.com/filtertrend">https://twitter.com/filtertrend</a></p><p><a href="https://twittercommunity.com/t/multiple-twitter-accounts-different-languages-how-do-can-i-use-a-single-dev-account/149272">https://twittercommunity.com/t/multiple-twitter-accounts-different-languages-how-do-can-i-use-a-single-dev-account/149272</a></p><p><a href="https://botmakers.org/">https://botmakers.org/</a></p><p><a href="https://blog.formpl.us/analyzing-tweeps-favorite-spotify-podcasts-a29ba6b11fbd">https://blog.formpl.us/analyzing-tweeps-favorite-spotify-podcasts-a29ba6b11fbd</a></p><p><a href="https://developer.twitter.com/en/docs/projects/overview">https://developer.twitter.com/en/docs/projects/overview</a></p><p><a href="https://developer.twitter.com/en/docs/apps/overview">https://developer.twitter.com/en/docs/apps/overview</a></p><p><a href="https://developer.twitter.com/en/docs/authentication/oauth-2-0">https://developer.twitter.com/en/docs/authentication/oauth-2-0</a></p><p><a href="https://developer.twitter.com/en/docs/authentication/oauth-1-0a">https://developer.twitter.com/en/docs/authentication/oauth-1-0a</a></p><p><a href="https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens">https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=529eaba6a576" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/how-to-create-multiple-bots-with-a-single-twitter-developer-account-529eaba6a576">How to Create Multiple Bots With a Single Twitter Developer Account</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>