<?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: Robin Olthuis</title>
    <description>The latest articles on DEV Community by Robin Olthuis (@robeart).</description>
    <link>https://dev.to/robeart</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%2F1907032%2F93483d3f-d839-4956-a9c7-c012acc91481.png</url>
      <title>DEV Community: Robin Olthuis</title>
      <link>https://dev.to/robeart</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/robeart"/>
    <language>en</language>
    <item>
      <title>Building a Stellar Smart Wallet using React</title>
      <dc:creator>Robin Olthuis</dc:creator>
      <pubDate>Sun, 18 Aug 2024 22:01:34 +0000</pubDate>
      <link>https://dev.to/robeart/building-a-stellar-smart-wallet-using-react-5hj7</link>
      <guid>https://dev.to/robeart/building-a-stellar-smart-wallet-using-react-5hj7</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/stellar"&gt;Build Better on Stellar: Smart Contract Challenge&lt;/a&gt;: Create a Tutorial&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tutorial
&lt;/h2&gt;

&lt;p&gt;Smart wallets represent a significant advancement in cryptocurrency management, offering enhanced security and usability compared to traditional wallets. In this tutorial, we'll walk through the process of creating a smart wallet that integrates with the Stellar network, using React for the frontend and leveraging Stellar's smart contract capabilities.&lt;/p&gt;

&lt;p&gt;To see a demo of the smart wallet in action, check out this video: &lt;a href="https://www.youtube.com/watch?v=58XhrWB5L-U" rel="noopener noreferrer"&gt;Stellar Smart Wallet Demo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What Are Smart Wallets?
&lt;/h3&gt;

&lt;p&gt;Smart wallets are advanced cryptocurrency wallets that offer additional features and security measures beyond simple storage and transfer of digital assets. Key characteristics include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enhanced Security: Utilizing WebAuthn for authentication, which can include biometric data.&lt;/li&gt;
&lt;li&gt;No Trustlines Required: Unlike regular Stellar wallets, smart wallets don't need trustlines for assets, simplifying user experience.&lt;/li&gt;
&lt;li&gt;Flexibility: Ability to add multiple signers, improving accessibility and security.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Implementation Steps
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Setting Up the Project
&lt;/h4&gt;

&lt;p&gt;First, clone the smart-wallet-demo repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/orbit-cdp/smart-wallet-demo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;smart-wallet-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Building, Installing, and Deploying Smart Contracts
&lt;/h4&gt;

&lt;p&gt;The contracts are located in the passkey-kit repository. Clone it and navigate to the contracts folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/kalepail/passkey-kit.git
&lt;span class="nb"&gt;cd &lt;/span&gt;passkey-kit/contracts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now use the Soroban CLI to build, install, and deploy the contracts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;stellar contract build

&lt;span class="c"&gt;# Install the wallet WASM&lt;/span&gt;
stellar contract &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--wasm&lt;/span&gt; path/to/wallet.wasm &lt;span class="nt"&gt;--network&lt;/span&gt; &amp;lt;network&amp;gt; &lt;span class="nt"&gt;--source-account&lt;/span&gt; &amp;lt;source_account&amp;gt;
&lt;span class="c"&gt;# Note the returned hash&lt;/span&gt;

&lt;span class="c"&gt;# Deploy the factory&lt;/span&gt;
stellar contract deploy &lt;span class="nt"&gt;--wasm&lt;/span&gt; path/to/factory.wasm &lt;span class="nt"&gt;--network&lt;/span&gt; &amp;lt;network&amp;gt; &lt;span class="nt"&gt;--source-account&lt;/span&gt; &amp;lt;source_account&amp;gt;
&lt;span class="c"&gt;# Note the returned factory_id&lt;/span&gt;

&lt;span class="c"&gt;# Initialize the factory&lt;/span&gt;
stellar contract invoke &lt;span class="nt"&gt;--id&lt;/span&gt; &amp;lt;factory_id&amp;gt; &lt;span class="nt"&gt;--network&lt;/span&gt; &amp;lt;network&amp;gt; &lt;span class="nt"&gt;--source-account&lt;/span&gt; &amp;lt;source_account&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; initialize &lt;span class="nt"&gt;--hash&lt;/span&gt; &amp;lt;wallet_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;&amp;lt;network&amp;gt;&lt;/code&gt; with the target network (e.g., testnet or public) and &lt;code&gt;&amp;lt;source_account&amp;gt;&lt;/code&gt; with the account you're using for deployment.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Configuring the Wallet
&lt;/h4&gt;

