1. Introduction
I know you can create an NFT collection like this: https://testnets.opensea.io/collection/runner-nfts.
It’s very easy to do this from an OpenSea user’s perspective! 😉
But,
-
Can you create this collection in a programmable way?
-
Why you should do this?
If you are in the sportive area, please contact me and I will discuss with you the business values for such thing.
The purpose of this tutorial is give to Blockchain developers some initial steps to start coding NFTs.
2. The manual (but fastest) way to create programmable NFTs
2.1. Tools used in the following steps
-
https://www.google.com/chrome/ ← Google Chrome
-
https://metamask.io/ ← Metamask
-
https://rinkebyfaucet.com/ ← Rinkeby Faucet
-
https://wizard.openzeppelin.com/ ← OpenZeppelin Wizard
-
https://remix.ethereum.org/ ← Remix IDE
-
https://nft.storage/ ← NFT Storage
-
https://jsonkeeper.com/ ← JSON Keeper
-
https://testnets.opensea.io/ ← OpenSea testnets
2.2. Steps
→ Install Metamask
-
Instal [metamask] on your [google-chrome].
→ Get some Rinkeby ethers
-
Use the [rinkeby-faucet] the get some fake ethers on the Rinkeby network.
→ Create the contract
-
Access the [openzeppelin-wizard] URL and create the contract.
-
Click the button
ERC721
. -
Name the NFT as
RunnerNFTs
and use the symbolRUNF
(Run Forrest! Run!) ;) -
Check the following features:
-
Mintable (and Auto Increment Ids)
-
URI Storage
-
-
-
Click the button
Open in Remix
.
→ Publish your image on NFT Storage and get its URL
-
Access the [nft-storage] URL and publish the image of your NFT.
-
Copy the generated URL to the image in order to use it in the next step.
→ Create the JSON metadata
-
Copy and paste this JSON to [jsonkeeper]:
{ "name": "Ironman Brazil 2017", "description": "Ironman Brazil 2017 medal", "image": "https://bafybeibgx437bg5mrvyaqkvst5ffa3uxk7yan4bao22ynev6lajq6zgdwq.ipfs.nftstorage.link/" }
-
Change the image URL according to the published URL in NFT Storage.
-
Hit the
Save
button and copy the generated JSON URL (i.e.: https://jsonkeeper.com/b/KN5D)
→ Compile and test the contract locally
-
Inside [remix-ide], change the
COMPILER
version to the corresponding generated code. -
Click Ctrl+S to compile the contract.
-
Click
Deploy & run transactions
on the left pane.-
Select the
CONTRACT
:RunnerNFTs
. -
Click the button
Deploy
.
-
-
Select the contract on
Deployed Contracts
.-
Click the
safeMint
button.-
Copy the address in the
ACCOUNT
and paste it into the value for theto:
field. -
Copy the JSON URL published in the previous step into the value for the
uri:
field.
-
-
Click the
tokenURI
button.-
Enter the value 0 for the field
tokenId:
and click call. -
Check if the returned value is the JSON URL informed above.
-
-
→ Deploy the contract to the Rinkeby network
-
Change the
ENVIRONMENT
toInjected Web3
. -
Check if the selected
CONTRACT
isRunnerNFTs
. -
Click
Deploy
and notice that Metamask will open. -
Confirm the transaction and wait for it to be confirmed.
-
Click
view on etherscan
on then Remix console to check the deployed contract on the Rinkeby.
-
→ Mint the NFT
-
Call the the
saveMint
function passing your account on Metamask and the JSON URL returned on the previous step.
→ Check your NFT on OpenSea
-
Repeat the actions
safeMint
andtokenURI
to check if the things are ok on the Rinkeby network. -
Copy the NFT contract address on Remix and search for it on [opensea-testnets].
→ Add another NFT to you collection
-
Repeat the action
safeMint
using another JSON URL. -
Call the
tokenURI
function incrementing it by 1 and check the JSON URL.