Storing SVGs onchain

Contracts deployed on Highlight automatically store all assets and metadata on Arweave. This is cheaper than storing data on the blockchain, while still guaranteeing decentralization.

In the case that you want all your data on your contract, this article will walk through how you can store SVGs and text on the blockchain.

Note: if you want to store files onchain, see Onchain File Storage.

Uploading your NFT as a URI

To upload your SVG-based NFT onto your contract, you'll need to convert it into a Uniform Resource Identifier (URI) so that your browser can render it.

  1. Transform your SVG file to URI: Take your SVG file code and convert it into an URI. URI's are a character sequence that typically helps identify a resource connected to the internet. It helps to distinguishes one resource from another. Use tools such as this or this to convert your SVG into a URI.

Minting your SVG

Once you have your URI for your token, you can write this directly onto your contract via the applicable block explorer (for instance, if your contract is deployed on Ethereum, you can use Etherscan).

Instructions below on how to write your SVG directly on your contract:

  1. Deploy contract on Highlight

  2. Go to block explorer, then "Write as Proxy". Youโ€™ll need to โ€œverify as proxyโ€ which can be done by selecting โ€œmore optionsโ€

  3. Write to contract One of one, limited edition, or open edition For any of the above collection styles, to change an entire edition's metadata to SVG, go to field 22 "setEditionURI" Enter the editionID of the collection. This can be found on the token management page. For open editions, it will always be 0. Reference image below. For "_uri (string)", enter in the URI pointing to the token metadata. Generative or series style collection For series and generative series, you can update a single token's metadata to SVG. Use field 30 "setTokenURIs". Under "ids", enter in the token ID for applicable token. For URIs, enter in the URI for the token SVG.

Last updated