Skip to content

Latest commit

 

History

History
189 lines (106 loc) · 7.91 KB

File metadata and controls

189 lines (106 loc) · 7.91 KB
description
Use VRF to get a 🎲 random "⚔️ strength" for each NFT as it is minted...

🐸 Chainlink 🎲 VRF 🎫 NFT

Branch Info

Author: Austin Griffith****
Source code: https://github.com/scaffold-eth/scaffold-eth-examples/tree/chainlink-vrf-nft
Intended audience: Beginners/Intermediate
Topics: Scaffold-eth basics, NFTs, Chainlink

🏃‍♀️ Quick Start

playmore

required: Node plus Yarn and Git

git clone https://github.com/scaffold-eth/scaffold-eth-examples.git buyer-mints-nft

cd buyer-mints-nft

git checkout buyer-mints-nft
yarn install
yarn start

in a second terminal window:

cd simple-nft-example
yarn chain

✏️ Edit the artwork manifest artwork.js with all of your art, then upload it to IPFS:

in a third terminal window:

cd simple-nft-example

yarn upload

yarn deploy

📱 Open http://localhost:3000 to see the app

Your artwork from artwork.json (if uploaded and deployed correctly) should show a gallery of possible NFTS to mint:

image

💦 Use the faucet wallet icon in the bottom left of the frontend to give your address $1000 in testnet ETH.

🎲 This repo uses Chainlink's VRF on Rinkby.

First call getRandomNumber() from the debug contracts tab:

image

Wait for the randomResult to get set:

image

Finally, mint from the gallery tab and your NFT will have a tokenStrength:

image

🎫 Try to "Mint" an NFT:

image

👛 Open an incognito window and navigate to http://localhost:3000 (You'll notice it has a new wallet address).

⛽️ Grab some gas for each account using the faucet:

image

🎟 Send an NFT to the incognito window just to make sure it works.

🕵🏻‍♂️ Inspect the Debug Contracts tab to figure out what address is the owner of YourCollectible?

💼 Edit your deployment script deploy.js in packages/hardhat/scripts

🔏 Edit your smart contract YourCollectible.sol in packages/hardhat/contracts

📝 Edit your frontend App.jsx in packages/react-app/src

🔑 Create wallet links to your app with yarn wallet and yarn fundedwallet

⬇️ Installing a new package to your frontend? You need to cd packages/react-app and then yarn add PACKAGE

📡 Deploy NFT smart contract!

🛰 Ready to deploy to a testnet?

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

image

🔐 Generate a deploy account with yarn generate

image

👛 View your deployer address using yarn account (You'll need to fund this account. Hint: use an instant wallet to fund your account via QR code)

image

📝 Triple check your artwork.json file and run:

yarn upload

👨‍🎤 Deploy your NFT smart contract:

yarn deploy

✏️ Edit your frontend App.jsx in packages/react-app/src to change the targetNetwork to wherever you deployed your contract:

image

You should see the correct network in the frontend:

image

An instant wallet running on xDAI insired by xdai.io.

⚔️ Side Quests

🐟 Open Sea

Add your contract to OpenSea ( create -> submit NFTs -> "or add an existing contract" )

(It can take a while before they show up, but here is an example:)

https://testnets.opensea.io/assets/0xc2839329166d3d004aaedb94dde4173651babccf/1

🔍 Etherscan Contract Verification

run yarn flatten > flat.txt (You will need to clean up extra junk at the top and bottom of flat.txt. Sorry, rookie stuff here.)

copy the contents of flat.txt to the block explorer and select compiler v0.6.7 and Yes to Optimization (200 runs if anyone asks)

image

🔶 Infura

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

image

🛳 Ship the app!

⚙️ build and upload your frontend and share the url with your friends...

# build it:

yarn build

# upload it:

yarn surge

Join the telegram [support chat 💬](https://t.me/joinchat/KByvmRe5wkR-8F_zz6AjpA)  to ask questions and find others building with 🏗 scaffold-eth!

yarn s3

===================================================== [⏫ back to the top ⏫](https://github.com/austintgriffith/scaffold-eth#-scaffold-eth)

yarn ipfs

image

👩‍❤️‍👨 Share your public url with a friend and ask them to buy a collectible

buyerpaysgastomint mov