<?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>Forem: Samina</title>
    <description>The latest articles on Forem by Samina (@saminacodes).</description>
    <link>https://forem.com/saminacodes</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%2F689052%2F6c7139b3-6594-4f61-b3d4-7fda1ec7e3fd.jpeg</url>
      <title>Forem: Samina</title>
      <link>https://forem.com/saminacodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/saminacodes"/>
    <language>en</language>
    <item>
      <title>How to create an NFT-gated website</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Wed, 13 Apr 2022 15:32:18 +0000</pubDate>
      <link>https://forem.com/thirdweb/how-to-create-an-nft-gated-website-176k</link>
      <guid>https://forem.com/thirdweb/how-to-create-an-nft-gated-website-176k</guid>
      <description>&lt;p&gt;One of the more dynamic use cases for NFTs is using them as a membership pass to the NFT holders. Let’s assume you want to create a website for your community that is gated by having access to a specific NFT from a collection. You can keep downloadable content or hidden pages by access to the NFT.&lt;/p&gt;

&lt;p&gt;In this guide, we will create a website that restricts content based on owning an NFT using React.&lt;/p&gt;

&lt;p&gt;You can grab a copy of the final project from our examples organization, &lt;a href="https://github.com/thirdweb-example/NFT-Gated-Website"&gt;check it out here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mint an NFT Drop
&lt;/h2&gt;

&lt;p&gt;To create an NFT gated website, we will need either an &lt;a href="https://portal.thirdweb.com/contracts/nft-collection?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;NFT Collection&lt;/a&gt;, &lt;a href="https://portal.thirdweb.com/contracts/nft-drop?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;NFT Drop&lt;/a&gt;, &lt;a href="https://portal.thirdweb.com/contracts/edition?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;Edition&lt;/a&gt;, or an &lt;a href="https://portal.thirdweb.com/contracts/edition-drop?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;Edition Drop&lt;/a&gt; contract already deployed on a blockchain. If you don’t have one created, you can create one using thirdweb’s &lt;a href="https://docs.thirdweb.com/typescript/sdk.nftdrop?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;TypeScript SDK&lt;/a&gt; or thirdweb’s &lt;a href="https://thirdweb.com/dashboard?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;dashboard&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your NFTs are an NFT Drop or Edition Drop contract, set up claim phases before using the claiming functions mentioned later in the guide.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For our example, I am using an NFT Drop contract called Cookie Club for members of the Cookie Club. 🤫&lt;/p&gt;

&lt;p&gt;You can view the Cookie Club NFT Drop on the &lt;a href="https://thirdweb.com/dashboard/rinkeby/nft-drop/0x66463b3C1EBf08b9dE889BCc0A5cbf29dc0e2B7a?tabIndex=0&amp;amp;utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;thirdweb dashboard.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Clone the template repository
&lt;/h2&gt;

&lt;p&gt;To get started will use a &lt;code&gt;cra-javascript-template&lt;/code&gt; which already includes a working SDK setup. This template will make it easy to learn and save time when getting started with our project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’d prefer to use your own template, you can install the latest version of our SDK in your project with &lt;code&gt;npm install @thirdweb-dev/sdk react ethers&lt;/code&gt; or&lt;code&gt;yarn add @thirdweb-dev/sdk react ethers&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;First, navigate to the &lt;a href="https://github.com/thirdweb-example/cra-javascript-starter?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;cra-javascript-starter GitHub repository&lt;/a&gt; and click on "Use this template" to create a copy.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UmZkr9DT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/cra-javascript-starter.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UmZkr9DT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/cra-javascript-starter.png" alt="thirdweb Create React App starter template on GitHub" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the project’s name, description, and other settings, and then clone it locally on your device. Open the directory and run &lt;code&gt;npm install&lt;/code&gt; in your terminal to install all the dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup the blockchain
&lt;/h2&gt;

&lt;p&gt;Inside our &lt;code&gt;src&lt;/code&gt; folder, we will open the &lt;code&gt;index.js&lt;/code&gt; file. We will first change the chain id to the chain of our NFT Drop. For this project, we’ll be using &lt;code&gt;Rinkeby&lt;/code&gt; since our NFT Drop contract is on the Rinkeby testnet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { ChainId, ThirdwebProvider } from "@thirdweb-dev/react";

// This is the chainId your dApp will work on.
const activeChainId = ChainId.Rinkeby;

ReactDOM.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;ThirdwebProvider desiredChainId={activeChainId}&amp;gt;
      &amp;lt;App /&amp;gt;
    &amp;lt;/ThirdwebProvider&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;,
  document.getElementById("root")
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setup the connect wallet button
&lt;/h2&gt;

&lt;p&gt;In the same folder, there is the &lt;code&gt;app.js&lt;/code&gt; file. In this one, we want to allow our user to connect to the app and then obtain our user’s wallet address. On the front end, we will create a button that lets users connect with MetaMask. When a wallet is connected, it will display the corresponding address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useAddress, useMetamask } from "@thirdweb-dev/react";
import "./styles.css";

const App = () =&amp;gt; {
  // get address of user &amp;amp; allow them to connect with metamask
  const address = useAddress();
  const connectWithMetamask = useMetamask();

  //if there isn't a wallet connected, display our connect MetaMask button
  if (!address) {
    return (
      &amp;lt;&amp;gt;
        &amp;lt;h1&amp;gt;Welcome to the Cookie Club&amp;lt;/h1&amp;gt;
        &amp;lt;button className="btn" onClick={connectWithMetamask}&amp;gt;
          Connect MetaMask
        &amp;lt;/button&amp;gt;
      &amp;lt;/&amp;gt;
    );
  }

  // if an address is connected, display address
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;p&amp;gt;Your address: {address}&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s preview what our app looks like and ensure it’s working by running &lt;code&gt;npm start&lt;/code&gt; in the terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ph4TTGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/welcome-screen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ph4TTGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/welcome-screen.png" alt="Welcome screen for application with Connect Wallet button" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conditionally render content &amp;amp; add an NFT minting button
&lt;/h2&gt;

&lt;p&gt;In the same &lt;code&gt;App.js&lt;/code&gt; file, we will add conditionals that render specific pages based on the connection status of the user. We want the user to be able to mint an NFT from the drop if they don’t already hold an NFT. If the connected user does have one, we will display some congratulatory text.&lt;br&gt;
As an extra, I added a helper function to display our shortened wallet address called &lt;code&gt;truncateAddress&lt;/code&gt;. Feel free to add or omit this as well in your app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useAddress, useMetamask } from '@thirdweb-dev/react';
import { useState, useEffect } from 'react';
import "./styles.css";

