> For the complete documentation index, see [llms.txt](https://docs.coti.io/coti-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coti.io/coti-documentation/coti-privacy-portal/developer-guide/minting-tokens.md).

# Minting Tokens

There are three mint variants depending on how the amount is provided.

{% stepper %}
{% step %}
**Public Mint (plain uint256)**

Requires `publicAmountsEnabled = true` (default). Only callable by `MINTER_ROLE`.

```javascript
// Hardhat / ethers.js
const token = await hre.ethers.getContractAt("MyPrivateToken", tokenAddress);
const amount = hre.ethers.parseUnits("1000", 18); // 1000 tokens
const tx = await token.mint(recipientAddress, amount, { gasLimit: 5000000 });
await tx.wait();
console.log("Minted 1000 tokens to", recipientAddress);
```

{% endstep %}

{% step %}
**Encrypted Mint (itUint256)**

For privacy-preserving minting where the amount is encrypted by the caller.

```javascript
const { prepareIT256 } = require("@coti-io/coti-sdk-typescript");

// Build the encrypted amount
const MINT_SELECTOR = ethers.id("mint(address,((uint256,uint256),bytes))").slice(0, 10);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, ethers.provider);

const it = prepareIT256(
    BigInt(hre.ethers.parseUnits("500", 18)), // 500 tokens
    { wallet, userKey: process.env.PRIVATE_AES_KEY_TESTNET },
    tokenAddress,
    MINT_SELECTOR
);

const tx = await token.connect(minterSigner)["mint(address,((uint256,uint256),bytes))"](
    recipientAddress,
    [[it.ciphertext.ciphertextHigh, it.ciphertext.ciphertextLow], it.signature],
    { gasLimit: 5000000 }
);
await tx.wait();
```

{% endstep %}

{% step %}
**GT Mint (gtUint256)**

For contract-to-contract flows where you already hold a `gtUint256` in memory (e.g. inside a bridge contract).

```solidity
// Inside a Solidity contract with MINTER_ROLE
gtUint256 gtAmount = MpcCore.setPublic256(depositAmount);
gtBool success = token.mintGt(recipient, gtAmount);
require(MpcCore.decrypt(success), "Mint failed");
```

{% endstep %}
{% endstepper %}

{% hint style="warning" %}
Note: `mintGt` and `mint(itUint256)` return `gtBool` — they do NOT revert on failure. Always decrypt and check the return value.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.coti.io/coti-documentation/coti-privacy-portal/developer-guide/minting-tokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
