Burning / Destroying Tokens and Collections

Put a temporary or permanent stop to token transfers.

"Burning" refers to the process of decreasing a token's supply and removing it from circulation, or in some cases, even removing the token from the blockchain entirely.
Burning a token with ENJ Infusion (often called "Melting") releases the Infused ENJ to the holder.

📘

What you'll need:

There are two ways to Burn a token:

  1. Using the Platform User Interface
  2. Using the GraphQL API

Option A. Using the Enjin Dashboard

Burning token's supply

In the Platform menu, navigate to "Tokens".
Locate the token you wish to burn, click the 3 vertical dots () to it's right, then click the "Burn" button.

Insert the amount of tokens to Burn, and click on the "Burn" button.

Burn form on Enjin Platform

Burn form on Enjin Platform

The Transaction Request will then appear in the "Transactions" menu.

A notification appears after you create a <<glossary:Mutation>>.

A notification appears after you create a Mutation.

Clicking "View" on the notification will take you to your Transactions List.

Clicking "View" on the notification will take you to your Transactions List.

Since this transaction is a Mutation, you will need to sign the transaction using your Wallet.

  • If a Wallet Daemon is running and configured, the transaction request will be signed automatically.
  • If a wallet is connected such as the Enjin Wallet or Polkadot.js, the transaction must be signed manually by clicking the "Sign" button and approving the signature request in your wallet.

Destroying a token and removing it from the Blockchain

📘

To destroy a token, these requirements must be met:

  • The caller is the collection owner
  • The token has no attributes
    • If the token has attributes, you can remove the attributes by clicking the 3 vertical dots () next to the token, followed by "Attributes" and selecting "Remove All".
  • The token has 0 supply
    • If the token has supply, you can follow the above guide Burning token's supply to remove all token supply (as long as you own all of the token's supply)
      Note - you can remove the supply and destroy the token in the same Burn transaction.

Burning a token and destroying it are two different actions.
The action demonstrated above is the action of burning a token, which decreases it's circulating supply.
While destroying a token removes the token from the blockchain, and retrieves the Storage Deposit to the collection owner.

To destroy a token, follow the above instructions for Burning a token, but make sure to tick the Remove Token Storage box.

Destroying a collection

📘

To destroy a collection, these requirements must be met:

  • The caller is the collection owner
  • The collection has no attributes
    • If the collection has attributes, you can remove the attributes by clicking the 3 vertical dots () next to the collection, followed by "Attributes" and selecting "Remove All".
  • The collection has 0 tokens in storage

In the Platform menu, navigate to "Collections".
Locate the collection you wish to destroy, click the 3 vertical dots () to it's right, then click the "Destroy" button.

Then, confirm by clicking the "Destroy" button

Destroy Collection form on Enjin Platform

Destroy Collection form on Enjin Platform

The Transaction Request will then appear in the "Transactions" menu

A notification appears after you create a <<glossary:Mutation>>.

A notification appears after you create a Mutation.

Clicking "View" on the notification will take you to your Transactions List.

Clicking "View" on the notification will take you to your Transactions List.

Since this transaction is a Mutation, you will need to sign the transaction using your Wallet.

  • If a Wallet Daemon is running and configured, the transaction request will be signed automatically.
  • If a wallet is connected such as the Enjin Wallet or Polkadot.js, the transaction must be signed manually by clicking the "Sign" button and approving the signature request in your wallet.

Option B. Using the Enjin API & SDKs

Burning token's supply

Use the Burn mutation:

mutation BurnToken{
  Burn(
    collectionId: 68844 #Specify the Collection ID
    params: {
      tokenId: {integer: 0} #Specify the Token ID
      amount: 1 #Specify the amount of supply to burn
    }
  ) {
    id
    method
    state
  }
}
curl --location 'https://platform.canary.enjin.io/graphql' \
-H 'Content-Type: application/json' \
-H 'Authorization: enjin_api_key' \
-d '{"query":"mutation BurnToken(\r\n  $collection_id: BigInt!\r\n  $token_id: BigInt!\r\n  $amount: BigInt!\r\n) {\r\n  Burn(\r\n    collectionId: $collection_id\r\n    params: { tokenId: { integer: $token_id }, amount: $amount }\r\n  ) {\r\n    id\r\n    method\r\n    state\r\n  }\r\n}","variables":{"collection_id":36105,"token_id":5,"amount":1}}'
using System.Text.Json;
using Enjin.Platform.Sdk;

