Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Metaplex create nft fails on testnet #544

@NiketYende1

Description

@NiketYende1

Hi, I am trying to create an nft with @metaplex-foundation/js. It works fine on the devnet, however does not work on the testnet.

Code snippet:

async function main() {
    // create a new connection to the cluster's API
    const connection = new Connection(clusterApiUrl('testnet'), 'confirmed');

    // initialize a keypair for the user
    const user = await initializeKeypair(connection);

    console.log("PublicKey:", user.publicKey.toBase58());

    const metaplex = Metaplex.make(connection)
    .use(keypairIdentity(user))
    .use(nftStorage({ token: process.env.NFT_STORAGE_TOKEN }));

    // upload NFT data and get the URI for the metadata
    // Till this point everything is fine on testnet
    const uri = await uploadMetadata(metaplex, carNftData);

    // create an NFT using the helper function and the URI from the metadata
    const nft = await metaplex.nfts().create(
        {
            uri: uri,
            name: carNftData.name,
            sellerFeeBasisPoints: carNftData.sellerFeeBasisPoints,
            symbol: carNftData.symbol,
        },
        { commitment: "finalized" },
    );
    console.log(`NFT mintAddress: ${nft.mintAddress}`);
    console.log(`NFT metadataAddress: ${nft.metadataAddress}`);
    console.log(`NFT masterEditionAddress: ${nft.masterEditionAddress}`);
    console.log(`NFT tokenAddress: ${nft.tokenAddress}`);
    console.log(`NFT response blockhash: ${nft.response.blockhash}`);
    console.log(`NFT response signature: ${nft.response.signature}`);    
    console.log(`Token Mint: https://explorer.solana.com/address/${nft.mintAddress}?cluster=testnet`);
}

Error:

cause: SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Failed to serialize or deserialize account data: Unknown
      at Connection.sendEncodedTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@solana/web3.js/lib/index.cjs.js:8026:13)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Connection.sendRawTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@solana/web3.js/lib/index.cjs.js:7992:20)
      at async RpcClient.sendTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/rpcModule/RpcClient.cjs:69:14)
      at async RpcClient.sendAndConfirmTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/rpcModule/RpcClient.cjs:96:23)
      at async TransactionBuilder.sendAndConfirm (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/utils/TransactionBuilder.cjs:115:22)
      at async Object.handle (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/nftModule/operations/createNft.cjs:71:20)
      at async Disposable.run (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/utils/Disposable.cjs:26:14)
      at async main (/home/solana/solana-workspace/solana-airdrop/createNFT.js:67:17) {
    logs: [
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
      'Program log: Error: BorshIoError',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3504 of 400000 compute units',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Failed to serialize or deserialize account data: Unknown'
    ]
  },
  program: {
    name: 'TokenMetadataProgram',
    address: PublicKey [PublicKey(metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s)] {
      _bn: <BN: b7065b1e3d17c45389d527f6b04c3cd58b86c731aa0fdb549b6d1bc03f82946>
    },
    errorResolver: [Function: errorResolver]
  },
  logs: [
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
    'Program log: Error: BorshIoError',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3504 of 400000 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Failed to serialize or deserialize account data: Unknown'
  ]

Versions:
node.js: v18.17.1
@metaplex-foundation/js: 0.20.1
@metaplex-foundation/js-plugin-nft-storage: 0.20.0
@solana/spl-token: 0.3.11
@solana/web3.js: 1.89.1

Is this feature supported on testnet? Is there any issue with this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions