Give your NFT a name, an image, and on-chain metadata
Turn yesterday’s empty 1-of-1 token into a real, viewable NFT by adding on-chain metadata, an image, attributes, and a locked supply.
Give your NFT a name, an image, and on-chain metadata
The Scenario
Yesterday you created a 1-of-1 token on devnet. Mechanically it is an NFT: supply of one, zero decimals, mint authority burned. But if you opened it in a wallet right now you would see a blank tile with no name, no picture, no description. Nothing that signals what the token represents. In Web2 terms, you provisioned the database row but left every column null.
Real NFTs carry a payload. A name, a symbol, a pointer to an image, a list of traits, sometimes a description. In the older Solana world that payload lived in a separate program called Metaplex Token Metadata, which created its own account next to your mint. With Token Extensions, that data can sit directly on the mint account itself using two extensions that work as a pair: the metadata pointer extension says “this mint’s metadata lives at address X,” and the metadata extension stores the actual fields. Today you are going to use them together to turn yesterday’s empty token into a viewable NFT that shows up correctly in Solana Explorer and most modern wallets.
The Challenge
You will create a fresh Token-2022 mint with the metadata extension enabled, host a small JSON file describing your NFT, write the on-chain metadata pointing to that JSON, mint exactly one unit to your wallet, and lock everything down. By the end you will have a complete, viewable, non-fungible artifact on devnet.
What you’ll need
- The spl-token CLI (install via Solana CLI tools, version recent enough to support Token-2022 metadata commands)
- A devnet keypair already funded with at least 0.5 SOL (use
solana airdrop 1if needed) - A free GitHub Gist account to host your JSON metadata file
- A public URL for an image (any direct PNG or JPG link works; a Wikipedia Commons URL or a GitHub-raw URL is fine)
- A terminal and a code editor
Steps
- Confirm your CLI is pointed at devnet and check your balance:
solana config set --url https://api.devnet.solana.com solana balance - Pick or upload an image. The simplest option is to find any PNG already hosted on the open web and copy its direct URL. For your first pass, a placeholder is fine. You can swap it later. Keep the URL handy.
- Create your off-chain metadata JSON. Open a new GitHub Gist, name the file
metadata.json, and paste in the following, replacing the values to describe your own NFT:
Save the gist as public, then click the Raw button. Copy that raw URL. It should start with{ "name": "First Light", "symbol": "LIGHT", "description": "My first real NFT, minted on Solana devnet during 100 Days of Solana.", "image": "https://upload.wikimedia.org/wikipedia/commons/4/49/Dichroic_filters.jpg", "attributes": [ { "trait_type": "Filters", "value": "44" }, { "trait_type": "Network", "value": "Devnet" } ] }https://gist.githubusercontent.com/and end inmetadata.json. This is your metadata URI. - Generate a vanity-friendly mint keypair so you can read the mint address easily:
This produces a JSON file in your current directory likesolana-keygen grind --starts-with nft:1nftXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json. Note the mint address (the file name without.json). - Create the mint with the metadata extension turned on. The Token Extensions program ID is
TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb:
Replace the path with the actual file produced in step 4. Thespl-token create-token \ --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \ --enable-metadata \ --decimals 0 \ ./nftXXXX...XXXX.json--enable-metadataflag wires up both the metadata pointer (pointing the mint at itself) and reserves space for metadata fields on the mint account. - Initialize the on-chain metadata fields. The arguments are
mint name symbol uri:
Substitute your actual mint address and the raw gist URL from step 3. After this transaction confirms, the mint account itself stores the name, symbol, and URI.spl-token initialize-metadata \ [YOUR_MINT_ADDRESS] \ "First Light" \ "LIGHT" \ [YOUR_GIST_RAW_URL] - Create your associated token account and mint exactly one unit:
spl-token create-account [YOUR_MINT_ADDRESS] spl-token mint [YOUR_MINT_ADDRESS] 1 - Lock the supply forever by disabling the mint authority, the same move you made yesterday:
spl-token authorize [YOUR_MINT_ADDRESS] mint --disable - Open Solana Explorer (devnet), paste your mint address into the search bar, and look at the token page. You should see your name, symbol, the image rendered from the JSON, and the attributes listed.
Run it
spl-token display [YOUR_MINT_ADDRESS]
You should see fields like Mint, Supply: 1, Decimals: 0, Mint authority: (not set), plus a metadata block listing your name, symbol, and URI.
What Just Happened
You stitched together two layers of an NFT in one sitting. The on-chain layer is the mint account itself, now carrying the metadata pointer extension and the metadata extension. Those extensions make your name, symbol, and metadata URI part of the token at the lowest level, with no separate Metaplex account required. The off-chain layer is the JSON file you hosted on a gist. That file holds the heavier fields like the image URL and attribute list, which are too expensive to store on-chain at scale.
If yesterday’s mint felt like a row in a database with most columns null, today’s mint is the same row with the columns finally populated, plus a foreign key (the URI) pointing to a richer record. Wallets and explorers know the convention: read the on-chain metadata, follow the URI, fetch the JSON, render the image. Every NFT you have ever scrolled past in a marketplace works on some version of this pattern. You just built one.
You also locked the supply at one and disabled the mint authority, which means no future transaction can ever produce a second copy. Combined with the on-chain metadata, your token now meets the practical definition of an NFT: unique, identifiable, and visible.
Resources
- Solana Docs: Metadata Pointer and Token Metadata extensions
- Solana Developers Guide: How to create a token (with metadata)
- QuickNode Guide: Create a Solana NFT with the SPL Metadata Token Extension
- SPL Token-2022 Extensions reference
Submission
Take a screenshot of your mint’s page on Solana Explorer (devnet) showing the name, image, and attributes, and submit it below!