1

I created a Fungible Solana Token using Metaplex Umi, mpl token metadata, mplCandyMachine libraries. It seems to be working fine, but I am just wondering if this is the best way to create a fungible token with metadata. I also saw many people using createMetadataAccountV2 or createMetadataAccountV3 approach to create tokens. So I am really confused now, which is the best way to create the tokens with metadata.

Any pointers would be very helpful.

Thanks Sam

2 Answers 2

2

both methods are viable.

Using umi and mpl-token-metadata is the newer method that Metaplex recommends.

createMetadataAccountV3 is using the instructions directly basically and does not allow you to use the abstraction umi provides.

you are probably not actually using mpl-candy-machine to create a fungible.

3
  • Thanks all for your great inputs. I saw there is a another interface available, Token Metadata Interface, solana.com/developers/guides/token-extensions/metadata-pointer I guess this is from the Core Solana Dev. I dont know if this a new approach. Commented Apr 24 at 6:15
  • This is what the documentation says, "Before the Token Extensions Program and the Token Metadata Interface, the process of adding extra data to a Mint Account required creating a Metadata Account through the Metaplex Metadata Program." The MetadataPointer extension now enables a Mint Account to specify the address of its corresponding Metadata Account. This flexibility allows the Mint Account to point to any account owned by a program that implements the Token Metadata Interface. Commented Apr 24 at 8:08
  • 1
    Token Extensions are a different kind of fungible token. Token Extensions (also known as token22) can have their own metadata or use metaplex metadata. Commented Apr 24 at 11:09
1

I'm fairly sure createMetadataAccountV2 does not work anymore - Metaplex doesn't publish changelogs for their software, but a friend who used to work there mentioned the program has been switched off.

However you don't have to use Umi if you don't want to. The old @metaplex-foundation/mpl-token-metadata@2 still works, and has been updated to point to the new V# program (again there's no Changelog, so I can't link to anything official, but if you install the software you'll see the function signature in @metaplex-foundation/mpl-token-metadata@2 has changed to say v3 now.

Just install mpl-token-metadata version 2:

npm i @metaplex-foundation/mpl-token-metadata@2

Then run the following TS (eg with esrun make-token-metadata-ts). This example by the way comes from Solana Foundation Professional Education repo:

// This uses "@metaplex-foundation/mpl-token-metadata@2" to create tokens
import "dotenv/config";
import {
  getKeypairFromEnvironment,
  getExplorerLink,
} from "@solana-developers/helpers";
import {
  Connection,
  clusterApiUrl,
  PublicKey,
  Transaction,
  sendAndConfirmTransaction,
} from "@solana/web3.js";
import { createCreateMetadataAccountV3Instruction } from "@metaplex-foundation/mpl-token-metadata";

const user = getKeypairFromEnvironment("SECRET_KEY");

const connection = new Connection(clusterApiUrl("devnet"));

console.log(
  `🔑 We've loaded our keypair securely, using an env file! Our public key is: ${user.publicKey.toBase58()}`
);

const TOKEN_METADATA_PROGRAM_ID = new PublicKey(
  "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
);

// Subtitute in your token mint account
const tokenMintAccount = new PublicKey("YOUR_TOKEN_MINT_ADDRESS_HERE");

const metadataData = {
  name: "Solana Training Token",
  symbol: "TRAINING",
  // Arweave / IPFS / Pinata etc link using metaplex standard for off-chain data
  uri: "https://arweave.net/1234",
  sellerFeeBasisPoints: 0,
  creators: null,
  collection: null,
  uses: null,
};

const metadataPDAAndBump = PublicKey.findProgramAddressSync(
  [
    Buffer.from("metadata"),
    TOKEN_METADATA_PROGRAM_ID.toBuffer(),
    tokenMintAccount.toBuffer(),
  ],
  TOKEN_METADATA_PROGRAM_ID
);

const metadataPDA = metadataPDAAndBump[0];

const transaction = new Transaction();

const createMetadataAccountInstruction =
  createCreateMetadataAccountV3Instruction(
    {
      metadata: metadataPDA,
      mint: tokenMintAccount,
      mintAuthority: user.publicKey,
      payer: user.publicKey,
      updateAuthority: user.publicKey,
    },
    {
      createMetadataAccountArgsV3: {
        collectionDetails: null,
        data: metadataData,
        isMutable: true,
      },
    }
  );

transaction.add(createMetadataAccountInstruction);

const transactionSignature = await sendAndConfirmTransaction(
  connection,
  transaction,
  [user]
);

const transactionLink = getExplorerLink(
  "transaction",
  transactionSignature,
  "devnet"
);

console.log(`✅ Transaction confirmed, explorer link is: ${transactionLink}!`);

const tokenMintLink = getExplorerLink(
  "address",
  tokenMintAccount.toString(),
  "devnet"
);

console.log(`✅ Look at the token mint again: ${tokenMintLink}!`);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.