Skip to main content
Tutorial
Beginner

Uploading your NFT metadata on IPFS

To create your NFT by deploying a smart contract you can upload your contract-level metadata on IPFS.

Creating your Json file

To upload your metadata, it must be in the Json format. You need to follow the standard of the marketplace where you want to showcase your NFT.

For example, if you wish to showcase your NFT on OpenSea, you can use this template:

{
"name":"My Super NFTs",
"description":"You’ve never seen NFTs this beautiful.",
"image":"",
"external_link":"",
"seller_fee_basis_points":100,
"fee_recipient":""
}

Uploading your file on IPFS

You can upload your file on IPFS using Starton from Dashboard or from Code.

    const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");
// AUTHENTICATING TO THE API USING YOUR API KEY
const startonApi = axios.create({
baseURL: "https://api.starton.com",
headers: {
"x-api-key": "YOUR_API_KEY",
},
});
// UPLOAD JSON TO IPFS.
const uploadJsonToIpfs = async (json, name) => {
const ipfsJson = await startonApi.post("/v3/ipfs/json", {
name: name of your json,
content: json,
metadata: { your: "additionnal", meta: "data" },
});
return ipfsJson;
};
// ENTERING YOUR JSON'S INFORMATION
uploadJsonToIpfs({ "metadata": "data" }, "Json name")
.then((res) => console.log(res))
.catch((e) => console.log(e));

After uploading your file, you will get a URI (the address of your file on IPFS), and a CID (content Identifier), that you can use you deploy your ERC721 or ERC1155 smart contracts.

Loubna Benzaama

Lead technical writer


Created:

April 3, 2024

Reading time:

2 min


Content
  • Creating your Json file
  • Uploading your file on IPFS