<?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: Jinali Pabasara</title>
    <description>The latest articles on DEV Community by Jinali Pabasara (@jinali98).</description>
    <link>https://dev.to/jinali98</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%2F648260%2F207ee045-1db9-482d-a801-89669c677a78.jpeg</url>
      <title>DEV Community: Jinali Pabasara</title>
      <link>https://dev.to/jinali98</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jinali98"/>
    <language>en</language>
    <item>
      <title>Crafting a Stitch-Inspired Memecoin on Sui</title>
      <dc:creator>Jinali Pabasara</dc:creator>
      <pubDate>Tue, 13 Jan 2026 04:27:56 +0000</pubDate>
      <link>https://dev.to/jinali98/crafting-a-stitch-inspired-memecoin-on-sui-4o0h</link>
      <guid>https://dev.to/jinali98/crafting-a-stitch-inspired-memecoin-on-sui-4o0h</guid>
      <description>&lt;p&gt;Last weekend, I went out with friends to catch Lilo &amp;amp; Stitch on the big screen, the heartwarming tale of a spunky Hawaiian girl and her mischievous alien companion. As the credits rolled, a simple idea struck me: why not channel Stitch’s playful spirit into something unique on-chain? And that’s exactly what we’ll do today by building a memecoin on Sui inspired by everyone’s favorite blue experiment!!.&lt;/p&gt;

&lt;p&gt;Welcome to the first article of a multi-part series all about crafting your memecoin on Sui. Over the coming days, we’ll explore design strategies and practical implementation for creating memecoin on Sui, using our Stitch inspired memecoin as a running example.&lt;/p&gt;

&lt;p&gt;In this opening chapter, we’ll lay the groundwork by unpacking essential concepts and diving into smart contract design.&lt;/p&gt;

&lt;p&gt;Before we dive in, I’ll assume you already have a basic grasp of smart contracts. If you’re new to Sui, don’t worry, head down to the Prerequisites section below, where you’ll find step-by-step guidance on setting up your development environment and writing your first Move module on Sui.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Sui
&lt;a href="https://docs.sui.io/guides/developer/getting-started/sui-install" rel="noopener noreferrer"&gt;https://docs.sui.io/guides/developer/getting-started/sui-install&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Environment Set up
&lt;a href="https://docs.sui.io/guides/developer/getting-started/connect" rel="noopener noreferrer"&gt;https://docs.sui.io/guides/developer/getting-started/connect&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Writing Your First Smart Contract On Sui
&lt;a href="https://docs.sui.io/guides/developer/first-app/write-package" rel="noopener noreferrer"&gt;https://docs.sui.io/guides/developer/first-app/write-package&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can grab the completed source code for the contract from &lt;a href="https://github.com/jinali98/sui_memecoin/blob/main/sources/stitch.move" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Crafting Our Memecoin’s Move Contract
&lt;/h3&gt;

&lt;p&gt;As for the first step, run the command below to generate a boilerplate package that includes a &lt;code&gt;Move.toml&lt;/code&gt; manifest and a &lt;code&gt;source&lt;/code&gt; folder containing a default module.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sui move new sui_memecoin

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

&lt;/div&gt;



&lt;p&gt;Next, let’s rename the default module created inside the source folder to &lt;code&gt;stitch.move&lt;/code&gt;. This module will be the main module where we implement the logic for our memecoin.&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%2F7g76krsspupmjnxc9bvy.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%2F7g76krsspupmjnxc9bvy.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, copy the code below and paste it into your module. We’ll walk through what each line of code does next.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module sui_memecoin::stitch;

use sui::coin::{Self, TreasuryCap};
use sui::transfer;
use sui::url::new_unsafe_from_bytes;

public struct STITCH has drop {}

const TOTAL_SUPPLY: u64 = 100_000_000_000;

fun init(otw: STITCH, ctx: &amp;amp;mut TxContext) {
    let (mut treasury, metadata) = coin::create_currency(
        otw,
        9,
        b"STITCH",
        b"STITCH",
        b"Stitch is a playful memecoin on Sui inspired by everyone's favorite duo, Lilo &amp;amp; Stitch. Fueled by the spirit of ohana, STITCH lets fans tip, swap and celebrate with little experiments of value—bringing that Hawaiian heart and mischief right onto the blockchain",
        option::some(
            new_unsafe_from_bytes(
                b"https://static.wikia.nocookie.net/the-stitch/images/e/e9/Stitch_OfficialDisney.jpg/revision/latest?cb=20140911233238",
            ),
        ),
        ctx,
    );

    // mint the total supply to the treasury during initialization
    mint(&amp;amp;mut treasury, TOTAL_SUPPLY, ctx.sender(), ctx);

    // Freeze the meta data so its immutable
    transfer::public_freeze_object(metadata);

    // freeze the treasury so its immutable
    transfer::public_freeze_object(treasury);
}

