๐ŸŽŸ
Simple NFT

Branch Info

Author: Hunter Chang Source code: https://github.com/scaffold-eth/scaffold-eth-examples/tree/simple-nft-example Intended audience: Beginners/Intermediate Topics: Scaffold-eth basics, NFTs, IPFS

๐Ÿƒโ€โ™€๏ธ Quick Start

Required: Node plus Yarn and Gitโ€‹
1
git clone https://github.com/scaffold-eth/scaffold-eth-examples.git simple-nft-example
Copied!
1
โ€‹
2
cd simple-nft-example
3
โ€‹
4
git checkout simple-nft-example
Copied!
1
yarn install
Copied!
1
yarn start
Copied!
in a second terminal window:
1
cd simple-nft-example
2
yarn chain
Copied!
in a third terminal window:
1
cd simple-nft-example
2
yarn deploy
Copied!
๐Ÿ“ฑ Open http://localhost:3000 to see the app
โœ๏ธ Edit the mint script mint.js in packages/hardhat/scripts and update the toAddress to your frontend address (wallet address in the top right or localhost:3000).
in a terminal window run the mint script:
1
yarn mint
Copied!
๐Ÿ‘€ You should see your collectibles show up if you minted to the correct address:
๐Ÿ‘› 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:
๐ŸŽŸ Send an NFT to the incognito window address:
๐Ÿ•ต๐Ÿปโ€โ™‚๏ธ 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
๐Ÿ” Generate a deploy account with yarn generate
๐Ÿ‘› 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)
๐Ÿ‘จโ€๐ŸŽค Deploy your NFT smart contract:
1
yarn deploy
Copied!
โœ๏ธ Edit your frontend App.jsx in packages/react-app/src to change the targetNetwork to wherever you deployed your contract:
You should see the correct network in the frontend:
An instant wallet running on xDAI insired by xdai.io.
๐ŸŽซ Ready to mint a batch of NFTs for reals?
1
yarn mint
2
โ€‹
3
await tenderlyVerify(
4
{contractName: "YourContract",
5
contractAddress: yourContract.address
6
})
Copied!
Make sure your target network is present in the hardhat networks config, then either update the default network in hardhat.config.js to your network of choice or run:
1
yarn deploy --network NETWORK_OF_CHOICE
Copied!
Once verified, they will then be available to view on Tenderly!

โš”๏ธ 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:)

๐Ÿ” 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)

๐Ÿ”ถ Infura

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

๐Ÿ›ณ Ship the app!

โš™๏ธ build and upload your frontend and share the url with your friends...
1
# build it:
2
โ€‹
3
yarn build
4
โ€‹
5
# upload it:
6
โ€‹
7
yarn surge
8
โ€‹
9
Join the telegram [support chat ๐Ÿ’ฌ](https://t.me/joinchat/KByvmRe5wkR-8F_zz6AjpA) to ask questions and find others building with ๐Ÿ— scaffold-eth!
10
โ€‹
11
yarn s3
12
โ€‹
13
===================================================== [โซ back to the top โซ](https://github.com/austintgriffith/scaffold-eth#-scaffold-eth)
14
โ€‹
15
yarn ipfs
Copied!
๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ Share your public url with a friend and ask them for their address to send them a collectible :)