Giter Site home page Giter Site logo

egeatesalp / simple-nft-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7.35 MB

My Implementation of Challenge 0: Simple NFT Example (https://speedrunethereum.com/challenge/simple-nft-example)

License: MIT License

JavaScript 13.78% Solidity 0.13% Shell 0.69% CSS 84.97% HTML 0.13% Less 0.06% Dockerfile 0.17% TypeScript 0.07%

simple-nft-example's Introduction

๐Ÿ— scaffold-eth | ๐Ÿฐ BuidlGuidl

๐Ÿšฉ Challenge 0: ๐ŸŽŸ Simple NFT Example ๐Ÿค“

๐ŸŽซ Create a simple NFT to learn basics of ๐Ÿ— scaffold-eth. You'll use ๐Ÿ‘ทโ€โ™€๏ธ HardHat to compile and deploy smart contracts. Then, you'll use a template React app full of important Ethereum components and hooks. Finally, you'll deploy an NFT to a public network to share with friends! ๐Ÿš€

๐ŸŒŸ The final deliverable is an app that lets users purchase and transfer NFTs. Deploy your contracts to Rinkeby and then build and upload your app to a public web server. Submit the url on SpeedRunEthereum.com!

๐Ÿ’ฌ Meet other builders working on this challenge and get help in the Challenge 0 telegram!!!


Checkpoint 0: ๐Ÿ“ฆ Install ๐Ÿ“š

Want a fresh cloud environment? Click this to open a gitpod workspace, then skip to Checkpoint 1 after the tasks are complete.

Open in Gitpod

Required:

  • Git
  • Node (๐Ÿงจ Use Node v16 or a previous version as v17 may cause errors ๐Ÿงจ)
  • Yarn

(โš ๏ธ Don't install the linux package yarn make sure you install yarn with npm i -g yarn or even sudo npm i -g yarn!)

git clone https://github.com/scaffold-eth/scaffold-eth-challenges.git challenge-0-simple-nft
cd challenge-0-simple-nft
git checkout challenge-0-simple-nft
yarn install
yarn chain

in a second terminal window, start your ๐Ÿ“ฑ frontend:

cd challenge-0-simple-nft
yarn start

in a third terminal window, ๐Ÿ›ฐ deploy your contract:

cd challenge-0-simple-nft
yarn deploy 

You can yarn deploy --reset to deploy a new contract any time.

๐Ÿ“ฑ Open http://localhost:3000 to see the app


Checkpoint 1: โ›ฝ๏ธ Gas & Wallets ๐Ÿ‘›

โ›ฝ๏ธ You'll need to get some funds from the faucet for gas.

image

๐ŸฆŠ At first, please don't connect MetaMask. If you already connected, please click logout:

image

๐Ÿ”ฅ We'll use burner wallets on localhost...

๐Ÿ‘› Explore how burner wallets work in ๐Ÿ— scaffold-eth by opening a new incognito window and navigate it to http://localhost:3000. You'll notice it has a new wallet address in the top right. Copy the incognito browsers' address and send localhost test funds to it from your first browser:

image

๐Ÿ‘จ๐Ÿปโ€๐Ÿš’ When you close the incognito window, the account is gone forever. Burner wallets are great for local development but you'll move to more permanent wallets when you interact with public networks.


Checkpoint 2: ๐Ÿ–จ Minting

โœ๏ธ Mint some NFTs! Click the MINT NFT button in the YourCollectables tab.

MintNFT

๐Ÿ‘€ You should see your collectibles start to show up:

nft3

๐Ÿ‘› Open an incognito window and navigate to http://localhost:3000

๐ŸŽŸ Transfer an NFT to the incognito window address using the UI:

nft5

๐Ÿ‘› Try to mint an NFT from the incognito window.

Can you mint an NFT with no funds in this address? You might need to grab funds from the faucet to pay the gas!

๐Ÿ•ต๐Ÿปโ€โ™‚๏ธ Inspect the Debug Contracts tab to figure out what address is the owner of YourCollectible?

๐Ÿ” You can also check out your smart contract YourCollectible.sol in packages/hardhat/contracts.

๐Ÿ’ผ Take a quick look at your deploy script 00_deploy_your_contract.js in packages/hardhat/deploy.

๐Ÿ“ If you want to make frontend edits, open App.jsx in packages/react-app/src.


Checkpoint 3: ๐Ÿ’พ Deploy it! ๐Ÿ›ฐ

๐Ÿ›ฐ Ready to deploy to a public testnet?!?

Change the defaultNetwork in packages/hardhat/hardhat.config.js to rinkeby

networkSelect

๐Ÿ” Generate a deployer address with yarn generate

nft7

๐Ÿ‘› View your deployer address using yarn account

nft8

โ›ฝ๏ธ Use a faucet like faucet.paradigm.xyz to fund your deployer address.

โš”๏ธ Side Quest: Keep a ๐Ÿง‘โ€๐ŸŽค punkwallet.io on your phone's home screen and keep it loaded with testnet eth. ๐Ÿง™โ€โ™‚๏ธ You'll look like a wizard when you can fund your deployer address from your phone in seconds.

๐Ÿš€ Deploy your NFT smart contract:

yarn deploy

๐Ÿ’ฌ Hint: You can set the defaultNetwork in hardhat.config.js to Rinkeby OR you can yarn deploy --network rinkeby.


Checkpoint 4: ๐Ÿšข Ship it! ๐Ÿš

โœ๏ธ Edit your frontend App.jsx in packages/react-app/src to change the targetNetwork to NETWORKS.rinkeby:

image

You should see the correct network in the frontend (http://localhost:3000):

nft10

๐ŸŽซ Ready to mint a batch of NFTs for reals? Use the MINT NFT button.

MintNFT2

๐Ÿ“ฆ Build your frontend:

yarn build

๐Ÿ’ฝ Upload your app to surge:

yarn surge

(You could also yarn s3 or maybe even yarn ipfs?)

๐Ÿ˜ฌ Windows users beware! You may have to change the surge code in packages/react-app/package.json to just "surge": "surge ./build",

โš™ If you get a permissions error yarn surge again until you get a unique URL, or customize it in the command line.

โš ๏ธ Run the automated testing function to make sure your app passes

yarn test

testOutput


Checkpoint 5: ๐Ÿ“œ Contract Verification

Update the api-key in packages/hardhat/package.json file. You can get your key here.

Screen Shot 2021-11-30 at 10 21 01 AM

Now you are ready to run the yarn verify --network your_network command to verify your contracts on etherscan ๐Ÿ›ฐ


Checkpoint 6: ๐Ÿ’ช Flex!

๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ Share your public url with a friend and ask them for their address to send them a collectible :)

nft15


โš”๏ธ Side Quests

๐ŸŸ Open Sea

Add your contract to OpenSea

  1. hover over your profile photo in the top right and navigate to Collections or go to https://opensea.io/collections my_collections
  2. click the vertical elipsis and select Import an existing smart contract import_contract
  3. select Live on a testnet live_on_testnet
  4. be sure you're on the same network you deployed to and enter your contract address! contract_address

(It can take a while before they show up, but here is an example:) https://testnets.opensea.io/assets/0xc2839329166d3d004aaedb94dde4173651babccf/1

๐Ÿ”ถ Infura

You will need to get a key from infura.io and paste it into constants.js in packages/react-app/src:

nft13


๐Ÿƒ Head to your next challenge here.

๐Ÿ’ฌ Meet other builders working on this challenge in the Challenge 0 telegram channel!!!

๐Ÿ‘‰ Problems, questions, comments on the stack? Post them to the ๐Ÿ— scaffold-eth developers chat

simple-nft-example's People

Contributors

austintgriffith avatar codenamejason avatar tomafrench avatar pabloruiz55 avatar calvbore avatar azf20 avatar zakgriffith avatar changoman avatar shravansunder avatar 0xsama avatar btogzhan2000 avatar hodlplus2021 avatar januarionclx avatar jfarid27 avatar jacobwillemsma avatar carletex avatar forshtat avatar chris-kag avatar clacladev avatar j2r5m3 avatar ironsoul0 avatar macguyversmusic avatar mingder78 avatar philippzentner avatar ro5s avatar taldenv avatar tomafc330 avatar xalava avatar xjjda22 avatar jcstein avatar

Watchers

Ege Atesalp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.