<?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: Bhanavi Goyal</title>
    <description>The latest articles on DEV Community by Bhanavi Goyal (@bhanavigoyal).</description>
    <link>https://dev.to/bhanavigoyal</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%2F3073287%2F3fa39cfb-d039-4f1d-9fbf-caa115ed2260.jpeg</url>
      <title>DEV Community: Bhanavi Goyal</title>
      <link>https://dev.to/bhanavigoyal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bhanavigoyal"/>
    <language>en</language>
    <item>
      <title>Building a Trustless Escrow dApp on Sui: My Learning Journey</title>
      <dc:creator>Bhanavi Goyal</dc:creator>
      <pubDate>Mon, 12 May 2025 05:39:12 +0000</pubDate>
      <link>https://dev.to/bhanavigoyal/building-a-trustless-escrow-dapp-on-sui-my-learning-journey-20id</link>
      <guid>https://dev.to/bhanavigoyal/building-a-trustless-escrow-dapp-on-sui-my-learning-journey-20id</guid>
      <description>&lt;p&gt;I recently built a simple—but surprisingly deep—escrow application on the Sui blockchain. My goal was to learn Move, master Sui’s object model, and tie it all together with a React + TypeScript frontend. Along the way I hit a bunch of hurdles—some in Move, others in Typescript—and each taught me something new. Here’s the story of how I built my first dApp on sui and what all problems I faced along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Chose Sui &amp;amp; Move
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Everything is an object&lt;/strong&gt;
On Sui, NFTs and coins are actual objects you can move around easily. That means I don’t need to deal with complex smart contract state—just send or modify an object directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No silly bugs with assets&lt;/strong&gt;
Move is strict. You can’t lose or duplicate tokens by mistake. If I try something unsafe with an NFT (like forgetting to return it), it won’t even compile. That’s a huge plus when you’re handling swaps or locks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend is super smooth&lt;/strong&gt;
Thanks to @mysten/dapp-kit, I could plug Sui into my React project with minimal effort. I didn’t have to write custom wallet logic or complex RPCs—it all felt like writing regular web code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Helpful structure for learning&lt;/strong&gt;
Move forces you to think clearly about ownership, transfers, and safety. At first it was hard, but now I feel like I understand smart contracts better than I ever did with Solidity.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How the Escrow Works (Alice &amp;amp; Bob)
&lt;/h2&gt;

&lt;p&gt;Let’s understand this with Alice and Bob — two NFT collectors who want to trade safely.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤝Bob locks his NFT
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Bob wants to exchange his NFT, but he doesn’t want to risk it being taken without a fair trade. So, he uses the on-chain &lt;code&gt;lock()&lt;/code&gt; function to lock his NFT, which generates a unique Key.&lt;/li&gt;
&lt;li&gt;This Key is like a secret code that can unlock the NFT later.&lt;/li&gt;
&lt;li&gt;He then shares this Key with Alice (off-chain).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🔒 Why lock?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once locked, Bob can’t transfer, sell, or tamper with the NFT.&lt;/li&gt;
&lt;li&gt;If Bob tries to unlock it manually, the Key gets destroyed.&lt;/li&gt;
&lt;li&gt;So if he unlocks it after Alice creates an escrow using the Key, the swap will fail — ensuring trust.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🤝Alice creates the escrow
&lt;/h3&gt;

&lt;p&gt;Alice takes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Key Bob gave her&lt;/li&gt;
&lt;li&gt;One of her own unlocked NFTs&lt;/li&gt;
&lt;li&gt;Bob’s wallet address&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;She then calls &lt;code&gt;create_escrow()&lt;/code&gt; on-chain, locking in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Key (to Bob’s NFT)&lt;/li&gt;
&lt;li&gt;Her own NFT&lt;/li&gt;
&lt;li&gt;Bob’s address (recipient)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates an on-chain escrow object visible to Bob.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤝Bob accepts or rejects the trade
&lt;/h3&gt;

&lt;p&gt;Bob now sees this escrow in his “Received Escrows”.&lt;/p&gt;

