Using IntelliJ IDE, Java project, Maven build config. I copied the entire code from the Code Check section. It built successfully. On Running it, the following error is thrown: [Output from Console] Created NFT with token ID 0.0.3806960 Exception in thread "main" java.lang.IllegalStateException: transaction is immutable; it has at least one signature or has been explicitly frozen at com.hedera.hashgraph.sdk.Transaction.requireNotFrozen(Transaction.java:972) at com.hedera.hashgraph.sdk.TokenMintTransaction.addMetadata(TokenMintTransaction.java:151) at CreateNFTTutorial.main(CreateNFTTutorial.java:99)

Relevant lines in code (per Tutorial):

   // Mint a new NFT
    TokenMintTransaction mintTx = new TokenMintTransaction()
            .setTokenId(tokenId)
            .setMaxTransactionFee(new Hbar(MAX_TRANSACTION_FEE))
            .freezeWith(client);

    for (String cid : CID) {
        mintTx.addMetadata(cid.getBytes());                 <<-- Line 99
    }

Expected the Tutorial Code to run without issue but Error was thrown

0

There are 0 best solutions below