<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: wispy</title>
    <description>The latest articles on DEV Community by wispy (@wispyiwnl).</description>
    <link>https://dev.to/wispyiwnl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1725138%2F666cb0ee-0a2a-4e88-bd24-ce28531df428.jpg</url>
      <title>DEV Community: wispy</title>
      <link>https://dev.to/wispyiwnl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wispyiwnl"/>
    <language>en</language>
    <item>
      <title>Convergence Finance Exploit Report</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Fri, 22 Aug 2025 15:13:04 +0000</pubDate>
      <link>https://dev.to/wispyiwnl/convergence-finance-exploit-report-jbg</link>
      <guid>https://dev.to/wispyiwnl/convergence-finance-exploit-report-jbg</guid>
      <description>&lt;p&gt;On &lt;strong&gt;August 1, 2024&lt;/strong&gt;, the DeFi protocol &lt;strong&gt;Convergence Finance&lt;/strong&gt; suffered an exploit that resulted in losses of approximately &lt;strong&gt;$210,000 USD&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
The attack targeted a critical vulnerability in the &lt;code&gt;CvxRewardDistributor&lt;/code&gt; contract, which allowed the attacker to &lt;strong&gt;mint 58,718,395 CVG tokens&lt;/strong&gt; —the entire planned staking emissions— and quickly liquidate them on Curve, draining the protocol’s liquidity.&lt;/p&gt;

&lt;p&gt;This incident serves as a clear example of how poor input validation in smart contracts can lead to devastating consequences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploit Simulation in a Forked Environment
&lt;/h2&gt;

&lt;p&gt;To technically analyze and validate the attack, a &lt;strong&gt;testing environment was set up using Foundry&lt;/strong&gt;, forking the Ethereum mainnet. This approach allowed us to accurately reproduce the protocol’s real state at the time of the exploit.&lt;/p&gt;

&lt;p&gt;Within this environment, the following were deployed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The vulnerable version of the &lt;strong&gt;&lt;code&gt;CvxRewardDistributor&lt;/code&gt;&lt;/strong&gt; contract.&lt;/li&gt;
&lt;li&gt;A malicious contract that mimicked the &lt;code&gt;claimCvgCvxMultiple()&lt;/code&gt; signature and returned inflated values. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Executing &lt;strong&gt;&lt;code&gt;claimMultipleStaking()&lt;/code&gt;&lt;/strong&gt; with this malicious contract as an argument resulted in the same on-chain behavior observed during the exploit: fraudulent minting followed by liquidation.&lt;/p&gt;

&lt;p&gt;📂 Repository with the simulation:&lt;br&gt;
&lt;a href="https://github.com/wispyiwnl/GuildAcademy-Hacks-Lab/tree/convergence/Convergence" rel="noopener noreferrer"&gt;Convergence PoC in Foundry&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Affected Contract
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/wispyiwnl/GuildAcademy-Hacks-Lab/tree/convergence/Convergence#vulnerable-contract" rel="noopener noreferrer"&gt;CvxRewardDistributor&lt;/a&gt; contract was responsible for distributing staking rewards in both CVG and Convex (CVX). Its critical function was &lt;strong&gt;&lt;code&gt;claimMultipleStaking()&lt;/code&gt;&lt;/strong&gt;, designed to allow users to claim accumulated rewards from multiple staking contracts.&lt;/p&gt;

&lt;p&gt;📌 &lt;em&gt;Note:&lt;/em&gt; The function should have validated that the contracts being called were legitimate (e.g., through a whitelist) and ensured that the &lt;code&gt;totalClaim&lt;/code&gt; value corresponded to actual rewards rather than arbitrary values returned by external contracts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Root Vulnerability
&lt;/h3&gt;

&lt;p&gt;The contract failed to validate the legitimacy of the addresses provided in &lt;code&gt;claimContracts[]&lt;/code&gt;. This allowed attackers to pass in malicious contracts that returned arbitrary values, artificially inflating &lt;code&gt;cvgClaimable&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Attack Flow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Preparation:&lt;/strong&gt; Initial funds were sourced from Tornado Cash &lt;code&gt;0x912c705958f527b08289320c20Ca6c90463AB572&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Malicious contract:&lt;/strong&gt; It mimicked the &lt;code&gt;claimCvgCvxMultiple()&lt;/code&gt; signature and returned an arbitrary number with no legitimate calculation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Execution:&lt;/strong&gt; The attacker called &lt;code&gt;claimMultipleStaking()&lt;/code&gt; with the malicious contract included in &lt;code&gt;claimContracts[]&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fraudulent mint:&lt;/strong&gt; &lt;strong&gt;58,718,395 CVG&lt;/strong&gt; were minted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Immediate liquidation:&lt;/strong&gt; The tokens were rapidly sold in Curve pools for WETH and other assets, extracting approximately &lt;strong&gt;$210,000 USD in liquidity&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;📌 &lt;strong&gt;Exploit transaction:&lt;/strong&gt; &lt;a href="https://etherscan.io/tx/0x636be30e58acce0629b2bf975b5c3133840cd7d41ffc3b903720c528f01c65d9" rel="noopener noreferrer"&gt;0x636be30e58acce0629b2bf975b5c3133840cd7d41ffc3b903720c528f01c65d9&lt;/a&gt;&lt;br&gt;
📌 &lt;strong&gt;Malicious contract:&lt;/strong&gt; &lt;a href="https://etherscan.io/address/0x03560A9D7A2c391FB1A087C33650037ae30dE3aA" rel="noopener noreferrer"&gt;0x03560A9D7A2c391FB1A087C33650037ae30dE3aA&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Economic Impact
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tokens minted:&lt;/strong&gt; 58,718,395 CVG&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Liquidity drained:&lt;/strong&gt; ≈ $210,000&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; This amount represented nearly the entirety of the staking emissions, negatively impacting the protocol’s TVL and the stability of its liquidity pools.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Protocol and Community Response
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Immediate alert (August 1):&lt;/strong&gt; Convergence warned users to stop interacting with the protocol.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Official post-mortem (August 2):&lt;/strong&gt; The root cause (missing validation) was identified, and CVG emissions were paused.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recovery attempt (August 6):&lt;/strong&gt; An on-chain message was sent to the attacker in an effort to negotiate the return of funds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;External reports:&lt;/strong&gt; Security firms such as PeckShield and QuillAudits confirmed the exploit and released technical alerts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixes:&lt;/strong&gt; Validation checks were implemented, and follow-up audits were conducted prior to reopening staking.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Convergence Finance exploit underscores the need for more rigorous development standards in DeFi. The vulnerability was not present in the original codebase; it emerged &lt;strong&gt;after the audits&lt;/strong&gt;, when the team introduced gas-saving changes and removed a critical validation. While such adjustments may be well-intentioned, they can inadvertently open the door to catastrophic failures.&lt;/p&gt;

&lt;p&gt;Key takeaways from this case include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Do not sacrifice security for gas optimization.&lt;/strong&gt; Micro-optimizations should never come at the cost of removing essential validations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict input validation.&lt;/strong&gt; External addresses should never be trusted without safeguards such as whitelists or interface checks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Defense in depth.&lt;/strong&gt; Techniques like fuzzing and adversarial scenario testing could have exposed the manipulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ongoing audits.&lt;/strong&gt; Any post-audit changes must undergo additional reviews before being deployed on mainnet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coordinated response.&lt;/strong&gt; Early communication and collaboration with the community helped contain the impact.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ultimately, developers should integrate these lessons to strengthen their development and testing processes. Every public function in a smart contract represents a potential attack vector—security must always take precedence over gas optimization.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Proof of Stake vs. Proof of Work: A Security Analysis in Blockchain</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Tue, 29 Jul 2025 20:56:00 +0000</pubDate>
      <link>https://dev.to/wispyiwnl/proof-of-stake-vs-proof-of-work-a-security-analysis-in-blockchain-ejj</link>
      <guid>https://dev.to/wispyiwnl/proof-of-stake-vs-proof-of-work-a-security-analysis-in-blockchain-ejj</guid>
      <description>&lt;p&gt;In this article, we explore how &lt;strong&gt;Proof of Stake (PoS)&lt;/strong&gt; secures blockchain networks, its main strengths and weaknesses, and how it mitigates threats such as double-spending and 51% attacks. After this analysis, we’ll compare its security features with those of &lt;strong&gt;Proof of Work (PoW)&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;: This article assumes basic knowledge of PoW and PoS. If you need a refresher, check out this&lt;/em&gt; &lt;a href="https://www.coinbase.com/learn/crypto-basics/proof-of-work-pow-vs-proof-of-stake-pos-what-is-the-difference" rel="noopener noreferrer"&gt;&lt;em&gt;Coinbase resource&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  PoS vs. PoW: Key Differences and Limitations
&lt;/h1&gt;

&lt;p&gt;Both mechanisms validate blocks, secure the network, and serve as protection against Sybil attacks, but they differ in their approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proof of Work (PoW)&lt;/strong&gt; relies on &lt;strong&gt;solving complex cryptographic puzzles&lt;/strong&gt;: the node that solves the problem first gets to add the block and receive the reward. This process provides strong security by making it extremely costly to alter the chain (as all hashes would need to be recalculated). However, it requires &lt;strong&gt;specialized hardware&lt;/strong&gt; and consumes &lt;strong&gt;enormous amounts of energy&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proof of Stake (PoS)&lt;/strong&gt; selects validators based on the &lt;strong&gt;amount of coins they have staked&lt;/strong&gt;. There’s no computational competition; selection is random but weighted by stake. This significantly reduces energy consumption and makes participation more accessible, although it may tend to &lt;strong&gt;centralize&lt;/strong&gt; power in the hands of large token holders.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both methods face limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PoW&lt;/strong&gt;: &lt;strong&gt;High energy costs&lt;/strong&gt; and entry barriers (mining is concentrated in large pools).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PoS&lt;/strong&gt;: &lt;strong&gt;Risk of stake accumulation&lt;/strong&gt; and less historical maturity compared to PoW.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Strengths and Weaknesses of PoS in Terms of Security
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;PoS&lt;/strong&gt; offers a security model based on economic incentives:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Aspect&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Strength&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Weakness&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Attack Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Requires owning and locking up the majority of the stake, making attacks extremely expensive and increasing the token's price.&lt;/td&gt;
&lt;td&gt;If more than 50% of the stake is accumulated, there's a risk of a 51% attack unless properly mitigated.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Slashing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Malicious actions or double-signing are punished by slashing the validator’s stake, discouraging dishonest behavior.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No need for intensive computation results in minimal energy consumption and improved scalability.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Any user with funds can participate in validation without specialized hardware.&lt;/td&gt;
&lt;td&gt;May incentivize power concentration among large token holders.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Technological Maturity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Being a newer model, it has undergone less stress testing in real-world environments.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Defense Against Common Attacks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PoS&lt;/strong&gt; includes mechanisms designed to prevent both &lt;strong&gt;double-spending&lt;/strong&gt; and &lt;strong&gt;51% attacks&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Double-Spending and 51% Attacks&lt;/strong&gt;: In PoS, the network requires each new block to be validated by a quorum of honest nodes. If an attacker attempts to rewrite the chain (via double-spending or majority control), the system enforces &lt;strong&gt;slashing&lt;/strong&gt;, confiscating the stake of malicious validators. Additionally, acquiring over 50% of the circulating stake is extremely costly and self-reinforcing: as token demand rises, the price of executing such an attack increases, along with the attacker’s exposure to slashing penalties.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this way, &lt;strong&gt;PoS&lt;/strong&gt; effectively addresses major vulnerabilities through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Economic Guarantees&lt;/strong&gt;: The potential loss of staked assets far outweighs the gains from submitting a fraudulent block..&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validation Quorum&lt;/strong&gt;: The requirement for multiple honest signatures makes it difficult to insert invalid blocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disincentives to Centralization&lt;/strong&gt;: Many PoS protocols include caps or distribution mechanisms to prevent excessive concentration of power.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Security Comparison: PoS vs. PoW
&lt;/h2&gt;

&lt;p&gt;While both mechanisms secure the blockchain, their approaches differ:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Feature&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Proof of Work (PoW)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Proof of Stake (PoS)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Validator Selection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hashrate competition: the first to solve the puzzle wins.&lt;/td&gt;
&lt;td&gt;Stake-weighted lottery: eliminates the need for computational races.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Double-Spending Protection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Altering blocks requires redoing all computations—an extremely high computational cost.&lt;/td&gt;
&lt;td&gt;Slashing and quorum: contradictory signatures lead to guaranteed loss of stake.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;51% Attack Resistance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Very costly: controlling &amp;gt;50% of mining power requires massive investment.&lt;/td&gt;
&lt;td&gt;Economically expensive, but theoretically easier than PoW if the market is illiquid—though penalties remain a deterrent.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Energy Consumption&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Gigawatt-hours of electricity consumed daily.&lt;/td&gt;
&lt;td&gt;Near zero: doesn't rely on intensive computation.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Proof of Stake offers a secure and sustainable paradigm: by staking funds as collateral, it creates an &lt;strong&gt;economic incentive&lt;/strong&gt; that discourages fraud and effectively mitigates both double-spending and 51% attacks. While PoS carries theoretical risks of stake centralization and still needs time to prove its long-term resilience, its &lt;strong&gt;energy efficiency&lt;/strong&gt; and &lt;strong&gt;slashing mechanism&lt;/strong&gt; make it a highly competitive alternative to Proof of Work.&lt;/p&gt;

&lt;p&gt;Ultimately, the choice between PoW and PoS depends on each network’s &lt;strong&gt;priorities&lt;/strong&gt;: if the goal is battle-tested security, PoW remains a strong option; if scalability and sustainability are the focus, PoS provides an innovative model that balances security with efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://www.coinbase.com/es-la/learn/crypto-basics/proof-of-work-pow-vs-proof-of-stake-pos-what-is-the-difference" rel="noopener noreferrer"&gt;https://www.coinbase.com/es-la/learn/crypto-basics/proof-of-work-pow-vs-proof-of-stake-pos-what-is-the-difference&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.cyfrin.io/blog/blockchain-proof-of-stake-vs-proof-of-work" rel="noopener noreferrer"&gt;https://www.cyfrin.io/blog/blockchain-proof-of-stake-vs-proof-of-work&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Take Your Vibe Trading to the Next Level: New AI Scanning Feature in Mode Terminal</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Mon, 09 Jun 2025 13:00:07 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/take-your-vibe-trading-to-the-next-level-new-ai-scanning-feature-in-mode-terminal-5b79</link>
      <guid>https://dev.to/modenetworkl2/take-your-vibe-trading-to-the-next-level-new-ai-scanning-feature-in-mode-terminal-5b79</guid>
      <description>&lt;h1&gt;
  
  
  What is Mode's AI Terminal?