// mint function is used to mint STITCH coins to a recipient
public fun mint(
    treasury: &amp;amp;mut TreasuryCap&amp;lt;STITCH&amp;gt;,
    amount: u64,
    recipient: address,
    ctx: &amp;amp;mut TxContext,
) {
    let coin = coin::mint(treasury, amount, ctx);

    transfer::public_transfer(coin, recipient);
}

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

&lt;/div&gt;



&lt;p&gt;If you are not familiar with Move, the first line in our code initiates our Sui Move module. We start with the package name, followed by our module name. In this case, the package name is &lt;code&gt;sui_memecoin&lt;/code&gt;, and the module name is &lt;code&gt;stitch&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module sui_memecoin::stitch;

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

&lt;/div&gt;



&lt;p&gt;Next, we import all the modules that we will use to develop the memecoin.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use sui::coin::{Self, TreasuryCap};
use sui::transfer;
use sui::url::new_unsafe_from_bytes;
Now, if you take a look at the first function in our code, which is the `init` function, you’ll notice that it takes two arguments.

fun init(otw: STITCH, ctx: &amp;amp;mut TxContext) {
    let (mut treasury, metadata) = coin::create_currency(
        otw,
        9,
        b"STITCH",
        b"STITCH",
        b"Stitch is a playful memecoin on Sui inspired by everyone's favorite duo, Lilo &amp;amp; Stitch. Fueled by the spirit of ohana, STITCH lets fans tip, swap and celebrate with little experiments of value—bringing that Hawaiian heart and mischief right onto the blockchain",
        option::some(
            new_unsafe_from_bytes(
                b"https://static.wikia.nocookie.net/the-stitch/images/e/e9/Stitch_OfficialDisney.jpg/revision/latest?cb=20140911233238",
            ),
        ),
        ctx,
    );

    // mint the total supply to the treasury during initialization
    mint(&amp;amp;mut treasury, TOTAL_SUPPLY, ctx.sender(), ctx);
    // Freeze the meta data so its immutable
    transfer::public_freeze_object(metadata);
    // freeze the treasury so its immutable
    transfer::public_freeze_object(treasury);
}

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

&lt;/div&gt;



&lt;p&gt;For those new to Move, the Sui runtime automatically calls the &lt;code&gt;init&lt;/code&gt; function for every module within a package only once upon the publication of that package.&lt;/p&gt;

&lt;p&gt;In our case, we can use the &lt;code&gt;init&lt;/code&gt; function to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Set the one-time witness.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provide the transaction context, which includes details about the address that publishes the contract&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are not familiar with the one-time witness pattern, &lt;a href="https://move-book.com/programmability/witness-pattern.html" rel="noopener noreferrer"&gt;check out the one-time witness pattern section&lt;/a&gt; in the Move book for a better understanding.&lt;/p&gt;

&lt;p&gt;In brief, the primary purpose of the one-time witness pattern is to guarantee that a resource or type can be instantiated or used only once.&lt;/p&gt;

&lt;p&gt;Next, let’s check what’s happening inside the &lt;code&gt;init&lt;/code&gt; function. The first thing we need to do is create our memecoin. For this, we can use the Coin module provided by Sui, which has everything we need to create and mint coins.&lt;/p&gt;

&lt;p&gt;The method we are using to create a new coin is &lt;code&gt;create_currency&lt;/code&gt;. This method takes the OTW we created, along with several other values.&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%2F6umbvqzuyzam1tk7jnlh.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%2F6umbvqzuyzam1tk7jnlh.png" alt=" " width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decimals: This refers to the number of decimal places for the coin. For most standard coins, this is set to 9.&lt;/li&gt;
&lt;li&gt;Symbol: This is the symbol of our memecoin. Just like other coins, each memecoin will have its own symbol, such as SOL or DOGE.&lt;/li&gt;
&lt;li&gt;Name: This will be the name of the coin we are going to create.&lt;/li&gt;
&lt;li&gt;Description: Here, we can provide a brief description of the coin, which will be useful when listing the token on exchanges.&lt;/li&gt;
&lt;li&gt;Icon URL: The URL to the icon file of the coin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;create_currency&lt;/code&gt; method creates and returns two objects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Treasury Cap: This is a capability object that provides control over the minting and burning of coins. It acts as an authorization mechanism for these processes.&lt;/li&gt;
&lt;li&gt;Metadata: This resource stores descriptive information about the coin. This information is essential for wallets, explorers, and other applications to display details about the coin accurately.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, let’s discuss how the mint function operates, which we have defined to accept multiple arguments.&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%2Fuzx2wxqau9pxtq145pco.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%2Fuzx2wxqau9pxtq145pco.png" alt=" " width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, inside the mint function, we call the mint method from the coin module. We pass three parameters: the treasury obtained from the create_currency function, the number of coins we want to mint, and the transaction context.&lt;/p&gt;

