<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Augusto Elesbão on Medium]]></title>
        <description><![CDATA[Stories by Augusto Elesbão on Medium]]></description>
        <link>https://medium.com/@aelesbao?source=rss-580be4a42877------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QePm5_rH91-fU2y7735PQg.jpeg</url>
            <title>Stories by Augusto Elesbão on Medium</title>
            <link>https://medium.com/@aelesbao?source=rss-580be4a42877------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 03:54:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aelesbao/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build, Mint, and Transfer NFTs on Archway]]></title>
            <link>https://medium.com/@aelesbao/how-to-build-mint-and-transfer-nfts-on-archway-64f80c62ffe5?source=rss-580be4a42877------2</link>
            <guid isPermaLink="false">https://medium.com/p/64f80c62ffe5</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[archway]]></category>
            <category><![CDATA[cosmwasm]]></category>
            <category><![CDATA[nft]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Augusto Elesbão]]></dc:creator>
            <pubDate>Thu, 27 Jan 2022 01:53:49 GMT</pubDate>
            <atom:updated>2023-02-22T17:57:53.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cZmOkTWmFWKiRPi5QSFNqA.png" /></figure><h3>Introduction</h3><p>Non-Fungible Tokens, or NFTs, have been a hot topic during this past year. From CryptoKitties to the Apes’ mania and Twitter accepting them as profile pictures, NFTs became an essential component of the decentralized digital world.</p><p>In this guide, we will learn how to write, deploy, and transfer an NFT collection smart contract in Archway using CosmWasm.</p><h3>The NFT Standard for CosmWasm</h3><p>To create an NFT Smart Contract, we should follow a token standard, which defines an interface with common endpoints and messages format. These standards ensure that the token will behave in a specific way and be composable with each other.</p><p>The most well-known specification for NFT contracts is the ERC-721, and it was first introduced on Ethereum by CryptoKitties. In CosmWasm, following the same convention, we call this standard <a href="https://docs.cosmwasm.com/cw-plus/cw721/spec/">CW721</a>. Looking at the specification, we see that it defines a few messages and queries we have to follow, the most important ones being:</p><ul><li><em>Mint {token_id, owner, token_uri}</em></li><li><em>TransferNft {recipient, token_id}</em></li><li><em>Tokens {owner}</em></li><li><em>OwnerOf {token_id}</em></li></ul><p>Those are the fundamental aspects of an NFT: an entry point to mint them, another one to transfer, and ways to query their ownership.</p><h3>Creating the Smart Contract</h3><p>To create an NFT Smart Contract in Archway, you need the <a href="https://github.com/archway-network/archway-cli">Archway developer CLI</a>. If you haven’t configured it yet, check the <a href="https://docs.archway.io/docs/create/getting-started/install">quick start guide</a>.</p><p>Next, we will set up two accounts, one to <strong>deploy</strong> and <strong>mint</strong> the NFT and another for the recipient of an NFT <strong>transfer</strong>.</p><pre>$ archway accounts -a deployer<br>$ archway accounts -a alice</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ezYsoD4uMHgiWB4_fRqKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjbAafhtjWASWLDvi7HvlA.png" /></figure><p>Now, let’s create a new project and, on the template selection list, select template #<em>4 - CW721 with on-chain metadata</em>:</p><pre>$ archway new nft-on-chain</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cyx_u9ppQLBXBwFidTfvMg.png" /></figure><p>The advantage of using this template is that it instantiates our contract using the <a href="https://github.com/CosmWasm/cw-nfts/tree/main/contracts/cw721-base">cw721-base </a>crate, a basic implementation of the CW721 spec that can be easily extended for our needs.</p><h3>Storing the NFT Metadata</h3><p>The asset metadata is a critical element for any NFT. It defines information like the name, image URL, and other properties that can be pulled by NFT marketplaces to show relevant information for the users. Things like rarity, custom traits, etc., all are stored here. The specification for it is defined by the<em> </em><a href="https://docs.opensea.io/docs/metadata-standards"><em>Metadata JSON Schema</em></a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7a1d4e0c6f063c301ad2e3dbb161ac9/href">https://medium.com/media/d7a1d4e0c6f063c301ad2e3dbb161ac9/href</a></iframe><p>In our example, we will keep this information <em>on-chain</em> or, in other words, the contract will store the metadata in its internal state. This is how we define the metadata struct in the src/lib.rs file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2bfef3f233fdce3077496814c544375/href">https://medium.com/media/e2bfef3f233fdce3077496814c544375/href</a></iframe><p>In the cw721-base code, this metadata is contained in the <strong>extension</strong> property of the <a href="https://github.com/CosmWasm/cw-nfts/blob/v0.9.3/contracts/cw721-base/src/state.rs#L91"><strong>TokenInfo</strong> struct</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fcb809a1b6506f54e7e2c172d378b1d/href">https://medium.com/media/5fcb809a1b6506f54e7e2c172d378b1d/href</a></iframe><h3>Publish and Instantiate the Contract</h3><p>Before deploying the contract, we need to request tokens from the faucet to our <em>deployer</em> account. This can be done with the archway faucet command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNLK6mMuaj4iNELa1DpeJg.png" /></figure><p>Now we are ready to deploy and instantiate the contract. The contract instantiation requires three parameters:</p><ul><li>name: the NFT collection name.</li><li>symbol: a token symbol to represent it.</li><li>minter: the wallet address allowed to mint a new NFT using this contract.</li></ul><p>To deploy it, we run the deploy command with the previous parameters configured in the command line:</p><pre>$ archway deploy -a &#39;{ &quot;name&quot;: &quot;My NFT Collection&quot;, &quot;symbol&quot;: &quot;MYNFT&quot;, &quot;minter&quot;: &quot;archway1e5fglhr2ml6rwhvqzezd9035hhwfl37l8u4c4h&quot; }&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xmJihuv-TrPIIjHeHES1A.png" /><figcaption>The <strong>minter</strong> address should be the same as the <strong>deployer</strong> account we created above</figcaption></figure><p>After the project finishes compiling, you will be asked which wallet to send the transaction from. Just type <strong>deployer</strong> and proceed.</p><h3>Minting and Querying</h3><p>To mint the NFT, we need to send a transaction with the <a href="https://github.com/CosmWasm/cw-nfts/blob/v0.9.3/contracts/cw721-base/src/msg.rs#L54"><strong>MintMsg</strong> struct</a> data as a JSON argument with the metadata included in the <strong>extension</strong> property. This is the JSON string we will use:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8205fd0ceeb61b0838bf993d94775916/href">https://medium.com/media/8205fd0ceeb61b0838bf993d94775916/href</a></iframe><p>The command to execute the transaction is:</p><pre>$ archway tx --args &#39;{ &quot;mint&quot;: { &quot;token_id&quot;: &quot;1&quot;, &quot;owner&quot;: &quot;archway1e5fglhr2ml6rwhvqzezd9035hhwfl37l8u4c4h&quot;, &quot;extension&quot;: { &quot;name&quot;: &quot;Autumn Sunset&quot;, &quot;description&quot;: &quot;Sunset in Berlin during autumn.&quot;, &quot;image&quot;: &quot;ipfs://QmSmUJPHNRjkA47AvvQ9eA7AzEGDJ9o4azrZvhUAViFLzk/autumn-sunset.gif&quot;, &quot;attributes&quot;: [ { &quot;trait_type&quot;: &quot;city&quot;, &quot;value&quot;: &quot;Berlin&quot; } ] } } }&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJ5-RI_lzN665j-JL9lA7A.png" /><figcaption>Mint</figcaption></figure><p>To confirm that our NFT is correctly stored on-chain, we run the query command, specifying the token_id we used in the previous call:</p><pre>$ archway query contract-state smart --args &#39;{ &quot;nft_info&quot;: { &quot;token_id&quot;: &quot;1&quot; } }&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4VN456pykuVE4WFOboGYA.png" /><figcaption>NftInfo</figcaption></figure><h3>Transferring</h3><p>To transfer a token, we have to send the <a href="https://github.com/CosmWasm/cw-nfts/blob/v0.9.3/contracts/cw721-base/src/msg.rs#L27"><strong>TransferNft</strong> message</a> with the <strong>recipient</strong> address (in our case, <em>alice</em>) and the token_id:</p><pre>$ archway tx --args &#39;{ &quot;transfer_nft&quot;: { &quot;recipient&quot;: &quot;archway1t5mqd4mcp5jy88m5fed9zaegpgzcrrfjnet76t&quot;, &quot;token_id&quot;: &quot;1&quot; } }&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8LOnJK6Xfp-h625LxF2sg.png" /><figcaption>TransferNft</figcaption></figure><p>After that, we can query the contract state and confirm that <em>alice</em> is the new token owner using the <a href="https://github.com/CosmWasm/cw-nfts/blob/v0.9.3/contracts/cw721-base/src/msg.rs#L79"><strong>OwnerOf</strong> message</a>:</p><pre>$ archway query contract-state smart --args &#39;{ &quot;owner_of&quot;: { &quot;token_id&quot;: &quot;1&quot; } }&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExOeDYFbELsPbe7gm6hNcw.png" /><figcaption>OwnerOf</figcaption></figure><h3>Conclusion</h3><p>As you can see, creating an NFT Smart Contract in Archway is incredibly simple and requires minimal effort. And, with the magic of Archway, for every transaction made with the NFT collection, the developer gets rewards baked into the protocol itself!</p><p>If you want to check the source code covered in this tutorial, it is available in our <a href="https://github.com/archway-network/contracts-examples/tree/main/archway-nft-on-chain">contracts examples repository</a>. If you are interested to learn about the NFT evolution, I recommend checking out this <a href="https://opensea.io/blog/guides/non-fungible-tokens">very informative guide from OpenSea</a>.</p><p>In a follow-up post, you will learn how to build a front-end app to display the collection we have just created. Stay tuned!</p><p>Got questions? Join our channel on <a href="https://discord.gg/archwayhq">Discord</a>, and we will be there to help you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNMbJLc5aXO6sFOrZ1Fi8A.gif" /></figure><p><a href="https://archway.io/?utm_source=medium.com"><em>Archway</em></a><em> is the best way for developers to launch decentralized apps &amp; smart contracts on a global scale while earning automagic, on-chain rewards.</em></p><p><em>If you’d like to stay in the loop with what we’re building — be sure to sign up for </em><a href="https://archway.io/newsletter?utm_source=medium.com&amp;utm_medium=footer"><em>Our Newsletter</em></a><em> and join the Archway community via </em><a href="https://twitter.com/archwayHQ"><em>Our Twitter</em></a><em> &amp; </em><a href="https://discord.gg/archwayhq"><em>Our Discord</em></a><em>.</em></p><p><em>Due to US regulations, the ARCH token will not be available to US residents.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64f80c62ffe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>