Creating an NFT engine — Part 1

Lucas Oliveira
3 min readJan 11, 2022

Today I’m working on a new useless project, I’m creating an NFT engine, where I can generate random images and push them to a blockchain and generate a smart contract with it.

PS.: Check the REPO!

So, maybe, you might be asking yourself why I’m doing this.

And the reason is one: Proof of concept, I explain it to you.

At the beginning of 2022, I’ve decided to make a bunch of small proof of concepts to understand the technologies I want to use on my new Startup, ClusterStack.

And If you don’t know ClusterStack, I recommend you watch my previous videos, where I show more or less what I’m doing.

To Summarize, ClusterStack is a one-stop-shop application for Immigrants, where you can have access to information, recruitment, services, and visa process

Before I started to mess with ClusteStack’s code and see the technology won’t work with it … later down the project, that would be a waste of time … more than it already is.

So! It would not be better to make an effort to create useless POC’s before I decide to use them on my company? The answer is yes! Definitely yes.

That’s why this nft-engine exists, where I generate random SVG images and push them to a smart contract.

I’ve started this POC before I’ve recorded this video, and they are a series of reels I’m making on Instagram, you can check it out there. And that said, let's layout first how the project works.

So the App consists of 2 parts:

Part 1 — The front end.

  1. First, we generate random images using a pack of SVG’s, where it returns the image, as well its properties.
  2. We wrap these images on the front end and create the marketplace, so the user can choose an NFT to mint.
  3. While on the front-end, the application call metamask and check for the wallet.
  4. When the user goes to the mint page and select minting the app does 3 things :

a) Upload the image to ipfs network and return its hash key

b) Add the rash key with the properties to create the metadata, and upload the metadata to the IPFS, returning a new hash key

c) Use web3 to connect to the smart contract deployed on the network

d) Call the smart contract function to mint, reducing the amount from the metamask wallet and creating a new NFT.

5. Users get their NFT recorded onto their wallet account on the network connection.

Part 2 — The smart contract.

  1. We write a smart contract in solidity.
  2. We use truffle to compile and migrate
  3. The contract is deployed onto the network, in this case, we’re using Ganache

At the moment I’ve fully deployed the smart contract, where you can see here:

and there are a few bits to do at the front end right now, so first of all I’m fixing the IPFS libraries to be able to send the metadata to the Ganache test chain.

--

--

Lucas Oliveira

Software Engineer - Open Source — Freedom Activist