5 Ways to Update Your Solana Token Metadata with Third-Party Apps, Terminal, and npm

Recently, our Solana devs needed to update the logo and token name in the wallets. Guess what? Stack Overflow wasn't very helpful that time.

Still, extrnode team made it through and recorded five ways to update the metadata. We decided to start a new column on techno-marketing to discuss different development challenges and solutions.

What Token Metadata Is and Why It Requires Updating

For those who usually work with the other blockchains or just starting to learn blockchain development, here is a brief overview of tokens on Solana:

  • Solana accounts either store data (data accounts) or execute instructions (program accounts).

  • Solana has no standards like ERC-20 or ERC-721. All tokens are SPL tokens.

  • To create a token, you don't need to deploy smart contracts: just send an instruction to the Token Program, and it will do everything by itself.

  • Only the token creator, the Mint Authority, can update the token.

  • The instruction to update the metadata is already in the Token Program. A developer does not need to modify the token code.

Now we will create a new token and show the five ways to change its metadata.

Creating a Token and Updating the Metadata on Strata Protocol Token Launchpad (Beginner)

Go to Strata Protocol, connect your wallet using the button in the upper right corner, and select Create New Token. Then hit Next.

On the next screen, select Self Managed and hit Next.

Fill in the token creation form. You can write anything you like since we’re going to change the metadata later anyway.

Be sure to flag Keep Mint Authority so that your wallet would keep the rights to manage the newly minted token. After several confirmations, your wallet will receive the tokens.

Now go back to the home page of Strata Launchpad and press Edit My Token’s Name, Symbol, or Image.

Here, press Wallet in the Mint field and select your token from the list that appears.

There, fill in the fields and press Update Metadata. In our example, we just added v1 to the token’s name.

Updating Metadata on Token Creator (Beginner)

Go to Token Creator, connect your wallet, and select the Update Metadata tab there.

Instead of selecting a token from a list, you have to input a Token Mint Address here. You can get one in the Mint line from the token address in a browser.

You also can’t upload a picture. Instead, you will have to provide a link to the metadata in JSON format. The easiest way to do so is to create a Public Github Gist in JSON and use the link to it.

Once you’ve created your Gist with the metadata, hit Raw in the right corner to open it via a direct link. Copy the link and paste it into the Metadata URL.

Now you can fill in the other fields and update the token metadata.

This way, we updated the metadata for the second time.

Updating Metadata Via mpl-token-metadata cli (Advanced)

mpl-token-cli is a package from the Metaplex library to work with tokens on Solana.

To work with it, install Rust. Open the terminal and clone the Metaplex library.

git clone https://github.com/metaplex-foundation/metaplex-program-library.git

Go to the folder and install the package:

cd metaplex-program-library/token-metadata/cli
cargo build --release

Go to the release folder and make sure everything is installed correctly.

cd metaplex-program-library/token-metadata/target/release
./metaplex-token-metadata-test-client --help

To update the metadata, you will need to save your wallet to a keypair file on your machine. Check first to see if everything is working, and to do this, look at the metadata of the previously created token:

./metaplex-token-metadata-test-client show \
--mint MINT_ADDRESS \
--keypair PATH_TO_KEYPAIR  \
--url https://api.mainnet-beta.solana.com

If everything’s correct, update the metadata with the following command:

./metaplex-token-metadata-test-client update_metadata_accounts \
--keypair PATH_TO_KEYPAIR \
--mint MINT_ADDRESS \
--name TOKEN_NAME \
--uri LINK_TO_JSON \
--url https://api.mainnet-beta.solana.com

The metadata has been updated, and the new name and logo are now displayed in the wallet.

Updating Metadata Via mpl-token-metadata in npm (Hard)

If you want to create your own web application to work with metadata and their updates, add the mpl-token-metadata package there.

Use the createupdateMetadataAccountV2 instruction to update the metadata.

Transfer the metadata in the following format in the instruction:

{
"name": "TOKEN_NAME",
"symbol": "TOKEN_SYMBOL",
"uri": "LINK_TO_JSON",
"sellerFeeBasisPoints": 0,
"creators": null,
"collection": null,
"uses": null
}