// Set up the burn params
var burnParams = new BurnParamsInput()
    .SetTokenId(new EncodableTokenIdInput().SetInteger(0)) // Set the token id.
    .SetAmount(1); // Set the amount to burn.

// Set up the mutation
var burn = new Burn()
    .SetCollectionId(68844) // Set the collection id.
    .SetParams(burnParams); // Set the burn params.

// Define and assign the return data fragment to the mutation
var burnFragment = new TransactionFragment()
    .WithId()
    .WithMethod()
    .WithState();

burn.Fragment(burnFragment);

// Create and auth a client to send the request to the platform
var client = PlatformClient.Builder()
    .SetBaseAddress("https://platform.canary.enjin.io")
    .Build();
client.Auth("Your_Platform_Token_Here");

// Send the request and write the output to the console.
// Only the fields that were requested in the fragment will be filled in,
// other fields which weren't requested in the fragment will be set to null.
var response = await client.SendBurn(burn);
Console.WriteLine(JsonSerializer.Serialize(response.Result.Data));
fetch('https://platform.canary.enjin.io/graphql', {
  method: 'POST',
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'},
  body: JSON.stringify({
    query: `
      mutation BurnToken(
        $collection_id: BigInt!
        $token_id: BigInt!
        $amount: BigInt!
      ){
        Burn(
          collectionId: $collection_id
          params: {
            tokenId: {integer: $token_id}
            amount: $amount
          }
        ) {
          id
          method
          state
        }
      }
    `,
    variables: {
      collection_id: 36105, //Specify the collection ID
      token_id: 5, //Specify the amount of supply to burn
      amount: 1 //Specify the amount of supply to burn
    }
  }),
})
.then(response => response.json())
.then(data => console.log(data));
const axios = require('axios');

