> For the complete documentation index, see [llms.txt](https://docs.ternoa.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ternoa.network/build-1/javascript/nft-features-and-pallets/basics-nft-and-collections/collections/mint-a-collection.md).

# Mint a Collection

### Prerequisites

Before getting started, make sure you have the following ready:

1. [Create a Ternoa](/getting-started/wallets/ternoa-wallet.md) account with [Alphanet CAPS](broken://pages/ej9gceaLIhCN2PgUBh42)
2. Install and set up your editor of choice (we will use Visual Studio Code \[VSC] in this tutorial)
3. Install [NodeJS v.14+](https://nodejs.org/en/download/) & NPM
4. [Install & initialize Ternoa-JS](/build-1/javascript/ternoa-js-library-utilities/installation-and-initialization.md)

### Minting a Collection on-chain using Ternoa-JS

To create a Collection on the Ternoa chain, Ternoa-JS provides you with a `createCollection` helper to do so. It returns an object promise containing the `CollectionCreatedEvent` returned by the Ternoa blockchain.

Replace *IPFS\_CID* in the following code snippet with your CID hash previously generated in "How to prepare Collection assets":

```typescript
import {
	createCollection,
	initializeApi,
	getKeyringFromSeed,
	WaitUntil,
} from "ternoa-js";

const main = async () => {
	try {
		const keyring = await getKeyringFromSeed("//TernoaTestAccount");
		const collectionData = await createCollection(
			"IPFS_CID",
			undefined,
			keyring,
			WaitUntil.BlockInclusion
		);
		console.log(
			"The on-chain Collection id is: ",
			collectionData.collectionId
		);
	} catch (e) {
		console.error(e);
	}
};
```

{% hint style="info" %}
Use your own account by updating the `//TernoaTestAccount` with your account seed when retrieving the keyring from the example below.
{% endhint %}

Here are detailed the `createCollection` helper parameters:

```markdown
`offchainData`: a string that can be an IPFS CID hash that points to a JSON file, a plain text, a small JSON string, or a link to either a static or a dynamic file.
`limit`: (Optional) an amount of NFT that can be associated with this collection.
`keyring`: the provided keyring (containing the address) will be used to sign the transaction and pay the execution fee.
`waitUntil`: WaitUntil defines at which point we want to get the results of the transaction execution: BlockInclusion or BlockFinalization.
```

The response returned includes all the information below according to the parameters provided when creating the Collection.

```markdown
`collectionId`: ID of the Collection.
`owner`: The owner of the Collection.
`offchainData`: The off-chain data provided for the Collection.
`limit`: The limit set for the Collection is defined.
```

### Next

The next step will be getting the Collection data from the Ternoa Indexer using the Collection id just generated. Keep it and continue on the [Retrieve a collection](/build-1/javascript/indexer/featured-requests/nft-collections.md) guide.

### Support

If you face any trouble, feel free to reach out to our community engineers in our [Discord](https://discord.gg/fUmBkPpnRu).
