Search code examples
javascriptnfthedera-hashgraph

What is the maximum amount of tokens to burn using TokenBurnTransaction()?


When I try calling TokenBurnTransaction() with 37 NFT serials, I get a return error BATCH_SIZE_LIMIT_EXCEEDED. I am therefore wondering what is the maximum amount I can burn within a single function call.


Solution

  • The maximum number of serials that you can mint or burn in a single transaction call is 10.

    See this code sample:

    // BURN 10 SERIALS IN THE NFT COLLECTION
    let tokenBurnTx = await new TokenBurnTransaction()
        .setTokenId(tokenId)
        .setSerials([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
        .freezeWith(client)
        .sign(supplyKey);
    let tokenBurnSubmit = await tokenBurnTx.execute(client);
    

    If you inspect the mirror node REST API for the corresponding transaction, you'll see all 10 mints/burns.

    REST API (testnet is reset each quarter so you may not see the exact result in the future): https://testnet.mirrornode.hedera.com/api/v1/transactions/0.0.1218-1675178140-095602422 Here's a portion of the mirror node info:

    {
      "transactions": [
        {
          "bytes": null,
          "charged_tx_fee": 2546089,
          "consensus_timestamp": "1675178151.645157386",
          "entity_id": "0.0.3072409",
          "max_fee": "10000000000",
          "memo_base64": "",
          "name": "TOKENBURN",
          "nft_transfers": [
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 1,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 2,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 3,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 4,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 5,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 6,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 7,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 8,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 9,
              "token_id": "0.0.3072409"
            },
            {
              "is_approval": false,
              "receiver_account_id": null,
              "sender_account_id": "0.0.23223",
              "serial_number": 10,
              "token_id": "0.0.3072409"
            }
          ],
          "node": "0.0.5",
          "nonce": 0,
          "parent_consensus_timestamp": null,
          "result": "SUCCESS",