I’m working on an ERC721 smart contract that will handle thousands of image-based NFTs. Storing all the image data directly in the contract as byte arrays seems like it would be really expensive and not practical at scale.
What’s the recommended approach for this? I’m curious about how popular projects like CryptoKitties handle their image storage. Do they actually store the raw image bytes in the smart contract, or do they just store links to external servers?
I’m worried about using external URLs because it seems to go against the whole idea of NFTs. If the server hosting the images goes down or the link breaks, then NFT owners would just have a broken reference instead of the actual artwork. That doesn’t seem very decentralized.
What are the trade-offs between different storage methods, and what do most successful NFT projects actually use in practice?
This is a fascinating problem! I’ve been wrestling with the same thing - there’s a huge gap between what projects say about decentralization and what they actually deliver.
Have you thought about going hybrid? Store the critical metadata on-chain (just the core attributes that make each NFT unique) and put full images on IPFS. If image hosting dies, you’d still have something meaningful tied to the token.
What type of images are you working with? Generative art where you could recreate from stored traits, or unique photos/artwork? I’ve seen smart projects store generation seeds on-chain and rebuild entire images from those parameters.
You should check out Arweave. It’s supposedly more permanent than IPFS - you pay once for “forever” storage instead of ongoing pinning fees. Worth comparing costs if you’re dealing with thousands of NFTs.
What’s your storage budget? That’ll help figure out which approach makes sense for your project.
yeah, true decentralization is rare in NFTs. most big projects, like CryptoKitties, use their own servers for metadata instead of true on-chain storage. hosting images on-chain can be super costly, but smaller collections sometimes do it for unique art. it’s a trade-off for sure.
Most projects use IPFS instead of storing everything on-chain or using regular HTTP links. Your smart contract holds an IPFS hash that points to a JSON file with the metadata, and that JSON references the actual image file (also on IPFS). I used this setup in my last NFT project and it works great - IPFS gives you content-addressed storage, so the hash guarantees nobody can change your files without breaking the link. The catch is you need IPFS nodes to pin your content or it disappears. Either run your own node or pay for services like Pinata or Infura. Some projects like Art Blocks generate everything on-chain using code in the contract - totally decentralized but only works for algorithmic art. For regular artwork, IPFS hits the sweet spot between decentralization and actually being practical.