> For the complete documentation index, see [llms.txt](https://xpansionchain-1.gitbook.io/xpansionchain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xpansionchain-1.gitbook.io/xpansionchain/guides/basic-guides/mint-assets.md).

# Mint assets

## Mint assets

Minting assets on XpansionChain means to bring into existence tokens from a smart contract. For more information on this concept, please see <mark style="color:blue;">Deep dive into minting</mark>.

In order for a user to mint tokens, they need:

1. A smart contract deployed on L1 (Ethereum) with <mark style="color:blue;">certain requirements</mark>
2. <mark style="color:blue;">To be registered as a user on XpansionChain</mark>
3. <mark style="color:blue;">To have registered an administrative entity, a project, on XpansionChain</mark>
4. <mark style="color:blue;">To have registered their collection (as represented by their smart contract) on XpansionChain</mark>
5. Ensure your metadata is available to be fetched by our systems before minting.

📝GUIDES

* <mark style="color:blue;">Core SDK</mark>
* <mark style="color:blue;">JS SDK</mark>

### Core SDK[​](https://docs.x.immutable.com/docs/x/how-to-mint-assets#core-sdk) <a href="#core-sdk" id="core-sdk"></a>

Once you have verified that a user has a smart contract deployed on L1 and that they are the owner, then your application can start the process of enabling them to mint tokens on L2 from this contract.

#### 1. Register user[​](https://docs.x.immutable.com/docs/x/how-to-mint-assets#1-register-user) <a href="#id-1-register-user" id="id-1-register-user"></a>

Before a user can register a project or collection and mint tokens on XpansionChain, they must be registered as a user on XpansionChain. Follow <mark style="color:blue;">this guide</mark> to do this.

#### 2. Register a project[​](https://docs.x.immutable.com/docs/x/how-to-mint-assets#2-register-a-project) <a href="#id-2-register-a-project" id="id-2-register-a-project"></a>

A project is an administrative-level entity that is associated with an user. A project can have many collections, which are represented by smart contracts.

* Typescript Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createProject</mark>

The `createProject` endpoint requires a signer (obtained in the <mark style="color:blue;">previous step</mark>) and a `createProjectRequest` object:

```
const createProjectRequest = {
  company_name: 'company',
  contract_email: 'email',
  name: 'name',
};
```

Then, create a project:

```
const createProjectResponse = await client.createProject(
  ethSigner,
  createProjectRequest
);

const projectId = createProjectResponse.id.toString();
```

* Kotlin (JVM) Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createProject</mark>

* Swift Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createProject</mark>

* Golang Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">CreateProject</mark>

💻EXAMPLE

* <mark style="color:blue;">CreateProject</mark>

#### 3. Register a collection[​](https://docs.x.immutable.com/docs/x/how-to-mint-assets#3-register-a-collection) <a href="#id-3-register-a-collection" id="id-3-register-a-collection"></a>

A collection refers to a deployed <mark style="color:blue;">token smart contract</mark> that has been registered on XpansionChain. Once this has occured, its tokens can be transacted (ie. minted, traded, bought and sold) on XpansionChain.

Each collection belongs to a project.

* Typescript Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createCollection</mark>

Use the project ID returned from <mark style="color:blue;">registering a project</mark> to use in the request body of this section.

The `createCollection` endpoint requires a signer (obtained in the <mark style="color:blue;">first step</mark>) and a `createCollectionRequest` object:

```
const createCollectionRequest = {
  name: 'name',
  contract_address: 'address',
  project_id: 'name',
  owner_public_key: 'owner public key',
};
```

Then, create a collection:

```
const createCollectionResponse = await client.createCollection(
  ethSigner,
  createCollectionRequest
);
```

* Kotlin (JVM) Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createCollection</mark>

* Swift Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">createCollection</mark>

* Golang Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">CreateCollection</mark>

💻EXAMPLE

* <mark style="color:blue;">CreateCollection</mark>

#### 4. Mint tokens[​](https://docs.x.immutable.com/docs/x/how-to-mint-assets#4-mint-tokens) <a href="#id-4-mint-tokens" id="id-4-mint-tokens"></a>

WHEN SETTING <mark style="color:blue;">ROYALTIES</mark> IN THE ORDER PARAMS

* You can set up to 50 royalty recipients

* You cannot set the same recipient more than once

* The royalty percentage for a single user cannot exceed 100% (however, the combined percentage for all recipients may exceed 100% - as this amount is calculated on top of the sale price)

* Individual percentage fees can’t be < 0% :::

* Typescript Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">mint</mark>

```
const mintResponse = await client.mint({
  "contractAddress": "0xc6185055ea9891d5d9020c927ff65229baebdef2",
  // Specifying contract-wide royalty information
  "royalties": [
    {
      // Specifying the contract-wide royalty recipient's wallet address
      "recipient": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
      // Specifying the contract-wide royalty rate for this collection
      "percentage": 2.5
    }
  ],
  "users": [
    {
      "etherKey": "0xc3ec7590d5970867ebd17bbe8397500b6ae5f690",
      "tokens": [
        {
          // Specific NFT token
          "id": "1",
          "blueprint": "my-on-chain-metadata",
          // Overriding the contract-wide royalty information with token-specific royalty information
          "royalties": [
            {
              // Same recipient's wallet address
              "recipient": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
              // Changed royalty rate for this specific token (i.e. 1% instead of the default 2.5%)
              "percentage": 1
            }
          ],
        }
      ]
    },
    {
      "etherKey": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
      "tokens": [
        {
          // Specific NFT token
          // No token-specific royalty information specified; contract-wide royalty infromation will be used
          "id": "2",
          "blueprint": "my-other-on-chain-metadata"
        }
      ]
    },
    ...
  ]
});
```

* Kotlin (JVM) Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">mintTokens</mark>

* Swift Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">mintTokens</mark>

* Golang Core SDK

📚SDK REFERENCE

* <mark style="color:blue;">Mint</mark>

💻EXAMPLE

* <mark style="color:blue;">Mint</mark>