&lt;/h1&gt;

&lt;p&gt;The &lt;strong&gt;Mode AI Terminal&lt;/strong&gt; is a smart assistant that combines real-world knowledge with access to contextual protocols to simplify on-chain transactions. It uses natural language processing, allowing you to ask questions and perform actions using natural language.&lt;/p&gt;

&lt;p&gt;Its architecture is based on AI models that interpret user requests and, through reasoning, determine which contextual protocols to use via the &lt;a href="https://x.com/goat_sdk" rel="noopener noreferrer"&gt;GOAT SDK&lt;/a&gt;. The platform is constantly evolving, with new features added regularly to enhance the user experience.&lt;/p&gt;

&lt;p&gt;If you encounter any limitations, you can reach out to Mode via &lt;a href="https://www.mode.network/telegram" rel="noopener noreferrer"&gt;Telegram &lt;/a&gt;or &lt;a href="https://discord.com/invite/modenetworkofficial" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Use Cases
&lt;/h2&gt;

&lt;p&gt;A clear example of its capabilities is when a user asks about trading opportunities. The terminal can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;a href="https://x.com/SynthdataCo" rel="noopener noreferrer"&gt;Synth&lt;/a&gt; to retrieve the latest BTC price predictions&lt;/li&gt;
&lt;li&gt;Write a Python script to calculate the probability of making a profit on a leveraged long position&lt;/li&gt;
&lt;li&gt;Offer to open this position based on the latest BTC price data from CoinGecko&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security and Precautions
&lt;/h2&gt;

&lt;p&gt;When the AI Terminal performs an on-chain action, it prepares the transaction or contract interaction for the user to confirm in their wallet. Since this technology is experimental, caution is advised: always review the transaction before signing it. If you're unsure about what you're about to do, it's best not to sign the transaction.&lt;/p&gt;

&lt;p&gt;This security philosophy also applies to the new analysis tools, where accuracy and verification are essential.&lt;/p&gt;

&lt;h1&gt;
  
  
  New Feature: AI-Powered Position Scanner
&lt;/h1&gt;

&lt;h1&gt;
  
  
  New Feature: Analyze Your Positions with Just an Image
&lt;/h1&gt;

&lt;p&gt;Mode’s AI Terminal can now analyze screenshots from platforms like &lt;strong&gt;Binance&lt;/strong&gt;, &lt;strong&gt;Hyperliquid&lt;/strong&gt;, &lt;strong&gt;Bybit&lt;/strong&gt;, or &lt;strong&gt;Mode Trade&lt;/strong&gt; to calculate in real time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Liquidation probability&lt;/li&gt;
&lt;li&gt;Associated risk information&lt;/li&gt;
&lt;li&gt;Recommendations or suggested actions to avoid liquidation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How Does It Work?
&lt;/h2&gt;

&lt;p&gt;You simply need to upload an image of your position taken from one of these platforms, and the AI Terminal will handle the rest. For example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Take a screenshot of your position in Mode Trade.&lt;/li&gt;
&lt;li&gt;Upload it directly to the terminal.&lt;/li&gt;
&lt;li&gt;The AI extracts the data from the image and returns a detailed analysis with the probability of that position being liquidated.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This tool marks a major step forward in risk management. As highlighted in the &lt;a href="https://x.com/modenetwork/status/1930271668498219337" rel="noopener noreferrer"&gt;official tweet&lt;/a&gt;, tools like this could have helped many traders avoid costly liquidations—showcasing the true power of combining AI with financial analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check the risk of your current position just by uploading an image.&lt;/li&gt;
&lt;li&gt;Get useful insights without having to enter data manually.&lt;/li&gt;
&lt;li&gt;Improve your risk management and avoid unexpected liquidations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;The new visual analysis feature takes &lt;strong&gt;Vibe Trading&lt;/strong&gt; to the next level. This tool combines AI + UX to help you make better trading decisions without leaving the terminal.&lt;/p&gt;

&lt;p&gt;Upload an image, analyze your risk, and make better decisions. It’s that simple.&lt;br&gt;
And this is just the beginning: with innovative features like this being released regularly, the terminal is solidifying its place as a powerful tool to optimize your financial decisions.&lt;/p&gt;

&lt;p&gt;Explore this and more features now:&lt;br&gt;
👉 &lt;a href="https://app.mode.network/terminal/" rel="noopener noreferrer"&gt;https://app.mode.network/terminal/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>trading</category>
      <category>terminal</category>
      <category>mode</category>
    </item>
    <item>
      <title>Quick Guide: Create Your Account ID on Orderly</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Fri, 30 May 2025 18:58:22 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/quick-guide-create-your-account-id-on-orderly-49ci</link>
      <guid>https://dev.to/modenetworkl2/quick-guide-create-your-account-id-on-orderly-49ci</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this tutorial, you’ll learn how to generate your &lt;code&gt;Orderly Account ID&lt;/code&gt; — a crucial step to authenticate yourself and use their private APIs.&lt;/p&gt;

&lt;p&gt;Before you can sign requests or integrate trading features with Orderly, you need this unique identifier linked to your wallet and the broker you’re working with.&lt;/p&gt;

&lt;p&gt;We’ll go over what &lt;strong&gt;&lt;a href="https://orderly.network/docs/introduction/getting-started/what-is-orderly" rel="noopener noreferrer"&gt;Orderly&lt;/a&gt;&lt;/strong&gt; is, why the &lt;strong&gt;Account ID&lt;/strong&gt; matters, and how to generate it step by step using JavaScript.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Orderly?
&lt;/h1&gt;

&lt;p&gt;Orderly is a decentralized trading infrastructure (DEX infra) that combines the efficiency of a centralized exchange (CEX) with the transparency and self-custody of DeFi. It doesn’t have its own user interface; instead, it provides an order engine and a liquidity layer that can be easily integrated by other projects.&lt;/p&gt;

&lt;p&gt;Thanks to its modular design, developers can build DEXs, wallet integrations, trading bots, or in-game swaps — all using its shared liquidity. Its vision is to connect multiple blockchains (both EVM and non-EVM) into a single order book, enabling seamless omnichain trading without bridges or friction.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the Account ID used for?
&lt;/h1&gt;

&lt;p&gt;The &lt;strong&gt;Account ID&lt;/strong&gt; is the first requirement to authenticate with the Orderly API. All private endpoints—such as placing orders or checking balances—require authentication using cryptographic keys.&lt;/p&gt;

&lt;p&gt;This process, known as &lt;code&gt;API Authentication&lt;/code&gt;, ensures that requests to the API come from a valid user by signing each message with a private key (Orderly key). To make this work, you must include the &lt;code&gt;orderly-account-id&lt;/code&gt; in the headers of every request.&lt;/p&gt;

&lt;p&gt;In short, without an &lt;strong&gt;Account ID&lt;/strong&gt;, you can’t generate valid signatures or access the API’s private features. That’s why the first step before interacting programmatically with Orderly is to create your &lt;strong&gt;Account ID&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to Create an Account ID
&lt;/h1&gt;

&lt;p&gt;To authenticate with the Orderly API, you first need to generate your Account ID. This identifier is derived from your wallet and the &lt;code&gt;brokerId&lt;/code&gt; of the builder you’re working with.&lt;/p&gt;

&lt;p&gt;Each wallet can have multiple Account IDs—one for each builder—and these IDs are not connected to each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Make sure you have &lt;a href="https://nodejs.org/en/download" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; installed.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2. Install the &lt;code&gt;ethers&lt;/code&gt; library (if you haven’t already):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;ethers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Getting the broker_id&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To generate your Account ID, you need to know the &lt;code&gt;broker_id&lt;/code&gt;. Orderly provides an endpoint called &lt;code&gt;chain_info&lt;/code&gt; where you can check the available &lt;code&gt;broker_ids&lt;/code&gt; for each network.&lt;/p&gt;

&lt;p&gt;Follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;a href="https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-chains-per-builder" rel="noopener noreferrer"&gt;chain_info endpoint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;Try it&lt;/code&gt; button&lt;/li&gt;
&lt;li&gt;In the input field, enter a sample &lt;code&gt;broker_id&lt;/code&gt; like &lt;code&gt;woofi_pro&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;You’ll see a list of all available &lt;code&gt;broker_ids&lt;/code&gt; by network&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Create a &lt;code&gt;.js&lt;/code&gt; file and paste the following code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AbiCoder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;keccak256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;solidityPackedKeccak256&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ethers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userAddress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0xYOUR_ADDRESS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your wallet&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;brokerId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;BROKER_ID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with the brokerId&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getAccountId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;brokerId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;abicoder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;AbiCoder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;defaultAbiCoder&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;keccak256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;abicoder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;address&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bytes32&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;userAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;solidityPackedKeccak256&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;brokerId&lt;/span&gt;&lt;span class="p"&gt;])]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;accountId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getAccountId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userAddress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;brokerId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Run the file with:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node filename.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;You’ll see your Account ID printed in the console, something like this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0x440adacb805d48efc87ba34dd6401f8fc8b45ee55126ccd9a14f33f5b85d403c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the value you’ll use as orderly-account-id in the headers of your API requests.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Getting your Orderly &lt;strong&gt;Account ID&lt;/strong&gt; is the first step toward securely interacting with its trading infrastructure. This ID allows you to authenticate your API requests and start building on the Orderly ecosystem—whether it's creating a DEX, integrating swaps into a wallet, or automating trades with bots.&lt;/p&gt;

&lt;p&gt;With just a few steps and common tools like &lt;code&gt;Node.js&lt;/code&gt; and &lt;code&gt;ethers&lt;/code&gt;, you’re ready to start developing with Orderly.&lt;/p&gt;

</description>
      <category>orderly</category>
      <category>trading</category>
    </item>
    <item>
      <title>INTEGRATION OF DAPPS WITH MODE: WALLET AND SMART CONTRACTS | PART 2: CONNECTING SMART CONTRACTS TO THE FRONT-END</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Tue, 10 Dec 2024 14:53:41 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/integration-of-dapps-with-mode-wallet-and-smart-contracts-part-2-connecting-smart-contracts-to-35l0</link>
      <guid>https://dev.to/modenetworkl2/integration-of-dapps-with-mode-wallet-and-smart-contracts-part-2-connecting-smart-contracts-to-35l0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Welcome to the second part of our tutorial series. Before diving into new content, let's do a quick recap of what we covered in Part 1:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 1 Recap:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Setting up Next.js and Reown Cloud&lt;/li&gt;
