In the previous part, we created and initialized an SPL Token Mint on Solana Devnet. At that point, the Mint existed on-chain with its decimals and authorities configured, but we hadn't really given it an identity yet.
That brings us to metadata. When we see a token with a name, symbol and other descriptive information, where does that information come from? Before jumping into the code, I wanted to understand where all of that information actually lives.
The Mint and its metadata are not the same thing
One thing that helped me understand this was separating the Mint Account from the metadata attached to it. The Mint Account handles the token itself. It stores information such as the token’s decimals, supply, mint authority and freeze authority. It does not directly store things like the token’s name, symbol or image.
That information lives separately as metadata. In our case, we use the Metaplex Token Metadata program, a Solana program for creating and managing metadata for tokens and NFTs. So instead of adding a name or symbol directly to the Mint Account, we create another account that holds this information and connects it back to the Mint.
I like to picture it this way:
Mint Account
├── Supply
├── Decimals
├── Mint Authority
└── Freeze Authority
↓ associated with
Metadata Account
├── Name
├── Symbol
└── URI
The Mint is still the identity of the token on Solana. The metadata simply gives applications and people more useful information about what that token represents.
This also explains why we needed the Mint address from the previous part. When creating the metadata, we have to tell the metadata program exactly which Mint this information belongs to.
What does the URI actually point to?
The metadata account can store information like the token's name and symbol, but we don't want to put every piece of information directly on-chain. Things like an image, description, or other details can be stored elsewhere and referenced through a URI.
Think of the URI as a link pointing to another metadata file that contains more information about the token. That file can look something like:
{
"name": "My Token",
"symbol": "MTK",
"description": "A token created while learning SPL tokens",
"image": "https://..."
}
Adding the metadata
With that in mind, the code started making a lot more sense to me. We already have the Mint address from the previous part, so the first thing we do is reference that same Mint and load our wallet as the signer.
const mint = publicKey("YOUR_MINT_ADDRESS");
const umi = createUmi("https://api.devnet.solana.com");
const keypair = umi.eddsa.createKeypairFromSecretKey(
new Uint8Array(wallet)
);
const signer = createSignerFromKeypair(umi, keypair);
umi.use(signerIdentity(signer));
Here, Umi is the toolkit we're using to interact with Metaplex. We connect it to Devnet, reconstruct our signer from the wallet we already have, and tell Umi to use that signer for the operations we're about to perform.
We then define which Mint the metadata belongs to and provide the information we want associated with it: things like the token's name, symbol and URI. The important part for me was understanding what we were asking the program to do: create metadata for this specific Mint, with its mint authority authorizing the operation.
What actually changed?
After the transaction is sent and confirmed, we haven't created any new tokens. Our Mint still represents the same token, and this operation doesn't suddenly increase its supply.
What we've done is associate a metadata account with it:
Mint
│
├── decimals
├── supply
└── authorities
│
└── associated Metadata
├── name
├── symbol
└── URI
We aren't modifying the Mint to squeeze a name, image and description into it. The Mint and its metadata have different responsibilities, but they are connected.
Where we are now
So far, we've created the Mint and added metadata to give it a recognizable identity. But there is still one important thing missing: we haven't actually minted any token units yet. Which leaves us with the next question: when we mint tokens, where do they actually go?
That takes us into Token Accounts and Associated Token Accounts (ATAs), which is what we'll look at next.
Top comments (0)