&lt;p&gt;He can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;swap()&lt;/code&gt; to complete the trade — both NFTs are swapped using the smart contract.&lt;/li&gt;
&lt;li&gt;Or call &lt;code&gt;unlock()&lt;/code&gt; to reject it — and retrieve his locked NFT (but the Key changes, so the swap can’t happen).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧠 Why This Matters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔐 Tamper-proof:&lt;br&gt;
Because Bob’s NFT is locked, Alice knows it won’t disappear before the trade. And if it does, the swap fails safely.&lt;/p&gt;

&lt;p&gt;🛠️ Trustless exchange:&lt;br&gt;
This setup removes the need for a trusted middleman or marketplace. Alice and Bob only rely on the smart contract logic to perform a secure and fair exchange.&lt;/p&gt;

&lt;p&gt;No third party. No risks. Just code.&lt;/p&gt;
&lt;h2&gt;
  
  
  Key Challenges &amp;amp; How I Solved Them
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Move &lt;code&gt;Option&amp;lt;T&amp;gt;&lt;/code&gt; &amp;amp; &lt;code&gt;option::extract&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
Symptom: My escrow struct wrapped the NFT in Option. Calling option::extract moves the value out, leaving None. When I later tried to read or re-extract it, the transaction aborted.&lt;/p&gt;

&lt;p&gt;Fix: Always guard with assert!(option::is_some(&amp;amp;escrow.escrowed_obj), …) before extracting, and never touch that field again unless you reinitialize or return it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Fetching data fields from the &lt;code&gt;getOwnedObjects()&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
Symptom: getOwnedObjects() by default only returns { objectId, version, digest }. My .fields calls on obj.data.content failed silently.&lt;/p&gt;