axios.post('https://platform.canary.enjin.io/graphql', {
  query: `
    mutation BurnToken(
      $collection_id: BigInt!
      $token_id: BigInt!
      $amount: BigInt!
    ){
      Burn(
        collectionId: $collection_id
        params: {
          tokenId: {integer: $token_id}
          amount: $amount
        }
      ) {
        id
        method
        state
      }
    }
  `,
  variables: {
    collection_id: 36105, //Specify the collection ID
    token_id: 5, //Specify the amount of supply to burn
    amount: 1 //Specify the amount of supply to burn
  }
}, {
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests

query = '''
mutation BurnToken(
  $collection_id: BigInt!
  $token_id: BigInt!
  $amount: BigInt!
){
  Burn(
    collectionId: $collection_id
    params: {
      tokenId: {integer: $token_id}
      amount: $amount
    }
  ) {
    id
    method
    state
  }
}
'''

variables = {
  'collection_id': 36105, #Specify the collection ID
  'token_id': 5, #Specify the amount of supply to burn
  'amount': 1 #Specify the amount of supply to burn
}

response = requests.post('https://platform.canary.enjin.io/graphql',
  json={'query': query, 'variables': variables},
  headers={'Content-Type': 'application/json', 'Authorization': 'Your_Platform_Token_Here'}
)
print(response.json())
Snippet In Progress

Once the transaction is executed, the token supply will be burned

Destroying a token and removing it from the Blockchain

📘

To destroy a token, these requirements must be met:

  • The caller is the collection owner
  • The token has no attributes
    • If the token has attributes, they can be removed using the RemoveAllAttributes mutation
  • The token has 0 supply
    • You can remove the supply and destroy the token in the same Burn transaction.

Use the Burn mutation, and add removeTokenStorage: true property

mutation DestroyToken{
  Burn(
    collectionId: 68844 #Specify the Collection ID
    params: {
      tokenId: {integer: 0} #Specify the Token ID
      amount: 1 #Specify the amount of supply to burn
      removeTokenStorage: true
    }
  ) {
    id
    method
    state
  }
}
curl --location 'https://platform.canary.enjin.io/graphql' \
-H 'Content-Type: application/json' \
-H 'Authorization: enjin_api_key' \
-d '{"query":"mutation BurnToken(\r\n  $collection_id: BigInt!\r\n  $token_id: BigInt!\r\n  $amount: BigInt!\r\n) {\r\n  Burn(\r\n    collectionId: $collection_id\r\n    params: {\r\n      tokenId: { integer: $token_id }\r\n      amount: $amount\r\n      removeTokenStorage: true\r\n    }\r\n  ) {\r\n    id\r\n    method\r\n    state\r\n  }\r\n}","variables":{"collection_id":36105,"token_id":5,"amount":1}}'
using System.Text.Json;
using Enjin.Platform.Sdk;

// Set up the burn params
var burnParams = new BurnParamsInput()
    .SetTokenId(new EncodableTokenIdInput().SetInteger(0)) // Set the token id.
    .SetAmount(1) // Set the amount to burn.
    .SetRemoveTokenStorage(true); // Set whether the token storage will be removed if no tokens are left.

// Set up the mutation
var burn = new Burn()
    .SetCollectionId(68844) // Set the collection id.
    .SetParams(burnParams); // Set the burn params.

// Define and assign the return data fragment to the mutation
var burnFragment = new TransactionFragment()
    .WithId()
    .WithMethod()
    .WithState();

burn.Fragment(burnFragment);

// Create and auth a client to send the request to the platform
var client = PlatformClient.Builder()
    .SetBaseAddress("https://platform.canary.enjin.io")
    .Build();
client.Auth("Your_Platform_Token_Here");

// Send the request and write the output to the console.
// Only the fields that were requested in the fragment will be filled in,
// other fields which weren't requested in the fragment will be set to null.
var response = await client.SendBurn(burn);
Console.WriteLine(JsonSerializer.Serialize(response.Result.Data));
fetch('https://platform.canary.enjin.io/graphql', {
  method: 'POST',
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'},
  body: JSON.stringify({
    query: `
      mutation BurnToken(
        $collection_id: BigInt!
        $token_id: BigInt!
        $amount: BigInt!
      ){
        Burn(
          collectionId: $collection_id
          params: {
            tokenId: {integer: $token_id}
            amount: $amount
            removeTokenStorage: true
          }
        ) {
          id
          method
          state
        }
      }
    `,
    variables: {
      collection_id: 36105, //Specify the collection ID
      token_id: 5, //Specify the amount of supply to burn
      amount: 1 //Specify the amount of supply to burn
    }
  }),
})
.then(response => response.json())
.then(data => console.log(data));
const axios = require('axios');

axios.post('https://platform.canary.enjin.io/graphql', {
  query: `
    mutation BurnToken(
      $collection_id: BigInt!
      $token_id: BigInt!
      $amount: BigInt!
    ){
      Burn(
        collectionId: $collection_id
        params: {
          tokenId: {integer: $token_id}
          amount: $amount
          removeTokenStorage: true
        }
      ) {
        id
        method
        state
      }
    }
  `,
  variables: {
    collection_id: 36105, //Specify the collection ID
    token_id: 5, //Specify the amount of supply to burn
    amount: 1 //Specify the amount of supply to burn
  }
}, {
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests

query = '''
mutation BurnToken(
  $collection_id: BigInt!
  $token_id: BigInt!
  $amount: BigInt!
){
  Burn(
    collectionId: $collection_id
    params: {
      tokenId: {integer: $token_id}
      amount: $amount
      removeTokenStorage: true
    }
  ) {
    id
    method
    state
  }
}
'''

variables = {
  'collection_id': 36105, #Specify the collection ID
  'token_id': 5, #Specify the amount of supply to burn
  'amount': 1 #Specify the amount of supply to burn
}

response = requests.post('https://platform.canary.enjin.io/graphql',
  json={'query': query, 'variables': variables},
  headers={'Content-Type': 'application/json', 'Authorization': 'Your_Platform_Token_Here'}
)
print(response.json())
Snippet In Progress

Once the transaction is executed, the token will be destroyed and the Storage Deposit will be retrieved.

Destroying a collection

📘

To destroy a collection, these requirements must be met:

  • The caller is the collection owner
  • The collection has no attributes
    • If the collection has attributes, they can be removed using the RemoveAllAttributes mutation
  • The collection has 0 tokens in storage
    • If the collection has some tokens, you can the above instructions for Destroying a token for each of the tokens in the collection, to destroy them all.
mutation DestroyCollection {
  DestroyCollection(
    collectionId: 68844 #Specify the Collection ID
  ) {
    id
    method
    state
  }
}
curl --location 'https://platform.canary.enjin.io/graphql' \
-H 'Content-Type: application/json' \
-H 'Authorization: enjin_api_key' \
-d '{"query":"mutation DestroyCollection($collection_id: BigInt!) {\r\n  DestroyCollection(collectionId: $collection_id) {\r\n    id\r\n    method\r\n    state\r\n  }\r\n}","variables":{"collection_id":36105}}'
using System.Text.Json;
using Enjin.Platform.Sdk;

// Set up the mutation
var destroyCollection = new DestroyCollection()
    .SetCollectionId(68844); // Set the collection id.

// Define and assign the return data fragment to the mutation
var destrotCollectionFragment = new TransactionFragment()
    .WithId()
    .WithMethod()
    .WithState();

destroyCollection.Fragment(destrotCollectionFragment);

// Create and auth a client to send the request to the platform
var client = PlatformClient.Builder()
    .SetBaseAddress("https://platform.canary.enjin.io")
    .Build();
client.Auth("Your_Platform_Token_Here");

// Send the request and write the output to the console.
// Only the fields that were requested in the fragment will be filled in,
// other fields which weren't requested in the fragment will be set to null.
var response = await client.SendDestroyCollection(destroyCollection);
Console.WriteLine(JsonSerializer.Serialize(response.Result.Data));
fetch('https://platform.canary.enjin.io/graphql', {
  method: 'POST',
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'},
  body: JSON.stringify({
    query: `
      mutation DestroyCollection($collection_id: BigInt!){
        DestroyCollection(
          collectionId: $collection_id
        ) {
          id
          method
          state
        }
      }
    `,
    variables: {
      collection_id: 36105 //Specify the collection ID
    }
  }),
})
.then(response => response.json())
.then(data => console.log(data));
const axios = require('axios');

axios.post('https://platform.canary.enjin.io/graphql', {
  query: `
    mutation DestroyCollection($collection_id: BigInt!){
      DestroyCollection(
        collectionId: $collection_id
      ) {
        id
        method
        state
      }
    }
  `,
  variables: {
    collection_id: 36105 //Specify the collection ID
  }
}, {
  headers: {'Content-Type': 'application/json','Authorization': 'Your_Platform_Token_Here'}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
import requests

query = '''
mutation DestroyCollection($collection_id: BigInt!){
  DestroyCollection(
    collectionId: $collection_id
  ) {
    id
    method
    state
  }
}
'''

variables = {
  'collection_id': 36105 #Specify the collection ID
}

response = requests.post('https://platform.canary.enjin.io/graphql',
  json={'query': query, 'variables': variables},
  headers={'Content-Type': 'application/json', 'Authorization': 'Your_Platform_Token_Here'}
)
print(response.json())
Snippet In Progress

Once the transaction is executed, the collection will be destroyed.

📘

Need to send a transaction request to user's wallet?

This can be done using Enjin Platform API & WalletConnect!
To learn more, check out the Using WalletConnect page.