&lt;p&gt;After minting the coins, we transfer them to the recipient, which in this case is the publisher of the contract.&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%2Fad1by05rz40fik902dxb.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%2Fad1by05rz40fik902dxb.png" alt=" " width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are not familiar with object transfer and how it works in the Move programming language, I recommend reading about the Sui object model to enhance your understanding.&lt;/p&gt;

&lt;p&gt;In summary, the transfer function is used to send an object to a specific address. Once an object is transferred, it becomes owned by that address, giving exclusive control of the object to the recipient’s account.&lt;/p&gt;

&lt;p&gt;In short, we have moved all the minted coins to the wallet address of the contract publisher. Therefore, when you publish the contract, all the minted coins will be in your wallet. You can then transfer them to other wallet addresses for distribution.&lt;/p&gt;

&lt;p&gt;Now let’s see what we have done to the metadata and treasury cap returned by the create currency method.&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%2F4z5nfz1qjbuskurjv2c7.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%2F4z5nfz1qjbuskurjv2c7.png" alt=" " width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, we have applied the &lt;code&gt;freeze_object&lt;/code&gt; method to both objects. The purpose of this is to make these objects immutable. Once we freeze an object, it becomes immutable, meaning we cannot make any changes to it. In our case, the coin metadata (such as name, symbol, and other parameters) cannot be modified.&lt;/p&gt;

&lt;p&gt;Additionally, by freezing the treasury cap object, no one can mint more STITCH coins. We have already minted the total supply mentioned at the beginning of the code, and that’s all that will be minted.&lt;/p&gt;

&lt;p&gt;When we publish the contract, it will call the init function to mint the total supply we designated to the publisher’s wallet address and freeze the treasury cap, preventing any further minting of coins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Crunching the Numbers: Calculating STITCH’s Total Supply
&lt;/h3&gt;

&lt;p&gt;Before we publish the contract, let’s discuss the total supply and how to calculate it.&lt;/p&gt;

&lt;p&gt;In our scenario, we want to mint 100 STITCH coins as our total supply, and we do not want to mint any additional STITCH coins beyond that.&lt;/p&gt;

&lt;p&gt;Remember that when we created the currency, we specified that we needed 9 decimal places for our coin. This means that the base unit of our coin will be 0.000000001. Therefore, when we pass the amount to the mint method, we need to specify the number of coins we want in base units.&lt;/p&gt;

&lt;p&gt;To mint your desired number of coins, you need to multiply that number by the base unit to determine the total supply in base units.&lt;/p&gt;

&lt;p&gt;As you can see, we have completed that calculation.&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%2Fntwe6y6oa354cr2qfz40.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%2Fntwe6y6oa354cr2qfz40.png" alt=" " width="800" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Publishing Time: Deploying Our Contract!
&lt;/h3&gt;

&lt;p&gt;Next, we need to publish the module. Before doing so, you can run the command below to ensure that there are no build errors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sui move build

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

&lt;/div&gt;



&lt;p&gt;Once you’ve confirmed there are no issues, use the command below to publish the package. This action will mint 100 STITCH tokens to your wallet address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sui client publish

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

&lt;/div&gt;



&lt;p&gt;The command will return a success response along with all the object changes, as shown below.&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%2Fxpmsx5bn2zc2qv8jaheu.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%2Fxpmsx5bn2zc2qv8jaheu.png" alt=" " width="800" height="645"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, copy the wallet address used to publish the smart contract and navigate to SuiScanner. Select either the testnet or devnet, depending on which environment you used to publish your contract.&lt;/p&gt;

&lt;p&gt;By searching for your wallet address, you will see that 100 STITCH coins have been minted to your wallet.&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%2Fi5phpe137y3aakrklg9f.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%2Fi5phpe137y3aakrklg9f.png" alt=" " width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you click on the STITCH coin, you can access the coin object page, which displays all the details we configured for the coin.&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%2Foeew5czmjeryn9molw4e.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%2Foeew5czmjeryn9molw4e.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Congratulations! You now have your own Memecoin on Sui!&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  **What’s Next
&lt;/h3&gt;

