How to store NFT metadata and SVG image completely on-chain (ERC721/ERC1155)

preview_player
Показать описание
Learn how to create truly immutable smart contracts (Ethereum / EVM) that can hold all metadata and SVG images on-chain.

0:00:00 - Intro
0:02:35 - Put metadata to struct
0:03:20 - OpenSea standard
0:05:00 - Return JSON meta from contract
0:06:40 - SVG image on-chain
0:11:00 - Testing JSON
0:13:00 - Deploy to Rinkeby testnet
0:14:00 - OpenSea test

Credits to Andy Hartnett for preparing great article and code:

#ethereum #nft #smartcontracts

Рекомендации по теме
Комментарии
Автор

Very very interesting. I have thought about directly saving data in smart contract as I have started developing on a very cheap gas blockchain.
This is the first practical approach I have found. Thank you a lot

NilsTBurmeister
Автор

Really nice tutorial Artur, it allows to store SVGs that may be XSS vulnerable, been trying this on Kovan and was successfull :) and yea Tibia is such a nice game, have minted Spike Sword from Rookgard :D

krystianpominski
Автор

thanks for the video! It helped a lot!

ВасилийКлёцкин-мг
Автор

Is this code outdated? I am launching my NFT on polygon mumbai- the json looks fine when I call for the tokenUri and decode it... but OpenSea does not display any image nor recognize any of the attributes... 😢

jimlynchcodes
Автор

Is there any way to include just the minter’s address in the NFT but not render the image as an SVG? I’m deploying Manifold contracts so 0 solidity knowledge.

hajarali
Автор

Hello Artur, great video! Sweet and easy to understand!

I just wanna ask: What happens if I have a large set of unique, complex 64x64 SVGs with multiple layers? What would be the best way to store/generate these NFTs on-chain?

I've already tried storing them on-chain and it was simply too big for the contract to even compile.

Cheers,
Ashton

ashtongoh
Автор

I know that IFPS is public by nature, but are there any methods or solutions for locking data like an SVG so only the owner of an associated NFT can access it? Piñata is offering a solution they're calling submarining, but it relies on a third party. Is there any talk in the NFT world of developments that could restrict data to everyone but NFT holders?

BTW, great video!

bagpiper.michael
Автор

Hi, When different prop attributes of the game are stored on the chain, does the player consume a lot of gas cost for minting NFT?

jameszhang
Автор

Would be sooo cool if additional attributes will generate (custom / randomly) into metadata

dzoblin
Автор

Does it matter what the image dimension is set to? Eg. 64x64, will it be upscaled on Opensea's item page or show up as a small image.

stoicego
Автор

artur I hope you can answer. I wanted to ask if i can make the image be dynamic where I can change the ipfs link to be unique for each given token. I dont want to use a SVG file

CarlosMiranda-ktmz
Автор

im curious to know what logic would you use to animate an svg in real time .. lets say a loading screen with a chosen nft that we dont know until user selects from MetaMask.
appreciate any feedback.. your a an awesome dev.. im studying coding now and love your vids.. keep them coming thanks

parzivall
Автор

Is there anyway we can get the json metadata stored in ipfs within our smart contract? Or it has to be stored on chain?

Thank you for the video.

Synopsia
Автор

Hey Artur,

Great video, can you make a video on how to create land token and visualize it on our own website? for example: sandbox and decentraland land tokens are fit in the map.

vineralph
Автор

Just wondering why you implemented the function _beforeTokenTransfer?

bernardusmuller
Автор

Hi. I want to develop farming game. And I want to mint the farm asset.

Each NFTs (farm asset) have different characteristics :
1) Limited
2) Infinity
3) Mint by stages

So, using ERC 1155, the smart contract have to deployed all once or seperately?

travellerrider
Автор

Can the data is only read by owner or with some salt key from web3? for example if we wanna store metadata such date birth or our another personal information? I just research about store personal information into blockchain. thanks great video!

HendRa-dmhw
Автор

Hi man! Thanks for the video 👍 I was wondering if as a developer you find this solution truly viable, due to the amount of data that has to be stored and computed on-chain. This may be ‘valid’ for a very simple and light svg file, but it becomes unfeasible with other types of graphic files. I would like to have your opinion on this. Thanks!

rodrigo
Автор

Great video @Artur Chmaro ! I was wondering if you know how to store partially on-chain metadata so it can be read by OpenSea?
I'm trying to store 99% as pre-made jsons on IPFS, and then two properties on-chain, so it can be edited by token owner: eg. Name.
Do you know how can I go about this?

hiranga
Автор

Can this be used for cardano to mint nft on chain?

cardanoclub