In this project, I create my own NFTs using the ERC-721 token standard, minted them and finally got them to show up in my Metamask wallet!
- Static NFT: This NFT will not change based on any action.
Note: The NFT is stored on IPFS, hence not 100% decentralised. The Token URI is mentioned below.
NFT Name: Dogie
NFT Symbol: DOG
Link to Dogie NFT contract on Etherscan
- Dynamic NFT: This NFT has the capability to change using a function call, hence it's dynamic. Isn't that cool!!😎
Note: This NFT is stored 100% on chain!
NFT Name: Mood NFT
NFT Symbol: MN
Link to Mood NFT contract on Etherscan
OpenZeppelin Contracts Docs
OpenZeppelin GitHub Repo
forge install OpenZeppelin/openzeppelin-contracts --no-commit
git clone https://github.com/alfheimrShiven/nft.git
cd nft
forge build
forge test
or
forge test --fork-url $SEPOLIA_RPC_URL
forge coverage
make anvil
make deployBasicNft
- Setup environment variables
You'll want to set your SEPOLIA_RPC_URL
and PRIVATE_KEY
as environment variables. You can add them to a .env
file, similar to what you see in .env.example
.
PRIVATE_KEY
: The private key of your account (like from metamask). NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT.- You can learn how to export it here.
SEPOLIA_RPC_URL
: This is url of the sepolia testnet node you're working with. You can get setup with one for free from Alchemy
Optionally, add your ETHERSCAN_API_KEY
if you want to verify your contract on Etherscan.
- Get testnet ETH
Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.
- Deploy
make deployBasicNft ARGS="--network sepolia"
make mintBasicNft
make anvil
make deployMoodNft
- Setup environment variables
You'll want to set your SEPOLIA_RPC_URL
and PRIVATE_KEY
as environment variables. You can add them to a .env
file, similar to what you see in .env.example
.
PRIVATE_KEY
: The private key of your account (like from metamask). NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT.- You can learn how to export it here.
SEPOLIA_RPC_URL
: This is url of the sepolia testnet node you're working with. You can get setup with one for free from Alchemy
Optionally, add your ETHERSCAN_API_KEY
if you want to verify your contract on Etherscan.
- Get testnet ETH
Head over to faucets.chain.link and get some testnet ETH. You should see the ETH show up in your metamask.
- Deploy
make deployMoodNft ARGS="--network sepolia"
make mintMoodNft
make flipMoodNft
Once minted, import your NFT into your Metamask. Since you would be the first one minting the NFT, Token ID = 0
. To learn how to import, refer this blog.
If you appreciated this, feel free to follow me: