I've been slowly getting into blockchain and web3 to understand what the hype is all about. After a few tutorials, walkthroughs, and a lot of reading, testing, and developing, I finally grasp the basic notions of what it has to offer.
So, without going into too much theory, a blockchain is formed by a series of blocks, linked together. An active blockchain has nodes, which contain the history of the blockchain, and add new blocks to it. In the case of Ethereum, blocks can contain arbitrary data, and people use the storage for a number of purposes.
You can "pay" a bit of Ethereum, to have those nodes store data in the blockchain. That way your data is available in the public, it's safe from tampering and anyone can see it & audit it. The cool thing is that Ethereum (and many other blockchains) also support writing small programs within the blockchain, which are called Smart Contracts.
NFTs are a type of data that people store in the blockchain. They typically consist of an image + some metadata, but that's not always the case, you can create an NFT with a video, an audio, or almost any content. People use them for different purposes, assets in a game, membership in a club, or even as collectibles (similar to trading cards).
Getting started is complex, but luckily there are plenty of resources out there to get started. I can only say good things about Pointer, and Buildspace. Amazing courses, plenty of community and rewards for completing the courses.
So, after a few courses, I knew my way around Hardhat, to debug and deploy smart contracts. I was familiar enough with Alchemy to propagate the smart contract to the blockchain. I understood gas fees transaction costs... and I was able to deploy the contract to the blockchain.
After careful consideration, I switched from Ethereum to Polygon, which is built on top of Ethereum, but offers lower fees for transactions. The development is pretty much the same, as both use Solidity as it's base language, and the tools mentioned above work identically for both.
So I decided to build a random NFT image, that is stored on-chain. This means that the NFT is generated at random when a user mints it. It is an image (an SVG to be precise), where some parts of the image are generated at random, making each NFT unique. The image is stored on-chain, which is not ideal, since storing data in the blockchain is expensive, but it saves me the trouble of storing it somewhere else. The data is base64 encoded
and stored directly in the blockchain.
The final NFT image is completely random, if you want to see what it can look like, you can .
So I deployed the Smart Contract with the help of Hardhat and Alchemy, and it's now visible on PolygonScan. This is a service that provides a simple way to scan the blockchain for specific data. Since all the data in the blockchain is always online and public, it's a handy tool to find out what's going on in the world.
And once that was there, all there was left was to allow people to mint an NFT interacting with my smart contract. Luckily most of that work is just pure frontend work, although a user would need a Metamask account (and the browser extension) to be able to interact with the blockchain. If you want to see how it ended up looking like, you can Mint my NFT (be warned, it has a symbolic cost of 1 MATIC + the gas fees).