&lt;p&gt;Update the &lt;code&gt;passkey.ts&lt;/code&gt; file with the deployed factory contract address:&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="c1"&gt;// passkey.ts&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;account&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;PasskeyKit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;rpcUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://soroban-testnet.stellar.org&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;networkPassphrase&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Test SDF Network ; September 2015&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;factoryContractId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_DEPLOYED_FACTORY_CONTRACT_ID&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;h4&gt;
  
  
  4. Implementing User Authentication (passkey.ts)
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;passkey.ts&lt;/code&gt; file handles the WebAuthn-based authentication. Here's a snippet of how it's used:&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;connectWallet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAsyncThunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wallet/connect&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&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;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;dispatch&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;keyId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;kid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;contractId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;cid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connectWallet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="c1"&gt;// ... handle connection keep track of the contractId as this is the smart wallets address&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;h4&gt;
  
  
  5. State Management (walletSlice.ts)
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;walletSlice.ts&lt;/code&gt; file uses Redux for efficient state management:&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;createSlice&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createAsyncThunk&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;@reduxjs/toolkit&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;account&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;native&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;send_transaction&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;../lib/passkey&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ... other imports and initial state ...&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;getWalletBalance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAsyncThunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wallet/getBalance&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&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;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getState&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;wallet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;WalletState&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;contractId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;wallet&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;contractId&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;nativeBalance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;native&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;balance&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;contractId&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="na"&gt;native&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;nativeBalance&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="nf"&gt;toString&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="k"&gt;else&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="na"&gt;native&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="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="c1"&gt;// ... other async thunks and reducer logic ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Adding New Assets
&lt;/h4&gt;

&lt;p&gt;To add new assets similar to how we create the native asset in &lt;code&gt;passkey.ts&lt;/code&gt;, you can create a new variable with a new contract address. Here's an example of how to add a new asset:&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="c1"&gt;// passkey.ts&lt;/span&gt;

&lt;span class="c1"&gt;// Existing native asset&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;native&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getSACClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Adding a new asset (e.g., a custom token) use the same way as native&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;customToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getSACClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_CUSTOM_TOKEN_CONTRACT_ADDRESS&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;Replace &lt;code&gt;"YOUR_CUSTOM_TOKEN_CONTRACT_ADDRESS"&lt;/code&gt; with the actual contract address of the token you want to add.&lt;/p&gt;

&lt;h4&gt;
  
  
  7. Signing Transactions with the Smart Wallet
&lt;/h4&gt;

&lt;p&gt;An important feature of smart wallets is secure transaction signing. Here's a simplified example of how to sign a transaction:&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signAndSendTransaction&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;xdr&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="nx"&gt;keyId&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Sign the transaction using the smart wallet&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signedXdr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xdr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;keyId&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// Send the signed transaction using launchtube&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;send_transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;signedXdr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Handle success (e.g., update UI, fetch new balances)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Handle error&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;This function takes an XDR (transaction) and the wallet's keyId, signs the transaction using WebAuthn, and sends it to the network. It demonstrates how the smart wallet's authentication mechanism is used to sign transactions securely.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges and Solutions
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Domain Dependency&lt;/strong&gt;: Implement multiple signer support to mitigate the risk of losing access if the WebAuthn domain becomes unavailable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Asset Transfer to Smart Wallets&lt;/strong&gt;: Most Stellar wallets don't support sending assets directly to smart wallet addresses (C addresses). Use the Soroban CLI for transfers:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;stellar contract invoke &lt;span class="nt"&gt;--network&lt;/span&gt; &amp;lt;network&amp;gt; &lt;span class="nt"&gt;--source-account&lt;/span&gt; &amp;lt;account&amp;gt; &lt;span class="nt"&gt;--id&lt;/span&gt; &amp;lt;token_address&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; transfer &lt;span class="nt"&gt;--to&lt;/span&gt; &amp;lt;smart_wallet_address&amp;gt; &lt;span class="nt"&gt;--amount&lt;/span&gt; &amp;lt;scalar_7_amount&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure the source account has sufficient balance for the transfer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Created
&lt;/h2&gt;

&lt;p&gt;This submission is a comprehensive guide for developers to create a secure and user-friendly smart wallet on the Stellar network. It supports the Stellar developer experience by:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Demonstrating the integration of Soroban smart contracts with a React frontend&lt;/li&gt;
&lt;li&gt;Describing some of the current challenges with smart wallets and possible solutions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Developers can use this tutorial to build their own smart wallet applications or enhance existing projects with smart wallet functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;My journey in creating this tutorial began with extensive research into the new Smart Wallets that recently got introduced into the ecosystem.&lt;/p&gt;

&lt;p&gt;During the content creation process, I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Experimented with different approaches to implement these into React&lt;/li&gt;
&lt;li&gt;Learned about state management with React&lt;/li&gt;
&lt;li&gt;Discovered challenges unique to smart wallet development, such as the complexities of asset transfers to contract addresses&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'm particularly proud of how the tutorial addresses real-world challenges that developers might face, providing practical solutions and workarounds. The section on using Soroban CLI for asset transfers, for instance, offers a valuable insight that's not commonly discussed.&lt;/p&gt;

&lt;p&gt;This project has deepened my appreciation for the Stellar ecosystem and its potential to revolutionize digital asset management. I look forward to contributing more to the community and seeing how other developers build upon these concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Team
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Joostmbakker&lt;/li&gt;
&lt;li&gt;Robeart&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>stellarchallenge</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