&lt;li&gt;Installing dependencies (Reown and Wagmi)&lt;/li&gt;
&lt;li&gt;Implementing wallet connection, including Mode chains (mainnet and testnet)&lt;/li&gt;
&lt;li&gt;Functionality testing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you haven’t gone through the previous tutorial yet, we recommend doing so before proceeding, as we will be building upon those concepts and configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Objectives of Part 2:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Connect an existing smart contract to a front-end on the Mode network.&lt;/li&gt;
&lt;li&gt;Interact with the contract from the front-end, performing read and write operations.&lt;/li&gt;
&lt;li&gt;Use Mode's testnet to develop and test our dApp.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Recommendations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of Solidity and smart contract development.&lt;/li&gt;
&lt;li&gt;Familiarity with front-end development using Next.js.&lt;/li&gt;
&lt;li&gt;Completion of Part 1 of this series (although it’s not strictly necessary).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quick Option&lt;/strong&gt;: If you prefer to start with the front-end already set up with a &lt;strong&gt;connect wallet&lt;/strong&gt; and the &lt;strong&gt;Mode&lt;/strong&gt; chains (testnet and mainnet), you can clone the repository &lt;a href="https://github.com/wispyiwnl/Integration-of-DApps-with-Mode-Connecting-the-Wallet" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This tutorial will provide you with a solid foundation for dApp development on the Mode blockchain, focusing on practical integration between smart contracts and the front-end. Let’s get started!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Smart Contract Development&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;In this section, we will create a simple smart contract for our project. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new file named &lt;code&gt;HelloMode.sol&lt;/code&gt; in the &lt;code&gt;src/&lt;/code&gt; directory of your project.&lt;/li&gt;
&lt;li&gt;Use the following sample code for a basic simpleStorage contract:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract HelloMode {
    string private message = "Hello Mode Chads";

    function setMessage(string calldata newMessage) public {
        message = newMessage;
    }

    function getMessage() public view returns (string memory) {
        return message;
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you already have your own developed smart contract, you can skip the sample code and use yours instead.&lt;/p&gt;

&lt;p&gt;This contract will serve as the foundation for our front-end interaction in the following steps of the tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation of the Smart Contract
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Features of the smart contract:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stores a message in a private variable &lt;code&gt;message&lt;/code&gt;, initialized with "Hello Mode Chads".&lt;/li&gt;
&lt;li&gt;Offers two main functions:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;setMessage&lt;/code&gt;: Allows changing the stored message.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;getMessage&lt;/code&gt;: Allows reading the current message without modifying it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Compilation and Deployment of the Smart Contract
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will not delve into the process of compiling and deploying smart contracts. However, it is a crucial step in DApp development. For those interested in exploring this topic further, Mode offers excellent resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For a detailed guide on how to deploy smart contracts using Foundry, Hardhat, Remix, or Thirdweb, check the &lt;a href="https://docs.mode.network/tutorials/deploying-a-smart-contract" rel="noopener noreferrer"&gt;official Mode documentation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although we won't delve into these processes, here are the basic commands using Foundry:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compilation: &lt;code&gt;forge build&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Deployment: &lt;code&gt;forge create --rpc-url https://sepolia.mode.network --private-key &amp;lt;YOUR_PRIVATE_KEY&amp;gt; contracts/HelloMode.sol:HelloMode --constructor-args &amp;lt;arg1&amp;gt; &amp;lt;arg2&amp;gt; &amp;lt;arg3&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you are going to use these commands, you must have Foundry installed. If you haven't done so yet, you can find detailed instructions in the &lt;a href="https://book.getfoundry.sh/getting-started/installation" rel="noopener noreferrer"&gt;official Foundry documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If the deployment was successful, you should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmoyg4cu2cwwedtpcdk94.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmoyg4cu2cwwedtpcdk94.jpg" width="800" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a detailed tutorial on compiling and deploying with Foundry, check &lt;a href="https://dev.to/modenetwork/how-to-deploy-and-verify-a-smart-contract-on-modes-blockchain-using-foundry-2p5n"&gt;this link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Remember, we are using Mode's testnet for this tutorial, which is ideal for development and testing before moving to the mainnet.&lt;/p&gt;

&lt;p&gt;To interact with a smart contract from the front-end, we need two essential elements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Address&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The address is the unique identifier of the contract on the blockchain.&lt;/li&gt;
&lt;li&gt;It is obtained after the contract is deployed.&lt;/li&gt;
&lt;li&gt;It is a hexadecimal string that identifies the contract's location on the network.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ABI (Application Binary Interface)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The ABI is an interface that defines how to interact with the contract.&lt;/li&gt;
&lt;li&gt;It is generated when the contract is compiled.&lt;/li&gt;
&lt;li&gt;It describes the functions and structures of the contract in JSON format.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Obtaining the ABI:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In Foundry: It can be found in the &lt;code&gt;out&lt;/code&gt; directory after compilation.&lt;/li&gt;
&lt;li&gt;In Remix: Available in the "Compilation Details" tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Project Setup
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; Create a &lt;code&gt;.json&lt;/code&gt; file in your project. You can name it whatever you like; in this tutorial, we will use &lt;code&gt;abi.json&lt;/code&gt;. Add the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"address"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Deployed&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;contract&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;address&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"abi"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Contract&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ABI&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt; Import the file into your main component: Open page.tsx and add the following import line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;    &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../abi.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Although we are using &lt;code&gt;abi&lt;/code&gt; as the import name here, you can choose any name that is clear to you, such as &lt;code&gt;contract&lt;/code&gt; or &lt;code&gt;smartContract&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recap
&lt;/h3&gt;

&lt;p&gt;So far, we have:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Created and deployed our smart contract.&lt;/li&gt;
&lt;li&gt;Obtained the address and the ABI of the contract.&lt;/li&gt;
&lt;li&gt;Stored this data in a &lt;code&gt;.json&lt;/code&gt; file in our project.&lt;/li&gt;
&lt;li&gt;Imported this file into our main component (&lt;code&gt;page.tsx&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With these steps completed, we are ready to start reading from and writing to our smart contract from the front-end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interacting with the Contract
&lt;/h2&gt;

&lt;p&gt;Now that we have access to the address and ABI of our contract from &lt;code&gt;page.tsx&lt;/code&gt;, let's interact with it by reading and writing data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading from the Smart Contract
&lt;/h3&gt;

&lt;p&gt;We will use &lt;code&gt;useReadContract&lt;/code&gt; from wagmi to read information from the contract. Wagmi is a React Hooks library that simplifies interaction with smart contracts on Ethereum.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; Look up &lt;code&gt;useReadContract&lt;/code&gt; in the wagmi documentation:&lt;br&gt;
    - Go to the hooks section (functions that start with "use").&lt;br&gt;
    - Find &lt;code&gt;useReadContract&lt;/code&gt; (the name may vary in future versions of wagmi).&lt;br&gt;
&lt;strong&gt;2&lt;/strong&gt; Import &lt;code&gt;useReadContract&lt;/code&gt; in your &lt;code&gt;page.tsx:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useReadContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; Set up useReadContract in your component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="s2"&gt;`0x&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;abi: abi.abi&lt;/code&gt;: The first &lt;code&gt;abi&lt;/code&gt; is the property of the object, while the second refers to the imported ABI.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;as '0x${string}'&lt;/code&gt;: This is to satisfy TypeScript typing for Ethereum addresses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4&lt;/strong&gt; Create a state for the message using a React hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;useState&lt;/code&gt; allows you to add state to functional components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5&lt;/strong&gt; Display the message in your component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello Mode&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember: If you're using hooks like &lt;code&gt;useState&lt;/code&gt;, make sure to include &lt;code&gt;'use client'&lt;/code&gt; at the top of &lt;code&gt;page.tsx&lt;/code&gt; to avoid errors.&lt;/p&gt;

&lt;p&gt;Your &lt;code&gt;page.tsx&lt;/code&gt; should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./page.module.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../abi.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useReadContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="s2"&gt;`0x&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;w3m&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello Mode&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Rest of your component */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the front-end like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog5zjwc2hkfph57o19n7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog5zjwc2hkfph57o19n7.jpg" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's update &lt;code&gt;message&lt;/code&gt; with information from the contract in real-time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using useEffect to Update the Message
&lt;/h3&gt;

&lt;p&gt;We will use the &lt;code&gt;useEffect&lt;/code&gt; hook from React. This hook allows you to run side effects in functional components, such as updating state based on changes to certain variables.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implement &lt;code&gt;useEffect&lt;/code&gt; in your component:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;code&gt;useEffect&lt;/code&gt; will run every time &lt;code&gt;result&lt;/code&gt; changes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[result]&lt;/code&gt; at the end indicates that the effect depends on &lt;code&gt;result&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;result.data&lt;/code&gt; exists, we update &lt;code&gt;message&lt;/code&gt; with that value.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Update your component to use this logic:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="s2"&gt;`0x&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;w3m&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello Mode&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Rest of your component */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, the message will change from "Hello Mode" to "Hello Mode Chads" (or whatever text is stored in the contract).&lt;/p&gt;

&lt;p&gt;To verify that this works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Observe the change in the front-end from "Hello Mode" to "Hello Mode Chads".&lt;/li&gt;
&lt;li&gt;You can modify the value in the contract to something like 'Hello Chads Mode' to see the change reflected.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Recap
&lt;/h3&gt;

&lt;p&gt;We have used two main hooks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;useState&lt;/code&gt;: To manage the message state in the component.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useEffect&lt;/code&gt;: To update the message when we get data from the contract.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;result&lt;/code&gt; contains the information read from the contract. When &lt;code&gt;result&lt;/code&gt; changes, &lt;code&gt;useEffect&lt;/code&gt; checks for data and updates the message on the front-end.&lt;/p&gt;

&lt;p&gt;The next step will be to implement the functionality to write to the contract from the front-end.&lt;/p&gt;

&lt;h3&gt;
  
  
  useWriteContract
&lt;/h3&gt;

&lt;p&gt;After reading information from the smart contract, we will now write data from the front-end. For this, we will use the writing functions, just as we did with &lt;code&gt;useReadContract&lt;/code&gt;, but now with &lt;code&gt;useWriteContract&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useWriteContract&lt;/code&gt; is a hook provided by wagmi that allows us to perform transactions that modify the state of a smart contract. Through this hook, we can invoke contract functions that write or change data on the blockchain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you're following this tutorial, always check the current wagmi documentation, as the names or features of hooks may change over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementing &lt;code&gt;useWriteContract&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;We import &lt;code&gt;useWriteContract&lt;/code&gt; in the same way we did with &lt;code&gt;useReadContract&lt;/code&gt;. Add this import in your &lt;code&gt;page.tsx&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useWriteContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;Home&lt;/code&gt; component, we configure &lt;code&gt;useWriteContract&lt;/code&gt; as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;writeContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useWriteContract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your &lt;code&gt;page.tsx&lt;/code&gt; file should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./page.module.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../abi.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useWriteContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="s2"&gt;`0x&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;writeContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useWriteContract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;- Here we use the writing hook&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;main&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;w3m&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;button&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello Mode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Rest of the code */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;main&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating a Form to Capture Data
&lt;/h3&gt;

&lt;p&gt;To write data to the contract, we need to capture it from the front-end. We will use a form to obtain the value we want to send to the contract.&lt;/p&gt;

&lt;p&gt;Add this form below where we display the message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;changeMessage&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Send&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Function &lt;code&gt;changeMessage&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Now, we will create an asynchronous function called &lt;code&gt;changeMessage&lt;/code&gt; that captures the data from the form and sends it to the smart contract:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeMessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputUsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLInputElement&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;event.preventDefault()&lt;/code&gt; prevents the form from reloading the page.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;form.elements[0].value&lt;/code&gt; gets the value entered in the text field.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Executing &lt;code&gt;writeContract&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To send the data to the contract, we use &lt;code&gt;writeContract&lt;/code&gt;. According to the wagmi documentation, the basic logic to execute this hook is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;writeContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0x6b175474e89094c44da98b954eedeac495271d0f&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transferFrom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0xd2135CfB216b74109775236E36d4b433F1DF507B&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0xA0Cf798816D4b9b9866b5330EEa46a18382f251e&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We add this logic inside our &lt;code&gt;changeMessage&lt;/code&gt; function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeMessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputUsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLInputElement&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;writeContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0x6b175474e89094c44da98b954eedeac495271d0f&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transferFrom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0xd2135CfB216b74109775236E36d4b433F1DF507B&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0xA0Cf798816D4b9b9866b5330EEa46a18382f251e&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We set up the logic to interact with the ABI, the contract address, and the function with the necessary arguments. This is what the complete component should look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Image&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/image&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./page.module.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../../abi.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useWriteContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useReadContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0x${string}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;writeContract&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useWriteContract&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;changeMessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLFormElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputUsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;elements&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;HTMLInputElement&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="nf"&gt;writeContract&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0x${string}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;setMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;inputUsed&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;w3m&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="nx"&gt;onSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;changeMessage&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Send&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
 &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/form&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
        &lt;span class="nx"&gt;Rest&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.....&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this is how your front-end should appear:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhumca6jh7gjta1a333sy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhumca6jh7gjta1a333sy.jpg" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this structure, you can now send data to the smart contract from the front-end. You should see the changes reflected in the contract when you enter a new value and press "Send"!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Congratulations on completing our series "Integrating DApps with Mode: Wallet and Smart Contracts"! You have made significant progress in decentralized application development, acquiring crucial skills to create complete and functional DApps on the Mode network.&lt;/p&gt;

&lt;p&gt;Throughout this series, you have achieved:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a Next.js project for Web3 development.&lt;/li&gt;
&lt;li&gt;Integrated ReoWn (formerly WalletConnect) into your application.&lt;/li&gt;
&lt;li&gt;Implemented wallet connection with support for the Mode network.&lt;/li&gt;
&lt;li&gt;Connected a smart contract to your front-end on the Mode network.&lt;/li&gt;
&lt;li&gt;Performed read and write operations on the blockchain from your user interface.&lt;/li&gt;
&lt;li&gt;Used the Mode testnet for development and testing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you have the skills to leverage Web3 capabilities in a Next.js application and interact with the Mode network through smart contracts. Remember, this is just the starting point for developing more advanced DApps on Mode. We encourage you to continue exploring and building on these concepts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Experiment with more complex contracts.&lt;/li&gt;
&lt;li&gt;Explore advanced features of the Mode network.&lt;/li&gt;
&lt;li&gt;Participate in hackathons or community projects on Mode.&lt;/li&gt;
&lt;li&gt;Share your creations with the Mode developer community.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Support and Resources&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you encounter any issues or have questions, feel free to join the &lt;a href="https://discord.com/invite/modenetworkofficial" rel="noopener noreferrer"&gt;Mode Discord&lt;/a&gt; and obtain the developer role. &lt;a href="https://mode.hashnode.dev/get-developer-role" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is how to get the role. The community is always ready to help.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Additional Resources:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.mode.network/" rel="noopener noreferrer"&gt;Mode Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://book.getfoundry.sh/" rel="noopener noreferrer"&gt;Foundry Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs" rel="noopener noreferrer"&gt;Next.js Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wagmi.sh/react/getting-started" rel="noopener noreferrer"&gt;Wagmi Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/modenetwork/how-to-deploy-and-verify-a-smart-contract-on-modes-blockchain-using-foundry-2p5n"&gt;Tutorial: Deploy and Verify Smart Contracts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/wispyiwnl/Integration-of-DApps-with-Mode-Connecting-Smart-Contracts-to-the-Front-end" rel="noopener noreferrer"&gt;Repository of the code used during the tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for being part of this educational series! We hope these tutorials have provided you with the tools and confidence needed to embark on exciting development projects on Mode. Learning in the blockchain space is ongoing, so stay updated with the latest news from Mode and the Web3 ecosystem in general.&lt;/p&gt;

&lt;p&gt;We look forward to seeing the amazing DApps you will build on Mode. The future of decentralized applications awaits you!&lt;/p&gt;

</description>
      <category>dapp</category>
      <category>frontend</category>
      <category>smartcontract</category>
      <category>wallet</category>
    </item>
    <item>
      <title>INTEGRATION OF DAPPS WITH MODE: WALLET AND SMART CONTRACTS | PART 1: CONNECTING THE WALLET</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Tue, 10 Dec 2024 14:53:20 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/integration-of-dapps-with-mode-wallet-and-smart-contracts-part-1-connecting-the-wallet-199d</link>
      <guid>https://dev.to/modenetworkl2/integration-of-dapps-with-mode-wallet-and-smart-contracts-part-1-connecting-the-wallet-199d</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This tutorial is also available in video format. If you prefer to follow along visually, you can watch it &lt;a href="https://www.youtube.com/watch?v=oqLFiBgfJhw" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Let's get started! &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Welcome to the first part of our series, "Integrating DApps with Mode: Wallet and Smart Contracts"! In this introductory tutorial, we'll dive into connecting wallets to a Next.js application, with a special focus on integrating the Mode blockchain.&lt;/p&gt;

&lt;p&gt;Throughout this guide, you will learn how to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a basic Next.js project to create the foundation for your decentralized application&lt;/li&gt;
&lt;li&gt;Install and configure reown to enable wallet connections and smart wallet support&lt;/li&gt;
&lt;li&gt;Add Mode network to the wallet options (and any EVM chain)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The wallet integration you'll learn in this tutorial is a fundamental step in developing decentralized applications (DApps). By enabling users to connect their wallets to your application, you'll establish the necessary foundation to interact with the Mode. While we're focusing specifically on this connection, mastering this component is essential for any DApp you plan to build in the future.&lt;/p&gt;

&lt;p&gt;Once you complete this part, you'll be ready to move on to Part 2 of the series, where we'll explore how to connect a smart contract to the front end we create here, further expanding your application's capabilities. Ready to take this important first step in developing your DApp with Mode? Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Next.js
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; Open your terminal and run the following command to install Next.js:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`npx create-next-app@13.4.19`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt; During the installation, configure your project with the following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Project name: mode-chain&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;TypeScript: yes (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Selecting yes enables TypeScript for static typing, helping to catch errors early and improve code quality. Choosing no configures your project to use JavaScript.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;ESLint: yes (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;If you choose yes, ESLint will be integrated to help detect errors and maintain code quality. Selecting no means that no linting rules will be applied by default.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Tailwind CSS: no (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Choosing no means Tailwind CSS will not be installed, so you won’t have access to its utility classes for rapid styling. You can always integrate Tailwind CSS later if you decide you want to use it for custom styling.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;src/ directory: yes (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Selecting yes creates a src/ folder to organize your source code. If you choose no, your code will reside in the project's root directory.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;App Router: yes (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;If you select yes, a router will be set up to manage navigation in your application. Choosing no means you'll need to implement navigation manually later on.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Import alias: yes (optional)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;By choosing yes, you can use import aliases, which helps in organizing your code and improving readability. If you select no, you'll have to use standard relative paths for imports.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; Once the installation is complete, navigate to the project directory with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`cd mode-chain`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;4&lt;/strong&gt; To view the initial front-end, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`npm run dev`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You should see an output similar to this in your terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm2lx5jcx5kavqsoh036.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm2lx5jcx5kavqsoh036.png" alt="Image description" width="477" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5&lt;/strong&gt; Open your browser and go to &lt;code&gt;http://localhost:3000&lt;/code&gt;. You can also directly open the link by &lt;code&gt;Ctrl + left-click&lt;/code&gt; on the URL that appears in the terminal.&lt;br&gt;
This is what your application looks like before integrating reown:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6akt1vgzpbyksixxo9f2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6akt1vgzpbyksixxo9f2.png" alt="Image description" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Cloud Configuration
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Project ID and reown (formerly known as WalletConnect) Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Visit &lt;a href="https://cloud.reown.com/sign-in" rel="noopener noreferrer"&gt;https://cloud.reown.com/sign-in&lt;/a&gt; and create an account (I recommend creating an account instead of connecting a wallet, as this can lead to several issues).&lt;/li&gt;
&lt;li&gt;Create a new project by clicking "Create New Project."&lt;/li&gt;
&lt;li&gt;You will see two options:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; Enter your project name (for example, "mode-chain").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Home page URL:&lt;/strong&gt;  You can leave this field blank if you prefer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click on "Continue." Then, two new options will appear: &lt;strong&gt;AppKit&lt;/strong&gt; and &lt;strong&gt;WalletKit&lt;/strong&gt;. Select &lt;strong&gt;AppKit&lt;/strong&gt; and choose &lt;strong&gt;React&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After creating the project, you will be directed to the “QuickStart” section. Here you will find:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install package:&lt;/strong&gt; In my case, I’ll select npm and wagmi. The reown installation command will be:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i @reown/appkit @reown/appkit-adapter-wagmi wagmi viem @tanstack/react-query&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Get started:&lt;/strong&gt; This section will provide you with code for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;wagmi configuration (including your Project ID automatically)&lt;/li&gt;
&lt;li&gt;Context Provider&lt;/li&gt;
&lt;li&gt;Layout&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These code snippets are crucial for the implementation and will be used in the following sections of the tutorial.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Project ID is a unique identifier that allows you to use reown services in your application.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing reown
&lt;/h2&gt;

&lt;p&gt;After setting up your project in reown Cloud, follow these steps to install reown in your Next.js project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the "QuickStart" section of your project on reown Cloud, specifically under &lt;strong&gt;Install package&lt;/strong&gt;, you will see the installation options. For this tutorial, we will use npm and wagmi.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open a terminal in your project directory and run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i @reown/appkit @reown/appkit-adapter-wagmi wagmi viem @tanstack/react-query&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command installs all the necessary dependencies for reown and wagmi.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: If you prefer to use a different setup (e.g., yarn instead of npm, or ethers instead of wagmi), you can find specific instructions in the &lt;a href="https://docs.reown.com/appkit/next/core/installation" rel="noopener noreferrer"&gt;official reown documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  reown implementation
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Wagmi Config
&lt;/h3&gt;

&lt;p&gt;The Wagmi configuration is essential for integrating reown and the desired chains, including Mode Chain. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new folder called &lt;code&gt;config&lt;/code&gt; at the root of your project.&lt;/li&gt;
&lt;li&gt;Inside the &lt;code&gt;config&lt;/code&gt; folder, create a file named &lt;code&gt;index.tsx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Copy the following code and paste it into &lt;code&gt;config/index.tsx&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is what your application looks like before integrating reown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// config/index.tsx&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;cookieStorage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createStorage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@wagmi/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;WagmiAdapter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@reown/appkit-adapter-wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sepolia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;modeTestnet&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@reown/appkit/networks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// Get projectId from https://cloud.reown.com&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;projectId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YOUR_PROJECT_ID&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Project ID is not defined&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sepolia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;modeTestnet&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;//Set up the Wagmi Adapter (Config)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;createStorage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;cookieStorage&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="na"&gt;ssr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;networks&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;wagmiConfig&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Main Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;YOUR_PROJECT_ID&lt;/code&gt; with the project ID you obtained from reown Cloud.&lt;/li&gt;
&lt;li&gt;In the line &lt;code&gt;import { mainnet, sepolia, mode, modeTestnet } from '@reown/appkit/networks'&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;mainnet&lt;/code&gt; and &lt;code&gt;sepolia&lt;/code&gt; are Ethereum chains included by default (mainnet and Sepolia testnet).&lt;/li&gt;
&lt;li&gt;We added &lt;code&gt;mode&lt;/code&gt; (Mode mainnet) and &lt;code&gt;modeTestnet&lt;/code&gt; (Mode testnet) to integrate Mode chains.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Session storage:&lt;/strong&gt; &lt;code&gt;CookieStorage&lt;/code&gt; is used to save session data, allowing users to continue where they left off when they return to the application.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;&lt;code&gt;WagmiAdapter&lt;/code&gt;&lt;/strong&gt;: This adapter simplifies the connection setup with Wagmi using the Reown project. The &lt;code&gt;ssr: true&lt;/code&gt; option is also defined to ensure the configuration works on the server side.&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Context Provider
&lt;/h3&gt;

&lt;p&gt;The Context Provider is necessary to initialize Web3Modal and wrap our application. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new folder called &lt;code&gt;context&lt;/code&gt; at the root of your project.&lt;/li&gt;
&lt;li&gt;Inside the &lt;code&gt;context&lt;/code&gt; folder, create a file named &lt;code&gt;index.tsx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Copy the following code and paste it into &lt;code&gt;context/index.tsx&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// context/index.tsx&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;projectId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../config&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;QueryClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;QueryClientProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@tanstack/react-query&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createAppKit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@reown/appkit/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sepolia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;modeTestnet&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@reown/appkit/networks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;cookieToInitialState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;WagmiProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wagmi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// Set up queryClient&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;queryClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;QueryClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Project ID is not defined&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Set up metadata&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mode-chain&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;AppKit Example&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://reown.com/appkit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// origin must match your domain &amp;amp; subdomain&lt;/span&gt;
    &lt;span class="na"&gt;icons&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://assets.reown.com/reown-profile-pic.png&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Create the modal&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;modal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAppKit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;adapters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sepolia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;modeTestnet&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;defaultNetwork&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mainnet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;features&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;analytics&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Optional - defaults to your Cloud configuration&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ContextProvider&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cookies&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ReactNode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cookieToInitialState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;wagmiConfig&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;WagmiProvider&lt;/span&gt; &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;wagmiAdapter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;wagmiConfig&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;QueryClientProvider&lt;/span&gt; &lt;span class="na"&gt;client&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;queryClient&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;QueryClientProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;WagmiProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;ContextProvider&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Main Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Connection Modal:&lt;/strong&gt; &lt;code&gt;createAppKit&lt;/code&gt; creates the modal that will allow users to connect their wallets to the application. It is configured with the &lt;code&gt;wagmiAdapter&lt;/code&gt;, &lt;code&gt;projectId&lt;/code&gt;, and the supported networks (Ethereum and Mode).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookies:&lt;/strong&gt; The &lt;code&gt;cookieToInitialState&lt;/code&gt; function retrieves the cookies stored in the browser to initialize the application with the user's previous state, ensuring continuity of their session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clients and Providers:&lt;/strong&gt; &lt;code&gt;QueryClientProvider&lt;/code&gt; and &lt;code&gt;WagmiProvider&lt;/code&gt; are responsible for providing the necessary context so that the entire application can interact with Web3 and the configured networks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Layout
&lt;/h3&gt;

&lt;p&gt;The Layout is crucial for integrating Web3ModalProvider throughout your Next.js application. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;app/layout.tsx&lt;/code&gt; file in your project.&lt;/li&gt;
&lt;li&gt;Replace the existing content with the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/layout.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Metadata&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Inter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/font/google&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./globals.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next/headers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// added&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ContextProvider&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../../context&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AppKit Example App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Powered by WalletConnect&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;RootLayout&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;children&lt;/span&gt;
&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nb"&gt;Readonly&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ReactNode&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;headerList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cookies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;headerList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cookie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ContextProvider&lt;/span&gt; &lt;span class="na"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;cookies&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;ContextProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Main Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Headers and Cookies:&lt;/strong&gt; The use of &lt;code&gt;headers()&lt;/code&gt; in Next.js allows for retrieving cookies passed from the server, which is necessary for initializing the user's session state in the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Wrappers:&lt;/strong&gt; Wraps the entire application within the &lt;code&gt;ContextProvider&lt;/code&gt;, enabling Web3 functionalities (such as wallet connections) to be available across all pages of the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Trigger the Modal
&lt;/h3&gt;

&lt;p&gt;To allow users to connect their wallets, we need to add a button that triggers the reown modal. Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reown provides a web component &lt;code&gt;&amp;lt;w3m-button /&amp;gt;&lt;/code&gt; that you can use directly in your application.&lt;/li&gt;
&lt;li&gt;This component does not require importing, as it is a global HTML element.&lt;/li&gt;
&lt;li&gt;To add the connection button, simply insert &lt;code&gt;&amp;lt;w3m-button /&amp;gt;&lt;/code&gt; into any component of your application where you want it to appear.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;HomePage&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Welcome&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;DApp&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;w3m&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding the connection button to your DApp, you should see a button with the text "Connect Wallet," similar to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8y9w8s5wgin2rs64gsu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8y9w8s5wgin2rs64gsu.png" alt="Image description" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we connect the wallet, we can observe that we have access to both the Mode mainnet and the Mode testnet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ohccemk46j7pvp62jxe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ohccemk46j7pvp62jxe.png" alt="Image description" width="420" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: If you prefer more control over the design or behavior of the button, you can create your own component using the AppKit hooks. Check the official documentation for more details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get ready for the next level!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Part 2 of this series, we'll take your DApp to the next level by connecting a smart contract to the front end we just created. This will allow you to interact with the Mode blockchain more comprehensively, unlocking the full potential of your decentralized application.&lt;/p&gt;

&lt;p&gt;Useful links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.reown.com/" rel="noopener noreferrer"&gt;Reown Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs" rel="noopener noreferrer"&gt;Next.js Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mode.network/" rel="noopener noreferrer"&gt;Mode Network Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for following this tutorial! If you have any questions or feedback, feel free to share them. See you in Part 2!&lt;/p&gt;

</description>
      <category>dapp</category>
      <category>frontend</category>
      <category>smartcontract</category>
      <category>wallet</category>
    </item>
    <item>
      <title>Exploring OP Stack and Superchain: The Future of Ethereum Layer 2</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Wed, 27 Nov 2024 23:55:08 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/exploring-op-stack-and-superchain-the-future-of-ethereum-layer-2-2eg8</link>
      <guid>https://dev.to/modenetworkl2/exploring-op-stack-and-superchain-the-future-of-ethereum-layer-2-2eg8</guid>
      <description>&lt;p&gt;The OP Stack and the Superchain are key components in the evolution of the Ethereum ecosystem, proposed by the Optimism collective. The OP Stack is a modular open-source infrastructure that enables the creation of efficient and scalable Layer 2 (L2) blockchains. Meanwhile, the Superchain aims to integrate multiple L2s under a framework of interoperability, optimizing communication and asset exchange between them. This article explores these concepts in detail, highlighting their features and benefits, and providing a clear understanding for those interested in the innovations of Optimism.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the OP Stack?
&lt;/h2&gt;

&lt;p&gt;The OP Stack is a standardized, shared, open-source development stack created by the Optimism collective. It serves as the set of software components that supports Optimism's infrastructure, including its current mainnet, OP Mainnet, and the concept of the Superchain. This infrastructure enables the construction of secure and scalable Layer 2 (L2) blockchains that collaborate to address Ethereum's scalability issues. Essentially, the OP Stack is a “template” that allows organizations or projects to launch their own blockchain compatible with the Ethereum ecosystem without having to build everything from scratch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure and Components of the OP Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optimism Bedrock:&lt;/strong&gt; Optimism Bedrock is the current version of the OP Stack, designed to deploy production-ready Optimistic Rollups. Its modular structure allows for future evolution, including greater flexibility in integrating additional components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Evolution Towards the Superchain:&lt;/strong&gt; As the concept of the Superchain develops, the OP Stack will increasingly focus on creating an interoperable network of L2 blockchains, facilitating secure interactions and more efficient asset transfers between different chains.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Advantages of the OP Stack
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost Reduction:&lt;/strong&gt; Transactions on an OP Stack-based Layer 2 blockchain are significantly cheaper than those on the Ethereum mainnet, resulting in substantial cost savings for both users and businesses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Time and Resource Savings:&lt;/strong&gt; By using the OP Stack, companies can leverage an optimized and pre-existing infrastructure, eliminating the need to develop a blockchain from scratch.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integrated Security and Scalability:&lt;/strong&gt; By adopting the OP Stack architecture, projects benefit from a proven infrastructure that provides a reliable foundation, along with inherent scalability from the Rollup model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interoperability with the Superchain:&lt;/strong&gt; Implementing the OP Stack enables seamless integration of the blockchain into Optimism's Superchain, allowing for secure communication between chains and the exchange of assets. This interoperability feature provides flexibility for users and maximizes asset liquidity.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  A Modular and Scalable Future
&lt;/h3&gt;

&lt;p&gt;The OP Stack is a constantly evolving project. The Bedrock version simplifies the creation of Layer 2 Rollups, but in the future, its modular design is expected to allow the integration of various features, such as cross-chain messaging mechanisms, which will promote complete interoperability within the Superchain ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Superchain
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Vision of Scalability
&lt;/h3&gt;

&lt;p&gt;The vision of scalability in blockchain aims to create an ecosystem capable of supporting a decentralized web: an internet without intermediaries and built on open protocols. Current scalability limitations have prevented blockchain from reaching its full potential, leaving many applications off-chain. However, we now have a clearer vision of how to design a truly scalable blockchain, which we refer to as the Superchain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Foundational Superchain concepts
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Horizontal scalability requires multiple chains…
&lt;/h4&gt;

&lt;p&gt;Horizontal scalability is achieved by adding multiple chains that operate in parallel, distributing the processing load among them. This way, each chain manages only a portion of the work, preventing any single chain from becoming overloaded and allowing the system as a whole to process more transactions.&lt;/p&gt;

&lt;h4&gt;
  
  
  …but traditional multi-chain architectures are insufficient
&lt;/h4&gt;

&lt;p&gt;Traditional multi-chain architectures face two key challenges:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Each new chain requires its own security model, increasing systemic risk as the ecosystem expands.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating new chains is costly, as it requires the implementation of new validators and block producers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To address these issues, Optimism proposes a shared Layer 1 blockchain that serves as a common source of truth for all Layer 2 solutions within the multi-chain system.&lt;/p&gt;

&lt;p&gt;With a Layer 1 serving as a shared source of truth, it becomes possible to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apply a standard security model across all chains.&lt;/li&gt;
&lt;li&gt;Eliminate the need for new validators, as each L2 chain would adopt the consensus of the L1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this way, the Superchain integrates the security and standardization of the L1 with the scalability of multiple L2s.&lt;/p&gt;

&lt;h4&gt;
  
  
  Not multi-chain, not mono-chain… Superchain
&lt;/h4&gt;

&lt;p&gt;The Superchain is a decentralized blockchain platform that connects multiple layer 2 (L2) chains under a unified framework of security and technology known as the OP Stack. This standardized architecture allows each chain to function as an interchangeable resource within a unified network. Unlike traditional multi-chain and mono-chain systems, the Superchain enables developers to build applications that operate seamlessly across chains, eliminating systemic risks and implementation costs. The interoperability of OP Chains ensures that tools and wallets interact uniformly with all chains, simplifying the experience for both developers and users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj87mgy78dx3qne1f56r3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj87mgy78dx3qne1f56r3.png" alt="Superchain" width="800" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary of the Superchain
&lt;/h2&gt;

&lt;p&gt;The Superchain is a network of layer 2 (L2) blockchains, known as OP Chains, that share the security of Ethereum (L1), a communication layer, and an open-source infrastructure called the OP Stack.&lt;br&gt;
Each OP Chain is standardized to function as an interchangeable resource, allowing developers to build applications that can be deployed across the Superchain without relying on a specific chain. This means that an application can run on any OP Chain within the network, and developers can switch chains without affecting the functionality of their applications.&lt;br&gt;
The OP Chains are officially managed by the Optimism Collective, ensuring that all of them adhere to the same standards and create a unified and secure ecosystem.&lt;/p&gt;

&lt;p&gt;To view the list of available OP Chains, visit &lt;a href="https://www.superchain.eco/opstack" rel="noopener noreferrer"&gt;this link&lt;/a&gt;. For more details about the Superchain and its architecture, check &lt;a href="https://docs.optimism.io/stack/explainer#superchain-overview" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today, the Superchain is a concept and an ongoing project, not yet a concrete reality. &lt;a href="https://docs.optimism.io/stack/explainer#the-superchain-at-a-glance" rel="noopener noreferrer"&gt;The documentation&lt;/a&gt; represents the best current estimate of what the components, features, and roadmap of the Superchain will be. Ultimately, its realization will depend on the contributions from the entire Optimism Collective (and will evolve alongside them). &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, the OP Stack and the Superchain represent a significant advancement in the scalability and interoperability of the Ethereum ecosystem. The OP Stack provides a modular and efficient infrastructure that allows developers to create Layer 2 (L2) blockchains more easily and cost-effectively, leveraging the benefits of the Optimistic Rollup model. As the concept of the Superchain evolves, it paves the way for an interconnected network of L2s, where chains can communicate and share assets seamlessly, maximizing liquidity and efficiency within the ecosystem. Together, the OP Stack and the Superchain not only enhance the user and developer experience but also strengthen security and standardization within the Optimism community.&lt;br&gt;
If you would like to dive deeper, here are some technical resources on the OP Stack and the Superchain&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.optimism.io/stack/getting-started" rel="noopener noreferrer"&gt;OP Stack - By Optimism Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.optimism.io/stack/explainer" rel="noopener noreferrer"&gt;Superchain explainer - By Optimism Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://blog.thirdweb.com/superchain/" rel="noopener noreferrer"&gt;What is the Superchain? The Complete Guide - By thirdweb&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.quillaudits.com/blog/blockchain/superchain" rel="noopener noreferrer"&gt;What is Superchain? A Complete Guide - By QuillAudits&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exploring SuperSim: Simulating Interoperability on the Superchain with OP Stack</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Wed, 30 Oct 2024 17:00:35 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/exploring-supersim-simulating-interoperability-on-the-superchain-with-op-stack-15pc</link>
      <guid>https://dev.to/modenetworkl2/exploring-supersim-simulating-interoperability-on-the-superchain-with-op-stack-15pc</guid>
      <description>&lt;p&gt;Recently, I had the opportunity to try out a new tool called SuperSim. As a Mode ambassador, I was able to test it and wanted to share my feedback. Given my ongoing research into L2 solutions, particularly the Optimism ecosystem, this tool caught my attention as a potential asset in understanding how L2s function in practice.&lt;/p&gt;

&lt;p&gt;In this article, I'll walk you through my experience with SuperSim — from the testing process to the challenges I faced, the lessons I learned, and how all of this deepened my understanding of L2 solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is SuperSim?
&lt;/h2&gt;

&lt;p&gt;SuperSim is a lightweight tool designed to simulate the Superchain, which consists of a single L1 chain and multiple L2 chains built with the OP-Stack. Its main advantage is simplicity: it allows devs to run multiple local nodes with a single command, significantly easing the coordination of message passing between these chains. Moreover, it does not require complex devnet configurations, as everything is managed through CLI commands that automatically adjust if no configuration options are specified. Each chain operates as an instance of anvil, a widely used testing tool in local environments.&lt;/p&gt;

&lt;p&gt;SuperSim enables working with pre-deployed anvil nodes and contracts based on the OP Stack, as well as forking multiple remote chains, which allows for replicating the state of the entire Superchain for more realistic testing. Additionally, it simplifies message simulation between L1 and L2, such as deposits, and interoperability between L2 chains, with a built-in auto-relayer that streamlines communication. It will soon include additional features, such as withdrawals and account abstraction services based on the ERC-4337 standard, like bundlers and paymasters, as well as the implementation of smart wallets.&lt;/p&gt;

&lt;h2&gt;
  
  
  How was the Developer Experience?
&lt;/h2&gt;

&lt;p&gt;The installation process for SuperSim was quite straightforward since it is built on Foundry, a widely used tool. However, when I attempted to install SuperSim in an Ubuntu environment running on Windows via WSL, I encountered a problem: the provided commands assumed that Homebrew was already installed, which is not the default case on Ubuntu. To resolve this, I installed Linuxbrew, a version of Homebrew for Linux. &lt;/p&gt;

&lt;p&gt;If you have Ubuntu and want to install Homebrew to try it out, here’s the link that explains the entire process: &lt;a href="https://docs.brew.sh/Homebrew-on-Linux" rel="noopener noreferrer"&gt;Homebrew on Linux&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks to this installation, I successfully executed the necessary commands to install SuperSim in my WSL environment.&lt;/p&gt;

&lt;p&gt;Once I installed Homebrew, I proceeded with the installation of SuperSim, which turned out to be quite straightforward.&lt;/p&gt;

&lt;p&gt;The “&lt;a href="https://supersim.pages.dev/getting-started/first-steps" rel="noopener noreferrer"&gt;First steps&lt;/a&gt;” section is the best place to start, which is divided into two sections. The first involves depositing ETH from L1 to L2, and the second involves sending an interoperable SuperchainERC20 token from chain 901 to 902. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Deposit ETH from the L1 into the L2 (L1 to L2 message passing)&lt;/strong&gt;&lt;br&gt;
First, I verified the balance on L2 (chain 901) to ensure I had an accurate starting point. After confirming the balance, I initiated a transaction from L1 (chain 900) by sending 0.1 ether. Once the transaction was completed, I checked the L2 balance again, which had increased accordingly, reflecting the successful transfer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Send an interoperable SuperchainERC20 token from chain 901 to 902 (L2 to L2 message passing)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The goal of this step is to transfer an ERC20 token from one L2 (chain 901) to another L2 (chain 902). Typically, a cross-chain L2 to L2 transfer involves two key transactions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Send transaction on the source chain (chain 901):&lt;/strong&gt; This initiates the token transfer on chain 901. During this transaction, the token is locked on the source chain, and the transfer details are prepared to be sent to the destination chain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Relay message transaction on the destination chain (chain 902):&lt;/strong&gt; Once the transfer details reach chain 902, a transaction on the destination chain is triggered to finalize the token reception. This transaction ensures that the tokens are available on chain 902.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimizing with &lt;code&gt;--interop.autorelay&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
To simplify this process, SuperSim offers the &lt;code&gt;--interop.autorelay&lt;/code&gt; flag, automatically triggering the relay message transaction on the destination chain. This removes the need for manually sending the relay message, significantly improving the developer experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here’s what I did:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. I started SuperSim with the auto-relay mode enabled.&lt;/strong&gt;&lt;br&gt;
I did this by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;supersim --interop.autorelay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Mint tokens on chain 901 to prepare them for transfer.&lt;/strong&gt;&lt;br&gt;
I executed the following command to mint 1000 L2NativeSuperchainERC20 tokens to the recipient's address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cast send 0x420beeF000000000000000000000000000000001 "mint(address _to, uint256 _amount)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Initiate the send transaction on chain 901, transferring the tokens from chain 901 to chain 902.&lt;/strong&gt;&lt;br&gt;
I did this using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cast send 0x420beeF000000000000000000000000000000001 "sendERC20(address _to, uint256 _amount, uint256 _chainId)" 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 1000 902 --rpc-url http://127.0.0.1:9545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. I waited a few seconds for the relay message to appear on chain 902.&lt;/strong&gt;&lt;br&gt;
Here is the message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO [10-22|13:24:00.942] L2ToL2CrossChainMessenger#RelayedMessage sourceChainID=901 destinationChainID=902 nonce=0 sender=0x420beeF000000000000000000000000000000001 target=0x420beeF000000000000000000000000000000001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Finally, I checked the balance on chain 902 to confirm that the tokens had been successfully transferred and that the balance had increased.&lt;/strong&gt;&lt;br&gt;
I ran the following command to verify the balance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cast balance --erc20 0x420beeF000000000000000000000000000000001 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://127.0.0.1:9546
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Following this guide was fairly easy, given that I have been researching how L2s work, particularly in the context of Optimism. If you want to dive deeper into this topic, I recently published an article on optimistic rollups which you can read &lt;a href="https://mirror.xyz/0x4B4ab33a7Fee58dB20AAF508D48D43101f5E6714/eAu-QPqXFuLIOyJ-8hRNoKaM_OfTL9Y5rNeTB4MJh6c" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After completing the "First steps" section, I explored the interoperability guide titled "Message Relay Manual with cast," which describes how to send messages between different blockchain layers. In this guide, we manually transfer SuperchainERC20 tokens without using the automatic relay feature. The process involves starting the transfer on one layer and then sending the necessary message to complete it on the other layer, if you want to better understand what this involves, &lt;a href="https://supersim.pages.dev/guides/interop/manually-relaying-interop-messages-cast" rel="noopener noreferrer"&gt;here's the link so you can try it too&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While following the guide, I encountered an error during the &lt;strong&gt;"Send the relayMessage transaction"&lt;/strong&gt; step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: server returned an error response: error code 3: execution reverted: custom error 0xeda86850, data: "0xeda86850".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although I double-checked that I was following the steps correctly, the error persisted, and attempts to find solutions using AI were unsuccessful.&lt;/p&gt;

&lt;p&gt;I decided to seek support from the Optimism community. I joined the &lt;a href="https://discord.gg/optimism" rel="noopener noreferrer"&gt;Optimism Discord&lt;/a&gt; and asked in the general chat where I could discuss the issue related to SuperSim. There, I was provided with a link to the repository where I could create a discussion. &lt;/p&gt;

&lt;p&gt;Upon opening the link, I found several options offering different approaches, some more technical than others, such as "Feedback," "Ideas," "General," and "Developer Questions." First, I identified which category would best fit my situation. Since I didn't find any discussions related to the error I was experiencing in the "Developer Questions" section, I decided to create one in the "General" category.&lt;/p&gt;

&lt;p&gt;I added a title that was as descriptive as possible for the problem I was facing and provided detailed, clear, and coherent context regarding my error, ensuring I included all relevant information for others to understand my situation. Finally, I created the discussion outlining the error and the context of my work.&lt;/p&gt;

&lt;p&gt;A few days later, I received a response informing me that they had updated the documentation and asked me to check if the problem persisted. To my satisfaction, the error was resolved; it appeared to be an issue with the original documentation. I’m glad it has been corrected, and I can now effectively test SuperSim.&lt;/p&gt;

&lt;p&gt;This was my first time creating a discussion on GitHub, and I found it to be an interesting experience. I'm very pleased with the prompt response and quick solution I received.&lt;/p&gt;

&lt;p&gt;You can view the complete discussion &lt;a href="https://github.com/ethereum-optimism/developers/discussions/610" rel="noopener noreferrer"&gt;here&lt;/a&gt;. If you'd like to create a discussion, you can do so &lt;a href="https://github.com/ethereum-optimism/developers/discussions" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learnings and Reflections
&lt;/h2&gt;

&lt;p&gt;Thanks to following the steps in the "First Steps" guide, I successfully bridged ETH from Layer 1 to Layer 2 and transferred an interoperable SuperchainERC20 token between Layer 2, all done locally.&lt;/p&gt;

&lt;p&gt;Additionally, while exploring the interoperability guide titled "Message Relay Manual with cast," I learned how to create a message identifier for cross-chain call transmission. This guide outlines the manual message relay process for transferring the SuperchainERC20 token, including key steps such as initiating the transfer on the source chain and relaying the message on the destination chain. This experience has provided me with a broader understanding of interactions between L2s, expanding my knowledge of L2s and the Optimism ecosystem.&lt;/p&gt;

&lt;p&gt;In summary, this experience reinforces the importance of interoperability in multi-chain environments and highlights the usefulness of tools like SuperSim to facilitate these interactions.I plan to create content about what I learn and share my insights along the way.&lt;/p&gt;

&lt;p&gt;For more details and to try SuperSim, you can check out the official documentation &lt;a href="https://supersim.pages.dev/introduction" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My social media:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/wispyiwnl" rel="noopener noreferrer"&gt;x.com/wispyiwnl&lt;/a&gt;&lt;br&gt;
&lt;a href="https://warpcast.com/wispyiwnl" rel="noopener noreferrer"&gt;warpcast.com/wispyiwnl&lt;/a&gt;&lt;/p&gt;

</description>
      <category>supersim</category>
      <category>superchain</category>
      <category>optimism</category>
      <category>interoperability</category>
    </item>
    <item>
      <title>Unit Test ModeSpray</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Wed, 18 Sep 2024 14:19:14 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/unit-test-modespray-1k0b</link>
      <guid>https://dev.to/modenetworkl2/unit-test-modespray-1k0b</guid>
      <description>&lt;p&gt;In this article, I will share my experience conducting a unit test on one of ModeSpray's smart contracts. This is the first test I have carried out, marking the beginning of my journey in web3 security, a path I started about a month ago. Documenting this process not only helps me consolidate what I have learned but can also serve as a guide for others just starting in this field.&lt;/p&gt;

&lt;p&gt;As a Security Researcher, I have been analyzing various dApps in the Mode Network ecosystem, available in their registered applications &lt;a href="https://explorer.mode.network/apps" rel="noopener noreferrer"&gt;here&lt;/a&gt;. During this analysis, I found ModeSpray and decided to focus on assessing the security of its smart contract. Below, I detail my approach and the results obtained during this test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fti7s657ie7zg1t7gymy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fti7s657ie7zg1t7gymy3.png" alt="image description" width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ModeSpray
&lt;/h2&gt;

&lt;p&gt;Before diving into the test I performed, I want to explain what &lt;a href="https://modespray.xyz/" rel="noopener noreferrer"&gt;ModeSpray &lt;/a&gt;is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://modespray.xyz/" rel="noopener noreferrer"&gt;Mode Spray&lt;/a&gt; is a dApp that simplifies the process of sending tokens on Mode. The user-friendly interface allows users to send tokens to multiple wallets in a single transaction. It uses an optimized process to cut down on the transaction fees incurred in transferring funds. You can use Mode Spray to pay contributors, send out grants or just transfer tokens to friends in one go super fast.&lt;/p&gt;

&lt;p&gt;ModeSpray is open-source, and you can view the code &lt;a href="https://github.com/wolfcito/mode-spray" rel="noopener noreferrer"&gt;here&lt;/a&gt;, in addition to being open to contributions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unit Test
&lt;/h2&gt;

&lt;p&gt;A unit test is a test that verifies the correct functioning of an individual unit of code, such as a function. It evaluates the behavior of a single part of the code in isolation, ensuring that each component fulfills its intended purpose and allows for easy identification and resolution of errors.&lt;/p&gt;

&lt;p&gt;I conducted the test with Foundry, following the article by &lt;a href="http://rareskills.io/post/foundry-testing-solidity" rel="noopener noreferrer"&gt;RareSkills&lt;/a&gt; which helped reinforce my knowledge. For this article, I recommend having basic knowledge of Solidity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment Setup
&lt;/h2&gt;

&lt;p&gt;I will walk you through the process I followed to configure everything and start the test (this part is more for documenting the process, it can be skipped).&lt;/p&gt;

&lt;p&gt;I had already installed Foundry. If you do not have it installed and want to install it, you can follow the instructions in the &lt;a href="https://book.getfoundry.sh/getting-started/installation" rel="noopener noreferrer"&gt;Foundry Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup process was as follows:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository
&lt;code&gt;git clone “REPOSITORY_URL”&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Access the repository
&lt;code&gt;cd modespray&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Open the repository in VSCode
&lt;code&gt;code .&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Initialize a Foundry project
Open the terminal in VSCode and initialize a Foundry project.
&lt;code&gt;forge init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install OpenZeppelin
&lt;code&gt;forge install OpenZeppelin/openzeppelin-contracts&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Smart Contract Description
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;BaseSpray&lt;/code&gt;contract, which inherits from OpenZeppelin's &lt;code&gt;Ownable&lt;/code&gt;, allows the distribution of ether among multiple recipients. Below, I provide a brief description of its functionality:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Constructor:&lt;/strong&gt; Initializes the &lt;code&gt;Ownable&lt;/code&gt;contract with an &lt;code&gt;initialOwner&lt;/code&gt;address as the owner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;disperseEther function:&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;Parameters: Accepts two arrays in memory: _recipients (recipient addresses) and _amounts (amounts to distribute).&lt;/li&gt;
&lt;li&gt;Require:&lt;/li&gt;
&lt;li&gt;The _recipients and _amounts arrays must have the same length. If not, the function reverts.&lt;/li&gt;
&lt;li&gt;The _recipients array cannot be empty. If it is empty, the function reverts.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Calculation of totalValue: Accumulates the sum of all _amounts values to determine the total amount to be distributed.&lt;/li&gt;

&lt;li&gt;Balance verification: Ensures that the contract's balance is sufficient to cover totalValue. If not, the function reverts with the message “Insufficient balance”.&lt;/li&gt;

&lt;li&gt;Ether distribution: Iterates over the recipients and makes the corresponding transfers.&lt;/li&gt;

&lt;li&gt;Event: Emits the TokenDispersed event with the transaction details.
&lt;/li&gt;

&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';

/// @custom:security-contact wolfcito.eth+security@gmail.com
contract BaseSpray is Ownable {
    event TokenDispersed(
        address indexed sender,
        address[] recipients,
        uint256[] values,
        address token
    );

    constructor(address initialOwner) Ownable(initialOwner) {}

    function disperseEther(
        address[] memory _recipients,
        uint256[] memory _amounts
    ) external payable {
        require(
            _recipients.length == _amounts.length,
            'Number of recipients must be equal to the number of corresponding values'
        );

        require(_recipients.length &amp;gt; 0, 'Recipients array cannot be empty');

        uint256 totalValue = 0;

        for (uint256 i = 0; i &amp;lt; _recipients.length; i++) {
            totalValue += _amounts[i];
        }

        require(address(this).balance &amp;gt;= totalValue, 'Insufficient balance');

        for (uint256 i = 0; i &amp;lt; _recipients.length; i++) {
            Address.sendValue(payable(_recipients[i]), _amounts[i]);
        }

        emit TokenDispersed(msg.sender, _recipients, _amounts, address(0));
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code Analysis and Test Scenario
&lt;/h2&gt;

&lt;p&gt;Before detailing the test functions I created, I want to mention the tools I used. These tools helped me verify different aspects of the contract and ensure that the scenarios I designed worked correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;During this test, I used the following Foundry functions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;assertEq(value1, value2):&lt;/strong&gt; Verifies that &lt;code&gt;value1&lt;/code&gt;and &lt;code&gt;value2&lt;/code&gt;are equal. If not, the test fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;assertGt(value1, value2):&lt;/strong&gt; Verifies that &lt;code&gt;value1&lt;/code&gt;is greater than &lt;code&gt;value2&lt;/code&gt;. If not, the test fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;vm.expectRevert():&lt;/strong&gt; Sets an expectation that an operation will revert (fail) during the test, allowing verification of the expected error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;vm.expectEmit():&lt;/strong&gt; Sets an expectation that a specific event will be emitted during the test, allowing verification that the correct event was emitted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;vm.deal(address, amount):&lt;/strong&gt; Assigns a specific amount of ether to an address, useful for simulating balance conditions in tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;console.log(message):&lt;/strong&gt; Prints messages to the console during tests, useful for debugging and inspecting data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the environment configured and the context of the &lt;code&gt;BaseSpray&lt;/code&gt;contract and Foundry functions established, let's review how I conducted the unit test:&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the Test Contract
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contract version&lt;/strong&gt;&lt;br&gt;
I used the same contract version I was going to test, in this case 0.8.20.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Import&lt;/strong&gt;&lt;br&gt;
I imported the libraries:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;import {Test, console} from “forge-std/Test.sol”;&lt;/code&gt; imports the &lt;code&gt;Test&lt;/code&gt;library for test functions and &lt;code&gt;console&lt;/code&gt;for printing debugging messages to the console.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import {BaseSpray} from “../src/BaseSpray.sol”;&lt;/code&gt; imports the &lt;code&gt;BaseSpray&lt;/code&gt; contract. I recommend importing only the contract to be tested to avoid having the EVM compile unnecessary code from other contracts in the same file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Creating the Test Contract&lt;/strong&gt;
I created the contract and named it &lt;code&gt;BaseSprayTest&lt;/code&gt; using &lt;code&gt;is Test&lt;/code&gt; to inherit the test library.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;contract BaseSprayTest is Test {}&lt;/code&gt; indicates that &lt;code&gt;BaseSprayTest&lt;/code&gt; inherits from Test, providing access to Foundry's testing functions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Declaration of variables and events&lt;/strong&gt;
I declared the necessary variables and events for the test.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Variables:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;BaseSpray baseSpray;&lt;/code&gt; declares a variable named &lt;code&gt;baseSpray&lt;/code&gt; of type &lt;code&gt;BaseSpray&lt;/code&gt;, which will be used to create and manage an instance of the &lt;code&gt;BaseSpray&lt;/code&gt; contract in the tests. This variable is initialized later to interact with the contract.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;address owner = address(0x55555);&lt;/code&gt; creates a test address for the contract owner. In this case, &lt;code&gt;0x55555&lt;/code&gt; is the address assigned for testing.&lt;/p&gt;

&lt;p&gt;Event:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;event TokenDispersed(&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;address indexed sender,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;address[] recipients,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;uint256[] values,&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;address token&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;);&lt;/code&gt; is emitted to log the token distribution, including the sender, recipients, distributed values, and token type. I created it in the test contract to verify that the contract emits this event correctly during tests.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function setUp&lt;/strong&gt;
I created the &lt;code&gt;setUp&lt;/code&gt;function, which runs before each test to initialize the contract.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;function setUp() public {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;baseSpray = new BaseSpray(owner);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;}&lt;/code&gt; runs before each test to ensure a clean state. In this case, it deploys a new &lt;code&gt;BaseSpray&lt;/code&gt; contract with the specified owner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Functions
&lt;/h2&gt;

&lt;p&gt;After understanding the contract's functionality, especially the &lt;code&gt;disperseEther&lt;/code&gt; function, I started designing test scenarios by formulating key questions. I verified whether the contract's logic executed correctly, such as whether the &lt;code&gt;owner&lt;/code&gt; was properly assigned (even though the &lt;code&gt;onlyOwner&lt;/code&gt; modifier is not used in this contract, it is good practice to confirm the assignment), whether the &lt;code&gt;require&lt;/code&gt; statements validated conditions correctly, and whether the function's logic worked as expected, among other issues.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;First function &lt;code&gt;test_initialOwner&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this function, I verified that the owner is assigned correctly:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36iku1kpc6b8bz81wqty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36iku1kpc6b8bz81wqty.png" alt="First function" width="761" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By using &lt;code&gt;assertEq(baseSpray.owner(), owner, "Owner does not match");&lt;/code&gt; I am stating that the owner of the &lt;code&gt;baseSpray&lt;/code&gt; contract must be equal to owner, and if it is not, it will throw the message "Owner does not match".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Second function &lt;code&gt;test_disperseEtherWorks&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this function, I verify that the disperseEther function works correctly when there is enough balance in the contract and the parameters are valid:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feronkwycuyyvaon87pqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feronkwycuyyvaon87pqh.png" alt="Second function" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;With &lt;code&gt;vm.deal(address(this), 3 ether);&lt;/code&gt; I am giving 3 ether to the contract.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;baseSpray.disperseEther{value: 3 ether}(recipients, amounts);&lt;/code&gt; I am calling the &lt;code&gt;disperseEther&lt;/code&gt; function of the &lt;code&gt;baseSpray&lt;/code&gt; contract and telling it to send 3 ether to the addresses in &lt;code&gt;recipients&lt;/code&gt; and using &lt;code&gt;amounts&lt;/code&gt; to specify how much ether to send to each address in &lt;code&gt;recipients&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;assertEq(recipients[0].balance, 1 ether, "Should have 1 ether");&lt;/code&gt; I am verifying that after calling the &lt;code&gt;disperseEther&lt;/code&gt; function, the correct &lt;code&gt;amount&lt;/code&gt; is given to the first address I created. If this is not correct, it will throw the message "Should have 1 ether".&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;assertEq(recipients[1].balance, 2 ether, "Should have 2 ether");&lt;/code&gt; I am verifying that the second address I created receives the 2 ether after calling the &lt;code&gt;disperseEther&lt;/code&gt; function. If this is not correct, it will throw the message "Should have 2 ether".&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;assertEq(address(baseSpray).balance, 0, "Contract should have 0 ether");&lt;/code&gt; I am verifying that after the contract makes the transfers, it should not have any ether left.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Third function &lt;code&gt;functiontest_requireUnequalLengthsRecipientsAmounts&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this function, I verify that the disperseEther function reverts (fails) when the contract does not have enough balance to make the transfers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmslyg4500edwwb6uvy7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmslyg4500edwwb6uvy7.png" alt="Third function" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;With &lt;code&gt;vm.expectRevert("Insufficient balance");&lt;/code&gt; I expect the function to revert (fail) due to insufficient balance with the message "Insufficient balance".&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;baseSpray.disperseEther(recipients, amounts);&lt;/code&gt; I am calling the &lt;code&gt;disperseEther&lt;/code&gt; function of the &lt;code&gt;baseSpray&lt;/code&gt; contract.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;assertEq(address(baseSpray).balance, 0, "Contract should have 0 ether");&lt;/code&gt; I am verifying that the contract does not have any ether.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fourth function &lt;code&gt;test_requireRecipientsLengthGreaterThanZero&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this function, I verify that the disperseEther function reverts (fails) when the _recipients array is empty:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizj8h6to63h7ep5ainf6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fizj8h6to63h7ep5ainf6.png" alt="Fourth function" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;With &lt;code&gt;vm.expectRevert();&lt;/code&gt; I expect the function to revert (fail) without specifying the error message.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;baseSpray.disperseEther(new address , amounts);&lt;/code&gt; I am calling the &lt;code&gt;disperseEther&lt;/code&gt; function of the &lt;code&gt;baseSpray&lt;/code&gt; contract but passing an empty &lt;code&gt;recipients&lt;/code&gt; array.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;assertEq(address(baseSpray).balance, 0, "Contract should have 0 ether");&lt;/code&gt; I am verifying that the contract does not have any ether.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fifth function &lt;code&gt;test_requireRecipientsLengthEqualToZero()&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this function, I verify that the disperseEther function emits the TokenDispersed event when called correctly:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbab9idgli39rq5co79d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbab9idgli39rq5co79d4.png" alt="Fifth function" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;With &lt;code&gt;vm.expectEmit(true, true, true, true);&lt;/code&gt; I expect the event to be emitted. The four true`` parameters indicate that all indexed fields and non-indexed fields should be verified.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;emit TokenDispersed(address(this), recipients, amounts, address(0));&lt;/code&gt; I emit the event with the parameters I created.&lt;/li&gt;
&lt;li&gt;With &lt;code&gt;baseSpray.disperseEther{value: 3 ether}(recipients, amounts);&lt;/code&gt; I call the &lt;code&gt;disperseEther&lt;/code&gt; function with the previously specified &lt;code&gt;recipients&lt;/code&gt; and &lt;code&gt;amounts&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sixth function &lt;code&gt;test_forLoopTotalValue&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this function, I test the for loop that accumulates the sum of all values in &lt;code&gt;_amounts&lt;/code&gt; to determine the total to be distributed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vr0kszmi5mv5pybwowo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vr0kszmi5mv5pybwowo.png" alt="Sixth function" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What I did here was create a variable of type uint256, called it totalValue, and assigned it the amount of the first address and the second address. Then, with assertEq, I verified that the contract's balance was indeed equal to the totalValue.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Seventh function &lt;code&gt;test_revertWhenBalanceLessThanTotalValue&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verifies that recipients has a length of zero and expects a revert.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsxkjsl4hhoadkp7cw85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsxkjsl4hhoadkp7cw85.png" alt="Seventh function" width="792" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Here, I gave the amounts a total of 3 ether and gave the contract 2 ether. Then I used vm.expectRevert, called the function disperseEther, and tried to send 3 ether to the recipients addresses.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Eighth function &lt;code&gt;test_contractBalanceAfterTransaction&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verifies that the contract balance is zero after executing the transaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fridmkz3b2bddlqc7paqu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fridmkz3b2bddlqc7paqu.png" alt="Eighth function" width="783" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Here, I performed the transaction normally, assigning ether to the contract equal to the amount in amounts. After calling the &lt;code&gt;disperseEther&lt;/code&gt; function, I verified that the contract balance was zero with &lt;code&gt;assertEq&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ninth function &lt;code&gt;test_TokenDispersedEvent&lt;/code&gt;:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verifies that the TokenDispersed event is emitted correctly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx751fjj09pr8maubuv16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx751fjj09pr8maubuv16.png" alt="Ninth function" width="763" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I executed the disperseEther function normally, assigning the parameters correctly. Before calling the function, I used vm.expectEmit and added a console.log with the message "Expected emit set". Then I called the function, and added another console.log after calling the disperseEther function with the message "disperseEther called". Here, I was mostly testing how the console.log function works.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Running the Tests
&lt;/h2&gt;

&lt;p&gt;To run the tests, simply execute the command:&lt;br&gt;
&lt;code&gt;forge test&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Result
&lt;/h2&gt;

&lt;p&gt;After running the tests, it is confirmed that the BaseSpray contract functions correctly in the specified scenarios and appropriately handles error cases. This experience has allowed me to deepen my understanding of unit testing and ensure the robustness of smart contracts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Conducting this unit test allowed me to verify some scenarios of the ModeSpray smart contract. Although it is a basic test, I am satisfied with taking another step forward in my development as a Security Researcher. My next steps will include attempting to attack the contract with the most common attack vectors and performing fuzz testing.&lt;/p&gt;

&lt;p&gt;I would like to thank &lt;a href="https://x.com/RareSkills_io" rel="noopener noreferrer"&gt;RareSkills&lt;/a&gt; for helping me strengthen my knowledge in Foundry, which enabled me to perform this test on &lt;a href="https://modespray.xyz/" rel="noopener noreferrer"&gt;ModeSpray&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading this article. If you enjoyed it and wish to follow my progress as a Security Researcher in web3, as well as stay updated on my upcoming articles, you can follow me on &lt;a href="https://x.com/wispyiwnl" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, now known as X.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ModeSpray Twitter:&lt;/strong&gt; &lt;a href="https://x.com/ModeSpray" rel="noopener noreferrer"&gt;https://x.com/ModeSpray&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RareSkills Twitter:&lt;/strong&gt; &lt;a href="https://x.com/RareSkills_io" rel="noopener noreferrer"&gt;https://x.com/RareSkills_io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RareSkills Article:&lt;/strong&gt; &lt;a href="http://rareskills.io/post/foundry-testing-solidity" rel="noopener noreferrer"&gt;http://rareskills.io/post/foundry-testing-solidity&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wispy Twitter:&lt;/strong&gt; &lt;a href="https://x.com/wispyiwnl" rel="noopener noreferrer"&gt;https://x.com/wispyiwnl&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mode - Blockchain Developer Apprenticeship</title>
      <dc:creator>wispy</dc:creator>
      <pubDate>Mon, 09 Sep 2024 14:11:18 +0000</pubDate>
      <link>https://dev.to/modenetworkl2/mode-blockchain-developer-apprenticeship-4lnl</link>
      <guid>https://dev.to/modenetworkl2/mode-blockchain-developer-apprenticeship-4lnl</guid>
      <description>&lt;p&gt;On June 17th, Mode, in collaboration with Bcamp, launched a blockchain-focused bootcamp. This bootcamp lasts for 7 weeks, with a class every Monday. During these sessions, topics such as Solidity in production, an overview of Mode, Web3 security, and global job searching will be covered. The bootcamp is designed for participants to develop a project of their choice. In the first week, the various available projects will be presented, and participants will select one to work on based on their interests (all projects are blockchain-focused and must be developed on Mode).&lt;/p&gt;

&lt;p&gt;In this article, we will review each week of the bootcamp, how it was experienced, what topics were covered, the project development process, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;June 17th - Week 1: Welcome to BCamp!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this session, BCamp will be introduced. The projects to be undertaken during the bootcamp will be reviewed, and there will be an opportunity to meet the project mentors and other participants.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Week 1 Objective: Code Review and Project Selection&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Submit a code review of IceWater.&lt;/li&gt;
&lt;li&gt;Rate the teams based on your interest in joining them.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Welcome to BCamp.&lt;/li&gt;
&lt;li&gt;Guest Speaker - Fede Sarquis (Mode Developer Relations).&lt;/li&gt;
&lt;li&gt;Project Overview.&lt;/li&gt;
&lt;li&gt;General Overview of Cohort Logistics:

&lt;ul&gt;
&lt;li&gt;Weekly Challenges and Presentations.&lt;/li&gt;
&lt;li&gt;Final Evaluation Panel.&lt;/li&gt;
&lt;li&gt;Weekly MVP Nominations.&lt;/li&gt;
&lt;li&gt;First Week Challenge.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;In the first week, BCamp was introduced.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;During the welcome session, it was discussed how BCamp is an educational organization dedicated to empowering ambitious individuals by providing valuable software development experience. Their ultimate goal is to help participants successfully enter the tech industry.&lt;/p&gt;

&lt;p&gt;The program lasts 7 weeks, from June 17th to August 2nd, 2024. BCamp is described as a hybrid between an internship and a hackathon, which they call "apprenticeship." Each Monday, a live session takes place from 11:30 AM to 1:00 PM PST. The program includes a competition with 3 teams in the finals, weekly MVP awards, and cohort MVP prizes.&lt;br&gt;
There was also a special guest.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Guest Speaker - Fede Sarquis (Mode Developer Relations)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;CryptoFede spoke about his transition from the corporate world to the crypto space, emphasizing the importance of continuous learning in the rapidly growing field of Web 3.0 development. He praised the open-minded culture, internationality, and collaboration in the crypto space, and highlighted the challenges of mastering the Solidity programming language. He stressed the importance of building networks and relationships in the Web 3 space and shared his goal at Mode of empowering developers and helping them create successful applications within the ecosystem. He suggested that the Bcamp initiative could serve as a better alternative to hackathons, as it offers a longer period for participants to build a portfolio and network.&lt;/p&gt;

&lt;p&gt;After Fede's talk, the bootcamp projects were shared.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Project Overview:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;202Ware Project:&lt;/strong&gt; The 202Ware project aims to develop a platform on the MODE network that allows artists to upload and mint their works as NFTs. Through LivingChain Showcase, artists can receive community votes to be featured in a magazine and earn tokens as rewards. These tokens can be used to access events and other rewards. This initiative creates a transparent and secure environment for artists to showcase their work, engage with the community, and enrich the magazine’s content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plinko &amp;amp; Similar Casino Games Project:&lt;/strong&gt; The Plinko &amp;amp; Similar Casino Games project aims to develop a Plinko casino game on the Mode network to enhance transparency and trust in online gambling. The solution proposes running the game logic on the blockchain and using random number generation oracles like Chainlink VRF to ensure fair outcomes. Smart contracts make the game rules public and protect users' data and funds. Additionally, the Mode network allows global access without geographical restrictions, enabling players from around the world to participate and setting a new standard of fairness in blockchain-based gambling games.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ticketchain Project:&lt;/strong&gt; Ticketchain aims to create a decentralized ticketing platform on the Mode network to address common issues in ticketing systems, such as high fees, ticket resale, and counterfeiting. The solution provides organizers with the ability to create and manage events, sell and verify tickets, while buyers can securely purchase, transfer, and resell tickets with reduced fees. The platform uses blockchain technology to ensure the transparency and authenticity of tickets. Ticketchain enhances trust in the ticket buying and selling process and optimizes event management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mode Score Project:&lt;/strong&gt; The Mode Score project aims to develop a dApp that evaluates users' capital efficiency across various web3 ecosystems through an "Idle Score." The application will calculate a capital efficiency score, ranging from 0 to 100, by connecting the user's wallet or entering their address, and then recommend investment opportunities within the Mode ecosystem or others, based on the idle capital detected. This tool enhances portfolio management by helping users identify and seize investment opportunities, increasing capital efficiency, and promoting the use of Total Value Locked (TVL) in blockchain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BitLance Project:&lt;/strong&gt; BitLance is a decentralized platform designed to connect advertisers and freelancers without the high fees of traditional platforms like Upwork and Fiverr. Using smart contracts on the Ethereum blockchain (Mode network), BitLance ensures job completion and freelancer payment, charging a small commission of 1-2% in addition to gas fees, and allowing payments in cryptocurrencies. This approach reduces the costs associated with conventional freelancing platforms and offers a rating system to assess user reliability, providing a more cost-effective and transparent alternative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Generative Art for Liquidity Position NFTs:&lt;/strong&gt; Generative Art for Liquidity Position NFTs aims to improve long-term liquidity retention in blockchain protocols by incorporating generative art into NFTs. Instead of relying solely on profits, the emotional value of these NFTs is used to incentivize liquidity providers to maintain their positions, thereby increasing the "stickiness" of liquidity in the protocols. Maintaining solid liquidity is crucial for the success of a protocol, as deep liquidity reduces investor mistrust and increases transaction volume, benefiting the protocol with higher revenue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Peer-to-Peer Coin Flip Game:&lt;/strong&gt; The Peer-to-Peer Coin Flip Game aims to provide a fair and transparent alternative to centralized betting through a coin flip game based on smart contracts. Users create and join challenges with specific bets, and a random number generator verifies the outcome. The smart contract ensures trustless execution and immediate payouts. This solution removes intermediaries, offering fair odds and transparent results, reducing the risk of fraud and increasing user trust in the betting system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memecoin Audit Bot :&lt;/strong&gt; The Memecoin Audit Bot aims to identify and prevent fraud in the memecoin market through a static analysis tool. This bot monitors new ERC-20 smart contracts, reviews verified source code, and generates reports on potential security issues. Its significance lies in enhancing security and transparency in the memecoin market, protecting investors, and promoting responsible investment practices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collateral-Free Small Loans:&lt;/strong&gt; Collateral-Free Small Loans addresses the challenge of offering loans without collateral, tackling issues like risk assessment, default management, and liquidity. The solution is a platform that enables trust-based and relationship-driven loans, with robust risk evaluation and native stablecoins to maintain liquidity. It will integrate with other DeFi protocols and feature a user-friendly interface. This approach facilitates access to decentralized financial services and promotes the adoption of Web3 and DeFi by eliminating the need for collateral.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blockchain Shipping and Receiving Application:&lt;/strong&gt; The Blockchain Shipping and Receiving Application aims to integrate shipping documentation and logs to improve the tracking of materials during transportation. The solution involves developing an application that uses smart contracts to record loading and unloading, handle payments, and manage rest stops, all on the blockchain. This approach enhances the accuracy of shipment tracking by providing an immutable and real-time accessible record, reducing errors and delays.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;They also discussed the logistics that will be followed during the bootcamp.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They explained the topics that would be covered each week and how the Final Judging Panel and weekly MVP nominations would work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weekly Topics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;June 17th - Session 1:&lt;/strong&gt; Welcome to BCamp!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;June 24th - Session 2:&lt;/strong&gt; Meet Your Team&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;July 1st - Session 3:&lt;/strong&gt; Project Proposals and Guest Speaker on Solidity in Production&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;July 8th - Session 4:&lt;/strong&gt; Project Presentations and Overview of Mode&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;July 15th - Session 5:&lt;/strong&gt; Team Presentations and Guest Speaker on Web3 Security&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;July 22nd - Session 6:&lt;/strong&gt; Pitch for the Finals and Global Job Search&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;July 29th - Session 7:&lt;/strong&gt; Final Project Presentations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;August 2nd - Expert Judging Panel&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Judging Panel:&lt;/strong&gt; The Final Judging Panel will operate as follows: Industry experts will be invited to join the panel to evaluate and provide feedback on the projects that reach the final stage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weekly MVP Nominations:&lt;/strong&gt; There will be weekly polls to choose the MVP, who will be given one minute during the session to be thanked and share more about their experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Week Challenge:&lt;/strong&gt; This week’s challenge involves providing a code review for the IceWater contract, which is a stablecoin with three intentional bugs of varying levels. The code review should be submitted in PDF format. Finding the bugs is not a requirement; the primary goal is for participants to start interacting with blockchain and smart contracts. After submitting the code review, participants can choose which project they want to work on.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;June 24th - Week 2: Meet Your Team&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this session, the teams will be announced, and you will get to meet your team in a breakout room.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Objective of Week 2: Project Planning.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It’s time to start development!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get to know your team, establish task division, and create a meeting schedule that works for everyone.&lt;/li&gt;
&lt;li&gt;Finalize an initial plan for your project with some form of architecture (such as a diagram or README.md).&lt;/li&gt;
&lt;li&gt;Prepare a 3-minute presentation to introduce your project, including the plans and architecture you have developed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Announcement of team assignments.&lt;/li&gt;
&lt;li&gt;Meet Your Team!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This week, the submissions for the Week 1 code review challenge were discussed. Several people identified the first bug, and 2 or 3 found the second bug, but no one detected the third bug. These bugs were intentionally added to encourage participants to interact with Solidity code.&lt;/p&gt;

&lt;p&gt;It was explained that, in the following weeks, each team will need to give a 3-minute progress update presentation until Week 5. In Weeks 6 and 7, presentations will be 7 minutes long. Examples of presentations were shown and shared, and it was recommended that each team start organizing, as project development will commence this week.&lt;/p&gt;

&lt;p&gt;This week, each team got to know each other and began project development.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;July 1st - Week 3: Project Proposals and Guest Speaker on Solidity in Production.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this session, each team will have the opportunity to present their projects for 3 minutes. Additionally, we will welcome a guest speaker, Justin Bebis, CEO of Conclave!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Objective of Week 3: Project Fundamentals&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Write pseudocode and set up the project file structure; once ready, begin developing the alpha version.&lt;/li&gt;
&lt;li&gt;Prepare a 3-minute presentation for next week's session covering the progress made this week.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Guest Speaker: Justin Bebis&lt;/li&gt;
&lt;li&gt;Project Proposals Presentations&lt;/li&gt;
&lt;li&gt;Alien Awards&lt;/li&gt;
&lt;li&gt;Tasks for This Week&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Week 3 began with guests Eidolon and Goober from Conclave, who shared their experience in writing production code in Solidity. They focused on smart contract architecture and front-end and back-end applications, highlighting the importance of security, minimalist design, and thorough testing. They recommended tools such as Foundry and Slither and discussed the challenges of invariant testing. Eidolon and Goober explained that auditors identify potential flaws but do not guarantee error-free code, emphasizing the need to combine audits with independent reviews. They also discussed EVM compatibility, Solidity versioning, and the importance of being prepared for emergencies and vulnerabilities. They shared their experiences entering the crypto world and stressed the relevance of continuous learning and collaboration.&lt;/p&gt;

&lt;p&gt;During this week, each team had their 3-minute presentation to discuss the project they are working on.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;July 8th - Week 4: Project Presentations and Overview of Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this session, each team will have the opportunity to present their projects for 3 minutes.&lt;/p&gt;

&lt;p&gt;Additionally, a representative from Mode will join us to review their product and codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Objective of Week 4: Development 1&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Start or continue developing your project with the goal of compiling and running something this week.&lt;/li&gt;
&lt;li&gt;Prepare a 3-minute presentation for next week’s session that showcases this week’s progress.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Highlight of the Learner&lt;/li&gt;
&lt;li&gt;Project Presentations&lt;/li&gt;
&lt;li&gt;Negotiation Exercise&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Overview of Mode&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Fede explained that Mode is a Layer 2 solution based on Optimism technology, designed to improve efficiency and reduce transaction costs on Ethereum. He highlighted the vision of the Superchain, which aims to interconnect multiple chains to facilitate fund transfers and application integration, creating a more efficient and cost-effective ecosystem. He also emphasized the importance of contributing to the OP Stack project, which is essential for the development and enhancement of these technologies.&lt;/p&gt;

&lt;p&gt;During this week, each team had their 3-minute presentation to showcase the progress they’ve made on their projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;July 15 - Week 5: Team Presentations and Guest Speaker on Web3 Security&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this session, each team will have the opportunity to present their projects for 3 minutes. Additionally, we will welcome a guest speaker from SphereX.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Objective for Week 5: Development 2&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Finalize an alpha version of your application/dApp.&lt;/li&gt;
&lt;li&gt;Prepare a 3-minute presentation for next week's session. This will be your team's final presentation before the judges to determine if you will advance to the finals.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Agenda:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Learner Spotlight&lt;/li&gt;
&lt;li&gt;Project Presentations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ariel from Spyx addressed security challenges in Web3, highlighting code visibility, the risk of direct financial theft, the decentralized nature, and the anonymity of actors. He emphasized the importance of secure key management and mitigating reentrancy attacks, explaining how a malicious actor can exploit vulnerabilities in smart contracts. He also discussed blockchain protocol design and the protection of private keys using tools such as Multi-Party Computation, multi-sig contracts, and hardware wallets. He recommended using development and auditing tools to write secure code and perform thorough reviews.&lt;/p&gt;

&lt;p&gt;During this week, each team had their 3-minute presentation to show the progress of their projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  July 22nd - Week 6: Finals Pitch and Global Job Search
&lt;/h2&gt;

&lt;p&gt;This week, Samuel Miranda discussed strategies for standing out in the competitive job market. An informational interview exercise was also conducted.&lt;/p&gt;

&lt;p&gt;Additionally, each project will have 3 minutes to present their projects and make their final pitch to reach the finals.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Objective of Week 6: Testing&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Test your application/dApp and make final adjustments.&lt;/li&gt;
&lt;li&gt;Prepare a 7-minute presentation about your project for the final session, highlighting the progress made.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In Week 6, strategies for improving LinkedIn profiles and finding employment in a competitive market were covered. Emphasis was placed on personalizing profiles, including relevant skills in the headline, crafting a personal narrative in the "About" section, and adding recommendations to boost credibility and SEO optimization. Sharing posts on relevant topics and work experiences was also recommended. An informational interview exercise was conducted, and the importance of networking and creating LinkedIn groups to facilitate connections was discussed.&lt;/p&gt;

&lt;p&gt;During this week, each team had their 7-minute presentation to showcase the progress of their projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  July 29th - Week 7: Session 7: Final Project Presentations
&lt;/h2&gt;

&lt;p&gt;Development Completed&lt;/p&gt;

&lt;p&gt;The last weekly session! Each team will have the opportunity to deliver a final 7-minute presentation.&lt;/p&gt;

&lt;p&gt;Additionally, the teams advancing to the finals will be announced.&lt;/p&gt;

&lt;p&gt;Teams that make it to the finals must prepare a 7-minute presentation for Friday, August 2nd, when the final judging panel will determine the winners of this cohort.&lt;/p&gt;

&lt;p&gt;CryptoFede shared his insights on the Web3 industry, emphasizing the importance of active participation and feedback. He discussed the challenges of finding work in the sector, advising not to be discouraged by unrealistic job descriptions and to engage in extensive networking. He also mentioned the SuperHack hackathon and the Optimism awards as great opportunities to showcase our projects, earn money, and increase our visibility in the Web3 world.&lt;/p&gt;

&lt;p&gt;In the final session of the bootcamp, teams delivered their final presentations. The top three finalist teams will now be selected and must prepare a 7-minute presentation for Friday, August 2nd. On that day, the winner of the bootcamp will be chosen.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 3 projects that made it to the finals are:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Liquidity NFTs&lt;/li&gt;
&lt;li&gt;Mode Score&lt;/li&gt;
&lt;li&gt;BitLance&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Liquidity NFTs:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The Liquidity NFTs team presented their final project on a landing page. The presentation included the following features and functionalities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generative Art for Liquidity Positions:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Purpose:&lt;/strong&gt; To create generative art for liquidity positions in the form of NFTs. The goal is to enhance the "stickiness" of liquidity by providing emotional value in addition to financial value.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Smart Contract Development:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compatibility and Optimization:&lt;/strong&gt; The team faced compatibility issues between Solidity versions (0.6.5 for DEX contracts and 0.8.0 for ERC 404) and had to limit the contract size. They addressed these issues by creating a separate contract for token management and implementing multiple optimizations.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LP 404 Factory:&lt;/strong&gt; Modification of the ERC 404 contract to incorporate on-chain metadata logic, allowing the minting of ERC 20 LP tokens alongside ERC 721 (NFTs) tokens that represent ownership in the liquidity pool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NFT Visualization:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NFT Viewer:&lt;/strong&gt; Users can request information about their NFTs using the contract address and token ID. Attributes are stored on IPFS and rendered via a canvas.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;User Interface and Live Demo:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Front-End Interface:&lt;/strong&gt; The interface allows users to create and manage ERC 20 token pairs, view balances, deposit and withdraw tokens, and view generated NFTs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Demo:&lt;/strong&gt; The demonstration showed the process of creating a token pair, retrieving contract information, depositing tokens, and minting NFTs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The Liquidity NFTs team delivered an innovative solution that combines emotional and financial incentives to maintain liquidity on DEX platforms. With a robust smart contract structure and an intuitive interface, the project is well-positioned to integrate with major DEXs like Uniswap and expand to other protocols that require liquidity.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Mode Score&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The ModeScore team, during their 10-minute presentation, showcased the final project on a landing page hosted on Vercel. The presentation included the following features and functionalities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Landing Page:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Navigation:&lt;/strong&gt; The homepage features a navigation menu that redirects to sections like features, team information, and contact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contact Form:&lt;/strong&gt; Users can send messages through a form, with emails being forwarded to the team's inbox.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Wallet Connection:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Wallet Connection API:&lt;/strong&gt; The application allows users to connect their wallet using Metamask and other connection options. This functionality is managed through an API that supports over 420 types of wallets, providing flexibility and accessibility for users.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;User Dashboard:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Visualization:&lt;/strong&gt; Once the wallet is connected, users can view their financial score, details of their assets, and recent transactions. The dashboard displays the ModeScore, congratulating the user on their first step toward financial efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Interface:&lt;/strong&gt; The dashboard includes a sidebar navigation that allows users to view specific details of their assets and transactions. Users can also switch between different cryptocurrencies, such as ETH and MODE.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Score Calculation Algorithm:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Integration with Covalent API:&lt;/strong&gt; The backend uses the Covalent API to retrieve detailed data from the user's wallet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex Algorithm:&lt;/strong&gt; An algorithm that calculates the financial score based on multiple factors, including wallet activity, transaction history, balance, and more.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Score Presentation:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Score Range:&lt;/strong&gt; Users receive a score ranging from 300 to 900, with personalized messages explaining their financial situation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credibility Details:&lt;/strong&gt; Detailed visualization of the evaluated parameters, including credibility and transaction traffic.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Deployment and Accessibility:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Back-End:&lt;/strong&gt; Deployed on Render, handling requests and data processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Front-End:&lt;/strong&gt; Deployed on Vercel, providing a user-friendly and accessible interface.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The ModeScore team delivered a comprehensive and well-designed application that enables users to assess and optimize their digital assets. With an intuitive interface and a sophisticated algorithm, ModeScore positions itself as an essential tool for efficient investment management in the Mode ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;BitLance&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Bitlance team presented their final project, a decentralized freelance platform. The presentation included the following features and functionalities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bitlance:&lt;/strong&gt; Decentralized Freelance Platform

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Problems in Web 2:&lt;/strong&gt; Freelance platforms in Web 2 face issues such as fees up to 20%, payments taking up to two weeks, and lack of transparency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bitlance Solution:&lt;/strong&gt; Lower fees, instant payments through smart contracts, and transparent data.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Project Structure:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Front-End and Back-End:&lt;/strong&gt; Users interact with the web interface and can connect their wallet via Metamask or Rainbow Wallet. The back-end only stores the user's email and name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mode Network:&lt;/strong&gt; Communication with the Mode network to manage data and transactions.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;System Features:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Login and User Profile:&lt;/strong&gt; Users can log in and view their profile, both as clients and freelancers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Job Creation and Application:&lt;/strong&gt; Clients can create job listings, and freelancers can apply to them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Job and Payment Management:&lt;/strong&gt; Clients can select freelancers for their jobs, and payments are managed through a smart contract acting as an escrow account. &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Work and Payment Process:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client:&lt;/strong&gt; The client creates a job and specifies the payment in LINK tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Freelancer:&lt;/strong&gt; The freelancer applies for the job and waits for client approval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approval and Completion:&lt;/strong&gt; Once approved, the freelancer completes the job, and the client releases the payment from the escrow account upon job completion.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Live Demo:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Demo Interaction:&lt;/strong&gt; The demo showcased the complete flow from job creation, freelancer application, client selection of the freelancer, job completion, and final payment to the freelancer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transactions on the Network:&lt;/strong&gt; LINK tokens on the Mode network were used to demonstrate the movement of funds between the client's and freelancer's accounts.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; The Bitlance team delivered a solution that addresses issues faced by Web 2 freelance platforms through a decentralized platform with lower fees, instant payments, and increased transparency. The project is well-positioned to enhance the freelance experience for both freelancers and clients within the blockchain ecosystem.&lt;/p&gt;

&lt;p&gt;Each team must prepare a 10-minute presentation for Friday, August 2, the day when the winning project of the bootcamp will be chosen.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;August 2nd - Week 8: Expert Evaluation Panel&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Industry experts will form an evaluation panel to assess and provide feedback on the projects that reach the final. Additionally, the MVPs of the cohort will be announced, and awards will be distributed. &lt;/p&gt;

&lt;p&gt;In the final evaluation session of the incubation program, it was announced that &lt;strong&gt;third place&lt;/strong&gt; went to the &lt;strong&gt;ModeScore&lt;/strong&gt; project and &lt;strong&gt;second place&lt;/strong&gt; to the &lt;strong&gt;Bitlance&lt;/strong&gt; team. &lt;strong&gt;The winning project was Liquidity for NFT Positions&lt;/strong&gt;, excelling in the categories of innovation and product vision. The judges praised the quality of the projects and the enthusiasm of the participants, highlighting that many demonstrated a high level of commitment and collaboration.&lt;/p&gt;

&lt;p&gt;During the final discussion, there was enthusiasm for the projects and participation in the program, with a focus on ongoing connection and support among community members. Future sponsorships and opportunities for participating teams were mentioned, especially in areas such as game development and blockchain-based solutions.&lt;/p&gt;

&lt;p&gt;The intent to use the program as a platform to promote and connect emerging talent with real market opportunities was discussed, emphasizing the potential for collaboration with various platforms and projects.&lt;/p&gt;

&lt;p&gt;The event concluded with thanks and a call to maintain connections through LinkedIn and other networks, encouraging participants to stay in touch and explore new opportunities.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Successful Journey
&lt;/h2&gt;

&lt;p&gt;The recent bootcamp, which brought together 47 participants, has been an incredibly enriching experience for everyone involved. Throughout the program, each team had the opportunity to develop and present projects addressing a wide range of challenges and innovations in the blockchain space.&lt;/p&gt;

&lt;p&gt;This event not only helped boost individual talent but also laid the groundwork for future developments in the blockchain ecosystem, particularly within the Mode Network. The diversity of projects and the creativity demonstrated by the teams highlight the potential for creating solutions that enhance the efficiency, security, and scalability of decentralized applications. These advancements could influence new technological proposals, attracting more developers and users to the network, thus strengthening its adoption.&lt;/p&gt;

&lt;p&gt;We would like to express our sincere gratitude to Mode and Bcamp for making this event possible. Their support was crucial to the success of the bootcamp. A special thanks to Fede, whose commitment was outstanding throughout the entire process.&lt;/p&gt;

&lt;p&gt;As the projects continue to evolve, it's likely that collaborations and ideas will emerge, driving new applications within the Mode ecosystem. This initiative not only fosters short-term innovation but could also serve as a catalyst for larger-scale projects, contributing to the growth and development of the blockchain sector as a whole. The impact of this bootcamp could, in the long term, influence the strategic direction of Mode Network, setting a precedent for future training and development programs.&lt;/p&gt;

&lt;p&gt;We look forward to seeing how these projects will continue to evolve and significantly contribute to the Mode Network ecosystem and beyond, driving new solutions for the blockchain industry.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