&lt;p&gt;**You can grab the completed source code for the contract from &lt;a href="https://github.com/jinali98/sui_memecoin/blob/main/sources/stitch.move" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>smartcontract</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>programming</category>
    </item>
    <item>
      <title>Enhancing Privacy with Stealth Addresses on Public Blockchains</title>
      <dc:creator>Jinali Pabasara</dc:creator>
      <pubDate>Tue, 13 Jan 2026 04:16:00 +0000</pubDate>
      <link>https://dev.to/jinali98/enhancing-privacy-with-stealth-addresses-on-public-blockchains-18h6</link>
      <guid>https://dev.to/jinali98/enhancing-privacy-with-stealth-addresses-on-public-blockchains-18h6</guid>
      <description>&lt;p&gt;Blockchains are distributed ledgers that record every transaction occurring within the network, including the sender’s address, the receiver’s address, and the transferred amount. These records are publicly accessible and can be inspected by anyone at any time. While blockchain addresses do not directly store personal information, they are pseudonymous rather than private. Once the real world identity behind a wallet address is uncovered through exchanges, payments, or social interactions, it becomes easy to trace all past and future transactions linked to that address. Also, the complete financial history of a wallet can be viewed without restriction, simply because blockchain data is designed to be public.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Are Stealth Addresses?
&lt;/h3&gt;

&lt;p&gt;The concept of stealth addresses was introduced to enhance privacy in blockchain transactions. A stealth address is a unique, one-time wallet address generated for each transaction. Instead of reusing a single public address, stealth addresses enable users to receive funds through different, unlinkable addresses every time.&lt;/p&gt;

&lt;p&gt;To an outside observer, it seems that funds sent using stealth addresses are transferred to completely new and unrelated wallet addresses for each transaction. This design makes it difficult to associate multiple payments with the same recipient, even though all transactions remain publicly visible on the blockchain.&lt;/p&gt;

&lt;p&gt;Let’s go through an example to understand how stealth addresses work in practice.&lt;/p&gt;

&lt;p&gt;Suppose Alice wants to send some funds to her friend Bob. Bob prefers to receive funds privately, and Alice wants to ensure that this payment cannot be easily traced back to either her wallet address or her previous transactions. This is where stealth addresses come into play.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Dual-Key Model
&lt;/h3&gt;

&lt;p&gt;In a typical blockchain wallet, a user controls a single private key, which is used to derive a public key or the wallet address. However, stealth addresses utilize a dual-key model known as the Dual-Key Stealth Address protocol.&lt;/p&gt;

&lt;p&gt;In this model, the receiver, Bob, generates two separate private keys. A viewing key and a spending key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Viewing Key: The viewing key allows Bob to scan the blockchain and identify payments that belong to him.&lt;/li&gt;
&lt;li&gt;Spending Key: The spending key is used to control and spend the funds once they are received.&lt;/li&gt;
&lt;/ul&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%2F49zejzzth7n95dfd1jaj.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%2F49zejzzth7n95dfd1jaj.png" alt=" " width="781" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once Bob has generated both keys, the next step is to derive their corresponding public keys. These two public keys, the viewing public key and the spending public key, are then combined into a single key known as a stealth meta address.&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%2Fgy0sdatle4xvu9mxrp4j.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%2Fgy0sdatle4xvu9mxrp4j.png" alt=" " width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The stealth meta address is not a wallet address that holds funds directly. Instead, it serves as a public identifier that Bob can safely share with others. Bob then sends this stealth meta address to Alice (the receiver).&lt;/p&gt;

&lt;h3&gt;
  
  
  Sender’s Process: Generating the Stealth Address
&lt;/h3&gt;

&lt;p&gt;Once Alice has the stealth meta address of Bob, as the sender, Alice needs to follow a few steps to send the funds securely. First, She will generate a temporary key pair, which we will refer to as an ephemeral key pair. This key pair will only be used for this specific transaction and is essentially a throwaway key pair.&lt;/p&gt;

&lt;p&gt;The next step is to mix the viewing public key extracted from the stealth meta address (remember, the stealth meta address is generated by combining the viewing and spending public keys) with the ephemeral private key to generate a shared secret.&lt;/p&gt;

