On chain NFT collection

Happy new year guys!

I am thinking of minting an on chain NFT collection by using various SVG layers. I want to layer the SVGs on top of each other to make a “complete” SVG, and I would like to nest it twice.

For example, I want to make a computer NFT, so I would need to have a keyboard layer, a monitor layer, a touchpad layer, a webcam layer and each layer has 5 types, e.g. there are 5 keyboards. If I have 4 layers and each layer has 5 types, that would create 625 possible permutations.

With my design software, my SVG code is about 2500 lines, and Remix keeps crashing when I try to deploy to testnet - I cannot even get an estimate of how much gas would it take.

I am concerned that storing the SVG data for these layer-types would be very costly on-chain, but there seems to be a hype around on-chain NFTs and I would like to avoid IPFS/API.

Is there any other more efficient way to generate on-chain NFTs without the use of:

  1. IPFS/APIs
  2. Storing the SVG layers on-contract

Thank you!

Hey @rahulsw, it’s not surprising the remix crash coz adding 2500 line of code could cost tons of ETH. I cannot see anyway you can store it directly other than using IPFS or other decentralized storage solution. Maybe using hash is possible because it have fixed length, but once something is hashed, you cannot reverse them. Also using URI from source such as IPFS is the standard from EIP-721 and EIP-1155, changing it might make your contract not an NFT anymore

Hi @YosephKS, thanks for your reply! Could you explain more about the hash part, would I be hashing the SVG?

Understand that the tokenURI method usually takes in a link from IPFS, but recently there seem to be a couple of collections that return SVG code such as Anonymice (https://opensea.io/collection/anonymice) and OnChainMonkeys (https://opensea.io/collection/onchainmonkey) from the tokenURI method.

Also, is there any other way to estimate the gas other than via Remix due to the crashing problem?

Thank you!

you could make the processing off chain and only to update the SVG for a particular token_id later

Would the storage of the SVG for the particular token_id still result in extremely high gas?

it depends on the size of the svg, also it could depend on the network that you use