The URI must point to a JSON file structured as follows:

{
"name": "TOKEN_NAME",
"symbol": "TOKEN_SYMBOL",
"description": "DESCRIPTION",
"image": "LINK_TO_TOKEN_IMAGE"
}

Check out the example instruction in the Token Creator's source code.

Updating Metadata With On-Chain Software (Hard)

In the first three examples, we updated the metadata of a token whose Mint Authority is a normal account. If the mint authority of the token is a program (e.g., a stake pool or another dApp), then the instruction to update the metadata must be sent on its behalf. This method requires some knowledge of both Rust and the Solana architecture.

The easiest way is to use the mpl-token-metadata package and the UpdateMetadataAccountV2 instruction. You can find the list of the available mpl-token-metadata program instructions and their constructors on Metaplex’s GitHub.

To add new metadata, you should use the CreateMetadataAccountV2 instruction and its constructor create_metadata_accounts_v2 that has the following signature:

pub fn create_metadata_accounts_v2(
    program_id: Pubkey,
    metadata_account: Pubkey,
    mint: Pubkey,
    mint_authority: Pubkey,
    payer: Pubkey,
    update_authority: Pubkey,
    name: String,
    symbol: String,
    uri: String,
    creators: Option<Vec<Creator>>,
    seller_fee_basis_points: u16,
    update_authority_is_signer: bool,
    is_mutable: bool,
    collection: Option<Collection>,
    uses: Option<Uses>,
) -> Instruction {

Please keep in mind that only the update authority is authorized to update the metadata. The mint authority usually does the job, but you can set any address you want.

To update your metadata, you should use the UpdateMetadataAccountV2 instruction and its constructor update_metadata_accounts_v2 that has the following signature:

pub fn update_metadata_accounts_v2(
    program_id: Pubkey,
    metadata_account: Pubkey,
    update_authority: Pubkey,
    new_update_authority: Option<Pubkey>,
    data: Option<DataV2>,
    primary_sale_happened: Option<bool>,
    is_mutable: Option<bool>,
) -> Instruction {

As you may already know, a cross-program invocation in Solana can be performed by calling the invoke and invoke_signed functions. In our case, we want to use the invoke_signed function and sign for the mint authority. Here is an example of how to update your existing metadata from a program:

let inst = mpl_token_metadata::instruction::create_metadata_accounts_v2(

                mpl_token_metadata::id(), 
                metadata_key, 
                *token_mint_info.key, 
                mint_authority_key, 
                *payer_info.key, 
                mint_authority_key,
                name,
                symbol,
                uri,
                None, 
                0,
                true, 
                true,
                None,
                None,
);
let accs = [
                metadata_account_info.clone(),
                token_mint_info.clone(),
                mint_authority_info.clone(),
                payer_info.clone(),
                mint_authority_info.clone(),
                system_program_info.clone(),
                rent_info.clone(),
                mpl_program_info.clone(),
];

let signers = &[&authority_signature_seeds[..]]; // your mint authority seeds

                invoke_signed(
                &inst, 
                &accs,
                signers,
)?;

Conclusion

If you issued a token and have access to a wallet with the mint authority, use the first three methods: Strata Launchpad, Token Creator, or mpl token metadata cli, we use these at Everstake.

The mpl token package will also help you update your metadata from a web application or dApp that owns the mint authority.

Token metadata used to be stored off-chain. You would have to create a pull request to update your token name and logo using this repository.

You can find some legacy token metadata here.

Since the repository became read-only recently, this method doesn’t work anymore. That said, if your token metadata are on that off-chain token list, you may find that most wallets prioritize the legacy token list over on-chain metadata, so the old name and logo are there instead of the new ones. Don’t worry, it’s a known bug that should be fixed in upcoming wallet releases.

Those Solana builders who know of other ways to update their token name or have encountered unusual problems and found a solution are specifically invited to come to our Discord Party and share their experience to help others start building.

Subscribe to extrnode | Powered by Everstake
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.