&lt;p&gt;We call this a shared secret because Bob will later be able to recreate the same secret using his viewing private key and the ephemeral public key. We can use the Elliptic Curve Diffie-Hellman (ECDH) protocol to generate this shared secret.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_Note&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;ECDH is a cryptographic key exchange protocol enabling two parties to establish a shared secret key over an insecure channel securely.&lt;/em&gt;&lt;br&gt;
_&lt;/p&gt;

&lt;p&gt;Next, Alice can use this shared secret to generate a unique address where she can send her funds. This is known as a stealth address.&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%2Frgzio9f0iqkpnf9lqa13.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%2Frgzio9f0iqkpnf9lqa13.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Recipient Detects and Claims Funds
&lt;/h3&gt;

&lt;p&gt;The question is, once I send money to this random wallet address, how does Bob know that I made a transaction?&lt;/p&gt;

&lt;p&gt;More importantly, how does he gain access to the funds in this random wallet address?&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%2F5nxpto2axx82ugn5pq1m.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%2F5nxpto2axx82ugn5pq1m.png" alt=" " width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After Alice transferred funds to a random wallet as the sender, she published something called an Announcement to the blockchain. This Announcement contains the ephemeral public key Alice generated and the view tag, which consists of the first few bytes of the shared secret sge generated previously, along with the actual stealth address Alice sent money to.&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%2Fkypp0filts0ae2e8sfgf.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%2Fkypp0filts0ae2e8sfgf.png" alt=" " width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now comes the final part of the process. As the recipient, Bob needs to monitor the blockchain and check for the announcement that was published. Since there could be announcements from many different people, how can Bob find the specific announcement Alice made for this specific transaction?&lt;/p&gt;

&lt;p&gt;Bob is going to check each announcement. For each announcement, he will retrieve the ephemeral public key and combine it with his Viewing Private Key to generate the shared secret.&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%2Fvzltu497sa8atk8n2seh.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%2Fvzltu497sa8atk8n2seh.png" alt=" " width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the announcement is intended for him (meaning a transaction has been made to him), the first few bytes of the shared secret that Bob generates should match the view tag value contained in the announcement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_Note&lt;/strong&gt;:&lt;br&gt;
&lt;em&gt;The initial view tag comparison check speeds up the announcement scanning process by avoiding the reconstruction of stealth addresses for every announcement.&lt;/em&gt;&lt;br&gt;
_&lt;/p&gt;

&lt;p&gt;Once he found the correct announcement, he could follow the next step to access his funds.&lt;/p&gt;

&lt;p&gt;Bob can combine the spending public key he has with the shared secret to generate the stealth address where Alice has sent the funds. If the stealth address that Bob generates matches the stealth address in the announcement, he can confirm that the transaction was intended for him.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generating the Stealth Private Key
&lt;/h3&gt;

&lt;p&gt;Now let’s move on to the final step of the process Which is generating the private key for the stealth address so that Bob can transfer funds to any wallet he chooses.&lt;/p&gt;

&lt;p&gt;To create the stealth private key, Bob needs to mathematically combine the spending private key with the generated shared secret. This process will yield the stealth private key for the stealth address to which Alice sent the funds. Once Bob has this private key, he can transfer funds from the temporary stealth wallet to any other wallets he likes.&lt;/p&gt;

&lt;p&gt;From the point of view of someone watching my wallet address, it will look like Alice sent funds to a random wallet address, not directly to a wallet owned by Bob. In the same way, someone who is watching Bob’s wallet address will not clearly see that he received funds from my wallet, because the money was sent to a one-time stealth address instead.&lt;/p&gt;

&lt;p&gt;After receiving the funds, Bob can move the money from the stealth address to any other wallet he owns, or even send it directly to an exchange. This can be done without creating a clear, direct link between my wallet address and Bob’s main wallet address.&lt;/p&gt;

&lt;p&gt;One important thing to note is that stealth addresses do not hide transaction amounts. Anyone looking at the blockchain can still see how much money was sent to the one-time stealth address. Also, if someone carefully tracks the movement of funds over time, they might be able to guess a connection between my wallet and Bob’s wallet. However, this connection is indirect and much harder to make compared to sending funds directly to a regular wallet address.&lt;/p&gt;

&lt;p&gt;In this section, we concentrated on the overarching concepts and cryptographic processes related to stealth addresses. In the next part, we will explore a specific off-chain implementation, demonstrating how these concepts are translated into actual code and how both the sender and receiver can independently generate the same stealth address in practice.&lt;/p&gt;

&lt;p&gt;_Originally published at &lt;a href="https://jinalipabasara.substack.com" rel="noopener noreferrer"&gt;https://jinalipabasara.substack.com&lt;/a&gt;.&lt;br&gt;
_&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
