What is a Solana NFT? (Part 2)

joão nuno lopes
Invisible Lab
Published in
3 min readMar 8, 2022

Part 2 — How does token metadata work on Solana?

If you read Part 1 of this article, you have learned two things:

  • Creating an FT (Fungible Token) is pretty easy
  • Associating Metadata to it is not as trivial as it seems

To solve this, we started wondering through the official Solana Discord where we weren’t able to find promising answers, but we got a hint: Metaplex

Metaplex has multiple products. For now, we will focus on the Metaplex Metadata Program. This is a Solana program developed by Metaplex that creates a Metadata Account where data is stored on chain (name, symbol, uri, creators). The URI should point to a JSON file with a specific format that is now used by the most popular wallets, Marketplaces and other Apps. The JSON below is identical to the one we’re using for this tutorial. We chose Arweave to deploy the image and the JSON. You can follow this simple guide on how to deploy a file, or you can use our deployment. You can also use Piñata Cloud that has a simpler graphical interface, where you just have to upload your JSON.

{
"name": "AWESOME-NFT",
"symbol": "AWESOME",
"description": "This is an awesome NFT.",
"seller_fee_basis_points": 0,
"image": "https://arweave.net/smE9rg4hOt5JXJ_-CbviA7as_l9KskKod9OxOrUwGyY",
"animation_url": "",
"external_url": "",
"attributes": [
{
"trait_type": "awesomeness",
"value": "100%"
}
],
"collection": {
"name": "What is an NFT?",
"family": "Part2"
},
"properties": {
"files": [
{
"uri": "https://arweave.net/smE9rg4hOt5JXJ_-CbviA7as_l9KskKod9OxOrUwGyY",
"type": "image/png"
}
],
"category": "image",
"creators": [
{
"address": "3QJyu...9xJ",
"share": 100
}
]
}
}

This might sound familiar to the ERC-721 standard.

So, is the Metaplex Metadata Program the ERC-721 of Solana?

Once again, it’s complicated… Let’s put it this way: It is possible that this program might become the standard for NFT metadata, but we can’t be sure about its adoption in the future. Let’s call it the Current Metadata Standard used by the community.

How do I add Metadata to the token I created in the Part 1?

Part 1 was pretty easy, just had to install the cli and copy paste stuff… So, how hard could this step be? Unfortunately, harder than it should. You have to start by cloning the Metaplex Programs repository and compile Rust code:

git clone https://github.com/metaplex-foundation/metaplex-program-library.gitcd token-metadatacargo build

This will generate an executable file with a name that didn’t bring us much confidence on what we were doing:

./target/debug/metaplex-token-metadata-test-client

Now we just have to execute it with the info we want and the mint address that was generated previously. If no mint address is given, a new one will be generated.

./metaplex-token-metadata-test-client create_metadata_accounts --keypair <keypair-path> --name <name> --uri <uri> --symbol <symbol> --mint <mint-address>

And… DONE! We just transformed the token created in Part 1 in an NFT with data on it! You can check a Solana Explorer to see that the Metadata is now available. Note that if you have disabled minting, this command will throw an error. You should start again with a new token and only disable it after associating the Metadata, or, don’t use the mint flag and a new one will be generated.

This flow can be easily adapted for your needs. You can create NFTs for collections similar to Degen Apes, or for NFTs with multiple copies that are worth the same and have the same address, like the ones used in Star Atlas. Hope you can come up with the next big collection yourself! ;)

There are other ways to create NFTs using Metaplex, which aren’t as technical. However, they aren’t designed for every purpose you might have. These alternatives will be explored in the next article of this series.

Stay tuned for the next Invisible Lab Stories!

--

--

joão nuno lopes
Invisible Lab

Software engineer during the day, track athlete at the evening, sax player at night