const App = () =&amp;gt; {
    // get address of user &amp;amp; allow them to connect with metamask
    const address = useAddress();
    const connectWithMetamask = useMetamask();

    // add nft Drop contract
    const nftDrop = useNFTDrop("0x66463b3C1EBf08b9dE889BCc0A5cbf29dc0e2B7a");
    const [hasClaimedNFT, setHasClaimedNFT] = useState(false);
    const [isClaiming, setIsClaiming] = useState(false);

    // function to claim NFT
    const mintNFT = async () =&amp;gt; {
        try {
            setIsClaiming(true);
            await nftDrop.claim(1);
            setHasClaimedNFT(true);
        catch (error) {
            setHasClaimedNFT(true);
            console.error("Failed to mint NFT", error);
        } finally {
            setIsClaiming(false);
        }
    }

    //if there isn't a wallet connected, display our connect MetaMask button
    if (!address) {
    return (
      &amp;lt;&amp;gt;
        &amp;lt;h1&amp;gt;Welcome to the Cookie Club&amp;lt;/h1&amp;gt;
        &amp;lt;button className="btn" onClick={connectWithMetamask}&amp;gt;
          Connect MetaMask
        &amp;lt;/button&amp;gt;
      &amp;lt;/&amp;gt;
    );
  }

    // if the user is connected and has an NFT from the drop, display text
    if (hasClaimedNFT) {
    return &amp;lt;h2&amp;gt;Congratulations! You have a Cookie NFT! 🍪&amp;lt;/h2&amp;gt;;
  }

  // helper function to truncate the address so it displays in a nice format
  function truncateAddress(address) {
    return `${address.slice(0, 6)}...${address.slice(-4)}`;
  }

    //if the user does not have an NFT, show their address and mint an NFT button
    return (
    &amp;lt;&amp;gt;
      &amp;lt;p className="address"&amp;gt;
        There are no Cookie NFTs held by:{" "}
        &amp;lt;span className="value"&amp;gt;{truncateAddress(address)}&amp;lt;/span&amp;gt;
      &amp;lt;/p&amp;gt;
      &amp;lt;button className="btn mint" disabled={isClaiming} onClick={mintNft}&amp;gt;
        Mint NFT
      &amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--65lytfqw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/none-held-screen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--65lytfqw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/none-held-screen.png" alt="No NFTs are currently owned screen" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add useEffect to check for state changes
&lt;/h2&gt;

&lt;p&gt;Lastly, we want to add a &lt;code&gt;useEffect&lt;/code&gt; function to ensure we are up to date with the latest state of the app. This function triggers every time something in the dependency array changes. For example, if the user’s address or &lt;code&gt;nftDrop&lt;/code&gt; disconnects or changes, we want to refresh and update it accordingly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useAddress, useMetamask, useNFTDrop } from "@thirdweb-dev/react";
import { useState, useEffect } from "react";
import "./styles.css";

export default function App() {
  // allow user to connect to app with metamask, and obtain address
  const address = useAddress();
  const connectWithMetamask = useMetamask();

  //
  const nftDrop = useNFTDrop("0x66463b3C1EBf08b9dE889BCc0A5cbf29dc0e2B7a");
  const [hasClaimedNFT, setHasClaimedNFT] = useState(false);
  const [isClaiming, setIsClaiming] = useState(false);

  useEffect(() =&amp;gt; {
    // If they don't have an connected wallet, exit!
    if (!address) {
      return;
    }

    const checkBalance = async () =&amp;gt; {
      try {
        const nfts = await nftDrop.getOwned(address);
        setHasClaimedNFT(nfts?.length &amp;gt; 0);
      } catch (error) {
        setHasClaimedNFT(false);
        console.error("Failed to get NFTs", error);
      }
    };
    checkBalance();
  }, [address, nftDrop]);

  const mintNft = async () =&amp;gt; {
    try {
      setIsClaiming(true);
      await nftDrop.claim(1);
      setHasClaimedNFT(true);
    } catch (error) {
      setHasClaimedNFT(false);
      console.error("Failed to mint NFT", error);
    } finally {
      setIsClaiming(false);
    }
  };

    //if there isn't a wallet connected, display our connect MetaMask button
  if (!address) {
    return (
      &amp;lt;&amp;gt;
        &amp;lt;h1&amp;gt;Welcome to the Cookie Club&amp;lt;/h1&amp;gt;
        &amp;lt;button className="btn" onClick={connectWithMetamask}&amp;gt;
          Connect MetaMask
        &amp;lt;/button&amp;gt;
      &amp;lt;/&amp;gt;
    );
  }

  // if the user is connected and has an NFT from the drop, display text
  if (hasClaimedNFT) {
    return &amp;lt;h2&amp;gt;Congratulations! You have a Cookie NFT! 🍪&amp;lt;/h2&amp;gt;;
  }

  // truncates the address so it displays in a nice format
  function truncateAddress(address) {
    return `${address.slice(0, 6)}...${address.slice(-4)}`;
  }

  // if there are no NFTs from collection in wallet, display button to mint
  return (
    &amp;lt;&amp;gt;
      &amp;lt;p className="address"&amp;gt;
        There are no Cookie NFTs held by:{" "}
        &amp;lt;span className="value"&amp;gt;{truncateAddress(address)}&amp;lt;/span&amp;gt;
      &amp;lt;/p&amp;gt;
      &amp;lt;button className="btn" disabled={isClaiming} onClick={mintNft}&amp;gt;
        Mint NFT
      &amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

export default function app;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Link to Project
&lt;/h2&gt;

&lt;p&gt;You can create a copy of this project from our &lt;a href="https://github.com/thirdweb-example/NFT-Gated-Website?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=nft_gated_website"&gt;example repository.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;Let’s go! You created an NFT gated membership website using React. Feel free to add some downloadable content or secret updates behind this new page for your NFT community members!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tHQ7Z1Hd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/congratulations-screen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tHQ7Z1Hd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/nft-gated-website/congratulations-screen.png" alt='"Congratulations! You have a Cookie NFT" screen' width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nft</category>
      <category>web3</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Mint An NFT Without Writing Any Code</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Sat, 26 Mar 2022 20:14:42 +0000</pubDate>
      <link>https://forem.com/thirdweb/mint-an-nft-without-writing-any-code-3a9h</link>
      <guid>https://forem.com/thirdweb/mint-an-nft-without-writing-any-code-3a9h</guid>
      <description>&lt;p&gt;This guide explains how to mint an NFT without writing code on thirdweb in a few steps.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Minting with thirdweb guarantees you own both the NFT and the smart contract. If you mint an NFT on a platform where you don't own the smart contract, this can create issues. What will happen if this platform goes down or decides to change the royalties of a smart contract? Owning both the NFT and the smart contract ensures true &lt;strong&gt;ownership&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To create our NFT, we will need to have a crypto wallet. For this guide, we are using &lt;a href="https://www.coinbase.com/wallet?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=create_nft_nocode"&gt;Coinbase Wallet&lt;/a&gt;. If you don't have a wallet, you can create one by following our &lt;a href="https://portal.thirdweb.com/guides/create-a-coinbase-wallet?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=create_nft_nocode"&gt;&lt;em&gt;Setup Coinbase Wallet Guide&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;To begin, navigate to the thirdweb &lt;a href="https://thirdweb.com/dashboard?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=create_nft_nocode"&gt;dashboard&lt;/a&gt; and connect your wallet. Once connected, you will be able to click &lt;strong&gt;+ Create New Contract&lt;/strong&gt; &amp;gt; &lt;strong&gt;Create NFTs and Tokens&lt;/strong&gt; &amp;gt; &lt;strong&gt;NFT Collection&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sph1P6_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sph1P6_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0.png" alt="Choose the NFT Collection contract" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;general settings&lt;/strong&gt;, add a contract name, description, image, and symbol to distinguish your contracts.You can pick any name you want for the contract. Under &lt;strong&gt;payout settings&lt;/strong&gt;, add the wallet address for primary sales and, optionally, royalty sales. The wallet address for primary sales is usually your own wallet, which is filled in by default. Leave it like this if you want to receive the proceeds of any sale under this contract.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mjzobwZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mjzobwZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-2.png" alt="Fill in the contract details" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down and click the blue &lt;strong&gt;deploy now&lt;/strong&gt; button to prompt a transaction confirmation from your wallet. Confirm this from the pop-up on your wallet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uMsiFajX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/CB1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uMsiFajX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/CB1.png" alt="Pop Up From Coinbase Wallet" width="880" height="1332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we get through the settings, we can mint our first NFT through the dashboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Minting the NFT
&lt;/h2&gt;

&lt;p&gt;Click on the blue &lt;strong&gt;+ Mint&lt;/strong&gt; button in the top right corner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EmfePfIs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EmfePfIs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-3.png" alt="NFT Collection contract" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A settings panel will pop up on the right side of your screen. Give your NFT a name, description, and upload your file.&lt;/p&gt;

&lt;p&gt;NFTs can be a variety of different mediums including image, audio, video, html, text file, pdf, or even 3d models.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1cT3MeL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1cT3MeL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-4.png" alt="Mint an NFT" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Optionally, you can add some metadata or properties to your NFT using ‘key’ and ‘value’ pairs. In this example, I chose the color of the cookie and the number of chocolate chips as the key-value properties.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qE9FkeFR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qE9FkeFR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-5.png" alt="Mint an NFT fill in details" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding the fields, click on the blue &lt;strong&gt;+ Mint NFT&lt;/strong&gt; button. You will be prompted to confirm the transaction in your wallet. Click the confirmation button. And that’s it- the newly minted NFT will appear in your dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sLfWEhNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sLfWEhNI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://portal.thirdweb.com/assets/portal/guides/create-nft-with-no-code/pasted_image_0-6.png" alt="NFT minted" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Congratulations!
&lt;/h2&gt;

&lt;p&gt;You have now minted your first NFT using thirdweb's dashboard. Now you can send it to a friend, list it on a marketplace, set it as your profile pic on Twitter, or just hold it in your wallet for safekeeping. The possibilities are endless with NFTs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This guide was originally posted on &lt;a href="https://portal.thirdweb.com/guides/create-nft-with-no-code?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=create_nft_nocode"&gt;thirdweb&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>web3</category>
      <category>nft</category>
      <category>tooling</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Day 1 - Getting Started with Flow + Cadence</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Thu, 19 Aug 2021 22:23:25 +0000</pubDate>
      <link>https://forem.com/saminacodes/day-1-getting-started-with-flow-cadence-2gah</link>
      <guid>https://forem.com/saminacodes/day-1-getting-started-with-flow-cadence-2gah</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What is Flow?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Flow is a blockchain similar to others you may have heard of such as Ethereum or Solana. One of the key distinguishers for Flow is how they solved scalability while maintaining decentralization and security.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want to dive into a more in depth comparison of Flow and Ethereum check out this article: &lt;a href="https://pixelplex.io/blog/flow-vs-ethereum-comparison-best-platforms-for-nft/"&gt;https://pixelplex.io/blog/flow-vs-ethereum-comparison-best-platforms-for-nft/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What is Cadence?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cadence is a Resource-Oriented programming language designed for developing smart contracts. Cadence is a great programming language to get started in Web3 because it prevents developers from accidentally writing code that could cause data or financial loss. It is also fast, lower cost compared to other &lt;a href="https://www.investopedia.com/terms/p/proof-work.asp"&gt;Proof Of Work&lt;/a&gt; Blockchains, and secure.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can learn more about Flow and Cadence through their &lt;a href="https://docs.onflow.org/"&gt;Getting Started&lt;/a&gt; page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Part I - Installing Flow CLI
&lt;/h3&gt;

&lt;p&gt;Installing the Flow CLI will depend on the operating system of your device. Follow the &lt;a href="https://docs.onflow.org/flow-cli/install/#gatsby-focus-wrapper"&gt;documentation from Flow&lt;/a&gt; to install the latest version.&lt;/p&gt;

&lt;p&gt;After installing, in your CLI/terminal, use the command &lt;code&gt;flow version&lt;/code&gt; to verify you have the correction version installed.&lt;/p&gt;

&lt;p&gt;To start working with Flow in a &lt;a href="https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop"&gt;REPL&lt;/a&gt;, in the CLI/Terminal type the command &lt;code&gt;flow cadence&lt;/code&gt; which will open something that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Welcome to Cadence v0.18.0!
Type '.help' for assistance.

1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the REPL environment in which we will start in.&lt;/p&gt;

&lt;p&gt;Of course, we can't break tradition. Let's start learning Cadence with none other than "Hello, World."&lt;/p&gt;

&lt;p&gt;In your CLI/terminal type the following and press enter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;log("Hello, World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should echo the statement back in your CLI/Terminal.&lt;/p&gt;

&lt;p&gt;Now we can move onto learning comments, types, variables, and functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part II - Comments
&lt;/h3&gt;

&lt;p&gt;Cadence has your standard options for formatting comments plus a few more.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Single line comments&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// comment
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Multi-line Comments&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* multi line
comment */
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Documentation Comments - Single Line&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/// documentation single line comment
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Documentation Comments - Multi-line&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
documentation
multi-line
comment
**/
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Part III - Types + Variable Declaration
&lt;/h3&gt;

&lt;p&gt;Like most programming languages, Cadence has &lt;strong&gt;primitive types&lt;/strong&gt;. Primitive types are basic data types that serve as a building block in most languages. &lt;/p&gt;

&lt;p&gt;In Cadence, you can declare primitive type variables explicitly &lt;code&gt;let name: String = "Samina"&lt;/code&gt; or implicitly &lt;code&gt;let name = "Samina"&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; before we get into types, when declaring variables in Cadence there is a difference between &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;var&lt;/code&gt;. Unlike in JavaScript, &lt;code&gt;let&lt;/code&gt; is an immutable or not changeable variable declaration. In contrast, &lt;code&gt;var&lt;/code&gt; is mutable or changeable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age = 21
age = age + 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, the statement above would result in an &lt;strong&gt;error&lt;/strong&gt;. Use &lt;code&gt;var&lt;/code&gt; instead of &lt;code&gt;let&lt;/code&gt; when you are planning on changing the variables. &lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integers&lt;/strong&gt; are used to represent whole numbers. An integer can take on many forms including decimal, binary, octal, and hex. You can also use underscores to make it visually easier to comprehend bigger numbers (ex. 100,000,000 -&amp;gt; &lt;code&gt;100_000_000&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numOne = 627 //decimal
var numTwo = 0b1010 //binary (decimal equivalent 10)
let numThree = 0o13 //octal (decimal equivalent 11)
var numFour = 0xFF //hex (decimal equivalent 255)
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;You can use specific versions of &lt;code&gt;Int&lt;/code&gt; such as &lt;code&gt;Int8&lt;/code&gt; (range: -128 to 127) or &lt;code&gt;Int16&lt;/code&gt; (range: &lt;br&gt;
-32,768 to 32,767) if you want to be specific or save storage space. You can also use unsigned &lt;br&gt;
integers: &lt;code&gt;UInt&lt;/code&gt;. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fixed- Point Numbers&lt;/strong&gt; are used to represent fractional numbers. In Cadence, these are &lt;code&gt;Fix64&lt;/code&gt; or &lt;code&gt;UFix64&lt;/code&gt; for the unsigned version.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numOne: Fix64 = 7.25
var numTwo: UFix64 = 126.02
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Strings&lt;/strong&gt; are a collection of unicode characters that are immutable. I like to think of them as a collection of characters or a word. &lt;strong&gt;Note:&lt;/strong&gt; strings are always enclosed in quotes.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = "Steve"
let favoriteGame: String = "Minecraft"
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Addresses&lt;/strong&gt; allows you to store addresses or pointers. This is used quite frequently in Cadence to reference accounts and will be super useful when we dive into Smart Contracts and Transactions.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let accountAddress: Address = 0x123456789
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Booleans&lt;/strong&gt; allows you to store the binary values &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;. These types can be used to indicate an on or off state or work with conditionals (if-else) to help control your program.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var lightsOn = false
let isAfraid = true
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Cadence also has several &lt;strong&gt;composite data types&lt;/strong&gt;. Composite types are usually built from the aforementioned primitive types. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Arrays&lt;/strong&gt; are a mutable collection of types.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let months = ["January", "February", "March", "April", 
"May", "June", "July", "August", "September", "October", 
"November", "December"]
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Dictionaries&lt;/strong&gt; are a mutable collection of key-value pairs.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let sides = {"triangle": 3, "square": 4 , "pentagon": 5 , "hexagon": 6}
sides["square"] //outputs 4
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Structures&lt;/strong&gt; or structs are a value type. You can compare them to objects in JavaScript. Their primary purpose is to store information.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub struct avenger {
    pub let name: String
    pub let ability: String
    pub let weapon: String
    pub let weight: Fix64 //pounds
    pub let height: Fix64 //inches

    init(name: String, ability: String, weapon: String, weight: Fix64, height: Fix64) {
        self.name = name
        self.ability = ability
        self.weapon = weapon
        self.weight = weight
        self.height = height
    }
}

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



&lt;p&gt;The keyword &lt;code&gt;pub&lt;/code&gt; stands for public- which is an [access modifier](&lt;a href="https://en.wikipedia.org/wiki/Access_modifiers#:%7E:text=Access%20modifiers%20(or%20access%20specifiers,facilitate%20the%20encapsulation%20of%20components.)"&gt;https://en.wikipedia.org/wiki/Access_modifiers#:~:text=Access%20modifiers%20(or%20access%20specifiers,facilitate%20the%20encapsulation%20of%20components.)&lt;/a&gt;. We use the keyword &lt;code&gt;struct&lt;/code&gt; to declare the structure and follow it with the name to reference the struct: &lt;code&gt;avenger&lt;/code&gt;. Inside of the struct, after we declare our fields, we must use &lt;code&gt;init()&lt;/code&gt; to initialize the fields.&lt;/p&gt;

&lt;p&gt;In order to initialize an instance of a struct we would do the following:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let CaptainAmerica = avenger(name: "Steve Rogers", ability: "Super Strength", weapon: "Shield", weight: 240, height: 74)
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt; are similar to structs except they are linear types. Resources are moved around and not copied (in contrast to structs) and they can only exist once. &lt;/p&gt;

&lt;p&gt;What does that mean? &lt;/p&gt;

&lt;p&gt;Good question. Well, it is a vital part of Resource-oriented programming &lt;br&gt;
languages, prevalent in Web3. Resources are special and can be used in Cadence to &lt;br&gt;
represent something unique such as an NFT, Collection, etc. &lt;/p&gt;

&lt;p&gt;For resources I am going to use the following example provided in the Fast Floward Bootcamp:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub resource Wallet {
    pub var dollars: UInt

    init(dollars: UInt) {
        self.dollars = dollars
    }
}
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;In order to initialize the Wallet we created, we would use the following&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myWallet &amp;lt;- create Wallet(dollars: 10)
destroy myWallet
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Notice how it uses an arrow &lt;code&gt;&amp;lt;-&lt;/code&gt; instead of &lt;code&gt;=&lt;/code&gt; and the keyword &lt;code&gt;create&lt;/code&gt; to initialize the Wallet. The arrow signifies where the resource is moving and the &lt;code&gt;create&lt;/code&gt; indicates the creation of that resource.&lt;/p&gt;

&lt;p&gt;Because resources don't allow [garbage collection](&lt;a href="https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)"&gt;https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)&lt;/a&gt;, we must delete the resource manually by using the keyword &lt;code&gt;destroy&lt;/code&gt; followed by the name of the resource. &lt;/p&gt;

&lt;p&gt;Something interesting to note is that resources are used in Cadence for assets like &lt;a href="https://www.theverge.com/22310188/nft-explainer-what-is-blockchain-crypto-art-faq"&gt;NFTs&lt;/a&gt; because they cannot be destroyed (unless destroyed by the owner). This is an important structure to have because you don't ever want to lose these, oftentimes, valuable assets. &lt;/p&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Part IIII - Functions
&lt;/h3&gt;

&lt;p&gt;Are you still there? Bare with me, this is the last technical section.&lt;/p&gt;

&lt;p&gt;Functions!&lt;/p&gt;

&lt;p&gt;If you have worked with functions in other programming languages, this should be fairly similar in nature. &lt;/p&gt;

&lt;p&gt;In contrast to the REPL we worked with earlier, for this section we can work with a &lt;code&gt;.cdc&lt;/code&gt; or Cadence file.&lt;/p&gt;

&lt;p&gt;To begin, create your file in the CLI/terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flow cadence demo.cdc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can open this using your favorite command line editor or use an IDE such as VS Code. If you decide to use VS Code, be sure to &lt;a href="https://docs.onflow.org/vscode-extension/"&gt;install the Cadence extension&lt;/a&gt; to assist you with syntax highlighting. &lt;/p&gt;

&lt;p&gt;In a &lt;code&gt;.cdc&lt;/code&gt; file we will declare an &lt;a href="https://en.wikipedia.org/wiki/Entry_point#:~:text=In%20computer%20programming%2C%20an%20entry,control%20to%20its%20entry%20point."&gt;entry-point&lt;/a&gt; by using the &lt;code&gt;main()&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun main() {
    log("Hello, World")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;To run this program type &lt;code&gt;flow cadence&lt;/code&gt; in the root of your directory. We should once again see it echo "Hello World"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Notice the keyword &lt;code&gt;pub&lt;/code&gt; (short for public)- this is an access modifier meaning that the public has access to the value. Following that is &lt;code&gt;fun&lt;/code&gt; which is an abbreviation for function. The rest of it should look similar to functions you have created before.&lt;/p&gt;

&lt;p&gt;Now let's take it a step further and add another function. This example was also provided by the Fast Floward Bootcamp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun hello(to name: String) {
    log("Hello, ".concat(name))
}

pub fun main() {
    hello(to: "Steve Rogers")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should see the following when we run this program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, Steve Rogers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that, we can conclude the main material from Day 1. &lt;/p&gt;

&lt;h3&gt;
  
  
  Fast Floward BootCamp
&lt;/h3&gt;

&lt;p&gt;For further learning, the Fast Floward Bootcamp provides a great example to reinforce all these concepts, and provides Quests to practice your learning.&lt;/p&gt;

&lt;p&gt;I want to thank the team at &lt;a href="https://decentology.com"&gt;Decentology&lt;/a&gt; for providing all this material to learn Flow and Cadence. Their team has gone above and beyond providing an inclusive, welcoming environment, and supporting incoming developers to Web3. &lt;/p&gt;

&lt;p&gt;If you are interested in registering for the Fast Floward Bootcamp, register through this link: &lt;a href="https://www.decentology.com/blog/fast-floward-developer-bootcamp-for-flow"&gt;https://www.decentology.com/blog/fast-floward-developer-bootcamp-for-flow&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I Solved W1Q1 Quest- Frame It!</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Thu, 19 Aug 2021 22:20:09 +0000</pubDate>
      <link>https://forem.com/saminacodes/how-i-solved-w1q1-quest-frame-it-33pe</link>
      <guid>https://forem.com/saminacodes/how-i-solved-w1q1-quest-frame-it-33pe</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;While working through the 2021 Fast Floward boot camp, you will come across a Quest on the first day that involves printing a "picture" from a provided String of characters. This problem tests your knowledge of the basics of the Cadence programming language: types, variables, structs, and functions.&lt;/p&gt;

&lt;p&gt;In this blog post, I will go over how I solved this problem and what challenges I faced when working through it. &lt;/p&gt;

&lt;h3&gt;
  
  
  Quest
&lt;/h3&gt;

&lt;p&gt;Write a function that displays a canvas in a frame&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun display(canvas: Canvas)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"+-----+"
"|*   *|"
"| * * |"
"|  *  |"
"| * * |"
"|*   *|"
"+-----+"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;The way I always like to start solving problems is to determine the given input and the expected output. Notice for this function they are passing in a parameter called &lt;code&gt;canvas&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Recall from the given program, a &lt;code&gt;canvas&lt;/code&gt; is a struct with &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, and &lt;code&gt;pixels&lt;/code&gt; fields. I will use &lt;code&gt;width&lt;/code&gt; to help parse the given string of &lt;code&gt;pixels&lt;/code&gt; into the expected output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub struct Canvas {
    pub let width: UInt8
    pub let height: UInt8
    pub let pixels: String

    init(width: UInt8, height: UInt8, pixels: String) {
        self.width = width
        self.height = height
        self.pixels = pixels
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First I will tackle the top and bottom borders of the "frame". In addition to the &lt;code&gt;display&lt;/code&gt; function, I am going to create a helper function called &lt;code&gt;displayBorder&lt;/code&gt; that prints based on the &lt;code&gt;width&lt;/code&gt; of the canvas. I will pass the &lt;code&gt;canvas&lt;/code&gt; struct as a parameter and declare a variable &lt;code&gt;myString&lt;/code&gt; to hold the output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//helper function for display
pub fun displayBorder(canvas: Canvas) {
    var myString = ""
}

pub fun display(canvas: Canvas) {
    //print top border
    displayBorder(canvas: Canvas)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I want to construct the desired output on &lt;code&gt;myString&lt;/code&gt;. I will use the &lt;code&gt;concat()&lt;/code&gt; method to append the characters &lt;code&gt;myString = myString.concat("+")&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;//helper function for display
pub fun displayBorder(canvas: Canvas) {
    var myString = ""

    myString = myString.concat("+")
}

pub fun display(canvas: Canvas) {
    //print top border
    displayBorder(canvas: Canvas)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding the first &lt;code&gt;+&lt;/code&gt; I will concatenate &lt;code&gt;-&lt;/code&gt; to span the width of the canvas. &lt;/p&gt;

&lt;p&gt;Since Cadence doesn't have increment-able for loops (i.e &lt;code&gt;for (var i = 0; i &amp;lt; num; i++)&lt;/code&gt;) I am adding a variable called &lt;code&gt;idx&lt;/code&gt; set to &lt;code&gt;0&lt;/code&gt; to help me increment using a while loop. Note when using &lt;code&gt;canvas.width&lt;/code&gt; in a comparison, you will need to type cast it into an Int, otherwise you cannot compare &lt;code&gt;Int&lt;/code&gt; and &lt;code&gt;UInt8&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;//helper function for display
pub fun displayBorder(canvas: Canvas) {
    var myString = ""
    var idx = 0

    myString = myString.concat("+")
    while idx &amp;lt; Int(canvas.width) {
        myString = myString.concat("-")
        idx = idx + 1
    }

}

pub fun display(canvas: Canvas) {
    //print top border
    displayBorder(canvas: Canvas)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To finish this helper function, I will add &lt;code&gt;myString = myString.concat("+")&lt;/code&gt; one more time and finally &lt;code&gt;log&lt;/code&gt; the output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//helper function for display
pub fun displayBorder(canvas: Canvas) {
    var myString = ""
    var idx = 0

    //build string
    myString = myString.concat("+")
    while idx &amp;lt; Int(canvas.width) {
        myString = myString.concat("-")
        idx = idx + 1
    }
    myString = myString.concat("+")

    log(myString)
}

pub fun display(canvas: Canvas) {
    //print top border
    displayBorder(canvas: Canvas)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I can add the content inside the canvas plus the left and right borders. For this part I can either create another helper function or leave it inside the &lt;code&gt;display&lt;/code&gt; canvas. Because I am only using this code once, I keep the code inside the &lt;code&gt;display&lt;/code&gt; function. &lt;/p&gt;

&lt;p&gt;For printing the canvas, I am going to use the same idea as I did for &lt;code&gt;displayBorder&lt;/code&gt; except I am going to loop through the length of &lt;code&gt;pixels&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I am also using an &lt;code&gt;offset&lt;/code&gt; variable equal to the width of the canvas to help navigate each "row" of the canvas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun display(canvas: Canvas) {
    var idx = 0
    var offset = Int(canvas.width)
    var myString = ""

    //print top border
    displayBorder(canvas: Canvas)

    //print canvas + l/r borders
    while idx &amp;lt; canvas.pixels.length {

    }

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

&lt;/div&gt;



&lt;p&gt;To build the string for each row, I first concatenate &lt;code&gt;|&lt;/code&gt; and then use the &lt;code&gt;slice&lt;/code&gt; method to add the pixels for each row. For slice, I am grabbing &lt;code&gt;pixels&lt;/code&gt; from &lt;code&gt;idx&lt;/code&gt; up until &lt;code&gt;idx + offset&lt;/code&gt; at each iteration of the loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun display(canvas: Canvas) {
    var idx = 0
    var offset = Int(canvas.width)
    var myString = ""

    //print top border
    displayBorder(canvas: Canvas)

    //print canvas + l/r borders
    while idx &amp;lt; canvas.pixels.length {
        myString = myString.concat("|")
        myString = myString.concat(canvas.pixels.slice(from: idx, upTo: idx + offset))
        myString = myString.concat("|")

        //increment index by offset
        idx = idx + offset
    }

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

&lt;/div&gt;



&lt;p&gt;Notice how I incremented &lt;code&gt;idx&lt;/code&gt; by &lt;code&gt;offset&lt;/code&gt; at each iteration. This ensures the index starts and ends at the beginning and end of each row.&lt;/p&gt;

&lt;p&gt;To illustrate what I mean, the first time we run our loop our &lt;code&gt;idx&lt;/code&gt; is 0 and &lt;code&gt;idx + offset&lt;/code&gt; is 5. The second time our &lt;code&gt;idx&lt;/code&gt; will be 5 but our &lt;code&gt;idx + offset&lt;/code&gt; will be 10 and so on. &lt;/p&gt;

&lt;p&gt;At the end of each iteration of the loop I also &lt;code&gt;log&lt;/code&gt; and reset &lt;code&gt;myString&lt;/code&gt; before looping again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun display(canvas: Canvas) {
    var idx = 0
    var offset = Int(canvas.width)
    var myString = ""

    //print top border
    displayBorder(canvas: Canvas)

    //print canvas + l/r borders
    while idx &amp;lt; canvas.pixels.length {
        myString = myString.concat("|")
        myString = myString.concat(canvas.pixels.slice(from: idx, upTo: idx + offset))
        myString = myString.concat("|")

        //print and reset string
        log(myString)
        myString = ""
    }

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

&lt;/div&gt;



&lt;p&gt;To finish this function, I will call our helper function &lt;code&gt;displayBorder&lt;/code&gt; once more to create the bottom border.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub fun display(canvas: Canvas) {
    var idx = 0
    var offset = Int(canvas.width)
    var myString = ""

    //print top border
    displayBorder(canvas: Canvas)

    //print canvas + l/r borders
    while idx &amp;lt; canvas.pixels.length {
        myString = myString.concat("|")
        myString = myString.concat(canvas.pixels.slice(from: idx, upTo: idx + offset))
        myString = myString.concat("|")

        //increment index by offset
        idx = idx + offset

        //print and reset string
        log(myString)
        myString = ""
    }

    //print bottom border
    displayBorder(canvas: Canvas)

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

&lt;/div&gt;



&lt;p&gt;To wrap everything up, call the &lt;code&gt;display&lt;/code&gt; function in &lt;code&gt;main()&lt;/code&gt; and test it on the &lt;code&gt;canvasX&lt;/code&gt; (example provided by Fast Floward).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;display(canvas: CanvasX)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see the &lt;a href="https://github.com/saminacodes/Fast-Floward-2021/blob/main/w1q1.cdc"&gt;final version&lt;/a&gt; of this program on GitHub.&lt;/p&gt;

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

&lt;p&gt;That's it! Fairly simple but it takes understanding of a few key concepts and a little bit of work to solve this problem.&lt;/p&gt;

&lt;p&gt;A challenge I faced was understanding how to reference the different fields from the struct and type casting. I learned that to reference you will need to prefix the field with the name of the struct e.g &lt;code&gt;canvas.width&lt;/code&gt; or &lt;code&gt;canvas.pixels&lt;/code&gt;. I also did not type cast the fields into &lt;code&gt;Int&lt;/code&gt; initially and ran into several errors. &lt;/p&gt;

&lt;p&gt;Another challenge I faced was understanding which methods I could use to build the strings for the output. I learned Cadence includes &lt;code&gt;concat()&lt;/code&gt; and &lt;code&gt;slice()&lt;/code&gt; which I was familiar with from JavaScript and used these two to build my strings.&lt;/p&gt;

&lt;p&gt;The last challenge I faced was deciding how to loop through the &lt;code&gt;pixels&lt;/code&gt; field to display the canvas. I remembered that in problems involving rows and columns using an offset can help simplify the problem. Drawing this part out on paper helped to visualize where to slice from.&lt;/p&gt;

&lt;p&gt;Of course, there will be more efficient ways to solve this problem. Even after solving, I realized I could pass &lt;code&gt;canvas.width&lt;/code&gt; into the helper function &lt;code&gt;displayBorder&lt;/code&gt; instead of the entire struct. &lt;/p&gt;

&lt;p&gt;If you came up with a different solution, let me know what is was in the comments!&lt;/p&gt;

&lt;h3&gt;
  
  
  Fast Floward BootCamp
&lt;/h3&gt;

&lt;p&gt;If you are interested in registering for the Fast Floward Bootcamp, register through this link: &lt;a href="https://www.decentology.com/blog/fast-floward-developer-bootcamp-for-flow"&gt;https://www.decentology.com/blog/fast-floward-developer-bootcamp-for-flow&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Vires In Numeris</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Thu, 19 Aug 2021 18:41:16 +0000</pubDate>
      <link>https://forem.com/saminacodes/vires-in-numeris-58ef</link>
      <guid>https://forem.com/saminacodes/vires-in-numeris-58ef</guid>
      <description>&lt;p&gt;Lorem ipsum dolor sit amet. And the rest of this post will resume in English.&lt;/p&gt;

&lt;p&gt;This past week I have been kept up at night pondering about the world of cryptocurrency. What are the barriers holding back this secure, efficient, and transparent financial system that could profoundly change the world? Is this system truly financially equitable for everyone?&lt;/p&gt;

&lt;p&gt;I’ve read some bold statements online and through the media, that claim cryptocurrency “relies on trust.” There is speculation that we need to trust the system to adopt it, the same way we trust the US Dollar or other fiat currencies.&lt;/p&gt;

&lt;p&gt;Who do we trust is the next question?&lt;/p&gt;

&lt;p&gt;We trust the government and banks with our fiat currencies because of the laws that protect the system. Furthermore, this currency has value because the government gives it value. The downside to this is governments have control over the amount of money in rotation and value. In some cases, this works out to boost the economy. In other cases, it can and has caused trouble.&lt;/p&gt;

&lt;p&gt;“It is based on the reality that central banks tinkering with the money supply has induced recessions, exacerbated unemployment, and given rise to a global banking system based on profiteering and corruption.” - James McWhinney, Investopedia (Why Governments Are Afraid of Blockchain)&lt;/p&gt;

&lt;p&gt;In contrast, cryptocurrency does not have a central authority or an institution behind it. There is not a single entity or a single individual controlling this technology. It is composed only of people who participate in the system. This initiative gives the power and control back to the people.&lt;/p&gt;

&lt;p&gt;In reality, cryptocurrency does not rely on trust. The entire premise of cryptocurrency is we should not need to trust someone or some entity to govern it. The “source of truth” is in the immutable and proven blockchain data.&lt;/p&gt;

&lt;p&gt;This brings me to “vires in numeris,” or Latin for strength in numbers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0lD08Rix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/os3m98jwejzi0b4hfkym.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0lD08Rix--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/os3m98jwejzi0b4hfkym.jpeg" alt='Meme of Call of Duty "The Numbers Mason, What do they mean?'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The proof is ultimately in the numbers.&lt;/p&gt;

&lt;p&gt;This famous motto is inscribed on minted Bitcoin and Ledger brand hardware wallets. The idea is relying on the strength of numbers to secure its value instead of central authorities.&lt;/p&gt;

&lt;p&gt;After digging, I found the original forum on which the minted phrase was decided: bitcointalk.org/index.php?topic=4994.msg140..&lt;/p&gt;

&lt;p&gt;This refreshing piece of digital history illustrates how quickly grand ideas can come to fruition.&lt;/p&gt;

&lt;p&gt;So the next time you hear online that for cryptocurrency to be adopted, think vires in numeris; the proof is in the numbers.&lt;/p&gt;

&lt;p&gt;One of these days, I will get that tattooed somewhere on my arm.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>cryptocurrency</category>
      <category>bitcoin</category>
    </item>
    <item>
      <title>The Next Ten Months</title>
      <dc:creator>Samina</dc:creator>
      <pubDate>Wed, 18 Aug 2021 16:25:44 +0000</pubDate>
      <link>https://forem.com/saminacodes/the-next-ten-months-5bd3</link>
      <guid>https://forem.com/saminacodes/the-next-ten-months-5bd3</guid>
      <description>&lt;p&gt;Sometimes inspiration strikes when you’re outside. Sometimes it appears when you’re browsing Instagram. Sometimes it hits when your peers are out-lapping you on “life’s biggest milestones.”&lt;/p&gt;

&lt;p&gt;In my case, it struck at 2 am while watching My Hero Academia.&lt;/p&gt;

&lt;p&gt;That’s right. &lt;a href="https://myheroacademia.fandom.com/wiki/My_Hero_Academia_Wiki"&gt;My Hero Academia&lt;/a&gt;, a Japanese anime, has inspired me to keep myself accountable on the next journey in my life from Web2 to Web3.&lt;/p&gt;

&lt;p&gt;For those unfamiliar with the series, a boy named Izuku wants to be a hero but was born without the genetic ability to become one. Avoiding major spoilers, Izuku becomes a hero on some condition and must go through ten months of disciplined training to catch up to speed with his peers. The rest of the series follows Izuku’s day-to-day life, the challenges he faces, and his inner monologue and reflections.&lt;/p&gt;

&lt;p&gt;Like Izuku, I want to spend ten months focused on Web3 and master this technology that is about to take the world by storm. In the process, I will break down concepts for others who also want to learn Web3, especially those coming from Web2.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I can’t afford to fall behind. I will be going for it with everything I have. -Izuku Midoriya, 'My Hero Academia'.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are a few action items I have planned for the upcoming future.&lt;/p&gt;

&lt;p&gt;I am officially beginning my journey with #100DaysOfWeb3 where I will tweet every day for 100 days something new I learned or what I completed. I encourage you to join me on this challenge if you are also considering a career in Web3 or want to learn more about it!&lt;/p&gt;

&lt;p&gt;I am completing the Fast Floward Bootcamp and writing summaries and solutions to help other developers attending future sessions.&lt;/p&gt;

&lt;p&gt;I am creating a resources page that will list out all the sources I used to learn. You can catch the latest version of this page on my blog: samina.dev/resources.&lt;/p&gt;

&lt;p&gt;Most importantly, I am joining the team at Decentology as a Developer Advocate. Decentology is a Silicon Valley based startup focused on onboarding the next 10 million Web2 developers into Web3. At Decentology, I will be following the steps of Izuku: documenting my journey, the challenges I face, and my reflections.&lt;/p&gt;

&lt;p&gt;You can follow snippets journey on the following platforms:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saminacodes"&gt;Twitter(#100DaysOfWeb3)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://instagram.com/saminacodes"&gt;Instagram(Study Inspiration)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://samina.dev/resources"&gt;Resource Page(List of resources)&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>startup</category>
      <category>100daysofcode</category>
      <category>career</category>
    </item>
  </channel>
</rss>
