Hi!
I would like to share my second project with this lovely community and hear your feedback!
From the suggested options, I chose the topic of collectibles. As I saw it, just making a collectible itself would rather mean doing market research and artwork, and not much actual programming. While that sure develops valuable skills, I thought it was not really the purpose at the moment.
Hence, I decided to create an application which would allow for anyone to take a file or string of data, and mint it as an NFT token.
Taking a look at how Opensea makes the NFTs appear on screen, I figured that usually the image (or whatever file the token will contain) is hosted somewhere, and the token is basically a link to this file.
As the blockchain is transparent anyway, the file will be accessible for everyone. The token only represents the ownership.
So, in my case, the user uploads the file on some hosting service (I have chosen Infura’s IPFS), gets the link to their file, and then mints this link as an ERC721 token. Then, by entering the token ID, the link can be retrieved. As the file would usually be an image, the webpage also makes this image appear.
To interact with the webpage, simply navigate to
https://ipfs.infura.io/ipfs/QmcFBRXCXW5XcVCsGJdSmqaSeMDMq13RPXzpmfLgGbCjwT
and follow the instructions on screen. When you first load it, give it a moment as it will be quite slow. I guess it is just how IPFS is.
Make sure you use a full link, including https://, like this:
To see the token ID, open console, copy Your transaction hash, paste it in Etherscan and see line 7, Tokens transfered. Yes, that is not pretty and should be improved.
For example, here I have minted a Big Strong goldfish that now lives in my MetaMask and attracts abundance.
The code with a more detailed description can be found here:
https://github.com/MarcisB8/Collectible
The contract itself is quite simple - it just has mint() and view() functions, and inherits the rest from OpenZeppelin ERC721 contract.
What I struggled quite a lot, was that during the course we were using pragma 0.5.12, but the ERC721.sol uses 0.6.0 and up. That meant updating Truffle and Ganache, after which Truffle didn’t work, then Ganache didn’t work, and then they didn’t communicate. Finally, I managed to deploy the contract on Ropsten. But now it is accessible for everyone!
Regarding the frontend, the mint() function was also supposed to bring the token ID on screen, but I didn’t get it to work.
Another option would be to bring up all tokens that the user’s address owns when MetaMask is connected, but at the moment I have no idea how to do that.