# Creating Tokens

As with ERC-20s, creating a token in Glittr is creating a contract.&#x20;

There are some token standards on Glittr that developer can use:

### Simple Assets

After declaring a contract creation, we declare the creation of an asset. Tokens which are meant to be purely fungible can be created using the Simple Asset primitive.

After declaring the asset and its properties, we can add additional statements about minting, mining, allocation, and other mechanisms of obtention.&#x20;

**Example:**

You can use GlittrSDK to deploy a new free mint contract with a prebuilt transaction&#x20;

```typescript
import { Account, GlittrSDK, GlittrTransaction } from "@glittr-sdk/sdk"

async function deployFreeMintContract() {
    const NETWORK = 'regtest'
    const client = new GlittrSDK({
        network: NETWORK,
        apiKey: 'your-api-key',
        glittrApi: "https://devnet-core-api.glittr.fi", // devnet
        electrumApi: "https://devnet-electrum.glittr.fi" // devnet
    })
    const account = new Account({
        network: NETWORK,
        wif: "cW84FgWG9U1MpKvdzZMv4JZKLSU7iFAzMmXjkGvGUvh5WvhrEASj",
    })
    const transaction = new GlittrTransaction({
        client,
        account
    })

    const txid = await transaction.contractDeployment.freeMint(
        "GLITTR", // ticker
        18, // divisibility
        "1", // amount per mint
        "1000000" // supply cap
    )

    console.log("TXID : ", txid)
}

deployFreeMintContract()
```

Alternatively, you can use our helper functions to manually construct the transaction, including its inputs and outputs :&#x20;

```typescript
import { Account, addFeeToTx, BitcoinUTXO, electrumFetchNonGlittrUtxos, GlittrSDK, OpReturnMessage, Output, txBuilder } from "@glittr-sdk/sdk";

async function deployFreeMintContract() {
  const NETWORK = 'regtest'
  const client = new GlittrSDK({
    network: NETWORK,
    apiKey: 'your-api-key',
    glittrApi: "https://devnet-core-api.glittr.fi", // devnet
    electrumApi: "https://devnet-electrum.glittr.fi" // devnet
  })
  const account = new Account({
    network: NETWORK,
    wif: "cW84FgWG9U1MpKvdzZMv4JZKLSU7iFAzMmXjkGvGUvh5WvhrEASj",
  })
  
  // Build the tx message
  const tx: OpReturnMessage = {
    contract_creation: {
      contract_type: {
        moa: {
          divisibility: 18,
          live_time: 0,
          supply_cap: "1000000000",
          ticker: "FKBTC",
          mint_mechanism: { free_mint: { amount_per_mint: "10", supply_cap: "1000000000" } }
        }
      },
    },
  };

  // Helper function to fetch non glittr utxos
  const utxos = await electrumFetchNonGlittrUtxos(client.electrumApi, client.apiKey, account.p2wpkh().address)
  
  const nonFeeInputs: BitcoinUTXO[] = []
  
  // Put tx message on output #0
  const nonFeeOutputs: Output[] = [
    { script: txBuilder.compile(tx), value: 0 }
  ]

  // Helper function to add UTXO fee into the tx
  const { inputs, outputs } = await addFeeToTx(
    NETWORK,
    account.p2wpkh().address,
    utxos,
    nonFeeInputs,
    nonFeeOutputs
  )

  const txid = await client.createAndBroadcastRawTx({
    account: account.p2wpkh(),
    inputs,
    outputs
  })
  
  console.log("TXID:", txid);
}

deployFreeMintContract()
```


---

# 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.glittr.fi/examples/creating-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.
