NFTs, DAOs, and Web3


This is module 7 of 10 for the Blockchain and Cryptocurrency course.

Module 6 << | >> Module 8

Readings

Non-Fungible Tokens

ERC-721 Tokens

Decentralized Autonomous Organization (DAO)

Web3

+

Self-Directed Learning

  • Buy an NFT. You can use an NFT exchange like OpenSea or go back to some of the original NFTs like CryptoKitties.
  • Track your transaction in your digital wallet and on a public blockchain.
  • Explore the range of DAOs and consider purchasing a DAO token. Try to understand what governance rights the ownership of the token would grant you.

+

Online Discussion of Module Topic

Write down what you are learning and questions that you may already have in the areas of NFTs, DAOs, and Web3. Here are some prompts to get you thinking:

  • Explain what an NFT is in your own words.
  • Explain what a DAO is in your own words.
  • What are historical and current examples of NFTs?
  • What are the benefits of NFTs?
  • Why do NFTs have value?
  • How do NFTs show up on blockchain explorers?
  • How do tokens relate to the governance of a DAO?
  • When a DAO is hacked, is the action illegal?
  • What is Web3 and how does it relate to blockchain?
  • What are the pros and cons of Web3 relative to Web2?

+

Technical Exercise

The technical exercise for Module 7 introduces you to another set of tools used to build Ethereum apps, called Truffle Suite (https://www.trufflesuite.com). Truffle Suite is another powerful Ethereum development framework that brands itself as “sweet tools for smart contracts” that get developers “from idea to dapp as comfortably as possible.” You are encouraged to explore and use Truffle for your group project work.

For this module, the technical exercise is to start the Truffle tutorial called “Pet Shop” on your local machine. In the next module, you will complete the tutorial. 

Step 1. Open the Truffle “Pet Shop” tutorial: https://www.trufflesuite.com/tutorial and take a look. You will notice familiar terminology like Smart Contracts and Solidity but a different project structure specific to Truffle. 

Step 2. Start the “Setting up the development environment” section at the beginning of the tutorial. When you install truffle, there may be some long pauses and warnings about errors. That’s OK.

Try the command truffle version. If it returns the error command not found, then try npx truffle version. Hopefully that will work. If that works, you should put the npx in front of truffle whenever you use the truffle command. Some other solutions to this issue can be found here.

Step 3. Complete the “Creating a Truffle Project” section. You will create a Truffle project using a Truffle Box called pet-shop.

Step 4. Complete the “Writing the Smart Contract” and “Compilation” sections. To create the smart contract, just create Adoption.sol and copy in the code provided. The variable setup and two functions will be inside the Contract {} braces. Compilation should be quick. If you get a truffle not found message, use npx truffle compile.

Step 5. Complete the “Migration” section. Depending on your computer, this may be one of the harder steps. In this part of the tutorial, you will download Ganache, Truffle Suite’s personal blockchain network that you will use to deploy contracts, develop applications, and run tests. 

Download Ganache from Truffle Suite: https://trufflesuite.com/ganache. Once you get to the “Create a Workspace” screen after installation, click on “New Workspace.” Give your workspace the name “pet-shop-tutorial.”

Next click on the “Add Project” button. This will bring up a file search window. Find the truffle-config.js file in your pet-shop-tutorial directory and add this file to your workspace. You should now see it listed in the projects box. Full instructions are in the Truffle docs for Linking a Project. Complete this step by clicking on Save Workspace.

Windows note 1: In your Ganache workspace, click on “Server” on the upper ribbon. Here you want to change the Hostname to the option with WSL. This will allow the application to connect with your Linux installation.

Windows note 2: Once you save your workspace, you will now see an updated server:

Now open your truffle-config file in the root of your tutorial directory and change the host and port under development as in the following:

Try to have the Ganache window viewable, and then run truffle migrate (possibly with npx on the front). You should see Ganache update with 4 blocks.

Step 6. Complete the “Testing the smart contract” section of the tutorial. There are two options: testing the smart contract using Solidity and testing the smart contract using JavaScript. You just need to create a test file and then paste in four sections of code. The truffle test should result in 3 successful tests. We will pick up the tutorial in the next module with “Creating a user interface to interact with the smart contract.”

Step 7. Document successful migration and testing of your smart contract. To complete the Module 7 technical exercise, take two screenshots: one of your Ganache Accounts page with the most current block after running the truffle migration step and another of your truffle test output.  ((Or if you prefer to use the ganache-cli, you may take screenshots of the following: one of your truffle migrate / ganache-cli output and another of your truffle test / ganache-cli output.)) Attach both screenshots to the Module 7 D2L discussion.

+

Team Project Work

In this part of the course, your team should become more intentional about connecting the business proposition to a smart contract. Each team should be considering the following:

Step 1. Come up with a name for your dapp and a 2-3 sentence description of what your dapp does.

Step 2. Motivate how a smart contract would relate to your project. What would it do?

Step 3. Think about who would use your smart contract and how they would benefit from using your smart contract.