&lt;p&gt;Fix: Request full data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await client.getOwnedObjects({
  owner: address,
  options: { showType: true, showContent: true }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(nft.data.content?.dataType==="moveObject"){
   const fields = nft.data.content.fields as {
       name:string
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Listing Shared Escrows via Events&lt;/strong&gt;&lt;br&gt;
Symptom: Shared escrow objects live under a system “shared” address, not each user’s account, so &lt;code&gt;getOwnedObjects(&lt;/code&gt;) never showed them.&lt;/p&gt;

&lt;p&gt;Fix: In &lt;code&gt;create_escrow&lt;/code&gt;, emit a &lt;code&gt;EscrowCreated&lt;/code&gt; event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;event::emit(EscrowCreated { id, sender: ctx.sender(), recipient });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then on frontend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const response = await client.queryEvents({
   query: {
      MoveEventType:"0x31b818703f625a7521c1a09d95f5cecddbaa0fe163bb83fe84d3105d86d14062::escrow::EscrowCreated",
   },
   limit: 50,
});

const events = response.data;

const objectPromises = events.map((event) =&amp;gt; {
     const parsed = event.parsedJson as EscrowCreatedEvent;
     if (parsed?.id) {
    return fetchEscrowObject(parsed.id);
     }
     return null;
}).filter(Boolean);

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Lessons &amp;amp; Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Move’s resource model is powerful but has a learning curve—especially around Option and object abilities (copy/drop).&lt;/li&gt;
&lt;li&gt;Always request full RPC data (showType and showContent) before reading Move object fields.&lt;/li&gt;
&lt;li&gt;Events + queryEvents are essential to track shared objects or past actions.&lt;/li&gt;
&lt;li&gt;Clear separation of concerns—hooks for chain logic, context for state, components for UI—makes the app maintainable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✨ Thanks for reading! Feel free to share or comment if you have questions or want to chat about Sui blockchain or Web3.&lt;/p&gt;

&lt;p&gt;👉 Check out the code on GitHub: &lt;a href="https://github.com/bhanavigoyal/sui-escrow" rel="noopener noreferrer"&gt;https://github.com/bhanavigoyal/sui-escrow&lt;/a&gt;&lt;br&gt;
Feel free to star, fork, or DM me for collab! 🚀&lt;/p&gt;

&lt;p&gt;➡️ I’m exploring Sui development with Move and on-chain assets. If you’re curious or building in Web3, let’s connect!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>dapp</category>
      <category>sui</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>NFTs on Sui vs Solana vs Ethereum: A Beginner-Friendly Guide</title>
      <dc:creator>Bhanavi Goyal</dc:creator>
      <pubDate>Tue, 22 Apr 2025 07:27:47 +0000</pubDate>
      <link>https://dev.to/bhanavigoyal/nfts-on-sui-vs-solana-vs-ethereum-a-beginner-friendly-guide-1hm8</link>
      <guid>https://dev.to/bhanavigoyal/nfts-on-sui-vs-solana-vs-ethereum-a-beginner-friendly-guide-1hm8</guid>
      <description>&lt;p&gt;If you're new to the Web3 world and wondering why everyone keeps talking about NFTs, or why NFTs on Sui are such a big deal compared to Ethereum and Solana, you're in the right place. This blog will walk you through the basics of NFTs and show you how they differ across three popular blockchains: &lt;strong&gt;Ethereum, Solana, and Sui.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are NFTs, Really?
&lt;/h2&gt;

&lt;p&gt;First let's start from the basics. NFT stands for Non-Fungible Token. It sounds technical, but it just means a unique digital item you can own — like digital art, a game item, a music track, or even a ticket. Unlike cryptocurrencies like Bitcoin or ETH, each NFT is unique and can't be swapped 1:1 with another.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fungible Token (like ETH or SOL)&lt;/strong&gt;: All tokens are the same. If you trade one ETH for another, nothing changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-Fungible Token (NFT)&lt;/strong&gt;: Each one is different, with its own name, image, and data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Think of an NFT like the Mona Lisa Painting. It is unique and can't be swapped with another painting.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  But do NFTs really hold the image?
&lt;/h3&gt;

&lt;p&gt;Not really. Most NFTs don’t keep the actual image inside them. They just hold a link to where the image is saved (usually on systems like IPFS or Arweave). So when you buy an NFT, you're getting a token that says, "Hey, the image is over there!" — not the image itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  🌐 NFTs on Ethereum
&lt;/h2&gt;

&lt;p&gt;Ethereum is where NFTs became popular. Most NFTs use a format called ERC-721, which is just a standard way to create and manage NFTs. Think of it like rules that everyone follows so NFTs work the same across different apps. For example, if you make a digital trading card, ERC-721 helps your wallet and marketplace understand how to show and trade it.&lt;/p&gt;

&lt;p&gt;Imagine buying a movie ticket printed on paper:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You hold a physical ticket with a ticket number and showtime details.&lt;/li&gt;
&lt;li&gt;Behind the scenes, the theater keeps its master schedule and seating chart in a computer system.&lt;/li&gt;
&lt;li&gt;If you lose the ticket, the theater can look up your ticket number in their system to confirm your seat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Ethereum NFTs work:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your wallet holds a token ID (like the ticket number).&lt;/li&gt;
&lt;li&gt;That token ID points to metadata off-chain (like the theater’s database entry with movie info, time, seat).&lt;/li&gt;
&lt;li&gt;The blockchain only tracks your token ID and link; it doesn’t store all the details.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;All ticket details live off-chain (in the theater’s system).&lt;/li&gt;
&lt;li&gt;Changing the showtime or seat requires updating the off-chain database, not the blockchain.&lt;/li&gt;
&lt;li&gt;Transactions (minting/transferring) can be slow and costly when the network is busy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚡ NFTs on Solana
&lt;/h2&gt;

&lt;p&gt;Solana is designed to be fast and cheap to use. It uses a system called &lt;strong&gt;Metaplex&lt;/strong&gt; to create and manage NFTs.&lt;/p&gt;

&lt;p&gt;On Solana, imagine a digital movie ticket in your phone’s wallet app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your phone creates a digital slot for each ticket you collect.&lt;/li&gt;
&lt;li&gt;The ticket has a link (QR code) to an off-chain database with showtime and seat info.&lt;/li&gt;
&lt;li&gt;You tap the ticket in your wallet, and it pulls up the details from the database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Solana NFTs work:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your wallet sets up an Associated Token Account (ATA)—think of it as a dedicated pocket or sleeve in your digital wallet, created automatically for each NFT type you receive.&lt;/li&gt;
&lt;li&gt;The ATA holds the actual token for that NFT mint, just like a specific sleeve in your wallet app holds one movie ticket. If you collect multiple tickets (NFTs), each goes into its own sleeve.&lt;/li&gt;
&lt;li&gt;This separation helps your wallet easily manage and display each NFT correctly.&lt;/li&gt;
&lt;li&gt;Without an ATA, your wallet wouldn’t know where to put or find that NFT, so every unique NFT mint needs its own ATA.&lt;/li&gt;
&lt;li&gt;The NFT token in that ATA includes a metadata URI (like a link) pointing to off-chain data (movie info: seat, showtime, etc.).&lt;/li&gt;
&lt;li&gt;Metaplex standardizes this process so wallets and apps can reliably fetch and display the NFT’s details.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Ticket details are off-chain; you rely on external servers.&lt;/li&gt;
&lt;li&gt;Updating ticket data still means updating off-chain metadata and URI.&lt;/li&gt;
&lt;li&gt;Changing details requires permission from the update authority (like the theater).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔥 NFTs on Sui
&lt;/h2&gt;

&lt;p&gt;Sui takes NFTs further by making them true on-chain objects—everything about the NFT (like name, image, and traits) is stored directly on the blockchain, not just a link. For example, imagine a library book that automatically stamps its own cover each time it's borrowed, so the book itself always shows its current status without any separate checkout log. And that is why it is sometimes called smart NFTs. &lt;em&gt;How cool is that?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's go back to our movie ticket - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, imagine a movie ticket that you can upgrade and change. This ticket holds all the information about your movie experience—your seat, showtime, and special perks like VIP access—all within the ticket itself.&lt;/li&gt;
&lt;li&gt;Upgrading your seat? You simply update the ticket with a new seat number. No need to go back to a database or change any external file.&lt;/li&gt;
&lt;li&gt;The ticket holds all this information directly, meaning it’s always available and up-to-date.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Sui NFTs work:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sui NFTs are like these smart movie tickets—everything about them, from metadata to state, is stored fully on-chain.&lt;/li&gt;
&lt;li&gt;Information such as your seat or perks is modifiable directly through smart contracts.&lt;/li&gt;
&lt;li&gt;This makes Sui NFTs dynamic, allowing changes like seat upgrades to happen efficiently on-chain without relying on external servers or links.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Fully on-chain: no need for external servers or links.&lt;/li&gt;
&lt;li&gt;Dynamic upgrades: tickets can be updated (seat changes, add-ons).&lt;/li&gt;
&lt;li&gt;Transparent history: every change is recorded and verifiable.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Newer ecosystem—fewer libraries and tools than Ethereum or Solana.&lt;/li&gt;
&lt;li&gt;Developers need to learn Sui’s Move programming language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🚀 Why Sui NFTs Matter
&lt;/h2&gt;

&lt;p&gt;With Sui, NFTs aren’t just static items—they’re living, evolving digital assets. This opens up a whole new world of possibilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Epic game items&lt;/strong&gt; that grow with you—level up, evolve, and gain new abilities over time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Membership passes&lt;/strong&gt; that auto-update to unlock exclusive perks as the game world or experience changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic collectibles&lt;/strong&gt; that adapt to real-world events and player actions in real-time, creating an ever-changing experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ethereum introduced NFTs, Solana made them fast and cheap, and Sui is making them truly dynamic.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;If you're new to Web3, understanding NFTs on different blockchains is key. Ethereum’s ERC-721 set the standard, Solana’s Metaplex scaled performance, and Sui’s object-centric design adds real interactivity.&lt;/p&gt;

&lt;p&gt;➡️ I’m exploring Sui development with Move and on-chain assets. If you’re curious or building in Web3, let’s connect!&lt;/p&gt;

&lt;p&gt;✨ Thanks for reading! Feel free to share or comment if you have questions or want to chat about NFTs or Web3.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>nft</category>
      <category>beginners</category>
      <category>sui</category>
    </item>
  </channel>
</rss>
