Encountering Signature Error During Hedera NFT Minting

Hey everyone, I’m hitting a snag with the Hedera Token Service (HTS) when I try to mint an NFT. The error says INVALID_SIGNATURE, and I can’t pinpoint the mistake in my signature generation. I rebuilt my code to try and isolate the issue but the error persists.

Below is a revised example of my approach:

let secretKey = KeyPair.generate();
let pubKey = secretKey.public;

let tokenCreation = new TokenInit()
  .assignName('MyExampleNFT')
  .assignSymbol('EXNFT')
  .selectType(TokenCategory.NonFungible)
  .setSupplyMode('Finite')
  .initializeSupply(0)
  .setLimit(100)
  .designateTreasury(associatedAccountId)
  .setAuthority(pubKey)
  .assignControl(pubKey);

let preparedTransaction = await tokenCreation.finalizeAndSign(secretKey);
let response = await preparedTransaction.send(clientInstance);

Has anyone experienced this snag or have ideas on how to resolve the invalid signature error? Your insight would be really helpful!

hey there, BrilliantCoder39! that error sounds super frustrating. i’ve run into similar issues before and it can be a real headache :sweat_smile:

have you double-checked that your secretKey and pubKey are properly synced? sometimes the mismatch can cause signature problems. also, are you sure the clientInstance has the right network config?

one thing that helped me was logging the entire transaction object before sending. it might give you more clues about what’s going wrong.

oh, and random thought - are you using the latest version of the Hedera SDK? there were some signature-related fixes in recent updates.

keep us posted on what you find! i’m curious to see how you solve this. maybe your solution will help others too :slightly_smiling_face:

I encountered a similar issue with INVALID_SIGNATURE errors when working on an NFT project. One crucial aspect to verify is the proper initialization of your client instance. Ensure that you’ve set up the correct account ID and private key for the client. Additionally, confirm that the treasury account has sufficient HBAR balance to cover the transaction fees.

Another potential cause could be inconsistencies in the transaction’s timestamp. Make sure your system clock is accurately synchronized. If the problem persists, try explicitly setting the transaction’s validity duration using setTransactionValidDuration() method.

Lastly, consider reviewing your token parameters. Certain combinations of token properties might trigger unexpected validation errors. Try simplifying your token creation parameters and gradually add complexity to isolate the source of the issue.

yo brilliantcoder39, that signature error’s a pain! have u tried generating a new key pair for each transaction? sometimes stale keys can mess things up. also, double-check ur client’s network settings - might be trying to connect to testnet instead of mainnet or vice versa. good luck mate, hope u figure it out soon!