# Burn Tokens

Below is a minimal, end-to-end example that mints a token and then burns part of its supply. After creating a token account and minting 10,000 units, a burn operation reduces both the holder’s balance and the token’s total supply by 2,500. Burns are staged with a builder and become final once published.

How it works:

* Create a token account, set basic info and default permission.
* Mint an initial supply to the token account.
* Start a new builder to burn: subtract the same amount from the account balance and the total supply.
* Publish to commit the burn on-chain.

This pattern keeps the ledger consistent: every burned unit is removed from circulation and reflected immediately in both balance and supply.import \* as KeetaNet from "@keetanetwork/keetanet-client";

```typescript

async function main() {
    // Generate random seed for account creation
    const seed = KeetaNet.lib.Account.generateRandomSeed({ asString: true });
    console.log("seed =", seed);

    // Create account and user client
    const account = KeetaNet.lib.Account.fromSeed(seed, 0);
    const userClient = KeetaNet.UserClient.fromNetwork("test", account);

    // Create and mint new token
    const builderMint = userClient.initBuilder();
    const pendingTokenAccount = builderMint.generateIdentifier(KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN);
    await builderMint.computeBlocks();
    const tokenAccount = pendingTokenAccount.account;

    builderMint.setInfo(
        {
            name: '',
            description: '',
            metadata: '',
            defaultPermission: new KeetaNet.lib.Permissions(['ACCESS']),
        },
        { account: tokenAccount }
    );
    builderMint.modifyTokenSupply(10_000n, { account: tokenAccount });

    await builderMint.publish();

    console.log("Token account created and minted.");
    console.log("Balances after minting:", await userClient.allBalances());

    // Burn some tokens
    const builderBurn = userClient.initBuilder();
    builderBurn.modifyTokenSupply(-2_500n, { account: tokenAccount });
    await builderBurn.publish();

    console.log("2,500 tokens burned from account", tokenAccount.publicKeyString.toString());
    console.log("Balances after burning:", await userClient.allBalances());
}

main()
    .then(() => {
        console.log("Done");
        process.exit(0);
    })
    .catch((err) => {
        console.error("Error:", err);
        process.exit(1);
    });

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeta.com/features/native-tokenization/token-creation/burn-tokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
